Category: MFEM
-
MFEM Tutorials (4) Simple Electomagnetic Diffusion Part C
Assemble the bilinear form and the corresponding linear system Assemble the bilinear form and the corresponding linear system, applying any necessary transformations such as: eliminating boundary conditions, applying conforming constraints for non-conforming AMR, static condensation, etc. This code first checks if the “static_cond” variable is true. If it is, it calls the EnableStaticCondensation method on…
-
MFEM Tutorials (4) Simple Electromagnetic Diffusion Part B
Read and refined the mesh from the given mesh file We can handle triangular, quadrilateral, tetrahedral, hexahedral, surface and volume meshes with the same code. Refine the mesh to increase the resolution. In this example we do ‘ref_levels’ of uniform refinement. We choose ‘ref_levels’ to be the/ largest number that gives a final mesh with…
-
MFEM Tutorials (4) Simple Electromagnetic Diffusion Part A
This example code solves a simple electromagnetic diffusion problem corresponding to the second order definite Maxwell equation with boundary condition Here, we use a given exact solution $E$ and compute the corresponding r.h.s. f. We discretize with Nedelec finite elements in 2D or 3D. The example demonstrates the use of $H$(curl) finite element spaces with…
-
MFEM Tutorials (3) Simple Linear Elasticity Problem Describing a Multi-Material Cantilever Beam Part B
Define a finite element space on the mesh. Here we use vector finite elements, i.e. dim copies of a scalar finite element space. The vector dimension is specified by the last argument of the FiniteElementSpace constructor. For NURBS meshes, we use the (degree elevated) NURBS space associated with the mesh nodes. This code sets up…
-
MFEM Tutorials (3) Simple Linear Elasticity Problem Describing a Multi-Material Cantilever Beam Part A
Description This example code solves a simple linear elasticity problem describing a multi-material cantilever beam. Specifically, we approximate the weak form of where is the stress tensor corresponding to displacement field $\textit{\textbf{u}}$, and lambda and mu // are the material Lame constants. The boundary conditions are $\textit{\textbf{u}}=0$ on the fixed part of the boundary with…
-
MFEM Tutorials (2) Simplest MFEM of Laplace Problem with Various Options Part B
Set up the bilinear form a(.,.) on the finite element space Set up the bilinear form a(.,.) on the finite element space corresponding to the Laplacian operator -Delta, by adding the Diffusion domain integrator. This code is the same as I explained earlier, it creates a BilinearForm object, “a”, which is used to represent the…
-
MFEM Tutorials (2) Simplest MFEM of Laplace Problem with Various Options Part A
Descriptions MFEM’s ex1 is a basic example of solving a linear elliptic PDE (partial differential equation) problem using the MFEM library. The problem is a simple scalar diffusion equation on a 2D mesh. The equation is defined as: where $u$ is the solution, $k$ is a scalar coefficient and $f$ is a source term. The…
-
MFEM Tutorials (1) Simplest MFEM of Laplace Problem
Description This example code demonstrates the most basic usage of MFEM to define a simple finite element discretization of the Laplace problem with zero Dirichlet boundary conditions. General 2D/3D mesh files and finite element polynomial degrees can be specified by command line options. Parse command line options This code includes the header files for the…
-
Introduction to MFEM
MFEM (Modular Finite Element Methods) is an open-source C++ library for solving partial differential equations (PDEs) using finite element methods (FEM). It is designed to be easy to use and highly modular, allowing users to combine different PDE solvers, preconditioners, and element types to create custom solutions to a wide range of problems. MFEM also…