Utilities
AMPHIBIOUS comes with utilities for commonly needed tasks.
Interpolating fields
interpolator is a program that interpolates restart fields, databases and statistics from one case to another, after a new settings.in is properly filled in a new case directory; it can also modify the domain decomposition.
The interpolator is compiled as:
make utilities/interpolator
and is run as:
mpirun -n <N> interpolator --new-dir=<path/to/new-dir> --old-dir=<path/to/old-dir> --stats=<statsNames> --fields=<idStart>:<idEnd> --restart
Flags can be given in both long and short Unix-like style, i.e. in one of the following equivalent ways:
--new-dir=<path/to/newdir>--new-dir <path/to/newdir>-n <path/to/newdir>(-ofor--old-dir)
Required inputs:
--old-dir: relative or absolute path to the case directory containing data which need to be interpolated--new-dir: relative or absolute path to the new case directory
Options:
--statsor-sfollowed by the list of statistics to be interpolated. One can also select a subset of stats (dependencies must be satisfied, an error is triggered otherwise).--stats=allinterpolates all the statistics of the old case.--fieldsor-ffollowed by a field id range. The range is specified as<countStart>:<countEnd>orall. Start/end counts can be omitted when first/last (e.g.2:interpolates fields fromcount-0002to last, note that fields count start fromcount-0000). To interpolate only one field the syntax is the same (e.g.2:2to interpolate fields fromcount-0002only).--restartorrinterpolates the restart field
The interpolator requires that preproc has been run correctly on both old and new case directory. interpolator is written such that any combination of cube decomposition in the new and old directory is possible, making it capable of both interpolating and changing the domain decomposition independently.
WE present two use cases below. Both assume that a simulation has been run in <oldDir> with decomposition and discretization dictated by:
!------------------
PREPROC
!------------------
Nx=100
Ny=100
Nz=100
nCubesX=2
nCubesY=2
nCubesZ=1
...
Use case 1
One wants to continue the simulation, by using more than 4 MPI ranks.
To do so, first a new case directory <newDir> is created; in the new settings.in, only the PREPROC section is changed to:
!------------------
PREPROC
!------------------
Nx=100
Ny=100
Nz=100
nCubesX=4
nCubesY=4
nCubesZ=1
...
Then cubes in the new directory are generated with:
mpirun -n 16 ./preproc <newDir>
and the new case directory is populated with:
mpirun -n <N> ./utilities/interpolator --new-dir=<newDir> --old-dir=<oldDir> --restart
where <N> is limited by the non-pruned cubes in the new directory (similarly to what happens for solver and postproc). The restart field is left untouched (besides possible roundoff errors) and saved in the usual restart/ subdirectory with the new domain decomposition. The same can be done for statistics and databases, if additional command-line arguments are used.
Use case 2
One wants to continue the simulation, by using a doubled number of points in the x and y directions.
To do so, first a new case directory <newDir> is created; in the new settings.in, only the PREPROC section is changed to:
!------------------
PREPROC
!------------------
Nx=200
Ny=200
Nz=100
nCubesX=2
nCubesY=2
nCubesZ=1
...
Then cubes in the new directory are generated with:
mpirun -n 4 ./preproc <newDir>
and the new case directory is populated with:
mpirun -n <N> ./utilities/interpolator --new-dir=<newDir> --old-dir=<oldDir> --restart
where <N> is limited by the non-pruned cubes in the new directory (similarly to what happens for solver and postproc). The restart field gets interpolated on the new grid and saved in the usual restart/ subdirectory without changing the domain decomposition. The same can be done for statistics and databases, if additional command-line arguments are used.
Cleaning runtime data
The script clean-runtimedata is a bash script which removes files generated by AMPHIBIOUS in the case directory, cleaning the subfolders cubes/, restart/, stats/, database/ and probes/
Usage: clean-runtimedata.sh <caseDir> <options>
Options:
--helpShow this help message and exit-cDo NOT deletecubes/-rDo NOT deleterestart/-sDo NOT deletestats/-dDo NOT deletedatabase/-pDo NOT deleteprobes/
Examples:
clean-runtimedata.sh <caseDir>
Clears all subdirectories generated by AMPHIBIOUS in <caseDir>
clean-runtimedata.sh <caseDir> -rc
Clears only stats/, probes/ and database/ in <caseDir>
Channel STL
createChannelSTL is an utility that creates a rectangle, with each of its 6 faces defined by two triangles. It can be used to generate the required STL files for the channel flow case. It is compiled as:
make utilities/createChannelSTL
and run as:
./createChannelSTL <caseDir>
createChannelSTL generates in directory <caseDir>/geometry/ the 6 files:
surfaceXhi.stl
surfaceXlo.stl
surfaceYhi.stl
surfaceYlo.stl
surfaceZhi.stl
surfaceZlo.stl
The channel sizes are selected in the source of createChannelSTL, and by default they amount to:
Lx=4*PI; Ly=2; Lz=2*PI