zhoutengye / NNMOF

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NNMOF

Nueral Network boosted Moment of Fluid

Installation

The code need several run-time libraries:

  • HDF5
  • hypre
  • Two external MOF libraries (Use to compare with my algorithm)

Easy installation

When you work with UNIX based OS, for example, Ubuntu/Linux Mint, with gcc, gfortran, mpich/openmpi installed from apt-get, you should be able to build the essential run-time libraries by

bash libs-install.sh

All libraries are located in libs directory.

Manual installation

You may compile your own hdf5 and hypre, and manually compile two external MOF libraries in libs directory. It is important to make sure the C, Fortran compiler and MPI version are consistent while compiling all those libraries.

For visualization

There are visualization tool available, which replies on h5py and mayavi library with Python. To use it, Python and correcponding library should be installed as well. Anaconda is recommanded to install Python and libraries.

Compile and run cases

The repository is under frequent update, it is recommended to make a new directory outside the NNMOF directory. To compile outside the NNMOF directory, one can simply copy a case from case dir and change the path of MOF_DIR in Makefile.

Makefile

See the Makefile in test/basics directory as the example to see how to customize makefile.

The code in src directory does not contain main file, the main file and other extra code file should be added to the name CASE_SRCS and makefile.

Run the code

Execute with command

mpirun -np (X) (executable) (input)
  • (X) should be consistant with px*py in input file
  • (executable) is generated by Makefile
  • (input) is the name of the input namelist file and the field file based on hdf5, without suffix for example, for file test3.namelist, and the initial field file is test3.h5, (input) should be test3. If no (input) is given, it will search for the default input file input.namelist and input.h5.
  • By default, both namelist and h5 files are essential, however, one can call the Init function with initfield = .false., so that the executable will no longer require initial h5 file.
  • The variables in initial field h5 file should correcponds with the variables in the namelist file.

Input file

Basic variables

Name Description Type Rank
px, py number of processors in $x$, $y$ direction Integer 1
nx, ny, nz number of grid in $x$, $y$, $z$ firection Integer 1
dx, dy, dz grid size in $x$, $y$, $z$ direction float 1
preiodx(or y,z) periodic boudary logical 1
tstart, end, dt start, end time and time step float 1
n_vars number of input/output field variable integer 1
io_x whether use the variable as input/output logical 1

Computational vars

NameDescriptionTypeRank
tstartstart of simulation timefloat1
tendEnd of simulation timeflost1
dttime stepfloat1
hotstarthotstart flaglogical1
hotstart_type0 for automatic, 1 for manualinteger1
hotstart_timewhen hotstart_type = 1, specify the start timefloat1
outptu_intevalfrequency of outputfloat1
startoutputtimethe time that output will startfloat1
output_format‘tecplot’, ‘paraview’, or ‘hdf5’float1

Note: Then hotstart = .true., tstart will not work, instead, will be determined by the hotstart parameters

Navier-Stokes related variables

NameDescriptionTypeRank
rho_l,rho_rdensity of liquid and gasfloat1
mu_l, mu_gviscosity of liquid and gasfloat1
body_forcebody foece in x, y, z dierectionsfloat3
rk_orderOrder of Runge-Kutta integration, should be 1, 2 or 3integer1
iter_maxMaximum iteration stepinteger1
iter_toleranceTolerance of the iterationqfloat1
hypre_solverChoice of hypre solverinteger1
hypre_preconditionerChoice of hypre preconsitionerinteger1
bc_leftLower boundary type at x directioninteger3
bc_rightUpper boundary type at x directioninteger3
bc_backLower boundary type at y directionfloat3
bc_frontUpper boundary type at y directionfloat3
bc_bottomLower boundary type at z directionfloat3
bc_topUpper boundary type at z directionfloat3

Options for Hypre

The choice of hypre solver and preconditioner only works with specific combination:

preconditioner =>012
solverNoneSMGPFMG
1SMGYes
2PFMGYes
3BiCGSTABYesYesYes
4GMRESYesYesYes

Notes: Seems that SMG without preconditioner or SMG conditioner with GMRES work best.

Boudnary conditions

valuetype
1No-slip Wall
2Slip Wall

Visualization

Tecplot and paraview

The output data is stored at hdf5 format. The input file provide options to export paraview and Tecplot supported format. It can also be done manuall by copying the python script from utils.

Inline visualization

Several inline visualiation functions are available in src/tools.f90, it allows you to visualize the field while calling the funcion. This is very useful in debugging.

About


Languages

Language:Jupyter Notebook 74.3%Language:Fortran 22.6%Language:Python 2.3%Language:Makefile 0.4%Language:C 0.2%Language:Shell 0.1%Language:C++ 0.0%