- README
- DIRECTORY
- DEMO

# Verified Finite Element Method (VFEM) libary

The Verified Finite Element Method (VFEM) library (in MATLAB language) implements well-used FEM spaces for solving PDEs, especially the Stokes equation.

Currently, only the 3D version is available here. The manual of VFEM is under preparation. A 2D version is also under development and will be released soon.

Below is a list of finite element function spaces:

- $H^1$ Conforming Lagrange FEM spaces with arbitrary degree.
- Scott-Vogelius FEM spaces with arbitray degree.
- Raviart-Thomas FEM spaces with arbitrary degree.
- Discontinuous FEM spaces with arbitrary degree.
- The Crouzeix-Raviart FEM space (only degree 1).

The polynomials in constructing the FEM space are based on the Bernstein polynomial. All the matrix assembling is done with explicit formula. Thus, there is no error from numerical quadrature.

### Verified computing

The verified computation is based on the INTVAL library by M. Rump. The VFEM library provides an interface to freely switch between approximate computing and rigorous computing mode.

### Efficiency of the library

Current implementation just focuses on "one reasonable implementation" of the codes needed by the solution verification for the Navier-Stokes equation. The code structure will have a big change in near future and the efficiency will/should be improved for large scaled computing.

# Solution verification example by VFEM

A solution verfication example for the Navier-Stokes equation is prepared in this project.

Also, a very simple 3D mesh generation for domain of blocks is provided; see `Simple3D_S_Zhang.py`

. It can create the special mesh proposed by Shangyou Zhang, which is used in the construction of the Scott-Vogelius FEM space.

## Step-by-step instruction on running the solution verification example.

There are two computation cases in the "Cases" folder of current project. In each case folder, there are the configuration of the problem and the output files during the computation.

The command is executed at the terminal of JupyterLab. The path of this project is `/home/ganjin/notebook/`

. The `<Project>`

below refers to this path.

Open the `setting.ini`

file in each case to confirm the configuration.

### Solution verification example

Here is an instruction on running solution verification for the case `Case_2021_06_12_Cube_r1`

.

### (1) Mesh generation and problem setting

To create the mesh for the computation, run the following command at `<Project>/Cases/Case_2021_06_12_Cube_r1/mesh_all/`

.

```
python Simple3D_S_Zhang.py
```

Note that the domain setting is configured inside the code `Simple3D_S_Zhang.py`

.

The setting file can be found in `<Project>/Cases/Case_2021_06_12_Cube_r1/setting.ini`

.

### (2) Approximate solution solver

To initialize the problem setting, run the following command in the `NS_Solver`

folder:

```
bash ./Run_NS_Solver.sh ../Cases/Case_2021_06_12_Cube_r1/
```

The above code will calculate the approximate divergence-free solution.

### (3) Solution verfication

To performt the solution verification while ignoring the approximation error in matrix computing, i.e., the error in solving linear equations and eigenvalue problems of matrices, set `INTERVAL_MODE = 0`

in `NS_Verify/NS_Runit.m`

file:

```
INTERVAL_MODE = 0;
```

To have a rigorous solution verification, set `INTERVAL_MODE = 1`

in `NS_Verify/NS_Runit.m`

file:

```
INTERVAL_MODE = 1;
```

Then, run the following comannd in the `NS_Verify`

folder:

```
bash ./Run_NS_Verify.sh ../Cases/Case_2021_06_12_Cube_r1/
```

For both the approximation mode and the rigorous computation mode, the above the solution verification example can be finished in several minutes with a standard virtual machine at Ganjin.online with about 4GB memory.

However, to perform rigorous solution verification example in `Case_2021_05_22_Hole_30_block_r0_anti_sym_f`

(the one reported in https://arxiv.org/abs/2101.03727), one needs a virtual machine server with at least 128GB memory (machine type=c2-standard-32). If you want to such a machine at Ganjin.online to run the demo (freely), please contact Xuefeng LIU directly.
Approximate solution verification for this case only requires less than 4G memory.

### (4) Clear computation results

During the solution verification, there will be huge files created in the case folder. A big file will cause failure in file backup. So, please clear the computation results before shutting down the virtual machine.

Run the code in `<Project>/Cases/`

```
bash ./clear_cache_files.sh
```

Note that if you are running the demo as a visitor (not a cloned project in your own account), all changes to the project, including the cache files, will be aborted when the demo site is shut down.

Xuefeng LIU

Last updated: 2021/9/19.

#### About the directory

Folders or files beginning with a dot are not displayed by default.

## Virtual Machine Setting

#### Warning!

You are starting the virtual machine as a **visitor** to current project. As a visitor, you can change files in the booted virtual machine, but the changed files will be aborted when the server is shut down.