SlideShare una empresa de Scribd logo
Introduction Object Models System Assembly Examples Summary
libMesh Finite Element Library
Roy Stogner
roystgnr@cfdlab.ae.utexas.edu
Derek Gaston
drgasto@sandia.gov
1Univ. of Texas at Austin
2Sandia National Laboratories
Albuquerque,NM
August 22, 2007
Introduction Object Models System Assembly Examples Summary
Outline
1 Introduction
2 Object Models
Core Classes
BVP Framework
3 System Assembly
Basic Example
Coupled Variables
Essential Boundary Conditions
4 Examples
Fluid Dynamics
Biology
Material Science
5 Summary
Introduction Object Models System Assembly Examples Summary
Goals
libMesh is not
Introduction Object Models System Assembly Examples Summary
Goals
libMesh is not
A physics implementation.
Introduction Object Models System Assembly Examples Summary
Goals
libMesh is not
A physics implementation.
A stand-alone application.
Introduction Object Models System Assembly Examples Summary
Goals
libMesh is not
A physics implementation.
A stand-alone application.
libMesh is
Introduction Object Models System Assembly Examples Summary
Goals
libMesh is not
A physics implementation.
A stand-alone application.
libMesh is
A software library and toolkit.
Introduction Object Models System Assembly Examples Summary
Goals
libMesh is not
A physics implementation.
A stand-alone application.
libMesh is
A software library and toolkit.
Classes and functions for writing parallel adaptive
finite element applications.
Introduction Object Models System Assembly Examples Summary
Goals
libMesh is not
A physics implementation.
A stand-alone application.
libMesh is
A software library and toolkit.
Classes and functions for writing parallel adaptive
finite element applications.
An interface to linear algebra, meshing, partitioning,
etc. libraries.
Introduction Object Models System Assembly Examples Summary
For most applications we
assume there is a Boundary
Value Problem to be
approximated in a Finite
Element function space
M
∂u
∂t
= F(u) ∈ Ω
G(u) = 0 ∈ Ω
u = uD ∈ ∂ΩD
N(u) = 0 ∈ ∂ΩN
u(x, 0) = u0(x)
δΩD
δΩN
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
¡
Ω
Introduction Object Models System Assembly Examples Summary
Associated to Ω is the
Mesh data structure
A Mesh is basically a
collection of geometric
elements and nodes
Ωh
:=
e
Ωe
Ω
h
Introduction Object Models System Assembly Examples Summary
Object Oriented Programming
Introduction Object Models System Assembly Examples Summary
Object Oriented Programming
Abstract Base Classes define user interfaces.
Introduction Object Models System Assembly Examples Summary
Object Oriented Programming
Abstract Base Classes define user interfaces.
Concrete Subclasses implement functionality.
Introduction Object Models System Assembly Examples Summary
Object Oriented Programming
Abstract Base Classes define user interfaces.
Concrete Subclasses implement functionality.
One physics code can work with many
discretizations.
Introduction Object Models System Assembly Examples Summary
Core Classes
Geometric Element Classes
Elem
#_nodes: Node **
#_neighbors: Elem **
#_parent: Elem *
#_children: Elem **
#_*flag: RefinementState
#_p_level: unsigned char
#_subdomain_id: unsigned char
+n_{faces,sides,vertices,edges,children}(): unsigned int
+centroid(): Point
+hmin,hmax(): Real
NodeElem FaceEdge Cell InfQuad InfCell
Prism Hex Pyramid Tet
Hex8 Hex20 Hex27
DofObject
-_n_systems: unsigned char
-_n_vars: unsigned char *
-_n_comp: unsigned char **
-_dof_ids: unsigned int **
-_id: unsigned int
-_processor_id: unsigned short int
Node
Abstract interface
gives mesh topology
Concrete
instantiations of
mesh geometry
Hides element type
from most
applications
Introduction Object Models System Assembly Examples Summary
Core Classes
Finite Element Classes
FEBase
+phi, dphi, d2phi
+quadrature_rule, JxW
+reinit(Elem)
+reinit(Elem,side)
Lagrange
Hermite
Hierarchic
Monomial
Finite Element object
builds data for each
Geometric object
User only deals with
shape function,
quadrature data
Introduction Object Models System Assembly Examples Summary
Core Classes
Core Features
Mixed element geometries in unstructured grids
Adaptive mesh h refinement with hanging nodes, p
refinement
Integration w/ PETSc, LASPack, METIS, ParMETIS,
Triangle, TetGen
Support for UNV, ExodusII, Tecplot, GMV, UCD files
Mesh creation, modification utilities
Introduction Object Models System Assembly Examples Summary
Core Classes
Degree of Freedom Handling
Introduction Object Models System Assembly Examples Summary
Core Classes
Degree of Freedom Handling
DofObject subclasses store global Degree of
Freedom indices
Introduction Object Models System Assembly Examples Summary
Core Classes
Degree of Freedom Handling
DofObject subclasses store global Degree of
Freedom indices
DofMap class assigns indices to a partitioned mesh
Introduction Object Models System Assembly Examples Summary
Core Classes
Degree of Freedom Handling
DofObject subclasses store global Degree of
Freedom indices
DofMap class assigns indices to a partitioned mesh
FE classes calculate hanging node, periodic
constraints
Introduction Object Models System Assembly Examples Summary
Core Classes
Degree of Freedom Handling
DofObject subclasses store global Degree of
Freedom indices
DofMap class assigns indices to a partitioned mesh
FE classes calculate hanging node, periodic
constraints
DofMap class applies constraints
Introduction Object Models System Assembly Examples Summary
Core Classes
Degree of Freedom Handling
DofObject subclasses store global Degree of
Freedom indices
DofMap class assigns indices to a partitioned mesh
FE classes calculate hanging node, periodic
constraints
DofMap class applies constraints
System class handles AMR/C projections
Introduction Object Models System Assembly Examples Summary
Core Classes
Generic Constraint Calculations
To maintain function space continuity, constrain “hanging
node” Degrees of Freedom coefficients on fine elements
in terms of DoFs on coarse neighbors.
uF
= uC
i
uF
i φF
i =
j
uC
j φC
j
Akiui = Bkjuj
ui = A−1
ki Bkjuj
Integrated values (and fluxes, for C1
continuity) give
element-independent matrices:
Aki ≡ (φF
i , φF
k )
Bkj ≡ (φC
j , φC
k )
Introduction Object Models System Assembly Examples Summary
Core Classes
Generic Projection Calculations
Upon element coarsening (or refinement in non-nested
spaces):
Copy nodal Degree of Freedom coefficients
Project edge DoFs, holding nodal DoFs constant
Project face DoFs, holding nodes/edges constant
Project interior DoFs, holding boundaries constant
Advantages / Disadvantages
Requires only local solves
Consistent in parallel
May violate physical conservation laws
Introduction Object Models System Assembly Examples Summary
Core Classes
libMesh Parallelization
Parallel code
Introduction Object Models System Assembly Examples Summary
Core Classes
libMesh Parallelization
Parallel code
PetscVector, DistributedVector classes for Linear
Algebra
Introduction Object Models System Assembly Examples Summary
Core Classes
libMesh Parallelization
Parallel code
PetscVector, DistributedVector classes for Linear
Algebra
Parallel assembly, error indicators, etc.
Introduction Object Models System Assembly Examples Summary
Core Classes
libMesh Parallelization
Parallel code
PetscVector, DistributedVector classes for Linear
Algebra
Parallel assembly, error indicators, etc.
Mesh partitioning with ParMETIS, etc.
Introduction Object Models System Assembly Examples Summary
Core Classes
libMesh Parallelization
Parallel code
PetscVector, DistributedVector classes for Linear
Algebra
Parallel assembly, error indicators, etc.
Mesh partitioning with ParMETIS, etc.
Serial code
Introduction Object Models System Assembly Examples Summary
Core Classes
libMesh Parallelization
Parallel code
PetscVector, DistributedVector classes for Linear
Algebra
Parallel assembly, error indicators, etc.
Mesh partitioning with ParMETIS, etc.
Serial code
Mesh storage on every node
Introduction Object Models System Assembly Examples Summary
Core Classes
libMesh Parallelization
Parallel code
PetscVector, DistributedVector classes for Linear
Algebra
Parallel assembly, error indicators, etc.
Mesh partitioning with ParMETIS, etc.
Serial code
Mesh storage on every node
DoF renumbering, constraint calculations
Introduction Object Models System Assembly Examples Summary
Core Classes
libMesh Parallelization
Parallel code
PetscVector, DistributedVector classes for Linear
Algebra
Parallel assembly, error indicators, etc.
Mesh partitioning with ParMETIS, etc.
Serial code
Mesh storage on every node
DoF renumbering, constraint calculations
Refinement/Coarsening flagging
Introduction Object Models System Assembly Examples Summary
Core Classes
libMesh Parallelization
Parallel code
PetscVector, DistributedVector classes for Linear
Algebra
Parallel assembly, error indicators, etc.
Mesh partitioning with ParMETIS, etc.
Serial code
Mesh storage on every node
DoF renumbering, constraint calculations
Refinement/Coarsening flagging
Mesh, solution I/O
Introduction Object Models System Assembly Examples Summary
Core Classes
ParallelMesh
Parallel subclassing of MeshBase
Start from unstructured Mesh class
Add methods to delete, reconstruct non-semilocal
Elem and Node objects
Parallelize DofMap methods
Parallelize MeshRefinement methods
Add parallel or chunked I/O support
Add load balancing support
Also want parallel BoundaryInfo, BoundaryMesh, Data,
Function, Generation, Modification, Smoother, and Tools
classes
Introduction Object Models System Assembly Examples Summary
BVP Framework
Boundary Value Problem Framework Goals
Goals
Improved test coverage and reliability
Hiding implementation details from user code
Rapid prototyping of new formulations
Physics-dependent error estimators
Methods
Object-oriented System and Solver subclasses
Factoring common patterns into library code
Per-element Numerical Jacobian verification
Introduction Object Models System Assembly Examples Summary
BVP Framework
FEM System Classes
FEMSystem
+elem_solution: DenseVector<Number>
+elem_residual: DenseVector<Number>
+elem_jacobian: DenseMatrix<Number>
#elem_fixed_solution: DenseVector<Number>
#*_fe_var: std::vector<FEBase *>
#elem: Elem *
+*_time_derivative(request_jacobian)
+*_constraint(request_jacobian)
+*_postprocess()
NavierStokesSystem
LaplaceYoungSystem
CahnHilliardSystem
SurfactantSystem
Generalized IBVP
representation
FEMSystem does all
initialization, global
assembly
User code only
needs weighted time
derivative residuals
(∂u
∂t
, vi) = Fi(u) and/or
constraints
Gi(u, vi) = 0
Introduction Object Models System Assembly Examples Summary
BVP Framework
ODE Solver Classes
TimeSolver
+*_residual(request_jacobian)
+solve()
+advance_timestep()
SteadySolver EulerSolver
AdamsMoultonSolver EigenSolver
Calls user code on
each element
Assembles
element-by-element
time derivatives,
constraints, and
weighted old
solutions
Introduction Object Models System Assembly Examples Summary
BVP Framework
Nonlinear Solver Classes
NonlinearSolver
+*_tolerance
+*_max_iterations
+solve()
QuasiNewtonSolverLinearSolver
ContinuationSolver
Acquires residuals,
jacobians from
FEMSystem
assembly
Handles inner loops,
inner solvers and
tolerances,
convergence tests,
etc
Introduction Object Models System Assembly Examples Summary
Basic Example
System Assembly
For simplicity we will focus on the weighted residual
statement arising from the Poisson equation, with
∂ΩN = ∅,
(R(uh
), vh
) :=
Ωh
uh
· vh
− fvh
dx = 0 ∀vh
∈ Vh
Introduction Object Models System Assembly Examples Summary
Basic Example
The element integrals . . .
Ωe
uh
· vh
− fvh
dx
Introduction Object Models System Assembly Examples Summary
Basic Example
The element integrals . . .
Ωe
uh
· vh
− fvh
dx
are written in terms of the local “φi” basis functions
Ns
j=1
uj
Ωe
φj · φi dx −
Ωe
fφi dx , i = 1, . . . , Ns
Introduction Object Models System Assembly Examples Summary
Basic Example
The element integrals . . .
Ωe
uh
· vh
− fvh
dx
are written in terms of the local “φi” basis functions
Ns
j=1
uj
Ωe
φj · φi dx −
Ωe
fφi dx , i = 1, . . . , Ns
This can be expressed naturally in matrix notation as
Ke
Ue
− Fe
Introduction Object Models System Assembly Examples Summary
Basic Example
The integrals are performed on a “reference” element
ˆΩe, transformed via Lagrange basis to the geometric
element.
eΩ
x ξ)x(
ξ
eΩ
Introduction Object Models System Assembly Examples Summary
Basic Example
The integrals are performed on a “reference” element
ˆΩe, transformed via Lagrange basis to the geometric
element.
eΩ
x x(ξ)
ξ
Ωe
The Jacobian of the map x(ξ) is J.
Fe
i =
Ωe
fφidx =
ˆΩe
f(x(ξ))φi|J|dξ
Introduction Object Models System Assembly Examples Summary
Basic Example
The integrals are performed on a “reference” element
ˆΩe, transformed via Lagrange basis to the geometric
element.
eΩ
x ξ)x(
ξ
Ωe
Introduction Object Models System Assembly Examples Summary
Basic Example
The integrals on the “reference” element are
approximated via numerical quadrature.
Introduction Object Models System Assembly Examples Summary
Basic Example
The integrals on the “reference” element are
approximated via numerical quadrature.
The quadrature rule has Nq points “ξq” and weights
“wq”.
Introduction Object Models System Assembly Examples Summary
Basic Example
The integrals on the “reference” element are
approximated via numerical quadrature.
The quadrature rule has Nq points “ξq” and weights
“wq”.
Fe
i =
ˆΩe
fφi|J|dξ
≈
Nq
q=1
f(x(ξq))φi(ξq)|J(ξq)|wq
Introduction Object Models System Assembly Examples Summary
Basic Example
The integrals on the “reference” element are
approximated via numerical quadrature.
The quadrature rule has Nq points “ξq” and weights
“wq”.
Ke
ij =
ˆΩe
φj · φi |J|dξ
≈
Nq
q=1
φj(ξq) · φi(ξq)|J(ξq)|wq
Introduction Object Models System Assembly Examples Summary
Basic Example
At the qth quadrature point, LibMesh can provide
variables including:
Code Math Description
JxW[q] |J(ξq)|wq Jacobian times weight
phi[i][q] φi(ξq) value of ith
shape fn.
dphi[i][q] φi(ξq) value of ith
shape fn. gradient
d2phi[i][q] φi(ξq) value of ith
shape fn. Hessian
xyz[q] x(ξq) location of ξq in physical space
normals[q] n(x(ξq)) normal vector at x on a side
Introduction Object Models System Assembly Examples Summary
Basic Example
The LibMesh representation of the matrix and rhs
assembly is similar to the mathematical statements.
for (q=0; q<Nq; ++q)
for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];
for (j=0; j<Ns; ++j)
Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Introduction Object Models System Assembly Examples Summary
Basic Example
The LibMesh representation of the matrix and rhs
assembly is similar to the mathematical statements.
for (q=0; q<Nq; ++q)
for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];
for (j=0; j<Ns; ++j)
Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Fe
i =
Nq
q=1
f(x(ξq))φi(ξq)|J(ξq)|wq
Introduction Object Models System Assembly Examples Summary
Basic Example
The LibMesh representation of the matrix and rhs
assembly is similar to the mathematical statements.
for (q=0; q<Nq; ++q)
for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];
for (j=0; j<Ns; ++j)
Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Fe
i =
Nq
q=1
f(x(ξq))φi(ξq)|J(ξq)|wq
Introduction Object Models System Assembly Examples Summary
Basic Example
The LibMesh representation of the matrix and rhs
assembly is similar to the mathematical statements.
for (q=0; q<Nq; ++q)
for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];
for (j=0; j<Ns; ++j)
Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Fe
i =
Nq
q=1
f(x(ξq))φi(ξq)|J(ξq)|wq
Introduction Object Models System Assembly Examples Summary
Basic Example
The LibMesh representation of the matrix and rhs
assembly is similar to the mathematical statements.
for (q=0; q<Nq; ++q)
for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];
for (j=0; j<Ns; ++j)
Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Fe
i =
Nq
q=1
f(x(ξq))φi(ξq)|J(ξq)|wq
Introduction Object Models System Assembly Examples Summary
Basic Example
The LibMesh representation of the matrix and rhs
assembly is similar to the mathematical statements.
for (q=0; q<Nq; ++q)
for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];
for (j=0; j<Ns; ++j)
Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Ke
ij =
Nq
q=1
ˆξφj(ξq) · ˆξφi(ξq)|J(ξq)|wq
Introduction Object Models System Assembly Examples Summary
Basic Example
The LibMesh representation of the matrix and rhs
assembly is similar to the mathematical statements.
for (q=0; q<Nq; ++q)
for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];
for (j=0; j<Ns; ++j)
Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Ke
ij =
Nq
q=1
ˆξφj(ξq) · ˆξφi(ξq)|J(ξq)|wq
Introduction Object Models System Assembly Examples Summary
Basic Example
The LibMesh representation of the matrix and rhs
assembly is similar to the mathematical statements.
for (q=0; q<Nq; ++q)
for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];
for (j=0; j<Ns; ++j)
Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Ke
ij =
Nq
q=1
ˆξφj(ξq) · ˆξφi(ξq)|J(ξq)|wq
Introduction Object Models System Assembly Examples Summary
Basic Example
Convection-Diffusion Equation
The matrix assembly routine for the linear
convection-diffusion equation,
−k∆u + b · u = f
for (q=0; q<Nq; ++q)
for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];
for (j=0; j<Ns; ++j)
Ke(i,j) += JxW[q]*(k*(dphi[j][q]*dphi[i][q])
+ (b*dphi[j][q])*phi[i][q]);
}
Introduction Object Models System Assembly Examples Summary
Basic Example
Convection-Diffusion Equation
The matrix assembly routine for the linear
convection-diffusion equation,
−k∆u + b · u = f
for (q=0; q<Nq; ++q)
for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];
for (j=0; j<Ns; ++j)
Ke(i,j) += JxW[q]*(k*(dphi[j][q]*dphi[i][q])
+ (b*dphi[j][q])*phi[i][q]);
}
Introduction Object Models System Assembly Examples Summary
Basic Example
Convection-Diffusion Equation
The matrix assembly routine for the linear
convection-diffusion equation,
−k∆u + b · u = f
for (q=0; q<Nq; ++q)
for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];
for (j=0; j<Ns; ++j)
Ke(i,j) += JxW[q]*(k*(dphi[j][q]*dphi[i][q])
+ (b*dphi[j][q])*phi[i][q]);
}
Introduction Object Models System Assembly Examples Summary
Coupled Variables
Stokes Flow
For multi-variable systems like Stokes flow,
p − ν∆u = f
· u = 0
∈ Ω ⊂ R2
The element stiffness matrix concept can extended to
include sub-matrices


