Boundary integrals
Boundary integrals are useful to compute fluxes, boundary forces, or to apply Neumann/Robin conditions.
Common ranges for boundary integration:
-
boundaryfaces(mesh)
— all boundary faces -
markedfaces(mesh, "MarkerName")
— faces with a given marker (see mesh marking in mesh generation)
1. Example: compute boundary flux
Compute the flux of a vector field q
through the boundary:
auto q = idv(qv); // example vector expression
double flux = integrate( _range = boundaryfaces(mesh), _expr = q*vf::N() ).evaluate()(0,0);
std::cout << "total flux = " << flux << std::endl;
2. Example: integral on a marked boundary
Only integrate on faces marked with "Neumann":
double neumannContrib = integrate( _range = markedfaces(mesh, "Neumann"), _expr = g ).evaluate()(0,0);
See integrate and Mesh iterators for parameter options such as _quad
and _geomap
.