# Assemble_RHS

| main | Tutorials | Functions | website |

Assembles the right hand side of the groundwater flow for flows defined on elements

Version : 1.0

Author : George Kourakos

email: giorgk@gmail.com

web : http://groundwater.ucdavis.edu/msim

Date 18-Mar-2014

Department of Land Air and Water

University of California Davis

## Contents

## Usage

F = Assemble_RHS(Ndof, p, MSH, FLUX)

## Input

* Ndof*: Number of degrees of freedom

* p*: [Np x 3] Coodrinates of nodes [x1 y1 z1; x2 y2 z2;...xn yn zn], where Np is the Number of points

* MSH*: [Nel x Np_el] id of elements. Each row correspond to an element Nel is the number of elements and Np_el is the number of dofs per element

* FLUX*: A structure with the following fields

*id*: The id of the elements where the flux conditions are applied.

*val*: the flux values. the size of *val* must be equal to *id*

*dim*: The structural dimension of the elements. For example in 3D flow the groundwater recharge is applied to 2D elements while the well pumping can be applied to 3D elements. See also the tutorials

*el_type*: the element type such as 'line', triangle','quad','prism','hex' etc.

*el_order*: the element order

*id_el*: This is the index of MSH.elem row. This is commonly 1. On case that this is different is the following example. Lets suppose that the problem is 3D, discretized in prism elements and the variable MSH containts the mesh info. MSH is a structure where the 2D elements will be on the 3rd row. MSH(3,1) will have a field *elem*. Each row of MSH(3,1).elem corresponds to the mesh of different type of elements. There will be one row for the triangular faces, and one row for the quadrilateral faces. *id_el* must to point to the correct row in MESH(x,1).elem(*id_el*,1).id. See also the 3D examples with prism elements.

*assemblemode*: choose the assemble mode 'vect' or 'nested' (use always vect)

## Output

* F*: The assembled right hand side