Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ build*/
Code/build/*
Code/build_clang/*
install/*
results/*
dependencies/build/*
deploy/.jobscripts
deploy/machines_user.json
deploy/machines_user.yml
personal/*
CMakeFiles/*
CMakeCache.txt
Code/client/displayClient
Expand Down Expand Up @@ -42,3 +40,11 @@ Tools/GenerateStl
_skbuild
dist
.vagrant


hemelb-experiments/*
results/*
personal/*
hemelb-scripts/*
papers/*
outputs/*
2 changes: 1 addition & 1 deletion Code/tests/pythontests/poiseuilleflowtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ def test_velocity_profile(self):

def test_shear_stress_profile(self):
pass


2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ Key publications:
complex domains", Phys. Rev. E (2014).
https://doi.org/10.1103/PhysRevE.89.023303

Please see the [doc] folder for more details.
Documentation available at the [doc](/doc/) folder.
6 changes: 3 additions & 3 deletions dependencies/ParMETIS/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
# license in the file LICENSE.
include_guard()

find_file(ParMETIS_TARBALL parmetis-4.0.2.tar.gz
find_file(ParMETIS_TARBALL parmetis-4.0.2.tar.gz
DOC "Path to download ParMETIS (can be url http://)"
PATHS ${HEMELB_DEPENDENCIES_PATH}/distributions
)
if(NOT ParMETIS_TARBALL)
message("No ParMETIS source found, will download.")
set(ParMETIS_TARBALL http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-4.0.2.tar.gz
set(ParMETIS_TARBALL https://karypis.github.io/glaros/files/sw/parmetis/parmetis-4.0.2.tar.gz
CACHE STRING "Path to download ParMETIS (can be local file://)" FORCE)
endif()

set(ParMETIS_CC ${MPI_C_COMPILER} CACHE STRING "MPI Compiler to use for ParMETIS, leave blank to let ParMETIS guess")
set(ParMETIS_CXX ${MPI_CXX_COMPILER} CACHE STRING "MPI Compiler to use for ParMETIS, leave blank to let ParMETIS guess")
if(ParMETIS_CC)
Expand Down
18 changes: 5 additions & 13 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@

A typical workflow with HemeLB consists of four steps:

1. A preprocessing step where you create a mesh or geometry file (we
use extension .gmy) from a representation of the surface of your
domain. For this, you need to use the application in the
[geometry-tool](../geometry-tool)
directory. [Documentation](user/geometry-tool.md)
1. A preprocessing step where you create a mesh or geometry file (we use extension .gmy) from a representation of the surface of your domain (.stl file). For this, you need to use the application in the [geometry-tool](../geometry-tool) directory. Please refer to the [Documentation](user/geometry-tool.md).

2. Setting options in the configuration XML file, such as timestep and
output data and
frequency. [Documentation](user/XmlConfiguration.md)
2. Setting options in the configuration XML file, such as timestep and output data and frequency. Please refer to the [Documentation](user/XmlConfiguration.md).

3. Compiling and running the
[main application](user/main-application.md).
3. Compiling and running the [main application](user/main-application.md).

4. Post processing the results, using the Python packages in the
[python-tools](../python-tools) directory. [Documentation](user/python-tools.md)
4. Post processing the results, using the Python packages in the [python-tools](../python-tools) directory. Please refer to the [Documentation](user/python-tools.md).


[Developer documentation](dev)
[Developer documentation](/doc/dev/)

2 changes: 1 addition & 1 deletion doc/user/CMakeOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ by setting these options.
`HEMELB_INLET_BOUNDARY` and `HEMELB_OUTLET_BOUNDARY` respectively from
NASHZEROTHORDERPRESSUREIOLET (default), LADDIOLET. It is *very
important* that you also select `HEMELB_WALL_INLET_BOUNDARY` and
`HEMELB_WALL_INLET_BOUNDARY` to match the combination of your
`HEMELB_WALL_OUTLET_BOUNDARY` to match the combination of your
selected wall and in/outlet boundaries. (Options are:
NASHZEROTHORDERPRESSURESBB, NASHZEROTHORDERPRESSUREBFL, LADDIOLETSBB,
LADDIOLETBFL)
Expand Down
83 changes: 25 additions & 58 deletions doc/user/XmlConfiguration.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# The HemeLB XML configuration file

This file is the main input file for a HemeLB simulation. If you use
the geometry tool to generate a .gmy file, it will also create a
minimal XML file that contains the required geometry-related data,
however it is currently (2023) not suitable to run immediately and
must be manually edited. Here we describe the file.
This file is the main input file for a HemeLB simulation. If you use the geometry tool to generate a .gmy file, it will also create a minimal XML file that contains the required geometry-related data, however, it is currently (2025) not suitable to run immediately, and must be manually edited. Here we describe the file.

All parameters that correspond to a property of the modelled system
should be given as follows:
All parameters that correspond to a property of the modelled system should be given as follows:

<$NAME value="$VALUE" unit="$UNITS" />
where:
* `$NAME` is a descriptive (considering the context of containing
elements) name for the physical quantity;
* `$UNITS` is a string specifying the units in which the value is
given; and,
* `$VALUE` is a string which can be converted to the C++ type of the
quantity (`T`) by `operator>>(stream&, T&)`. For example:
* `$UNITS` is a string specifying the units in which the value is given; and,
* `$VALUE` is a string which can be converted to the C++ type of the quantity (`T`) by `operator>>(stream&, T&)`. For example:
```xml
<step_length value="0.0001" units="s" />
```
Expand All @@ -28,12 +21,10 @@ or:
a `util::Vector3D<float>`).

At the top level there must be the root element: `<hemelbsettings
version="int">`. It MUST have a version attribute, an integer. This is
currently 5.
version="int">`. It MUST have a version attribute, an integer. This is currently **5**.

## Simulation
The `<simulation>` is required and specifies some global properties of
the simulation, mainly time-related.
The `<simulation>` is required and specifies some global properties of the simulation, mainly time-related.

It's child elements are:
* Required: `<stresstype value="int">` - the type of stresses to calculate. Must correspond to the `enum hemelb::lb::StressTypes`
Expand All @@ -55,25 +46,15 @@ It's child elements are:

## Geometry
The `<geometry>` element is required. It has one, required, child element:
* `<datafile path="relative path to geometry file" />` - the path
(relative to the XML file) of the GMY file.
* `<datafile path="relative path to geometry file" />` - the path (relative to the XML file) of the GMY file.

## Inlets
`<inlets>` - the element contains zero or more `<inlet>` subelements

* `<inlet>` - describes the position and orientation of an inlet plane
as well as the boundary conditions to impose upon it. Inlets always
have the following two sub elements
* `<position value="(x,y,z)" units="m" />` - the location of a point
on the inlet plane (should be the centre if that makes
sense). Must have three attributes (x,y,z) which give the location
in metres in the input coordinate system
* `<normal value="(x,y,z)" units="dimensionless" />` - a vector
normal to the plane. Must have x,y,z attributes. Does not *have*
to be normalised but for good practice should be.
* `<condition type="" subtype="">` - Gives the BC. There are several
types available, in two classes, pressure-based and
velocity-based.
* `<inlet>` - describes the position and orientation of an inlet plane as well as the boundary conditions to impose upon it. Inlets always have the following two sub elements
* `<position value="(x,y,z)" units="m" />` - the location of a point on the inlet plane (should be the centre if that makes sense). Must have three attributes (x,y,z) which give the location in metres in the input coordinate system
* `<normal value="(x,y,z)" units="dimensionless" />` - a vector normal to the plane. Must have x,y,z attributes. Does not *have* to be normalised but for good practice should be.
* `<condition type="" subtype="">` - Gives the BC. There are several types available, in two classes, pressure-based and velocity-based.
* `type="pressure"`
* `subtype="cosine"` - all subelements required
* `<amplitude value="float" units="mmHg" />`
Expand All @@ -87,54 +68,41 @@ The `<geometry>` element is required. It has one, required, child element:
* `<velocity value="velocity" units="m/s" />`
* `<label value="multiscale_label_string" />`
* `type="velocity"`
* `subtype="parabolic"` - Poiseuille flow in a cylinder, i.e. parabolic
* `<radius value="float" units="lattice" />` - radius of tube (in lattice units)
* `<maximum value="float" units="lattice">` - maximum velocity (in lattice units)
* `subtype="parabolic"` - Poiseuille flow in a cylinder, i.e. parabolic. **Note:** When using this, HemeLB must be compiled with the flag `HEMELB_INLET_BOUNDARY=LADDIOLET`. Otherwise, the simulation will result in a runtime error.
* `<radius value="float" units="m" />` - radius of tube
* `<maximum value="float" units="m/s">` - maximum velocity
* `subtype="womersley"`
* `<womersley_velocity>` - a Womersley flow in a cylinder
* `<pressure_gradient_amplitude value="float" units="lattice"/>`
* `<period value="float" units="lattice"/>`
* `<womersley_number value="float" units="dimensionless"/>`
* `<radius value="float" units="lattice"/>`
* `subtype="file"` - all subelements required
* `<path value="relative/path/to/velocity/data/file" />`
* `<radius value="float" units="lattice"/>` or `<radius value="float" units="m"/>`
* `subtype="file"` - all subelements required
* `<path value="relative/path/to/velocity/data/file" />`
* `<radius value="float" units="lattice"/>` or `<radius value="float" units="m"/>`

## Outlets
As for "inlets" but with `s/inlet/outlet/`
Similar to the parameters of "inlets" but substitute with outlet or do the command `s/inlet/outlet/`.

## Initial Conditions
`<initialconditions>` - describe initial conditions. Child elements:

* `<pressure>` - start at rest and equilibrium at the given pressure
field
* `<uniform value="float" units="mmHg">` - a uniform pressure at all
sites. Value must be in mmHg.
* `<pressure>` - start at rest and equilibrium at the given pressure field
* `<uniform value="float" units="mmHg">` - a uniform pressure at all sites. Value must be in mmHg.

* `<checkpoint file="rel/path/to/file" offset="rel/path">` - restart from a
checkpoint + offset file. Attribute `file` is required and gives
path to the checkpoint. The offset file is optional - if given it
must be a relative path to the file, else must have the same path with
the extension replaced by ".off".
checkpoint + offset file. Attribute `file` is required and gives path to the checkpoint. The offset file is optional - if given it must be a relative path to the file, else must have the same path with the extension replaced by `.off`.

## (Extracted) Properties
Describe what data to extract under the `<properties>` element. Child elements:

* `<propertyoutput file="path.xtr" period="int"
timestep_mode="[multi|single]">` - specify the file (under the
`results/Extraction` directory) and the output period (in time
steps). The way that multiple timesteps of data will be handled is
set by the `timestep_mode` attribute. Valid values are `multi` (the
default if the attribute is not present) or `single`. For `multi`,
each subsequent timestep's data will be appended to the same
file. For `single`, only a single timestep will be written to each
file; in this case the `file` attribute must contain exactly one
`%d` which will be replaced with the timestep number.
timestep_mode="[multi|single]">` - specify the file (under the `results/Extraction` directory) and the output period (in time steps). The way that multiple timesteps of data will be handled is set by the `timestep_mode` attribute. Valid values are `multi` (the default if the attribute is not present) or `single`.
For `multi`, each subsequent timestep's data will be appended to the same file. For `single`, only a single timestep will be written to each file; in this case the `file` attribute must contain exactly one `%d` which will be replaced with the timestep number.
- `<geometry type="type">` - the type string must be one of the following:
+ `type="whole"` - all lattice points - no subelements needed
+ `type="surface"` - all lattice points with one or more links
(defined by the active velocity set) intersecting a wall (not
inlet/outlet) - no sublements needed
(defined by the active velocity set) intersecting a wall (not inlet/outlet) - no sublements needed
+ `type="plane"` - all lattice points within sqrt(3)*voxel size of the specified plane
* Required: `<point value="(x,y,z)" units="m" />`
* Required: `<normal value="(x,y,z)" units="dimensionless" />`
Expand All @@ -154,8 +122,7 @@ Describe what data to extract under the `<properties>` element. Child elements:
+ `type="tangentialprojectiontraction"`
+ `type="mpirank"`

* `<checkpoint file="path" period="int">` - save a checkpoint file to
the given path at the given interval (in timesteps).
* `<checkpoint file="path" period="int">` - save a checkpoint file to the given path at the given interval (in timesteps).

## Changes

Expand Down
72 changes: 40 additions & 32 deletions doc/user/geometry-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,20 @@ Build dependencies:

Runtime dependencies:
- Python
- Numpy
- NumPy
- PyYAML
- VTK
- VMTK
- wxPython (only for the GUI)

Test dependencies:
- pytest
- hlb (NB: this must be compiled with the same version of numpy as
used above)
- hlb (Note: this must be compiled with the same version of numpy as used above)


## Conda install

VMTK is hard to build yourself but is easily installed via Conda, so
we present this process here.
VMTK is hard to build yourself but is easily installed via Conda. So we present this process here.

### Virtual enviroment setup

Expand All @@ -57,8 +55,7 @@ conda env create --file conda-environment.yml
```

By default this will use `gmy-tool` as the name, but you can use
anything you wish by adding `--name PREFERED_NAME` to the command
above.
anything you wish by adding `--name PREFERED_NAME` to the command above.


You then need to activate this for your shell session:
Expand All @@ -77,8 +74,7 @@ pip install '.[gui]'

(If your pip version is less than 21.3, add the extra flag `--use-feature=in-tree-build`)

If you don't want the GUI, you can drop the `[gui]` extra
specification.
If you don't want the GUI, you can drop the `[gui]` extra specification.

**Note for macOS**: On macOS GUI applications have to be linked
against some special framework. If you don't fix this up you will get
Expand Down Expand Up @@ -106,20 +102,15 @@ python macos-fix-gui-launcher.py

## Install with custom VMTK

The hemelb-codes organisation on GitHub includes a project to build
VMTK for Ubuntu: https://github.com/hemelb-codes/vmtk-build/
The hemelb-codes organisation on GitHub includes a project to build VMTK for Ubuntu: https://github.com/hemelb-codes/vmtk-build/

That will hopefully give you an idea for how to proceed. If you are
lucky you can just download the tarball. (Some Ubuntu packages will
have to be installed - see that repo)
That will hopefully give you an idea for how to proceed. If you are lucky you can just download the tarball. (Some Ubuntu packages will have to be installed - see that repo)

## Test

Install pytest the usual way via `pip install pytest`.

The Conda VMTK package forces you to use an old version of numpy. To
ensure that the `hlb` package in `python-tools` is built with the same
one, you need to change to that directory, install Cython (`pip
The Conda VMTK package forces you to use an old version of numpy. To ensure that the `hlb` package in `python-tools` is built with the same one, you need to change to that directory, install Cython (`pip
install cython`) and then install the package with:

```
Expand All @@ -131,15 +122,14 @@ Run the tests by invoking `py.test` in this directory.

## Run GUI

Ensure your environment is activated then run `hlb-gmy-gui`. There is
basic command line help available:
Ensure your environment is activated then run `hlb-gmy-gui`. There is basic command line help available:

```
$ hlb-gmy-gui --help
usage: hlb-gmy-gui [-h] [--profile PATH] [--stl PATH] [--geometry PATH]
[--xml PATH]

Process an input STL file intosuitable input for HemeLB.
Process an input STL file into suitable input for HemeLB.

optional arguments:
-h, --help show this help message and exit
Expand All @@ -150,20 +140,38 @@ optional arguments:
--xml PATH XML output file
```

The terminal will produced a few errors that can ignore, like:
`vtkSTLReader (0x7fdaa773bf10): A FileName must be specified.`. (This
is just VTK trying to display the mesh before the source file is
specified.)
The terminal will produce a few errors that can ignore, like: `vtkSTLReader (0x7fdaa773bf10): A FileName must be specified.` (This is just VTK trying to display the mesh before the source file is specified.) and `vtkCompositeDataPipeline (0x2fb7b9a0): UpdateInformation invoked during another request. Returning failure to algorithm vtkSTLReader(0x2f740e60).` (This is just vtkSTLReader was called during another operation, but rendering works as the STL gets loaded and cached beforehand).

## Profile (.pr2) file

## Profile (.pr2) files
The geometry tool can save inlet, outlet, and seed point data used to generate a .gmy geometry file, using this Profile file. **(Saving this is highly recommended for reproducibility)**

The geometry tool can store the the data it will use to generate a
geometry file. Saving this is highly recommended for reproducibility!

It's a YAML file which can be edited manually. Floating point values
are stored by default in hexadecimal to avoid precision loss
(https://docs.python.org/3/library/stdtypes.html#float.hex) but can be
set in decimal if more convenient.
It is a YAML file which can be edited manually. Floating point values are stored by default in hexadecimal to avoid precision loss (https://docs.python.org/3/library/stdtypes.html#float.hex) but can be set in decimal if more convenient.

Paths are relative to the geometry file's location.

## Run CLI

There is a command line version of Geometry Setup Tool, where you can use the .pr2 file to generate the geometry file.
Ensure your environment is activated then run `hlb-gmy-cli`. There is basic command line help available:

```
$ hlb-gmy-cli --help

usage: hlb-gmy-cli [-h] [--geometry PATH] [--xml PATH] [--voxel FLOAT] PATH

Generate the config file described by a profile file

positional arguments:
PATH The profile to use. Other options given override those in
the profile file.

optional arguments:
-h, --help show this help message and exit
--geometry PATH Config output file
--xml PATH XML output file
--voxel FLOAT The voxel size in metres

```

You need to add the path to the directory of the .pr2 file. Example command: `hlb-gmy-cli /path-to-your-profile.pr2`. *Note: The .stl file related to the .pr2 file needs to be in the same directory alongwith it.*
5 changes: 2 additions & 3 deletions doc/user/main-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ The main HemeLB application requires:

If using resolved blood cells, you also require:
- HDF5*
- VTK* version 9 (for RBC mode)
- VTK*>=9 (for RBC mode)

The dependencies marked with * can be built automatically by the build
system.
The dependencies marked with * can be built automatically by the build system.

## Download

Expand Down
Loading