Ke
u1u1
Ke
u1u2
Ke
u1p
Ke
u2u1
Ke
u2u2
Ke
u2p
Ke
pu1
Ke
pu2
Ke
pp




Ue
u1
Ue
u2
Ue
p

 −


Fe
u1
Fe
u2
Fe
p


We have an array of submatrices: Ke[ ][ ]
Introduction Object Models System Assembly Examples Summary
Coupled Variables
Stokes Flow
For multi-variable systems like Stokes flow,
p − ν∆u = f
· u = 0
∈ Ω ⊂ R2
The element stiffness matrix concept can extended to
include sub-matrices


Ke
u1u1
Ke
u1u2
Ke
u1p
Ke
u2u1
Ke
u2u2
Ke
u2p
Ke
pu1
Ke
pu2
Ke
pp




Ue
u1
Ue
u2
Ue
p

 −


Fe
u1
Fe
u2
Fe
p


We have an array of submatrices: Ke[1][1]
Introduction Object Models System Assembly Examples Summary
Coupled Variables
Stokes Flow
For multi-variable systems like Stokes flow,
p − ν∆u = f
· u = 0
∈ Ω ⊂ R2
The element stiffness matrix concept can extended to
include sub-matrices


Ke
u1u1
Ke
u1u2
Ke
u1p
Ke
u2u1
Ke
u2u2
Ke
u2p
Ke
pu1
Ke
pu2
Ke
pp




Ue
u1
Ue
u2
Ue
p

 −


Fe
u1
Fe
u2
Fe
p


We have an array of submatrices: Ke[2][2]
Introduction Object Models System Assembly Examples Summary
Coupled Variables
Stokes Flow
For multi-variable systems like Stokes flow,
p − ν∆u = f
· u = 0
∈ Ω ⊂ R2
The element stiffness matrix concept can extended to
include sub-matrices


Ke
u1u1
Ke
u1u2
Ke
u1p
Ke
u2u1
Ke
u2u2
Ke
u2p
Ke
pu1
Ke
pu2
Ke
pp




Ue
u1
Ue
u2
Ue
p

 −


Fe
u1
Fe
u2
Fe
p


We have an array of submatrices: Ke[3][2]
Introduction Object Models System Assembly Examples Summary
Coupled Variables
Stokes Flow
For multi-variable systems like Stokes flow,
p − ν∆u = f
· u = 0
∈ Ω ⊂ R2
The element stiffness matrix concept can extended to
include sub-matrices


Ke
u1u1
Ke
u1u2
Ke
u1p
Ke
u2u1
Ke
u2u2
Ke
u2p
Ke
pu1
Ke
pu2
Ke
pp




Ue
u1
Ue
u2
Ue
p

 −


Fe
u1
Fe
u2
Fe
p


And an array of right-hand sides: Fe[].
Introduction Object Models System Assembly Examples Summary
Coupled Variables
Stokes Flow
For multi-variable systems like Stokes flow,
p − ν∆u = f
· u = 0
∈ Ω ⊂ R2
The element stiffness matrix concept can extended to
include sub-matrices


Ke
u1u1
Ke
u1u2
Ke
u1p
Ke
u2u1
Ke
u2u2
Ke
u2p
Ke
pu1
Ke
pu2
Ke
pp




