This page provides a list of libROM example applications. For detailed
documentation of the libROM sources, including the examples, see the online
Doxygen documentation or the doc directory in the distribution. The goal of the example
codes is to provide a step-by-step introduction to libROM in simple model
settings.
Select from the categories below to display examples and miniapps that contain
the respective feature. All examples support (arbitrarily) high-order meshes
and finite element spaces. The numerical results from the example codes can
be visualized using the GLVis or VisIt visualization tools. See the GLVis
and VisIt
websites for more details.
Users are encouraged to submit any example codes and miniapps that they have
created and would like to share. Contact a member of the libROM team to report
bugs
or post questions
or comments.
**Application (PDE)**
**Reduced order models type**
**Parameterization type**
**hyper-reduction**
**Physics code**
**Optimization solver**
Poisson Problem
This example code demonstrates the use of libROM and MFEM to define a reduced
order model for a simple isoparametric finite element discretization of the
Poisson problem $$-\Delta u = f$$ with homogeneous Dirichlet boundary
conditions. The example parameterizes the righthand side with frequency
variable, $\kappa$:
$$f =
\cases{
\displaystyle \sin(\kappa (x_0+x_1+x_2)) & for 3D \cr
\displaystyle \sin(\kappa (x_0+x_1)) & for 2D
}$$
The 2D solution contour plot for $\kappa=1$ is shown in the figure
on the right to show the effect of $\kappa$. For demonstration, we sample
solutions at $\kappa=1$, $1.1$, and $1.2$. Then a ROM is build with basis size
of 3, which is used to predict the solution for $\kappa = 1.15$. The ROM is
able to achieve a speedup of $7.5$ with a relative error of $6.4\times10^{-4}$.
One can follow the command line options below to reproduce the numerical results
summarized in the table below:
The code that generates the numerical results above can be found in
(poisson_global_rom.cpp)
and the explanation of codes is provided in
here.
The
poisson_global_rom.cpp
is based on
ex1p.cpp from
MFEM with a modification on the right hand side function.
Heat conduction problem
For a given initial condition, i.e., $u_0(x) = u(0,x)$,
heat conduction solves a simple 2D/3D time dependent nonlinear heat conduction problem
with a natural insulating boundary condition $\frac{du}{dn}=0$. We linearize
the problem by using the temperature field $u$ from the previous time step to
compute the conductivity coefficient.
One can run the following command line options to reproduce the DMD results
summarized in the table below:
This example demonstrates the parametric DMD on the heat conduction
problem. The initial condition, $u_0(x)$, is
parameterized by the center of circle and the radius, i.e.,
$$u_0(x) =
\cases{
\displaystyle 2 & for |x-c| < r \cr
\displaystyle 1 & for |x-c| $\ge$ r
}$$
One can run the following command line options to reproduce the parametric DMD results
summarized in the table below:
with a natural insulating boundary condition $\frac{\partial v}{\partial n}=0$. The
$H(div)$-conforming Raviart-Thomas finite element space is used for the velocity function $\boldsymbol{v}$,
and the $L^2$ finite element space is used for pressure function, $p$.
This example introduces how the hyper-reduction is implemented and how the
reduced bases for two field varibles, $p$ and $\boldsymbol{v}$.
One can run the following command line options to reproduce the DMD results
summarized in the table below:
where $c$ is advection velocity.
The initial condition, $u_0(x)$, is given by
$$u_0(x) =
\cases{
\displaystyle exp\left (-log(2)\frac{(x+7)^2}{0.0009}\right ) & for -0.8 $\le$ x $\le$ -0.6 \cr
\displaystyle 1 & for -0.4 $\le$ x $\le$ -0.2 \cr
\displaystyle 1-|10(x-0.1)| & for 0 $\le$ x $\le$ 0.2 \cr
\displaystyle \sqrt{1-100(x-0.5)^2} & for 0.4 $\le$ x $\le$ 0.6 \cr
\displaystyle 0 & \text{otherwise}
}$$
The DMD is applied to accelerate the advection simulation:
FOM solution time
DMD setup time
DMD query time
3.85 sec
0.18 sec
0.027 sec
The instruction of running this simulation can be found at
the HyPar page, e.g., go to Examples -> libROM Examples -> 1D Linear Advection-Discontinuous Waves.
Advection
For a given initial condition, i.e., $u_0(x) = u(0,x)$,
DG advection solves the time-dependent advection problem:
$$\frac{\partial u}{\partial t} + v\cdot\nabla u = 0,$$
where $v$ is a given advection velocity.
One can run the following command line options to reproduce the DMD results
summarized in the table below:
$$ \rho = \left ( 1-\frac{(\gamma-1)b^2}{8\gamma \pi^2} e^{1-r^2} \right )^{\frac{1}{r-1}}, p = \rho^\gamma$$
$$ u = u_\infty - \frac{b}{2\pi} e^{\frac{1}{2}(1-r^2)}(y-y_c)$$
$$ v = v_\infty + \frac{b}{2\pi} e^{\frac{1}{2}(1-r^2)}(x-x_c),$$
where $b=0.5$ is the vortex strength and $r = \left ( (x-x_c)^2 + (y-y_c)^2 \right )^{\frac{1}{2}}$ is the distance from the vortex center $(x_c,y_c) = (5,5)$.
The DMD is applied to accelerate the vortex convection simulation:
FOM solution time
DMD setup time
DMD query time
5.85 sec
5.25 sec
0.28 sec
The instruction of running this simulation can be found at
the HyPar page, e.g., go to Examples -> libROM Examples -> 2D Euler Equations - Isentropic Vortex Convection.
is solved. The DMD is applied to accelerate the Riemann problem:
FOM solution time
DMD setup time
DMD query time
111.1 sec
17.6 sec
1.4 sec
The instruction of running this simulation can be found at
the HyPar page, e.g., go to Examples -> libROM Examples -> 2D Euler Equations - Riemann Problem Case 4
Euler equation
For a given initial condition, i.e., $u_0(x) = u(0,x)$,
DG Euler solves the compressible Euler system of equation, i.e., a model
nonlinear hyperbolic PDE:
with a state vector $\boldsymbol{u} = [\rho,\rho v_0, \rho v_1, \rho E]$, where
$\rho$ is the density, $v_i$ is the velocity in the $i$th direction, $E$ is the
total specific energy, and $H = E + p/\rho$ is the total specific enthalpy. The
pressure, $p$ is computed through a simple equation of state (EOS) call. The
conservative hydrodynamic flux $\boldsymbol{F}$ in each direction $i$ is
The DMD is applied to accelerate the cavity flow simulation:
FOM solution time
DMD setup time
DMD query time
554.6 sec
58.6 sec
0.3 sec
The instruction of running this simulation can be found at
the HyPar page, e.g., go to Examples -> libROM Examples -> 2D Navier-Stokes Equations - Lid-Driven Square Cavity
1D-1V Vlasov Equation, Two-Stream Instability
The 1D-1V Vlasov equatoin is solved with the initial condition given by
Laghos (LAGrangian High-Order Solver) is a miniapp that solves the
time-dependent Euler equations of compressible gas dynamics in a moving
Lagrangian frame using unstructured high-order finite element spatial
discretization and explicit high-order time-stepping. LaghosROM introduces
reduced order models of Laghos simulations.
A list of example problems that you can solve with LaghosROM includes Sedov
blast, Gresho vortex, Taylor-Green vortex, triple-point, and Rayleigh-Taylor
instability problems. Below are command line options for each problems and some
numerical results. For each problem, four different phases need to be taken,
i.e., the offline, hyper-reduction preprocessing, online, and restore phase. The
online phase runs necessary full order model (FOM) to generate simulation data.
libROM dynamically collects the data as the FOM simulation marches in time
domain. In the hyper-reduction preprocessing phase, the libROM builds a library
of reduced basis as well as hyper-reduction operators. The online phase runs the
ROM and the restore phase projects the ROM solutions to the full order model
dimension.
Sedov blast problem
Sedov blast problem is a three-dimensional standard shock hydrodynamic
benchmark test. An initial delta source of internal energy deposited at the
origin of a three-dimensional cube is considered. The computational domain is
the unit cube $\tilde{\Omega} = [0,1]^3$ with wall boundary conditions on all
surfaces, i.e., $v\cdot n = 0$. The initial velocity is given by $v=0$. The
initial density is given by $\rho = 1$. The initial energy is given by a delta
function at the origin. The adiabatic index in the ideal gas equations of state
is set $\gamma = 1.4$. The initial mesh is a uniform Catesian hexahedral mesh,
which deforms over time. It can be seen that the radial symmetry is maintained
in the shock wave propagation in both FOM and ROM simulations. One can reproduce
the numerical result, following the command line options described below:
Gresho vortex problem is a two-dimensional benchmark test for the
incompressible inviscid Navier-Stokes equations. The computational domain is
the unit square $\tilde\Omega = [-0.5,0.5]^2$ with wall boundary conditions on
all surfaces, i.e., $v\dot n = 0$. Let $(r,\phi)$ denote the polar coordinates
of a particle $\tilde{x} \in \tilde{\Omega}$. The initial angular velocity is
given by
$$v_\phi =
\cases{
\displaystyle 5r & for 0 $\leq$ r < 0.2 \cr
\displaystyle 2-5r & for 0.2 $\leq$ r < 0.4 \cr
\displaystyle 0 i & for r $\geq$ 0.4.
}$$
The initial density if given by $\rho=1$. The initial thermodynamic pressure is
given by
$$p = \cases{
5 + \frac{25}{2} r^2 & for 0 $\leq$ r < 0.2 \cr
9 - 4 \log(0.2) + \frac{25}{2} - 20r + 4 \log(r) & for 0.2 $\leq$ r < 0.4 \cr
3 + 4\log(2) & for r $\geq$ 0.4 }$$
Taylor-Green vortex problem is a three-dimensional benchmark test for the
incompressible Navier-Stokes equasions. A manufactured smooth solution is
considered by extending the steady state Taylor-Green vortex solution to the
compressible Euler equations. The computational domain is the unit cube
$\tilde{\Omega}=[0,1]^3$ with wall boundary conditions on all surfaces,
i.e., $v\cdot n = 0$. The initial velocity is given by
The initial energy is related to the pressure and the density by the equation
of state for the ideal gas, $p=(\gamma-1)\rho e$, with $\gamma = 5/3$. The
initial mesh is a uniform Cartesian hexahedral mesh, which deforms over time.
The visualized solution is given on the right. One can reproduce the
numerical result, following the command line options described below:
Triple-point problem is a three-dimensional shock test with two materials in
three states. The computational domain is $\tilde{\Omega} = [0,7] \times [0,3
] \times [0,1.5]$ with wall boundary conditions on all surfaces, i.e.,
$v\cdot n = 0$. The initial velocity is given by $v=0$. The initial density is
given by
$$\rho =
\cases{
\displaystyle 1 & for x $\leq$ 1 or y $\leq$ 1.5, \cr
\displaystyle 1/8 & for x $>$ 1 and y $>$ 1.5
}$$
The initial thermodynamic pressure is given for
$$p =
\cases{
\displaystyle 1 & for x $\leq$ 1, \cr
\displaystyle 0.1 & for x $>$ 1
}$$
The initial energy is related to the pressure and the density by the equation
of state for the ideal gas, $p=(\gamma-1)\rho e$, with
$$\gamma =
\cases{
\displaystyle 1.5 & for x $\leq$ 1 or y $>$ 1.5\cr
\displaystyle 1.4 & for x $>$ 1 and y $\leq$ 1.5
}$$
The initial mesh is a uniform Cartesian hexahedral mesh, which deforms over
time. The visualized solution is given on the right. One can reproduce the
numerical result, following the command line options described below: