# Verification of PeleC

Verification of PeleC uses MASA and auto-differention tools to implement the Method of Manufactured Solutions into PeleC.

The \(L_2\) error norm for a quantity \(s\) is defined as

where \(s^h\) is the numerical solution, \(s^*\) is the exact solution, and \(N_e\) is the number of elements. \(N\), used below, is the number of element on a side of the cube (\(N_e = N^3\)).

## Building and running MMS

The user must first build and install MASA. This can be done from source or using Spack.

### Building MASA from source

The user must build both Metaphysicl and MASA. After defining
`METAPHYSICL_ROOT_DIR`

and `MASA_ROOT_DIR`

:

```
$ git clone https://github.com/roystgnr/MetaPhysicL
$ ./bootstrap
$ ./configure --prefix=$METAPHYSICL_ROOT_DIR
$ make
$ make install
```

```
$ git clone https://github.com/manufactured-solutions/MASA
$ ./bootstrap
$ ./configure --enable-fortran-interfaces METAPHYSICL_DIR=$METAPHYSICL_ROOT_DIR --prefix=$MASA_ROOT_DIR --enable-python-interfaces
$ make
$ make check
$ make install
```

### Building MASA using Spack

Assuming the user has Spack configured for their system, building and installing MASA is as easy as:

```
$ spack install masa
```

### Linking MASA to PeleC and running

For the MMS problem setup, one must specify the install location for
MASA in the `MASA_HOME`

variable. This can be done on the command
line either as:

```
$ export MASA_HOME=$MASA_ROOT_DIR
```

or, when compiling PeleC,

```
$ make -j 16 DIM=3 USE_MPI=TRUE MASA_HOME=$MASA_ROOT_DIR
```

where `MASA_ROOT_DIR`

is the MASA install location. If using Spack
and after loading the MASA module, the `MASA_ROOT_DIR`

will be
automatically populated.

After building the PeleC MMS executable, one can perform an MMS convergence study to demonstrate formal accuracy of the numerical implementation. Results of several MMS tests are detailed below.

### Running the full MMS suite

The full MMS suite can be executed through the PeleCRegressionTesting test suite:

```
$ ./verify-pelec.sh
```

## Testing the Euler equations

We can turn off diffusion in Pele and set the coefficients for those terms to zero in MASA to test the hydrodynamic update. A convergence study shows second order for Pele’s treatment of the hydrodynamic source. The initial solution was initialized to the exact solution and 100 pseudo-time steps were taken (fixed to \(10^{-8}\)). Periodic boundaries are imposed everywhere.

Density \(L_2\) error norm:

Velocity (u, v, w) \(L_2\) error norm:

Pressure \(L_2\) error norm:

## Testing the adaptive mesh refinement algorithm

This setup is similar to the previous one except for the fact that this test uses the AMR framework. There are two grid refinement levels: a coarse grid covering the entire domain and a fine grid on top of this one covering 50% of the domain. The grids are fixed in time, i.e. they do not adapt based on the solution value. This test ensures that the algorithms dealing with the grid interfaces, time integration of the different levels, and level synchronization preserve the second order accuracy of the code.

Magnitude of velocity and mesh:

Velocity \(L_2\) error norm:

## Testing the constant Smagorinsky Large Eddy Simulation model

This setup is identical to the MMS study for the compressible Navier-Stokes equations. The Large Eddy Simulation (LES) constants, \(C_s\) and \(C_I\), were chosen such that the turbulent eddy viscosity was comparable to the viscosity, i.e. \(\frac{\mu_t}{\mu} = \mathcal{O}(1)\). Since the model scales with the mesh spacing, \(C_s\) and \(C_I\) were scaled inversely with the mesh spacing for the mesh refinement studies. For example, \(C_s\) is set to 2 for the \(8^3\) mesh and set to 4 for the \(16^3\) mesh (for \(C_I\), it is 1 and 4, respectively). A convergence study shows second order for Pele’s treatment of the compressible Navier-Stokes equations with the constant Smagorinsky Large Eddy Simulation model.

Density \(L_2\) error norm:

Velocity (u, v, w) \(L_2\) error norm:

Pressure \(L_2\) error norm: