Skip to content

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> (-o for --old-dir)

Required inputs:

  1. --old-dir: relative or absolute path to the case directory containing data which need to be interpolated
  2. --new-dir: relative or absolute path to the new case directory

Options:

  1. --stats or -s followed 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=all interpolates all the statistics of the old case.
  2. --fields or -f followed by a field id range. The range is specified as <countStart>:<countEnd> or all. Start/end counts can be omitted when first/last (e.g. 2: interpolates fields from count-0002 to last, note that fields count start from count-0000). To interpolate only one field the syntax is the same (e.g. 2:2 to interpolate fields from count-0002 only).
  3. --restart or r interpolates 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:

  • --help Show this help message and exit
  • -c Do NOT delete cubes/
  • -r Do NOT delete restart/
  • -s Do NOT delete stats/
  • -d Do NOT delete database/
  • -p Do NOT delete probes/

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