Giter Club home page Giter Club logo

perigee's Introduction

PERIGEE is a nonlinear dynamic finite element analysis code for multiphysics analysis. The code has been developed with the goal of providing an object-oriented framework for parallel implementation of multiphysics problems. Copyright and licensing information can be found in LICENSE.

Table of Contents

Install

We recommend using UNIX-like operating systems, such as Linux or MacOS, for the code development. If you are a Windows user, you may refer to this for a detailed install guide. The following instructions are based on a Linux Ubuntu system, and there could be minor differences for Mac systems.

  1. A quick guide for library installation is here and a more advanced guide is there. After the libraries are all properly installed, proceed to step 2.

Notice that VTK is typically installed as a shared library in a non-standard folder. One therefore has to edit the LD_LIBRARY_PATH environmental variable for the linker to locate the .so files. Open the .bash_profile or .bashrc file and edit the LD_LIBRARY_PATH variable. See below is an example with my VTK installed at /Users/juliu/lib/VTK-8.2.0/.

export LD_LIBRARY_PATH=/Users/juliu/lib/VTK-8.2.0/lib:$LD_LIBRARY_PATH

For more information on this environmental variable, see here.

  1. After the libraries are installed, add a configuration file named as system_lib_loading.cmake in the conf folder. You may find a file called system_lib_loading_example.cmake, which is an example. In this file, you will have to specify the paths for the external libraries,
  • Set VTK_DIR to the VTK library location (e.g. /home/jliu/lib/VTK-7.1.1-shared).
  • Set PETSC_DIR to the PETSc library location (e.g. /home/jliu/lib/petsc-3.11.3).
  • Set PETSC_ARCH to the value used in PETSc installation (e.g. arch-linux2-c-debug).
  • Set METIS_DIR to the METIS library location (e.g. /home/jliu/lib/metis-5.0.3).
  • Set HDF5_DIR to the HDF5 library location (e.g. /home/jliu/lib/hdf5-1.8.16).
  • Set CMAKE_C_COMPILER to $PETSC_DIR/$PETSC_ARCH/bin/mpicc
  • Set CMAKE_CXX_COMPILER to $PETSC_DIR/$PETSC_ARCH/bin/mpicxx

After the edit, save the CMake file and rename it as system_lib_loading.cmake, and you have your own configuration file set up. Notice that we have the file name system_lib_loading.cmake added in .gitignore, meaning that git will not track this file. You may want to keep a copy of this file out of PERIGEE, because when you switch to other branches, PERIGEE may not keep a copy of this file.

Build

First, create a folder build out of the source directory. Enter that folder, and run the following commands to build, as an example, a suite of heat equation solvers.

CMake ~/PERIGEE/examples/linearPDE/

CMake will print some information on the screen. Pay a look at the variable CMAKE_BUILD_TYPE. If its value is Debug, this means your code will be compiled in the debug mode. If you want to make the code faster, run CMake as follows,

CMake ~/PERIGEE/examples/linearPDE/ -DCMAKE_BUILD_TYPE=Release

Now the value of CMAKE_BUILD_TYPE is set to Release. The code will be compiled in the optimized mode. For more information about the compiler, please refer to this. Of course, a fully optimized code requires that your external libraries, especially PETSc, are compiled in the optimized mode also. Refer to the advanced guide for more info on building libraries in a release mode. After CMake generates the Makefile for you, you need to run the following command to compile the source code.

make

Of course, you may add -j2 to run Makefile with 2 threads. If the make complains about the auto keyword or the nullptr, your default compiler does not support C++11. You may add SET(CMAKE_CXX_STANDARD 11) in your .cmake configuration file to enforce the C++11 standard.

Tutorial