Ue
u1
Ue
u2
Ue
p

 −


Fe
u1
Fe
u2
Fe
p


And an array of right-hand sides: Fe[1].
Introduction Object Models System Assembly Examples Summary
Coupled Variables
Stokes Flow
For multi-variable systems like Stokes flow,
p − ν∆u = f
· u = 0
∈ Ω ⊂ R2
The element stiffness matrix concept can extended to
include sub-matrices


Ke
u1u1
Ke
u1u2
Ke
u1p
Ke
u2u1
Ke
u2u2
Ke
u2p
Ke
pu1
Ke
pu2
Ke
pp




Ue
u1
Ue
u2
Ue
p

 −


Fe
u1
Fe
u2
Fe
p


And an array of right-hand sides: Fe[2].
Introduction Object Models System Assembly Examples Summary
Coupled Variables
Stokes Flow
The matrix assembly can proceed in essentially the
same way.
For the momentum equations:
for (q=0; q<Nq; ++q)
for (d=0; d<2; ++d)
for (i=0; i<Ns; ++i) {
Fe[d](i) += JxW[q]*f(xyz[q],d)*phi[i][q];
for (j=0; j<Ns; ++j)
Ke[d][d](i,j) +=
JxW[q]*nu*(dphi[j][q]*dphi[i][q]);
}
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
Essential Boundary Data
Dirichlet boundary conditions can be enforced after
the global stiffness matrix K has been assembled
This usually involves
1 placing a “1” on the main diagonal of the global
stiffness matrix
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
Essential Boundary Data
Dirichlet boundary conditions can be enforced after
the global stiffness matrix K has been assembled
This usually involves
1 placing a “1” on the main diagonal of the global
stiffness matrix
2 zeroing out the row entries
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
Essential Boundary Data
Dirichlet boundary conditions can be enforced after
the global stiffness matrix K has been assembled
This usually involves
1 placing a “1” on the main diagonal of the global
stiffness matrix
2 zeroing out the row entries
3 placing the Dirichlet value in the rhs vector
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
Essential Boundary Data
Dirichlet boundary conditions can be enforced after
the global stiffness matrix K has been assembled
This usually involves
1 placing a “1” on the main diagonal of the global
stiffness matrix
2 zeroing out the row entries
3 placing the Dirichlet value in the rhs vector
4 subtracting off the column entries from the rhs
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
Essential Boundary Data
Dirichlet boundary conditions can be enforced after
the global stiffness matrix K has been assembled
This usually involves
1 placing a “1” on the main diagonal of the global
stiffness matrix
2 zeroing out the row entries
3 placing the Dirichlet value in the rhs vector
4 subtracting off the column entries from the rhs




k11 k12 k13 .
k21 k22 k23 .
k31 k32 k33 .
. . . .



 ,




f1
f2
f3
.



 →




1 0 0 0
0 k22 k23 .
0 k32 k33 .
0 . . .



 ,




