Overview
NinjaFOAM is a new optional solver in WindNinja that solves the conservation of mass and momentum equations. It is based on the OpenFOAM computational fluid dynamics (CFD) toolbox. OpenFOAM is free, open source software for CFD from the OpenFOAM Foundation.
NinjaFOAM
This page documents the individual steps in a NinjaFOAM simulation. These steps are executed in ninjafoam::simulate_wind()
. Output from each OpenFOAM call is written to a log file (e.g., log.checkMesh
) in the temporary directory.
-
A temporary case directory is created and the OpenFOAM case files are written to the temporary directory. The OpenFOAM files are copied from template files located in
WINDNINJA_DATA/ninjafoam.zip
. -
The DEM is converted to binary STL format and written to
constant/triSurface
. -
Call
surfaceTransformPoints
. This creates an STL of the output surface. This is a surface shifted to the user-specified output wind height. It is written toconstant/triSurface/<demBaseName>_out.stl
. -
Call
surfaceCheck
. This performs a check on the generated STL and writes a file calledlog.json
which is later used in theblockMeshDict
file writing if a DEM is not available (e.g., runs initiated with an STL). -
Write
blockMeshDict
. During this step,xmin
,xmax
,ymin
,ymax
,zmin
,zmax
are read/calculated from the DEM unless the run was initiated with an STL file, in which case the necessary terrain information is read fromlog.json
. This is the bounding box forblockMesh
. -
Run
blockMesh
. -
Run
moveDynamicMesh
, in parallel if more than once processor is available. -
Refine the near-surface layer with
refineMesh
. This refines the near-surface cells in all directions. -
Call
checkMesh
to check the current cell count. Repeat 8-9 until cell count meets our threshold. -
Call
renumberMesh
. -
Call
applyInit
. This applies the initial conditions. -
Run
simpleFoam
, in parallel if more than one processor is available. -
Call
sample
to sample the velocity field at the user-specified output height. The sampling is controlled bysampleDict
. The sampling is performed on the output surface<demBaseName>_out.stl
created at the beginning of the simulation. There are several types of interpolation schemes available:cell
,cellPoint
,cellPointFace
, etc. -
Convert the raw xyz output to the requested WindNinja formats.
-
Remove the temporary directory and all OpenFOAM case files unless VTK output was requested.