In general, one has to go through the following steps for simulation.

  • Obtain the mesh in vtu/vtp format from a front-end code, e.g., SimVascular or Gmsh.
  • Run a preprocessor to load the mesh, assign boundary conditions, and partition the mesh. The preprocessor is a serial code and may need to be run on a large memory cluster node if you are dealing with a very large problem.
  • Run a finite element analysis code to solve the partial differential equations. The solutions will be saved on disk in the binary format.
  • Run a preprocessor for postprocessing. This step re-partition the mesh to make preparations for postprocessing, such as visualization, error calculation, etc. Similar to the preprocessor, this routine should be run in serial and may consume a lot memory if your mesh is fine. With this routine, we are able to run the postprocessing routine with different number of CPUs. For example, we run FEM analysis with, say, 360 CPUs; visualizing the solution is much less intensive in computing and may only need, say, 24 CPUs. So you should repartition the domain into 24 sub-domains in this step.
  • Run a postprocessor in parallel. Often, this step refers to the visualization of the solutions. The visualzation routine will read the binary solution files and write the data into (parallel) vtu/vtp format. Then the data can be visualized in Paraview.

Simulation Samples

The vortex-induced vibration of an elastic plate with Re $\approx$ 3 $\times$ 10^4. The mesh consists of 18 million linear tetrahedral elements for the fluid and 0.7 million elements for the solid. The variational multiscale formulation provides the LES technique in the flow problem, and the time integration is based on the generalized-α scheme.

Pulmonary CFD

A fluid-structure interaction simulation of a pulmonary model is performed using the unified continuum and variational multiscale formulation. The model and mesh are prepared by W. Yang. The solid model is fully incompressible and is numerically modeled via the residual-based variational multiscale formulation.

Pulmonary FSI

References

Theory

Verification & Validation

HPC

  • D. Goldberg, What every computer scientist should know about floating-point arithmetic.
  • U. Drepper, What every programmer should know about memory.

C++

Contact

Dr. Ju Liu, [email protected], [email protected]

Acknowledgement

National Natural Science Foundation of China, Grant number 12172160

Shenzhen Science and Technology Program, Grant number JCYJ20220818100600002

perigee's People

Contributors

chongran-zhao avatar davidluojw avatar goldeninscriptions avatar guanjiashen avatar hjy9725 avatar ingridxlan avatar ju-liu avatar mr-chi-ding avatar oguzziya2 avatar rrrabittt avatar seavegetable avatar syj-0525 avatar wgyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

perigee's Issues

Enable periodic BC with reading section '$Periodic' in .msh file

  1. Gmsh_FileIO private: void read_periodic(), std::vector periodic_slave, std::vector periodic_master (node indices)

  2. write_vtp or write_quadratic_vtu( ..., bool is_periodic), if yes: DataVecStr{ {...}, "PeriodicMasterID", "Node"} written

  3. class NodalBC_periodic : public INodalBC, otherwise we just modified NodalBC

rename file

ALocal_inflow_NodalBC ---> ALocal_inflow_Data

This class does not hold NodalBC data, meaning it is not used to enforce BC on the matrix problem. Thus we change its name to avoid misunderstanding.

part of Math_Tools move to a new namespace FE_Tools

In Math_Tools, there are several functions that are developed to assist FE routines. Also, the Matrix_double_3by3_Array and Matrix_double_6by6_Array classes are constructed for the same purposes.

We can collect these functions together as FE_Tools, so that the purpose of these functions is clearer.

SYS_T::to_string function needs to be replaced

new C++ allows a to_string function that does the same thing. So we do not need to have the same function in our sys_tools class. To do the replacement, we need to carefully replace all SYS_T::to_string by to_string and testing.

A linear elasticity code

For education purposes, we need to enable a linear elasticity example, preferably in the linearPDE folder.

clean a std vector with a VEC_T function

We need a helper function that truely empty a std vector with its size and capacity to zero.

For example, Solid_Prestress needs this function to free the memory in a fluid element.

Accelerate the preprocess procedure by parallelization

In at least two parts, the procedure can be accelerated by an OpenMP type parallelization:

  1. In the convection from gmsh to vtu, the loop over element can be parallelized;
  2. In the partition of the mesh file, the generation of part file can be parallelized.

print the nonzero info from assembly

we need to print the nonzero info from the assembly routine, which is already done. We multiply 4 in the assembly with the given nonzero estimate. Perhaps this is a bit confusing. Need to unify in the future.

need a SymmMatrix_3x3 class

Oftentimes, we need to work on symmetric matrices. We need a dedicated class that holds the six matrix entries.

