# calcBKBtriang_Lin

| main | Tutorials | Functions | website |

Computes the product B' x K x B for 21D linear triangle elements in vectorized manner This is used internally from calcBKB.

Version : 1.0

Author : George Kourakos

email: giorgk@gmail.com

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

Date 28-Mar-2014

Department of Land Air and Water

University of California Davis

## Contents

## Usage

BKB = calcBKBtriang_Lin(B, K, ii)

## Input

* B*: [Nel x N_sh^2] contains the contributions of each element to the final conductance matrix

* K* : [Nel x Nanis] Hydraulic conductiviy element values. The number of columns is defined by the anisotropy. Maximum number is 3.

* ii* : In case of nested assembly this indicates the iteration. In vectorized assembly this is not used

## Output

* BKB*: the product B'*K*B

## How to compute

In mSim we avoid by hand computations at all costs, therefore we used the symbolic toolbox to perform the vectorized computations. The following code show how we computed the products.

syms b1 b2 b3 syms b4 b5 b6 syms kx ky B=[b1 b2 b3; b4 b5 b6]; BT = [b1 b4;b2 b5; b3 b6]; BKB = BT*[kx 0; 0 ky]*B

BKB = [ kx*b1^2 + ky*b4^2, b1*b2*kx + b4*b5*ky, b1*b3*kx + b4*b6*ky] [ b1*b2*kx + b4*b5*ky, kx*b2^2 + ky*b5^2, b2*b3*kx + b5*b6*ky] [ b1*b3*kx + b4*b6*ky, b2*b3*kx + b5*b6*ky, kx*b3^2 + ky*b6^2]