g1
f2 − k21g1
f3 − k31g1
.




Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
Cons of this approach :
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
Cons of this approach :
Works for an interpolary finite element basis but not in
general.
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
Cons of this approach :
Works for an interpolary finite element basis but not in
general.
May be inefficient to change individual entries once
the global matrix is assembled.
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
Cons of this approach :
Works for an interpolary finite element basis but not in
general.
May be inefficient to change individual entries once
the global matrix is assembled.
Need to enforce boundary conditions for a generic
finite element basis at the element stiffness matrix
level.
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
A “penalty” term is added to the standard weighted
residual statement
(R(u), v) +
1
∂ΩD
(u − uD)v dx
penalty term
= 0 ∀v ∈ V
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
A “penalty” term is added to the standard weighted
residual statement
(R(u), v) +
1
∂ΩD
(u − uD)v dx
penalty term
= 0 ∀v ∈ V
Here 1 is chosen so that, in floating point
arithmetic, 1
+ 1 = 1
.
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
A “penalty” term is added to the standard weighted
residual statement
(R(u), v) +
1
∂ΩD
(u − uD)v dx
penalty term
= 0 ∀v ∈ V
Here 1 is chosen so that, in floating point
arithmetic, 1
+ 1 = 1
.
This weakly enforces u = uD on the Dirichlet
boundary, and works for general finite element bases.
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
LibMesh provides:
A quadrature rule with Nqf points and JxW f[]
A finite element coincident with the boundary face
that has shape function values phi f[][]
for (qf=0; qf<Nqf; ++qf) {
for (i=0; i<Nf; ++i) {
Fe(i) += JxW_f[qf]*
penalty*uD(xyz[q])*phi_f[i][qf];
for (j=0; j<Nf; ++j)
Ke(i,j) += JxW_f[qf]*
penalty*phi_f[j][qf]*phi_f[i][qf];
}
}
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
LibMesh provides:
A quadrature rule with Nqf points and JxW f[]
A finite element coincident with the boundary face
that has shape function values phi f[][]
for (qf=0; qf<Nqf; ++qf) {
for (i=0; i<Nf; ++i) {
Fe(i) += JxW_f[qf]*
penalty*uD(xyz[q])*phi_f[i][qf];
for (j=0; j<Nf; ++j)
Ke(i,j) += JxW_f[qf]*
penalty*phi_f[j][qf]*phi_f[i][qf];
}
}
Introduction Object Models System Assembly Examples Summary
Essential Boundary Conditions
LibMesh provides:
A quadrature rule with Nqf points and JxW f[]
A finite element coincident with the boundary face
that has shape function values phi f[][]
for (qf=0; qf<Nqf; ++qf) {
for (i=0; i<Nf; ++i) {
Fe(i) += JxW_f[qf]*
penalty*uD(xyz[q])*phi_f[i][qf];
for (j=0; j<Nf; ++j)
Ke(i,j) += JxW_f[qf]*
penalty*phi_f[j][qf]*phi_f[i][qf];
}
}
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Introduction
Laplace-Young equation model surface tension effects for
enclosed liquids.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Introduction
Laplace-Young equation model surface tension effects for
enclosed liquids.
Combining surface tension, gravity and contact the energy
functional for Laplace-Young is:
Ω
1 + | u|2 dΩ +
Ω
1
2
κu2
dΩ −
∂Ω
σu ds
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Introduction
Laplace-Young equation model surface tension effects for
enclosed liquids.
Combining surface tension, gravity and contact the energy
functional for Laplace-Young is:
Ω
1 + | u|2 dΩ +
Ω
1
2
κu2
dΩ −
∂Ω
σu ds
Where κ is the ratio of surface energy to gravitational
energy and u is the height of the liquid.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Introduction
Laplace-Young equation model surface tension effects for
enclosed liquids.
Combining surface tension, gravity and contact the energy
functional for Laplace-Young is:
Ω
1 + | u|2 dΩ +
Ω
1
2
κu2
dΩ −
∂Ω
σu ds
Where κ is the ratio of surface energy to gravitational
energy and u is the height of the liquid.
While the weak formulation of the stationary condition is
given by:
u
1 + | u|2
, ϕ
Ω
+ κ (u, ϕ)Ω = σ (1, ϕ)∂Ω (1)
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Introduction
Laplace-Young equation model surface tension effects for
enclosed liquids.
Combining surface tension, gravity and contact the energy
functional for Laplace-Young is:
Ω
1 + | u|2 dΩ +
Ω
1
2
κu2
dΩ −
∂Ω
σu ds
Where κ is the ratio of surface energy to gravitational
energy and u is the height of the liquid.
While the weak formulation of the stationary condition is
given by:
u
1 + | u|2
, ϕ
Ω
+ κ (u, ϕ)Ω = σ (1, ϕ)∂Ω (1)
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Instead of explicitly finding the Jacobian, we’ll use FEMSystem to finite difference the weak form.
element constraint()
for (unsigned int qp=0; qp != n_qpoints; qp++) {
Number u = interior_value(0, qp);
Gradient grad_u = interior_gradient(0, qp);
Number K = 1. / sqrt(1. + (grad_u * grad_u));
for (unsigned int i=0; i != n_u_dofs; i++) {
Fu(i) += JxW[qp] * ((_kappa * u * phi[i][qp]) +
(K * grad_u * dphi[i][qp]));
}
}
side constraint()
for (unsigned int qp=0; qp != n_qpoints; qp++) {
for (unsigned int i=0; i != n_u_dofs; i++) {
Fu(i) -= JxW[qp] * _gamma * phi[i][qp];
}
}
0
B
@
u
q
1 + | u|2
, ϕ
1
C
A
Ω
+ κ (u, ϕ)Ω − σ (1, ϕ)∂Ω = 0 ∀ϕ ∈ V
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Instead of explicitly finding the Jacobian, we’ll use FEMSystem to finite difference the weak form.
element constraint()
for (unsigned int qp=0; qp != n_qpoints; qp++) {
Number u = interior_value(0, qp);
Gradient grad_u = interior_gradient(0, qp);
Number K = 1. / sqrt(1. + (grad_u * grad_u));
for (unsigned int i=0; i != n_u_dofs; i++) {
Fu(i) += JxW[qp] * ((_kappa * u * phi[i][qp]) +
(K * grad_u * dphi[i][qp]));
}
}
side constraint()
for (unsigned int qp=0; qp != n_qpoints; qp++) {
for (unsigned int i=0; i != n_u_dofs; i++) {
Fu(i) -= JxW[qp] * _gamma * phi[i][qp];
}
}
0
B
@
u
q
1 + | u|2
, ϕ
1
C
A
Ω
+ κ (u, ϕ)Ω − σ (1, ϕ)∂Ω = 0 ∀ϕ ∈ V
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Instead of explicitly finding the Jacobian, we’ll use FEMSystem to finite difference the weak form.
element constraint()
for (unsigned int qp=0; qp != n_qpoints; qp++) {
Number u = interior_value(0, qp);
Gradient grad_u = interior_gradient(0, qp);
Number K = 1. / sqrt(1. + (grad_u * grad_u));
for (unsigned int i=0; i != n_u_dofs; i++) {
Fu(i) += JxW[qp] * ((_kappa * u * phi[i][qp]) +
(K * grad_u * dphi[i][qp]));
}
}
side constraint()
for (unsigned int qp=0; qp != n_qpoints; qp++) {
for (unsigned int i=0; i != n_u_dofs; i++) {
Fu(i) -= JxW[qp] * _gamma * phi[i][qp];
}
}
0
B
@
u
q
1 + | u|2
, ϕ
1
C
A
Ω
+ κ (u, ϕ)Ω − σ (1, ϕ)∂Ω = 0 ∀ϕ ∈ V
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Instead of explicitly finding the Jacobian, we’ll use FEMSystem to finite difference the weak form.
element constraint()
for (unsigned int qp=0; qp != n_qpoints; qp++) {
Number u = interior_value(0, qp);
Gradient grad_u = interior_gradient(0, qp);
Number K = 1. / sqrt(1. + (grad_u * grad_u));
for (unsigned int i=0; i != n_u_dofs; i++) {
Fu(i) += JxW[qp] * ((_kappa * u * phi[i][qp]) +
(K * grad_u * dphi[i][qp]));
}
}
side constraint()
for (unsigned int qp=0; qp != n_qpoints; qp++) {
for (unsigned int i=0; i != n_u_dofs; i++) {
Fu(i) -= JxW[qp] * _gamma * phi[i][qp];
}
}
0
B
@
u
q
1 + | u|2
, ϕ
1
C
A
Ω
+ κ (u, ϕ)Ω − σ (1, ϕ)∂Ω = 0 ∀ϕ ∈ V
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Instead of explicitly finding the Jacobian, we’ll use FEMSystem to finite difference the weak form.
element constraint()
for (unsigned int qp=0; qp != n_qpoints; qp++) {
Number u = interior_value(0, qp);
Gradient grad_u = interior_gradient(0, qp);
Number K = 1. / sqrt(1. + (grad_u * grad_u));
for (unsigned int i=0; i != n_u_dofs; i++) {
Fu(i) += JxW[qp] * ((_kappa * u * phi[i][qp]) +
(K * grad_u * dphi[i][qp]));
}
}
side constraint()
for (unsigned int qp=0; qp != n_qpoints; qp++) {
for (unsigned int i=0; i != n_u_dofs; i++) {
Fu(i) -= JxW[qp] * _gamma * phi[i][qp];
}
}
0
B
@
u
q
1 + | u|2
, ϕ
1
C
A
Ω
+ κ (u, ϕ)Ω − σ (1, ϕ)∂Ω = 0 ∀ϕ ∈ V
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Instead of explicitly finding the Jacobian, we’ll use FEMSystem to finite difference the weak form.
element constraint()
for (unsigned int qp=0; qp != n_qpoints; qp++) {
Number u = interior_value(0, qp);
Gradient grad_u = interior_gradient(0, qp);
Number K = 1. / sqrt(1. + (grad_u * grad_u));
for (unsigned int i=0; i != n_u_dofs; i++) {
Fu(i) += JxW[qp] * ((_kappa * u * phi[i][qp]) +
(K * grad_u * dphi[i][qp]));
}
}
side constraint()
for (unsigned int qp=0; qp != n_qpoints; qp++) {
for (unsigned int i=0; i != n_u_dofs; i++) {
Fu(i) -= JxW[qp] * _gamma * phi[i][qp];
}
}
0
B
@
u
q
1 + | u|2
, ϕ
1
C
A
Ω
+ κ (u, ϕ)Ω − σ (1, ϕ)∂Ω = 0 ∀ϕ ∈ V
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Solution
An overkill solution containing 200,000 DOFs.
(a) 2D. (b) Contour Elevation.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Compressible Shocked Flow
Original compressible flow code written by Ben Kirk
utilizing libMesh.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Compressible Shocked Flow
Original compressible flow code written by Ben Kirk
utilizing libMesh.
Solves both Compressible Navier Stokes and Inviscid
Euler.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Compressible Shocked Flow
Original compressible flow code written by Ben Kirk
utilizing libMesh.
Solves both Compressible Navier Stokes and Inviscid
Euler.
Includes both SUPG and a shock capturing scheme.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Problem Specification
The problem studied is that of an oblique shock
generated by a 10o
wedge angle.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Problem Specification
The problem studied is that of an oblique shock
generated by a 10o
wedge angle.
This problem has an exact solution for density which
is a step function.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Problem Specification
The problem studied is that of an oblique shock
generated by a 10o
wedge angle.
This problem has an exact solution for density which
is a step function.
Utilizing libmesh’s exact solution capability the exact
L2 error can be solved for.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Problem Specification
The problem studied is that of an oblique shock
generated by a 10o
wedge angle.
This problem has an exact solution for density which
is a step function.
Utilizing libmesh’s exact solution capability the exact
L2 error can be solved for.
The exact solution is shown below:
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Uniformly Refined Solutions
For comparison purposes, here is a mesh and a
solution after 1 uniform refinement with 10890 DOFs.
x
y
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
(c) Mesh after 1 uniform
x
y
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
r
1.45
1.4
1.35
1.3
1.25
1.2
1.15
1.1
1.05
1
(d) Solution after 1 uni-
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
H-Adapted Solutions
A flux jump indicator was employed as the error
indcator along with a statistical flagging scheme.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
H-Adapted Solutions
A flux jump indicator was employed as the error
indcator along with a statistical flagging scheme.
Here is a mesh and solution after 2 adaptive
refinements containing 10800 DOFs:
x
y
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
x
y
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
r
1.45
1.4
1.35
1.3
1.25
1.2
1.15
1.1
1.05
1
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Redistributed Solutions
Redistribution utilizing the same flux jump indicator.
x
y
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
(i) Mesh after 8 redistri-
butions.
x
y
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
r
1.45
1.4
1.35
1.3
1.25
1.2
1.15
1.1
1.05
1
(j) Solution after 8 redis-
tributions.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Redistributed and Adapted
Now combining the two, here are the mesh and
solution after 2 adaptations beyond the previous
redistribution containing 10190 DOFs.
x
y
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
x
y
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
r
1.45
1.4
1.35
1.3
1.25
1.2
1.15
1.1
1.05
1
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Solution Comparison
For a better comparison here are 3 of the solutions,
each with around 11000 DOFs:
x
y
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
r
1.45
1.4
1.35
1.3
1.25
1.2
1.15
1.1
1.05
1
(m) Uniform.
x
y
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
r
1.45
1.4
1.35
1.3
1.25
1.2
1.15
1.1
1.05
1
(n) Adaptive.
x
y
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
r
1.45
1.4
1.35
1.3
1.25
1.2
1.15
1.1
1.05
1
(o) R + H.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Error Plot
libmesh provides capability for computing error norms
against an exact solution.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Error Plot
libmesh provides capability for computing error norms
against an exact solution.
The exact solution is not in H1
therefore we only
obtain the L2 convergence plot:
3.5 4.0 4.5 5.0
01 sfoD )N(gol
-2.2
-2.0
-1.8
-1.6
-1.4
-1.2
01)rorrE
2
L(gol
Uniform
Adaptivity
Redist + Adapt
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Natural Convection
Tetrahedral mesh of “pipe” geometry. Stream ribbons
colored by temperature.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Surface-Tension-Driven Flow
Adaptive grid solution shown with temperature
contours and velocity vectors.
Introduction Object Models System Assembly Examples Summary
Fluid Dynamics
Double-Diffusive Convection
Solute contours: a plume of warm, low-salinity fluid is
convected upward through a porous medium.
Introduction Object Models System Assembly Examples Summary
Biology
Tumor Angiogenesis
The tumor secretes a chemical which stimulates
blood vessel formation.
Introduction Object Models System Assembly Examples Summary
Material Science
Free Energy Formulation
Cahn-Hilliard systems model phase separation and
interface evolution
f(c, c) ≡ f0(c) + fγ( c)
fγ( c) ≡
2
c
2
c · c
f0(c) ≡ NkT (c ln (c) + (1 − c) ln (1 − c)) + Nωc(1 − c)
∂c
∂t
= · Mc f0(c) − 2
c∆c
Introduction Object Models System Assembly Examples Summary
Material Science
Phase Separation - Spinodal Decomposition
Initial Evolution
Initial homogeneous blend quenched below critical T
Random perturbations anti-diffuse into two phases
divided by narrow interfaces
Gradual coalescence of single-phase regions
Additional physics leads to pattern self-assembly
Introduction Object Models System Assembly Examples Summary
Summary
libMesh Development
Open Source (LGPL)
Leveraging existing libraries
Public site, mailing lists, CVS tree, examples, etc. at
http://libmesh.sf.net/
18 examples including:
Infinite Elements for the wave equation.
Helmholtz with complex numbers.
Laplace in L-Shaped Domain.
Biharmonic Equation.
Using SLEPc for an Eigen Problem.
Unsteady Navier Stokes.
And More!

Más contenido relacionado

PPTX
Local anaesthetics pharmacology
PPTX
Photovoltaic Training Course - Module 1.3 - PV facility calculations
PPTX
Dental prophylaxis
PDF
Une Communaute d'Energie sur le parc des Hauts-Sarts - 02/04/2021
DOC
Lasers in dentistry / endodontics courses
PDF
0020 introduction to fpso design
PPT
Analisis y diseño orientado a odjetos
PPS
Analisis Y DiseñO Orientado Objetos
Local anaesthetics pharmacology
Photovoltaic Training Course - Module 1.3 - PV facility calculations
Dental prophylaxis
Une Communaute d'Energie sur le parc des Hauts-Sarts - 02/04/2021
Lasers in dentistry / endodontics courses
0020 introduction to fpso design
Analisis y diseño orientado a odjetos
Analisis Y DiseñO Orientado Objetos

Similar a Finite Elements libmesh (20)

DOCX
Tc2 301403 21
DOCX
Analisis Proyecto TETRAD V
DOCX
Manual c# 2
DOCX
Manual de c#
DOCX
manual de C#
PPT
DiseñO De Sitemas
PPTX
Fundamentos del análisis orientado a objetos
DOCX
Metodologia de iconix jhon poo
PDF
Modelo de datos
PDF
Analisis Proyecto TETRAD V
PPT
Semanas01y02
PPT
DOC
Metodologia para el proyecto
PPTX
12-Unidad 2: Aplicaciones Windows Forms-2.3 Ado-net
PPTX
Análisis y diseño orientado a objetos
PPTX
12-Unidad 2: Aplicaciones Windows Form-2.3: Acceso a datos ADO.NET (ejemplos)
PDF
Patrones de comportamiento iterator, strategy, command, observer y visitor
PPT
Objeto de Aprendizaje : Introducción a UML
PDF
Metodología OOSE.pdf
PPTX
Clase ii patrones de diseño
Tc2 301403 21
Analisis Proyecto TETRAD V
Manual c# 2
Manual de c#
manual de C#
DiseñO De Sitemas
Fundamentos del análisis orientado a objetos
Metodologia de iconix jhon poo
Modelo de datos
Analisis Proyecto TETRAD V
Semanas01y02
Metodologia para el proyecto
12-Unidad 2: Aplicaciones Windows Forms-2.3 Ado-net
Análisis y diseño orientado a objetos
12-Unidad 2: Aplicaciones Windows Form-2.3: Acceso a datos ADO.NET (ejemplos)
Patrones de comportamiento iterator, strategy, command, observer y visitor
Objeto de Aprendizaje : Introducción a UML
Metodología OOSE.pdf
Clase ii patrones de diseño
Publicidad

Más de M Reza Rahmati (20)

PDF
Geometric Control System and Fault-Diagnosis
PDF
Fault detection and_diagnosis
PDF
Wind river NASA Real-Time Constrained Control Systems
PDF
Differential geometry vision systems
PDF
Automata based programming
PDF
Component Based Control System Design
PDF
Robust reachability analysis NASA
PDF
Reachability Analysis Control of Non-Linear Dynamical Systems
PDF
Reachability Analysis "Control Of Dynamical Non-Linear Systems"
PDF
Symbolic Computation and Automated Reasoning in Differential Geometry
PDF
Modeling and Prototyping Physical Neural Network and On-Line Learning Perform...
PDF
Neural Network Dynamical Systems
PDF
HyperSpace
PDF
Planning and Control Algorithms Model-Based Approach (State-Space)
PDF
Geometrical control theory
PDF
Optimal Control System Design
PDF
Geometry methods dynamical_system_theory
PDF
The Existence and Laws of Our Universe
PDF
Modelling Time in Computation (Dynamic Systems)
PPTX
Trilinos progress, challenges and future plans
Geometric Control System and Fault-Diagnosis
Fault detection and_diagnosis
Wind river NASA Real-Time Constrained Control Systems
Differential geometry vision systems
Automata based programming
Component Based Control System Design
Robust reachability analysis NASA
Reachability Analysis Control of Non-Linear Dynamical Systems
Reachability Analysis "Control Of Dynamical Non-Linear Systems"
Symbolic Computation and Automated Reasoning in Differential Geometry
Modeling and Prototyping Physical Neural Network and On-Line Learning Perform...
Neural Network Dynamical Systems
HyperSpace
Planning and Control Algorithms Model-Based Approach (State-Space)
Geometrical control theory
Optimal Control System Design
Geometry methods dynamical_system_theory
The Existence and Laws of Our Universe
Modelling Time in Computation (Dynamic Systems)
Trilinos progress, challenges and future plans
Publicidad

Último (20)

PPTX
Presentación de Redes de Datos modelo osi
PPTX
COMO AYUDAN LAS TIC EN LA EDUCACION SUPERIOR.pptx
PDF
Estrategia de apoyo tecnología miguel angel solis
DOCX
Zarate Quispe Alex aldayir aplicaciones de internet .docx
PPT
El-Gobierno-Electrónico-En-El-Estado-Bolivia
PDF
Maste clas de estructura metálica y arquitectura
PDF
Diapositiva proyecto de vida, materia catedra
PDF
Influencia-del-uso-de-redes-sociales.pdf
PDF
programa-de-estudios-2011-guc3ada-para-el-maestro-secundarias-tecnicas-tecnol...
PPTX
RAP02 - TECNICO SISTEMAS TELEINFORMATICOS.pptx
PDF
Calidad desde el Docente y la mejora continua .pdf
PPTX
historia_web de la creacion de un navegador_presentacion.pptx
PDF
Plantilla para Diseño de Narrativas Transmedia.pdf
PPTX
Propuesta BKP servidores con Acronis1.pptx
PPTX
RAP01 - TECNICO SISTEMAS TELEINFORMATICOS.pptx
PDF
MANUAL TECNOLOGÍA SER MINISTERIO EDUCACIÓN
PDF
Estrategia de apoyo tecnología grado 9-3
PDF
Instrucciones simples, respuestas poderosas. La fórmula del prompt perfecto.
PPT
Que son las redes de computadores y sus partes
PDF
5.1 Pinch y Bijker en libro Actos, actores y artefactos de Bunch Thomas (coor...
Presentación de Redes de Datos modelo osi
COMO AYUDAN LAS TIC EN LA EDUCACION SUPERIOR.pptx
Estrategia de apoyo tecnología miguel angel solis
Zarate Quispe Alex aldayir aplicaciones de internet .docx
El-Gobierno-Electrónico-En-El-Estado-Bolivia
Maste clas de estructura metálica y arquitectura
Diapositiva proyecto de vida, materia catedra
Influencia-del-uso-de-redes-sociales.pdf
programa-de-estudios-2011-guc3ada-para-el-maestro-secundarias-tecnicas-tecnol...
RAP02 - TECNICO SISTEMAS TELEINFORMATICOS.pptx
Calidad desde el Docente y la mejora continua .pdf
historia_web de la creacion de un navegador_presentacion.pptx
Plantilla para Diseño de Narrativas Transmedia.pdf
Propuesta BKP servidores con Acronis1.pptx
RAP01 - TECNICO SISTEMAS TELEINFORMATICOS.pptx
MANUAL TECNOLOGÍA SER MINISTERIO EDUCACIÓN
Estrategia de apoyo tecnología grado 9-3
Instrucciones simples, respuestas poderosas. La fórmula del prompt perfecto.
Que son las redes de computadores y sus partes
5.1 Pinch y Bijker en libro Actos, actores y artefactos de Bunch Thomas (coor...

Finite Elements libmesh

  • 1. Introduction Object Models System Assembly Examples Summary libMesh Finite Element Library Roy Stogner roystgnr@cfdlab.ae.utexas.edu Derek Gaston drgasto@sandia.gov 1Univ. of Texas at Austin 2Sandia National Laboratories Albuquerque,NM August 22, 2007
  • 2. Introduction Object Models System Assembly Examples Summary Outline 1 Introduction 2 Object Models Core Classes BVP Framework 3 System Assembly Basic Example Coupled Variables Essential Boundary Conditions 4 Examples Fluid Dynamics Biology Material Science 5 Summary
  • 3. Introduction Object Models System Assembly Examples Summary Goals libMesh is not
  • 4. Introduction Object Models System Assembly Examples Summary Goals libMesh is not A physics implementation.
  • 5. Introduction Object Models System Assembly Examples Summary Goals libMesh is not A physics implementation. A stand-alone application.
  • 6. Introduction Object Models System Assembly Examples Summary Goals libMesh is not A physics implementation. A stand-alone application. libMesh is
  • 7. Introduction Object Models System Assembly Examples Summary Goals libMesh is not A physics implementation. A stand-alone application. libMesh is A software library and toolkit.
  • 8. Introduction Object Models System Assembly Examples Summary Goals libMesh is not A physics implementation. A stand-alone application. libMesh is A software library and toolkit. Classes and functions for writing parallel adaptive finite element applications.
  • 9. Introduction Object Models System Assembly Examples Summary Goals libMesh is not A physics implementation. A stand-alone application. libMesh is A software library and toolkit. Classes and functions for writing parallel adaptive finite element applications. An interface to linear algebra, meshing, partitioning, etc. libraries.
  • 10. Introduction Object Models System Assembly Examples Summary For most applications we assume there is a Boundary Value Problem to be approximated in a Finite Element function space M ∂u ∂t = F(u) ∈ Ω G(u) = 0 ∈ Ω u = uD ∈ ∂ΩD N(u) = 0 ∈ ∂ΩN u(x, 0) = u0(x) δΩD δΩN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ Ω
  • 11. Introduction Object Models System Assembly Examples Summary Associated to Ω is the Mesh data structure A Mesh is basically a collection of geometric elements and nodes Ωh := e Ωe Ω h
  • 12. Introduction Object Models System Assembly Examples Summary Object Oriented Programming
  • 13. Introduction Object Models System Assembly Examples Summary Object Oriented Programming Abstract Base Classes define user interfaces.
  • 14. Introduction Object Models System Assembly Examples Summary Object Oriented Programming Abstract Base Classes define user interfaces. Concrete Subclasses implement functionality.
  • 15. Introduction Object Models System Assembly Examples Summary Object Oriented Programming Abstract Base Classes define user interfaces. Concrete Subclasses implement functionality. One physics code can work with many discretizations.
  • 16. Introduction Object Models System Assembly Examples Summary Core Classes Geometric Element Classes Elem #_nodes: Node ** #_neighbors: Elem ** #_parent: Elem * #_children: Elem ** #_*flag: RefinementState #_p_level: unsigned char #_subdomain_id: unsigned char +n_{faces,sides,vertices,edges,children}(): unsigned int +centroid(): Point +hmin,hmax(): Real NodeElem FaceEdge Cell InfQuad InfCell Prism Hex Pyramid Tet Hex8 Hex20 Hex27 DofObject -_n_systems: unsigned char -_n_vars: unsigned char * -_n_comp: unsigned char ** -_dof_ids: unsigned int ** -_id: unsigned int -_processor_id: unsigned short int Node Abstract interface gives mesh topology Concrete instantiations of mesh geometry Hides element type from most applications
  • 17. Introduction Object Models System Assembly Examples Summary Core Classes Finite Element Classes FEBase +phi, dphi, d2phi +quadrature_rule, JxW +reinit(Elem) +reinit(Elem,side) Lagrange Hermite Hierarchic Monomial Finite Element object builds data for each Geometric object User only deals with shape function, quadrature data
  • 18. Introduction Object Models System Assembly Examples Summary Core Classes Core Features Mixed element geometries in unstructured grids Adaptive mesh h refinement with hanging nodes, p refinement Integration w/ PETSc, LASPack, METIS, ParMETIS, Triangle, TetGen Support for UNV, ExodusII, Tecplot, GMV, UCD files Mesh creation, modification utilities
  • 19. Introduction Object Models System Assembly Examples Summary Core Classes Degree of Freedom Handling
  • 20. Introduction Object Models System Assembly Examples Summary Core Classes Degree of Freedom Handling DofObject subclasses store global Degree of Freedom indices
  • 21. Introduction Object Models System Assembly Examples Summary Core Classes Degree of Freedom Handling DofObject subclasses store global Degree of Freedom indices DofMap class assigns indices to a partitioned mesh
  • 22. Introduction Object Models System Assembly Examples Summary Core Classes Degree of Freedom Handling DofObject subclasses store global Degree of Freedom indices DofMap class assigns indices to a partitioned mesh FE classes calculate hanging node, periodic constraints
  • 23. Introduction Object Models System Assembly Examples Summary Core Classes Degree of Freedom Handling DofObject subclasses store global Degree of Freedom indices DofMap class assigns indices to a partitioned mesh FE classes calculate hanging node, periodic constraints DofMap class applies constraints
  • 24. Introduction Object Models System Assembly Examples Summary Core Classes Degree of Freedom Handling DofObject subclasses store global Degree of Freedom indices DofMap class assigns indices to a partitioned mesh FE classes calculate hanging node, periodic constraints DofMap class applies constraints System class handles AMR/C projections
  • 25. Introduction Object Models System Assembly Examples Summary Core Classes Generic Constraint Calculations To maintain function space continuity, constrain “hanging node” Degrees of Freedom coefficients on fine elements in terms of DoFs on coarse neighbors. uF = uC i uF i φF i = j uC j φC j Akiui = Bkjuj ui = A−1 ki Bkjuj Integrated values (and fluxes, for C1 continuity) give element-independent matrices: Aki ≡ (φF i , φF k ) Bkj ≡ (φC j , φC k )
  • 26. Introduction Object Models System Assembly Examples Summary Core Classes Generic Projection Calculations Upon element coarsening (or refinement in non-nested spaces): Copy nodal Degree of Freedom coefficients Project edge DoFs, holding nodal DoFs constant Project face DoFs, holding nodes/edges constant Project interior DoFs, holding boundaries constant Advantages / Disadvantages Requires only local solves Consistent in parallel May violate physical conservation laws
  • 27. Introduction Object Models System Assembly Examples Summary Core Classes libMesh Parallelization Parallel code
  • 28. Introduction Object Models System Assembly Examples Summary Core Classes libMesh Parallelization Parallel code PetscVector, DistributedVector classes for Linear Algebra
  • 29. Introduction Object Models System Assembly Examples Summary Core Classes libMesh Parallelization Parallel code PetscVector, DistributedVector classes for Linear Algebra Parallel assembly, error indicators, etc.
  • 30. Introduction Object Models System Assembly Examples Summary Core Classes libMesh Parallelization Parallel code PetscVector, DistributedVector classes for Linear Algebra Parallel assembly, error indicators, etc. Mesh partitioning with ParMETIS, etc.
  • 31. Introduction Object Models System Assembly Examples Summary Core Classes libMesh Parallelization Parallel code PetscVector, DistributedVector classes for Linear Algebra Parallel assembly, error indicators, etc. Mesh partitioning with ParMETIS, etc. Serial code
  • 32. Introduction Object Models System Assembly Examples Summary Core Classes libMesh Parallelization Parallel code PetscVector, DistributedVector classes for Linear Algebra Parallel assembly, error indicators, etc. Mesh partitioning with ParMETIS, etc. Serial code Mesh storage on every node
  • 33. Introduction Object Models System Assembly Examples Summary Core Classes libMesh Parallelization Parallel code PetscVector, DistributedVector classes for Linear Algebra Parallel assembly, error indicators, etc. Mesh partitioning with ParMETIS, etc. Serial code Mesh storage on every node DoF renumbering, constraint calculations
  • 34. Introduction Object Models System Assembly Examples Summary Core Classes libMesh Parallelization Parallel code PetscVector, DistributedVector classes for Linear Algebra Parallel assembly, error indicators, etc. Mesh partitioning with ParMETIS, etc. Serial code Mesh storage on every node DoF renumbering, constraint calculations Refinement/Coarsening flagging
  • 35. Introduction Object Models System Assembly Examples Summary Core Classes libMesh Parallelization Parallel code PetscVector, DistributedVector classes for Linear Algebra Parallel assembly, error indicators, etc. Mesh partitioning with ParMETIS, etc. Serial code Mesh storage on every node DoF renumbering, constraint calculations Refinement/Coarsening flagging Mesh, solution I/O
  • 36. Introduction Object Models System Assembly Examples Summary Core Classes ParallelMesh Parallel subclassing of MeshBase Start from unstructured Mesh class Add methods to delete, reconstruct non-semilocal Elem and Node objects Parallelize DofMap methods Parallelize MeshRefinement methods Add parallel or chunked I/O support Add load balancing support Also want parallel BoundaryInfo, BoundaryMesh, Data, Function, Generation, Modification, Smoother, and Tools classes
  • 37. Introduction Object Models System Assembly Examples Summary BVP Framework Boundary Value Problem Framework Goals Goals Improved test coverage and reliability Hiding implementation details from user code Rapid prototyping of new formulations Physics-dependent error estimators Methods Object-oriented System and Solver subclasses Factoring common patterns into library code Per-element Numerical Jacobian verification
  • 38. Introduction Object Models System Assembly Examples Summary BVP Framework FEM System Classes FEMSystem +elem_solution: DenseVector<Number> +elem_residual: DenseVector<Number> +elem_jacobian: DenseMatrix<Number> #elem_fixed_solution: DenseVector<Number> #*_fe_var: std::vector<FEBase *> #elem: Elem * +*_time_derivative(request_jacobian) +*_constraint(request_jacobian) +*_postprocess() NavierStokesSystem LaplaceYoungSystem CahnHilliardSystem SurfactantSystem Generalized IBVP representation FEMSystem does all initialization, global assembly User code only needs weighted time derivative residuals (∂u ∂t , vi) = Fi(u) and/or constraints Gi(u, vi) = 0
  • 39. Introduction Object Models System Assembly Examples Summary BVP Framework ODE Solver Classes TimeSolver +*_residual(request_jacobian) +solve() +advance_timestep() SteadySolver EulerSolver AdamsMoultonSolver EigenSolver Calls user code on each element Assembles element-by-element time derivatives, constraints, and weighted old solutions
  • 40. Introduction Object Models System Assembly Examples Summary BVP Framework Nonlinear Solver Classes NonlinearSolver +*_tolerance +*_max_iterations +solve() QuasiNewtonSolverLinearSolver ContinuationSolver Acquires residuals, jacobians from FEMSystem assembly Handles inner loops, inner solvers and tolerances, convergence tests, etc
  • 41. Introduction Object Models System Assembly Examples Summary Basic Example System Assembly For simplicity we will focus on the weighted residual statement arising from the Poisson equation, with ∂ΩN = ∅, (R(uh ), vh ) := Ωh uh · vh − fvh dx = 0 ∀vh ∈ Vh
  • 42. Introduction Object Models System Assembly Examples Summary Basic Example The element integrals . . . Ωe uh · vh − fvh dx
  • 43. Introduction Object Models System Assembly Examples Summary Basic Example The element integrals . . . Ωe uh · vh − fvh dx are written in terms of the local “φi” basis functions Ns j=1 uj Ωe φj · φi dx − Ωe fφi dx , i = 1, . . . , Ns
  • 44. Introduction Object Models System Assembly Examples Summary Basic Example The element integrals . . . Ωe uh · vh − fvh dx are written in terms of the local “φi” basis functions Ns j=1 uj Ωe φj · φi dx − Ωe fφi dx , i = 1, . . . , Ns This can be expressed naturally in matrix notation as Ke Ue − Fe
  • 45. Introduction Object Models System Assembly Examples Summary Basic Example The integrals are performed on a “reference” element ˆΩe, transformed via Lagrange basis to the geometric element. eΩ x ξ)x( ξ eΩ
  • 46. Introduction Object Models System Assembly Examples Summary Basic Example The integrals are performed on a “reference” element ˆΩe, transformed via Lagrange basis to the geometric element. eΩ x x(ξ) ξ Ωe The Jacobian of the map x(ξ) is J. Fe i = Ωe fφidx = ˆΩe f(x(ξ))φi|J|dξ
  • 47. Introduction Object Models System Assembly Examples Summary Basic Example The integrals are performed on a “reference” element ˆΩe, transformed via Lagrange basis to the geometric element. eΩ x ξ)x( ξ Ωe
  • 48. Introduction Object Models System Assembly Examples Summary Basic Example The integrals on the “reference” element are approximated via numerical quadrature.
  • 49. Introduction Object Models System Assembly Examples Summary Basic Example The integrals on the “reference” element are approximated via numerical quadrature. The quadrature rule has Nq points “ξq” and weights “wq”.
  • 50. Introduction Object Models System Assembly Examples Summary Basic Example The integrals on the “reference” element are approximated via numerical quadrature. The quadrature rule has Nq points “ξq” and weights “wq”. Fe i = ˆΩe fφi|J|dξ ≈ Nq q=1 f(x(ξq))φi(ξq)|J(ξq)|wq
  • 51. Introduction Object Models System Assembly Examples Summary Basic Example The integrals on the “reference” element are approximated via numerical quadrature. The quadrature rule has Nq points “ξq” and weights “wq”. Ke ij = ˆΩe φj · φi |J|dξ ≈ Nq q=1 φj(ξq) · φi(ξq)|J(ξq)|wq
  • 52. Introduction Object Models System Assembly Examples Summary Basic Example At the qth quadrature point, LibMesh can provide variables including: Code Math Description JxW[q] |J(ξq)|wq Jacobian times weight phi[i][q] φi(ξq) value of ith shape fn. dphi[i][q] φi(ξq) value of ith shape fn. gradient d2phi[i][q] φi(ξq) value of ith shape fn. Hessian xyz[q] x(ξq) location of ξq in physical space normals[q] n(x(ξq)) normal vector at x on a side
  • 53. Introduction Object Models System Assembly Examples Summary Basic Example The LibMesh representation of the matrix and rhs assembly is similar to the mathematical statements. for (q=0; q<Nq; ++q) for (i=0; i<Ns; ++i) { Fe(i) += JxW[q]*f(xyz[q])*phi[i][q]; for (j=0; j<Ns; ++j) Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]); }
  • 54. Introduction Object Models System Assembly Examples Summary Basic Example The LibMesh representation of the matrix and rhs assembly is similar to the mathematical statements. for (q=0; q<Nq; ++q) for (i=0; i<Ns; ++i) { Fe(i) += JxW[q]*f(xyz[q])*phi[i][q]; for (j=0; j<Ns; ++j) Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]); } Fe i = Nq q=1 f(x(ξq))φi(ξq)|J(ξq)|wq
  • 55. Introduction Object Models System Assembly Examples Summary Basic Example The LibMesh representation of the matrix and rhs assembly is similar to the mathematical statements. for (q=0; q<Nq; ++q) for (i=0; i<Ns; ++i) { Fe(i) += JxW[q]*f(xyz[q])*phi[i][q]; for (j=0; j<Ns; ++j) Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]); } Fe i = Nq q=1 f(x(ξq))φi(ξq)|J(ξq)|wq
  • 56. Introduction Object Models System Assembly Examples Summary Basic Example The LibMesh representation of the matrix and rhs assembly is similar to the mathematical statements. for (q=0; q<Nq; ++q) for (i=0; i<Ns; ++i) { Fe(i) += JxW[q]*f(xyz[q])*phi[i][q]; for (j=0; j<Ns; ++j) Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]); } Fe i = Nq q=1 f(x(ξq))φi(ξq)|J(ξq)|wq
  • 57. Introduction Object Models System Assembly Examples Summary Basic Example The LibMesh representation of the matrix and rhs assembly is similar to the mathematical statements. for (q=0; q<Nq; ++q) for (i=0; i<Ns; ++i) { Fe(i) += JxW[q]*f(xyz[q])*phi[i][q]; for (j=0; j<Ns; ++j) Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]); } Fe i = Nq q=1 f(x(ξq))φi(ξq)|J(ξq)|wq
  • 58. Introduction Object Models System Assembly Examples Summary Basic Example The LibMesh representation of the matrix and rhs assembly is similar to the mathematical statements. for (q=0; q<Nq; ++q) for (i=0; i<Ns; ++i) { Fe(i) += JxW[q]*f(xyz[q])*phi[i][q]; for (j=0; j<Ns; ++j) Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]); } Ke ij = Nq q=1 ˆξφj(ξq) · ˆξφi(ξq)|J(ξq)|wq
  • 59. Introduction Object Models System Assembly Examples Summary Basic Example The LibMesh representation of the matrix and rhs assembly is similar to the mathematical statements. for (q=0; q<Nq; ++q) for (i=0; i<Ns; ++i) { Fe(i) += JxW[q]*f(xyz[q])*phi[i][q]; for (j=0; j<Ns; ++j) Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]); } Ke ij = Nq q=1 ˆξφj(ξq) · ˆξφi(ξq)|J(ξq)|wq
  • 60. Introduction Object Models System Assembly Examples Summary Basic Example The LibMesh representation of the matrix and rhs assembly is similar to the mathematical statements. for (q=0; q<Nq; ++q) for (i=0; i<Ns; ++i) { Fe(i) += JxW[q]*f(xyz[q])*phi[i][q]; for (j=0; j<Ns; ++j) Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]); } Ke ij = Nq q=1 ˆξφj(ξq) · ˆξφi(ξq)|J(ξq)|wq
  • 61. Introduction Object Models System Assembly Examples Summary Basic Example Convection-Diffusion Equation The matrix assembly routine for the linear convection-diffusion equation, −k∆u + b · u = f for (q=0; q<Nq; ++q) for (i=0; i<Ns; ++i) { Fe(i) += JxW[q]*f(xyz[q])*phi[i][q]; for (j=0; j<Ns; ++j) Ke(i,j) += JxW[q]*(k*(dphi[j][q]*dphi[i][q]) + (b*dphi[j][q])*phi[i][q]); }
  • 62. Introduction Object Models System Assembly Examples Summary Basic Example Convection-Diffusion Equation The matrix assembly routine for the linear convection-diffusion equation, −k∆u + b · u = f for (q=0; q<Nq; ++q) for (i=0; i<Ns; ++i) { Fe(i) += JxW[q]*f(xyz[q])*phi[i][q]; for (j=0; j<Ns; ++j) Ke(i,j) += JxW[q]*(k*(dphi[j][q]*dphi[i][q]) + (b*dphi[j][q])*phi[i][q]); }
  • 63. Introduction Object Models System Assembly Examples Summary Basic Example Convection-Diffusion Equation The matrix assembly routine for the linear convection-diffusion equation, −k∆u + b · u = f for (q=0; q<Nq; ++q) for (i=0; i<Ns; ++i) { Fe(i) += JxW[q]*f(xyz[q])*phi[i][q]; for (j=0; j<Ns; ++j) Ke(i,j) += JxW[q]*(k*(dphi[j][q]*dphi[i][q]) + (b*dphi[j][q])*phi[i][q]); }
  • 64. Introduction Object Models System Assembly Examples Summary Coupled Variables Stokes Flow For multi-variable systems like Stokes flow, p − ν∆u = f · u = 0 ∈ Ω ⊂ R2 The element stiffness matrix concept can extended to include sub-matrices   Ke u1u1 Ke u1u2 Ke u1p Ke u2u1 Ke u2u2 Ke u2p Ke pu1 Ke pu2 Ke pp     Ue u1 Ue u2 Ue p   −   Fe u1 Fe u2 Fe p   We have an array of submatrices: Ke[ ][ ]
  • 65. Introduction Object Models System Assembly Examples Summary Coupled Variables Stokes Flow For multi-variable systems like Stokes flow, p − ν∆u = f · u = 0 ∈ Ω ⊂ R2 The element stiffness matrix concept can extended to include sub-matrices   Ke u1u1 Ke u1u2 Ke u1p Ke u2u1 Ke u2u2 Ke u2p Ke pu1 Ke pu2 Ke pp     Ue u1 Ue u2 Ue p   −   Fe u1 Fe u2 Fe p   We have an array of submatrices: Ke[1][1]
  • 66. Introduction Object Models System Assembly Examples Summary Coupled Variables Stokes Flow For multi-variable systems like Stokes flow, p − ν∆u = f · u = 0 ∈ Ω ⊂ R2 The element stiffness matrix concept can extended to include sub-matrices   Ke u1u1 Ke u1u2 Ke u1p Ke u2u1 Ke u2u2 Ke u2p Ke pu1 Ke pu2 Ke pp     Ue u1 Ue u2 Ue p   −   Fe u1 Fe u2 Fe p   We have an array of submatrices: Ke[2][2]
  • 67. Introduction Object Models System Assembly Examples Summary Coupled Variables Stokes Flow For multi-variable systems like Stokes flow, p − ν∆u = f · u = 0 ∈ Ω ⊂ R2 The element stiffness matrix concept can extended to include sub-matrices   Ke u1u1 Ke u1u2 Ke u1p Ke u2u1 Ke u2u2 Ke u2p Ke pu1 Ke pu2 Ke pp     Ue u1 Ue u2 Ue p   −   Fe u1 Fe u2 Fe p   We have an array of submatrices: Ke[3][2]
  • 68. Introduction Object Models System Assembly Examples Summary Coupled Variables Stokes Flow For multi-variable systems like Stokes flow, p − ν∆u = f · u = 0 ∈ Ω ⊂ R2 The element stiffness matrix concept can extended to include sub-matrices   Ke u1u1 Ke u1u2 Ke u1p Ke u2u1 Ke u2u2 Ke u2p Ke pu1 Ke pu2 Ke pp     Ue u1 Ue u2 Ue p   −   Fe u1 Fe u2 Fe p   And an array of right-hand sides: Fe[].
  • 69. Introduction Object Models System Assembly Examples Summary Coupled Variables Stokes Flow For multi-variable systems like Stokes flow, p − ν∆u = f · u = 0 ∈ Ω ⊂ R2 The element stiffness matrix concept can extended to include sub-matrices   Ke u1u1 Ke u1u2 Ke u1p Ke u2u1 Ke u2u2 Ke u2p Ke pu1 Ke pu2 Ke pp     Ue u1 Ue u2 Ue p   −   Fe u1 Fe u2 Fe p   And an array of right-hand sides: Fe[1].
  • 70. Introduction Object Models System Assembly Examples Summary Coupled Variables Stokes Flow For multi-variable systems like Stokes flow, p − ν∆u = f · u = 0 ∈ Ω ⊂ R2 The element stiffness matrix concept can extended to include sub-matrices   Ke u1u1 Ke u1u2 Ke u1p Ke u2u1 Ke u2u2 Ke u2p Ke pu1 Ke pu2 Ke pp     Ue u1 Ue u2 Ue p   −   Fe u1 Fe u2 Fe p   And an array of right-hand sides: Fe[2].
  • 71. Introduction Object Models System Assembly Examples Summary Coupled Variables Stokes Flow The matrix assembly can proceed in essentially the same way. For the momentum equations: for (q=0; q<Nq; ++q) for (d=0; d<2; ++d) for (i=0; i<Ns; ++i) { Fe[d](i) += JxW[q]*f(xyz[q],d)*phi[i][q]; for (j=0; j<Ns; ++j) Ke[d][d](i,j) += JxW[q]*nu*(dphi[j][q]*dphi[i][q]); }
  • 72. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions Essential Boundary Data Dirichlet boundary conditions can be enforced after the global stiffness matrix K has been assembled This usually involves 1 placing a “1” on the main diagonal of the global stiffness matrix
  • 73. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions Essential Boundary Data Dirichlet boundary conditions can be enforced after the global stiffness matrix K has been assembled This usually involves 1 placing a “1” on the main diagonal of the global stiffness matrix 2 zeroing out the row entries
  • 74. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions Essential Boundary Data Dirichlet boundary conditions can be enforced after the global stiffness matrix K has been assembled This usually involves 1 placing a “1” on the main diagonal of the global stiffness matrix 2 zeroing out the row entries 3 placing the Dirichlet value in the rhs vector
  • 75. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions Essential Boundary Data Dirichlet boundary conditions can be enforced after the global stiffness matrix K has been assembled This usually involves 1 placing a “1” on the main diagonal of the global stiffness matrix 2 zeroing out the row entries 3 placing the Dirichlet value in the rhs vector 4 subtracting off the column entries from the rhs
  • 76. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions Essential Boundary Data Dirichlet boundary conditions can be enforced after the global stiffness matrix K has been assembled This usually involves 1 placing a “1” on the main diagonal of the global stiffness matrix 2 zeroing out the row entries 3 placing the Dirichlet value in the rhs vector 4 subtracting off the column entries from the rhs     k11 k12 k13 . k21 k22 k23 . k31 k32 k33 . . . . .     ,     f1 f2 f3 .     →     1 0 0 0 0 k22 k23 . 0 k32 k33 . 0 . . .     ,     g1 f2 − k21g1 f3 − k31g1 .    
  • 77. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions Cons of this approach :
  • 78. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions Cons of this approach : Works for an interpolary finite element basis but not in general.
  • 79. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions Cons of this approach : Works for an interpolary finite element basis but not in general. May be inefficient to change individual entries once the global matrix is assembled.
  • 80. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions Cons of this approach : Works for an interpolary finite element basis but not in general. May be inefficient to change individual entries once the global matrix is assembled. Need to enforce boundary conditions for a generic finite element basis at the element stiffness matrix level.
  • 81. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions A “penalty” term is added to the standard weighted residual statement (R(u), v) + 1 ∂ΩD (u − uD)v dx penalty term = 0 ∀v ∈ V
  • 82. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions A “penalty” term is added to the standard weighted residual statement (R(u), v) + 1 ∂ΩD (u − uD)v dx penalty term = 0 ∀v ∈ V Here 1 is chosen so that, in floating point arithmetic, 1 + 1 = 1 .
  • 83. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions A “penalty” term is added to the standard weighted residual statement (R(u), v) + 1 ∂ΩD (u − uD)v dx penalty term = 0 ∀v ∈ V Here 1 is chosen so that, in floating point arithmetic, 1 + 1 = 1 . This weakly enforces u = uD on the Dirichlet boundary, and works for general finite element bases.
  • 84. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions LibMesh provides: A quadrature rule with Nqf points and JxW f[] A finite element coincident with the boundary face that has shape function values phi f[][] for (qf=0; qf<Nqf; ++qf) { for (i=0; i<Nf; ++i) { Fe(i) += JxW_f[qf]* penalty*uD(xyz[q])*phi_f[i][qf]; for (j=0; j<Nf; ++j) Ke(i,j) += JxW_f[qf]* penalty*phi_f[j][qf]*phi_f[i][qf]; } }
  • 85. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions LibMesh provides: A quadrature rule with Nqf points and JxW f[] A finite element coincident with the boundary face that has shape function values phi f[][] for (qf=0; qf<Nqf; ++qf) { for (i=0; i<Nf; ++i) { Fe(i) += JxW_f[qf]* penalty*uD(xyz[q])*phi_f[i][qf]; for (j=0; j<Nf; ++j) Ke(i,j) += JxW_f[qf]* penalty*phi_f[j][qf]*phi_f[i][qf]; } }
  • 86. Introduction Object Models System Assembly Examples Summary Essential Boundary Conditions LibMesh provides: A quadrature rule with Nqf points and JxW f[] A finite element coincident with the boundary face that has shape function values phi f[][] for (qf=0; qf<Nqf; ++qf) { for (i=0; i<Nf; ++i) { Fe(i) += JxW_f[qf]* penalty*uD(xyz[q])*phi_f[i][qf]; for (j=0; j<Nf; ++j) Ke(i,j) += JxW_f[qf]* penalty*phi_f[j][qf]*phi_f[i][qf]; } }
  • 87. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Introduction Laplace-Young equation model surface tension effects for enclosed liquids.
  • 88. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Introduction Laplace-Young equation model surface tension effects for enclosed liquids. Combining surface tension, gravity and contact the energy functional for Laplace-Young is: Ω 1 + | u|2 dΩ + Ω 1 2 κu2 dΩ − ∂Ω σu ds
  • 89. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Introduction Laplace-Young equation model surface tension effects for enclosed liquids. Combining surface tension, gravity and contact the energy functional for Laplace-Young is: Ω 1 + | u|2 dΩ + Ω 1 2 κu2 dΩ − ∂Ω σu ds Where κ is the ratio of surface energy to gravitational energy and u is the height of the liquid.
  • 90. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Introduction Laplace-Young equation model surface tension effects for enclosed liquids. Combining surface tension, gravity and contact the energy functional for Laplace-Young is: Ω 1 + | u|2 dΩ + Ω 1 2 κu2 dΩ − ∂Ω σu ds Where κ is the ratio of surface energy to gravitational energy and u is the height of the liquid. While the weak formulation of the stationary condition is given by: u 1 + | u|2 , ϕ Ω + κ (u, ϕ)Ω = σ (1, ϕ)∂Ω (1)
  • 91. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Introduction Laplace-Young equation model surface tension effects for enclosed liquids. Combining surface tension, gravity and contact the energy functional for Laplace-Young is: Ω 1 + | u|2 dΩ + Ω 1 2 κu2 dΩ − ∂Ω σu ds Where κ is the ratio of surface energy to gravitational energy and u is the height of the liquid. While the weak formulation of the stationary condition is given by: u 1 + | u|2 , ϕ Ω + κ (u, ϕ)Ω = σ (1, ϕ)∂Ω (1)
  • 92. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Instead of explicitly finding the Jacobian, we’ll use FEMSystem to finite difference the weak form. element constraint() for (unsigned int qp=0; qp != n_qpoints; qp++) { Number u = interior_value(0, qp); Gradient grad_u = interior_gradient(0, qp); Number K = 1. / sqrt(1. + (grad_u * grad_u)); for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) += JxW[qp] * ((_kappa * u * phi[i][qp]) + (K * grad_u * dphi[i][qp])); } } side constraint() for (unsigned int qp=0; qp != n_qpoints; qp++) { for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) -= JxW[qp] * _gamma * phi[i][qp]; } } 0 B @ u q 1 + | u|2 , ϕ 1 C A Ω + κ (u, ϕ)Ω − σ (1, ϕ)∂Ω = 0 ∀ϕ ∈ V
  • 93. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Instead of explicitly finding the Jacobian, we’ll use FEMSystem to finite difference the weak form. element constraint() for (unsigned int qp=0; qp != n_qpoints; qp++) { Number u = interior_value(0, qp); Gradient grad_u = interior_gradient(0, qp); Number K = 1. / sqrt(1. + (grad_u * grad_u)); for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) += JxW[qp] * ((_kappa * u * phi[i][qp]) + (K * grad_u * dphi[i][qp])); } } side constraint() for (unsigned int qp=0; qp != n_qpoints; qp++) { for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) -= JxW[qp] * _gamma * phi[i][qp]; } } 0 B @ u q 1 + | u|2 , ϕ 1 C A Ω + κ (u, ϕ)Ω − σ (1, ϕ)∂Ω = 0 ∀ϕ ∈ V
  • 94. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Instead of explicitly finding the Jacobian, we’ll use FEMSystem to finite difference the weak form. element constraint() for (unsigned int qp=0; qp != n_qpoints; qp++) { Number u = interior_value(0, qp); Gradient grad_u = interior_gradient(0, qp); Number K = 1. / sqrt(1. + (grad_u * grad_u)); for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) += JxW[qp] * ((_kappa * u * phi[i][qp]) + (K * grad_u * dphi[i][qp])); } } side constraint() for (unsigned int qp=0; qp != n_qpoints; qp++) { for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) -= JxW[qp] * _gamma * phi[i][qp]; } } 0 B @ u q 1 + | u|2 , ϕ 1 C A Ω + κ (u, ϕ)Ω − σ (1, ϕ)∂Ω = 0 ∀ϕ ∈ V
  • 95. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Instead of explicitly finding the Jacobian, we’ll use FEMSystem to finite difference the weak form. element constraint() for (unsigned int qp=0; qp != n_qpoints; qp++) { Number u = interior_value(0, qp); Gradient grad_u = interior_gradient(0, qp); Number K = 1. / sqrt(1. + (grad_u * grad_u)); for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) += JxW[qp] * ((_kappa * u * phi[i][qp]) + (K * grad_u * dphi[i][qp])); } } side constraint() for (unsigned int qp=0; qp != n_qpoints; qp++) { for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) -= JxW[qp] * _gamma * phi[i][qp]; } } 0 B @ u q 1 + | u|2 , ϕ 1 C A Ω + κ (u, ϕ)Ω − σ (1, ϕ)∂Ω = 0 ∀ϕ ∈ V
  • 96. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Instead of explicitly finding the Jacobian, we’ll use FEMSystem to finite difference the weak form. element constraint() for (unsigned int qp=0; qp != n_qpoints; qp++) { Number u = interior_value(0, qp); Gradient grad_u = interior_gradient(0, qp); Number K = 1. / sqrt(1. + (grad_u * grad_u)); for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) += JxW[qp] * ((_kappa * u * phi[i][qp]) + (K * grad_u * dphi[i][qp])); } } side constraint() for (unsigned int qp=0; qp != n_qpoints; qp++) { for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) -= JxW[qp] * _gamma * phi[i][qp]; } } 0 B @ u q 1 + | u|2 , ϕ 1 C A Ω + κ (u, ϕ)Ω − σ (1, ϕ)∂Ω = 0 ∀ϕ ∈ V
  • 97. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Instead of explicitly finding the Jacobian, we’ll use FEMSystem to finite difference the weak form. element constraint() for (unsigned int qp=0; qp != n_qpoints; qp++) { Number u = interior_value(0, qp); Gradient grad_u = interior_gradient(0, qp); Number K = 1. / sqrt(1. + (grad_u * grad_u)); for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) += JxW[qp] * ((_kappa * u * phi[i][qp]) + (K * grad_u * dphi[i][qp])); } } side constraint() for (unsigned int qp=0; qp != n_qpoints; qp++) { for (unsigned int i=0; i != n_u_dofs; i++) { Fu(i) -= JxW[qp] * _gamma * phi[i][qp]; } } 0 B @ u q 1 + | u|2 , ϕ 1 C A Ω + κ (u, ϕ)Ω − σ (1, ϕ)∂Ω = 0 ∀ϕ ∈ V
  • 98. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Solution An overkill solution containing 200,000 DOFs. (a) 2D. (b) Contour Elevation.
  • 99. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Compressible Shocked Flow Original compressible flow code written by Ben Kirk utilizing libMesh.
  • 100. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Compressible Shocked Flow Original compressible flow code written by Ben Kirk utilizing libMesh. Solves both Compressible Navier Stokes and Inviscid Euler.
  • 101. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Compressible Shocked Flow Original compressible flow code written by Ben Kirk utilizing libMesh. Solves both Compressible Navier Stokes and Inviscid Euler. Includes both SUPG and a shock capturing scheme.
  • 102. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Problem Specification The problem studied is that of an oblique shock generated by a 10o wedge angle.
  • 103. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Problem Specification The problem studied is that of an oblique shock generated by a 10o wedge angle. This problem has an exact solution for density which is a step function.
  • 104. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Problem Specification The problem studied is that of an oblique shock generated by a 10o wedge angle. This problem has an exact solution for density which is a step function. Utilizing libmesh’s exact solution capability the exact L2 error can be solved for.
  • 105. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Problem Specification The problem studied is that of an oblique shock generated by a 10o wedge angle. This problem has an exact solution for density which is a step function. Utilizing libmesh’s exact solution capability the exact L2 error can be solved for. The exact solution is shown below:
  • 106. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Uniformly Refined Solutions For comparison purposes, here is a mesh and a solution after 1 uniform refinement with 10890 DOFs. x y 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 (c) Mesh after 1 uniform x y 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 r 1.45 1.4 1.35 1.3 1.25 1.2 1.15 1.1 1.05 1 (d) Solution after 1 uni-
  • 107. Introduction Object Models System Assembly Examples Summary Fluid Dynamics H-Adapted Solutions A flux jump indicator was employed as the error indcator along with a statistical flagging scheme.
  • 108. Introduction Object Models System Assembly Examples Summary Fluid Dynamics H-Adapted Solutions A flux jump indicator was employed as the error indcator along with a statistical flagging scheme. Here is a mesh and solution after 2 adaptive refinements containing 10800 DOFs: x y 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 x y 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 r 1.45 1.4 1.35 1.3 1.25 1.2 1.15 1.1 1.05 1
  • 109. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Redistributed Solutions Redistribution utilizing the same flux jump indicator. x y 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 (i) Mesh after 8 redistri- butions. x y 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 r 1.45 1.4 1.35 1.3 1.25 1.2 1.15 1.1 1.05 1 (j) Solution after 8 redis- tributions.
  • 110. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Redistributed and Adapted Now combining the two, here are the mesh and solution after 2 adaptations beyond the previous redistribution containing 10190 DOFs. x y 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 x y 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 r 1.45 1.4 1.35 1.3 1.25 1.2 1.15 1.1 1.05 1
  • 111. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Solution Comparison For a better comparison here are 3 of the solutions, each with around 11000 DOFs: x y 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 r 1.45 1.4 1.35 1.3 1.25 1.2 1.15 1.1 1.05 1 (m) Uniform. x y 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 r 1.45 1.4 1.35 1.3 1.25 1.2 1.15 1.1 1.05 1 (n) Adaptive. x y 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 r 1.45 1.4 1.35 1.3 1.25 1.2 1.15 1.1 1.05 1 (o) R + H.
  • 112. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Error Plot libmesh provides capability for computing error norms against an exact solution.
  • 113. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Error Plot libmesh provides capability for computing error norms against an exact solution. The exact solution is not in H1 therefore we only obtain the L2 convergence plot: 3.5 4.0 4.5 5.0 01 sfoD )N(gol -2.2 -2.0 -1.8 -1.6 -1.4 -1.2 01)rorrE 2 L(gol Uniform Adaptivity Redist + Adapt
  • 114. Introduction Object Models System Assembly Examples Summary Fluid Dynamics
  • 115. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Natural Convection Tetrahedral mesh of “pipe” geometry. Stream ribbons colored by temperature.
  • 116. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Surface-Tension-Driven Flow Adaptive grid solution shown with temperature contours and velocity vectors.
  • 117. Introduction Object Models System Assembly Examples Summary Fluid Dynamics Double-Diffusive Convection Solute contours: a plume of warm, low-salinity fluid is convected upward through a porous medium.
  • 118. Introduction Object Models System Assembly Examples Summary Biology Tumor Angiogenesis The tumor secretes a chemical which stimulates blood vessel formation.
  • 119. Introduction Object Models System Assembly Examples Summary Material Science Free Energy Formulation Cahn-Hilliard systems model phase separation and interface evolution f(c, c) ≡ f0(c) + fγ( c) fγ( c) ≡ 2 c 2 c · c f0(c) ≡ NkT (c ln (c) + (1 − c) ln (1 − c)) + Nωc(1 − c) ∂c ∂t = · Mc f0(c) − 2 c∆c
  • 120. Introduction Object Models System Assembly Examples Summary Material Science Phase Separation - Spinodal Decomposition Initial Evolution Initial homogeneous blend quenched below critical T Random perturbations anti-diffuse into two phases divided by narrow interfaces Gradual coalescence of single-phase regions Additional physics leads to pattern self-assembly
  • 121. Introduction Object Models System Assembly Examples Summary Summary libMesh Development Open Source (LGPL) Leveraging existing libraries Public site, mailing lists, CVS tree, examples, etc. at http://libmesh.sf.net/ 18 examples including: Infinite Elements for the wave equation. Helmholtz with complex numbers. Laplace in L-Shaped Domain. Biharmonic Equation. Using SLEPc for an Eigen Problem. Unsteady Navier Stokes. And More!