Matrix_double_6by6_Array needs maintance

We need to at least conver the data structure from [6][6] to a oneD array of [36].

And we do not need to store the inverse of diagonal entries in the member data.

element improvement

  • 1. We will get rid of the get_normal_out old fashinoned implementation, instead use the one with Vector_3 as input.
  • 2. The build basis function needs a way to get std::array<std::vector,3> as the input of the control points.
  • 3. Same for the get_h funciton.
  • 4. We rarely use get_d2R_dxx in our code, so this kind of get function, perhaps, can be removed.
  • 5. It can be convenient to return std::array<std::vector,4> for get_R_gradR and such type of access functions.

cross3d and normalized3d

These are outdated functions in MATH_T.

If one use them, one shall resort to fun in Vector_3.

ElemBC_3D_hex class in need

We will need a class to load hex mesh's boundary file for surface integral (Neuman BC).

In particular, we need to discuss a rule for the outward normal vector definition, and implement a reset IEN function for hex-quad mesh.

petsc use PETSC_NULLPTR

Since 3.19, PETSc invokes PETSC_NULLPTR.

see https://petsc.org/release/changes/319/

currently, we use #define PETSC_SILENCE_DEPRECATION_WARNINGS_3_19_0
in SYS_Tools to blind this warning message. We will have to update our call of related PETSc functions and remove the above marco.

enable YAML to pass control of the code

From PETSc 3.15, we may pass all petsc argument in a single YAML file, which allows us to make comments. This is more user friendly as we may have very long nested arguments for our solver control.

Enable ALE-CFD in the existing code

We had an old implementation of ALE-CFD. We need to enable this capability in the PERIGEE code, for the study of, say, blood pumps.

We may have a separate example folder for it, or, merge it with the NS code.

Enabling the pure Neumann bc for all cap surfaces

The code can essentially enable full Neumann for cap surfaces. There are a few minor things to take into account.

  1. The inflow file shall allow num_nbc to be zero;
  2. The backflow stabilization term shall be turned off, at least for the `inflow' caps;

With the above two, one can enable the full Neumann cap bc by setting num_inlet to zero, and prepare all caps meshes with the name starting by outflow_vol_.

Build "examples/tet4_vascular/FSI" with errors.

Dear all
I have tried to build the examples/tet4_vascular/FSI with cmake, but followed errors occur.

`CMake Error at CMakeLists.txt:149 (ADD_LIBRARY):
Cannot find source file:

/home/shuoxing/software/PERIGEE/src/Mesh/IElemBC.cpp

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
.hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc

CMake Error at CMakeLists.txt:149 (ADD_LIBRARY):
No SOURCES given to target: perigee_preprocess
`
I think the source file is missed.

Best

Matrix_PETSc class needs updating

  1. We need to rename the member data m and n as gm and gn;
  2. We need to extract the actual memory allocation and use it for the actual, finally-assembled matrices.

Make Matrix_SymPos_Dense an independent class

We should not make it a derived class of Matrix_Dense as it does not need the permutation vector pp at all. Logically, making it an independent class will make things easier and cleaner.

a bug in CMM code

/Users/juliu/PERIGEE/examples/cmm/src/PNonlinear_CMM_Solver.cpp:504:32: warning: declaration shadows
a field of 'PNonlinear_CMM_Solver' [-Wshadow]
const PDNSolution * const &dot_step,
^
/Users/juliu/PERIGEE/examples/cmm/./include/PNonlinear_CMM_Solver.hpp:122:19: note: previous
declaration is here
PDNSolution * dot_step;
^
/Users/juliu/PERIGEE/examples/cmm/src/PNonlinear_CMM_Solver.cpp:552:26: warning: declaration shadows
a field of 'PNonlinear_CMM_Solver' [-Wshadow]
PDNSolution * const &dot_step) const
^
/Users/juliu/PERIGEE/examples/cmm/./include/PNonlinear_CMM_Solver.hpp:122:19: note: previous
declaration is here
PDNSolution * dot_step;
^
2 warnings generated.

rename file

ALocal_NodalBC ---> ALocal_NBC.

This makes its name follow the style of EBC.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.