Language:EN
Pages: 3
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
discusses the assembly the matrix for the bilinear

Discusses the assembly the matrix for the bilinear form the left-hand-side

SOLUTION of (3-8.c):
[Lecture → Ex. 2.7.4.37] discusses the assembly of the S0 1(M)-Galerkin matrix for the bilinear form on the left-hand-side of (3.8.3). Of course, for the function solveImpedanceBVP() only the edges on Γ0 should be visited by the Eval() method of .

Of course, we also have to take care of the non-zero Dirichlet boundary conditions on Γg, as demonstrated in [Lecture → Code 2.7.6.17]; use the function with a SELECTOR argument that singles out edges ong. To that end query the position of the edge and rely on the information Ω0 ⊂ [0.1, 0.9]2.

Eigen : : VectorXd solveImpedanceBVP(
const std : : shared_ptr< l f : : uscalfe : : FeSpaceLagrangeO1<double>> &fe_space_p ,
Eigen : : Vector2d g ) {
// Related implementations:
// Homework problem ErrorEstimatesForTraces:
//
https://gitlab.math.ethz.ch/ralfh/npdecodes/tree/master/homeworks/ErrorEstimatesFor

// Pointer to current mesh
std : : shared_ptr<const l f : : mesh : : Mesh> mesh_p = fe_space_p −>Mesh ( ) ; // Obtain local->global index mapping for current finite element space const l f : : assemble : : DofHandler &dofh { fe_space_p −>LocGlobMap ( ) } ;
// Dimension of finite element space
const
l f : : uscalfe : : size_type N_dofs ( dofh . NumDofs ( ) ) ; // Obtain specification for shape functions on edges
const l f : : fe : : ScalarReferenceFiniteElement <double> * rsf_edge_p = fe_space_p −>ShapeFunctionLayout ( l f : : base : : RefEl : : kSegment ( ) ) ;

// I.i : Computing volume matrix for negative Laplace operator
// Initialize object taking care of local mass (volume) computations.

l f : : uscalfe : : LinearFELaplaceElementMatrix elmat_builder { } ;
// Invoke assembly on cells (co-dimension = 0 as first argument)
// Information about the mesh and the local-to-global map is passed through // a Dofhandler object, argument ’dofh’. This function call adds triplets to // the internal COO-format representation of the sparse matrix A.

dofh , dofh ,

Galerkin matrix, cf. boundary term in (3.8.3).

2

// I.ii : Computing mass edge matrix resulting from Robin B.C.

i f [& bd_flags ] ( const

{

auto endpoints =

l f : : geometry : : Corners ( * ( edge . Geometry ( ) ) ) ;

i f ( endpoints (0 , 0) <= 0.05 | | 0.95 <= endpoints (0 , 0)
endpoints (1 , 0) <= 0.05 | | 0.95 <= endpoints (1 , 0) )
return

edgemat_builder ( fe_space_p ,

eta ,

edges_predicate_RobinBC ) ;

dofh , dofh ,

Function solveImpedanceBVP: Assembly of right-hand-side vector and

solution of linear system of equations.

auto mf_f = l f : : mesh : : u t i l s : : MeshFunctionGlobal (

[ ] ( Eigen : : Vector2d x ) −> double { return 0.0; } ) ;

dofh , elvec_builder ,

phi ) ;

// I.iv : Imposing essential boundary conditions

// InitEssentialConditionFromFunction()

//

i f [& bd_flags ] ( const

l f : : mesh : : E n t i t y &edge ) −> bool {

( bd_flags ( edge ) )

auto endpoints =
i f ( endpoints (0 , 0) <= 0.05 | | 0.95 <= endpoints (0 , 0)
endpoints (1 , 0) <= 0.05 | | 0.95 <= endpoints (1 , 0) )
return

true ;

27
28
29
30
31
32
33

gdof_idx )
return

edges_flag_values_Dirichlet [ gdof_idx ] ;

} ,
A, phi ) ;

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Christina Ellis-MacConachy

PageId: ELI6423120