diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f78c1599..aa196de3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,10 @@ jobs: - name: Docs shell: bash run: | + # Ensure no stubs are generated these should be already completed by the developer + apptainer exec hippo-release.sif bash -c "cd /opt/hippo/doc && [ \$(./moosedocs.py generate hippoApp | wc -l) -eq 1 ]" + + # Build the docs apptainer exec hippo-release.sif bash -c "cd /opt/hippo/doc && ./moosedocs.py build --destination=${{ github.workspace }}/doc/htmldoc" [ -f ${{ github.workspace }}/doc/htmldoc/index.html ] - name: Artifact docs diff --git a/doc/config.yml b/doc/config.yml index e353d66b..cb948e01 100644 --- a/doc/config.yml +++ b/doc/config.yml @@ -1,23 +1,34 @@ Content: - hippo: - root_dir: ${ROOT_DIR}/doc/content - moose: - root_dir: ${MOOSE_DIR}/framework/doc/content - content: - - js/* - - css/* - - contrib/** - - media/** + hippo: + root_dir: ${ROOT_DIR}/doc/content + moose: + root_dir: ${MOOSE_DIR}/framework/doc/content + content: + - js/* + - css/* + - contrib/** + - media/** Renderer: - type: MooseDocs.base.MaterializeRenderer + type: MooseDocs.base.MaterializeRenderer Extensions: - MooseDocs.extensions.navigation: - name: hippo - repo: https://github.com/aurora-multiphysics/hippo/ - MooseDocs.extensions.appsyntax: - executable: ${ROOT_DIR} - remove: !include ${MOOSE_DIR}/framework/doc/remove.yml - includes: - - include + MooseDocs.extensions.navigation: + name: hippo + repo: https://github.com/aurora-multiphysics/hippo/ + menu: + Getting started: + Installation: installation.md + Apptainer: apptainer.md + Documentation: + Input syntax: /source/index.md + Examples: /examples/index.md + Development guide: developer_guide.md + Case studies: + Case studies: case_studies.md + MooseDocs.extensions.appsyntax: + executable: ${ROOT_DIR} + remove: + framework: !include ${MOOSE_DIR}/framework/doc/remove.yml + includes: + - include diff --git a/doc/content/apptainer.md b/doc/content/apptainer.md new file mode 100644 index 00000000..66f80e21 --- /dev/null +++ b/doc/content/apptainer.md @@ -0,0 +1,54 @@ +# Apptainer + +We make use of [Apptainer](https://apptainer.org/docs/user/main/) containers to test Hippo within the CI pipeline and in the future, we intend to include them as part of Hippo releases. +There are two containers +- **Development container:** this contains all of Hippo's dependencies but not Hippo itself. +The definition file can be found [here](https://github.com/aurora-multiphysics/hippo/apptainer/hippo-dev.def). +Stored under +[UKAEA's Quay.io organisation](https://quay.io/repository/ukaea/hippo) +with name `hippo:dev-` followed by the first 10 characters of the Git revision that created it. +- **Release container:** used to build and test Hippo within the CI environment. +The definition file can be found [here](https://github.com/aurora-multiphysics/hippo/apptainer/hippo-release.def). + + +## Building the containers + +To build the release container locally, run (from the root directory) + +```bash +apptainer build hippo-release.sif apptainer/hippo-release.def +``` + +## Running the containers + +The most common way to use MPI with Apptainer, +is to use the [hybrid approach](https://apptainer.org/docs/user/latest/mpi.html), +in which the host MPI is used to launch the container and works with the MPI installed in the container. +This means that the MPI in the container must be compatible with the host MPI. +The release container currently uses OpenMPI, but in the future we plan to alsp support MPICH. + +To run Hippo using the container with MPI on 4 processes + +```bash +mpirun -n 4 apptainer run ./hippo-release.sif -i main.i +``` + +or more simply + +```bash +mpirun -n 4 ./hippo-release.sif -i main.i +``` + +## The CI pipeline + +The development container is created on +[workflow dispatch](https://github.com/aurora-multiphysics/hippo/actions/workflows/deploy-apptainer-dev.yaml) +and stored under +[UKAEA's Quay.io organisation](https://quay.io/repository/ukaea/hippo) +with name `hippo:dev-` followed by the first 10 characters of the Git revision that created it. +Once the image has been built and pushed to Quay.io, +a developer should open a PR that updates `.github/workflows/ci.yml` +A [robot account](https://docs.quay.io/glossary/robot-accounts.html) +has been set up with write permissions for the Hippo repository. +This robot account is used to authenticate between Quay and GitHub. +Contact UKAEA's Quay.io admins (or the RSE team) for support with this account. diff --git a/doc/content/case_studies.md b/doc/content/case_studies.md new file mode 100644 index 00000000..91fc3ae8 --- /dev/null +++ b/doc/content/case_studies.md @@ -0,0 +1 @@ +# Case studies diff --git a/doc/content/examples/index.md b/doc/content/examples/index.md new file mode 100644 index 00000000..78c9c6fd --- /dev/null +++ b/doc/content/examples/index.md @@ -0,0 +1,8 @@ +# Examples + +## Conjugate heat transfer + +We currently have two examples for the conjugate heat transfer + +1. [Flow over heated plate:](examples/step_by_step.md) a simple CHT case highlighting the basic syntax. +2. [Shell and tube heat exchanger:](examples/shell_tube_hx.md) a more complex CHT with two fluid domains. diff --git a/doc/content/shell_tube_hx.md b/doc/content/examples/shell_tube_hx.md similarity index 100% rename from doc/content/shell_tube_hx.md rename to doc/content/examples/shell_tube_hx.md diff --git a/doc/content/step_by_step.md b/doc/content/examples/step_by_step.md similarity index 98% rename from doc/content/step_by_step.md rename to doc/content/examples/step_by_step.md index abd3fc86..6c135e82 100644 --- a/doc/content/step_by_step.md +++ b/doc/content/examples/step_by_step.md @@ -138,7 +138,7 @@ Hippo also implements the `FoamBC` system that allows you to impose boundary con on OpenFOAM from the Hippo input file. In this case, we wish to impose a heat flux BC on the temperature field. This requires the `FoamFixedGradientBC`, which mirrors OpenFOAM's `fixedGradient` BC type. As in this case, we provide a heat flux, we must also provide the -thermal conductivity, which is specified as the `diffusivity_coefficient`. +thermal conductivity, which is specified as the `diffusivity`. `kappa` is the name of the thermal conductivity variable in OpenFOAM. ```toml @@ -148,7 +148,7 @@ thermal conductivity, which is specified as the `diffusivity_coefficient`. [solid_heat_flux] type = FoamFixedGradientBC foam_variable = T - diffusivity_coefficient = kappa + diffusivity = kappa [] [] ``` diff --git a/doc/content/hit/step_by_step/fluid.i b/doc/content/hit/step_by_step/fluid.i index 1599dffb..f2dec5c3 100644 --- a/doc/content/hit/step_by_step/fluid.i +++ b/doc/content/hit/step_by_step/fluid.i @@ -16,7 +16,7 @@ [solid_heat_flux] type = FoamFixedGradientBC foam_variable = 'T' - diffusivity_coefficient = kappa + diffusivity = kappa initial_condition = 0 [] [] diff --git a/doc/content/index.md b/doc/content/index.md index 20795c1c..5e2ce4cf 100644 --- a/doc/content/index.md +++ b/doc/content/index.md @@ -1,35 +1,30 @@ !config navigation breadcrumbs=False scrollspy=False -# Hippo +# Hippo class=center style=font-weight:200;font-size:400% -A MOOSE multiapp wrapping OpenFOAM for conjugate heat transfer problems. -## Installation +!style halign=center fontsize=120% A MOOSE application wrapping OpenFOAM for multiphysics problems. -Build instructions can be found in the repository's -[README](https://github.com/aurora-multiphysics/hippo/blob/main/README.md). +!col! small=12 medium=4 large=4 icon=flash_on -Alternatively, you can use Hippo in a Docker container. -An image with all of Hippo's dependencies pre-installed -can be found on [quay.io](https://quay.io/repository/ukaea/hippo). -You will need to mount and install Hippo within the container. +### Flexible Multiphysics class=center style=font-weight:200 -```shell -$ git clone https://github.com/aurora-multiphysics/hippo.git -$ docker run -it -v $(pwd)/hippo:/opt/hippo quay.io/ukaea/hippo:latest bash -$ make -j -$ hippo-opt --help -``` +!style halign=center +Leverage two of the most popular multiphysics frameworks in OpenFOAM and MOOSE +!col-end! -## Examples +!col! small=12 medium=4 large=4 icon=settings -### Conjugate heat transfer +### Getting started class=center style=font-weight:200 -We currently have two examples for the conjugate heat transfer +!style halign=center +[Installation](installation.md) and [examples](examples/index.md) can be found here. +!col-end! -1. [Flow over heated plate:](step_by_step.md) a simple CHT case highlighting the basic syntax. -2. [Shell and tube heat exchanger:](shell_tube_hx.md) a more complex CHT with two fluid domains. +!col! small=12 medium=4 large=4 icon=assessment -## Developer Guide +### Case studies class=center style=font-weight:200 -See [here](developer_guide.md) for developer documentation. +!style halign=center +Find relevant an overview of Hippo case studies [here](case_studies.md) +!col-end! diff --git a/doc/content/installation.md b/doc/content/installation.md new file mode 100644 index 00000000..4f8e9e2f --- /dev/null +++ b/doc/content/installation.md @@ -0,0 +1,83 @@ +# Installation + +Hippo's source code can be cloned from GitHub: + +```bash +git clone https://github.com/aurora-multiphysics/hippo.git +``` + +## Dependencies + +First, install the build dependencies + +```bash +apt install \ + bison \ + flex \ + libptscotch-dev \ + libqt5opengl5-dev \ + libqt5x11extras5-dev \ + libxt-dev \ + make \ + paraview \ + paraview-dev \ + qtbase5-dev \ + qttools5-dev \ + qttools5-dev-tools +``` + +## Installing OpenFOAM + +Hippo currently works with openfoam.org (The OpenFOAM Foundation's) +flavour of OpenFOAM and has been tested on OpenFOAM-12 specifically. +Unfortunately, for Hippo to work correctly, OpenFOAM needs to be patched. +For convenience, the script [`scripts/install-openfoam.sh`](https://github.com/aurora-multiphysics/hippo/blob/main/scripts/install-openfoam.sh) +has been provided to patch and install OpenFOAM-12. +To execute the script, run + +```bash +bash ./scripts/install-openfoam.sh +``` + +The `-h` flag shows the installation options. +To set the OpenFOAM build options (e.g., Opt or Debug mode), +copy `scripts/openfoam-prefs.sh` to `~/.OpenFOAM/prefs.sh`, +and update the environment variables within. +The variables will be loaded when `/etc/bashrc` is sourced +(which is done automatically by the install script). + +## Installing MOOSE + +Follow instructions +[here](https://mooseframework.inl.gov/getting_started/installation/gcc_install_moose.html) +to build MOOSE. + +Hippo requires MOOSE release `2024-09-05-release` or higher. + +## Environment + +Set (recommend [direnv](https://direnv.net/) for this) + +```bash +MOOSE_DIR=/path/to/moose/dir +MPI_ROOT=/path/to/mpich/root +MPI_ARCH_INC="-I/path/to/mpi/includes" +MPI_ARCH_LIBS="-L/path/to/mpi/libs -lmpi" +source /path/to/OpenFOAM/etc/bashrc +``` + +## Building Hippo + +Once the dependencies are built, then (in theory) you should be able to `make` in the root directory: + +```bash +make +``` + +Or, for a debug build: + +```bash +METHOD=dbg make +``` + +The `-j N` option can be used for multi-threaded builds with `N` threads. diff --git a/doc/content/source/actions/AddFoamBCAction.md b/doc/content/source/actions/AddFoamBCAction.md new file mode 100644 index 00000000..d1d7a823 --- /dev/null +++ b/doc/content/source/actions/AddFoamBCAction.md @@ -0,0 +1,9 @@ +# AddFoamBCAction + +!syntax description /FoamBCs/AddFoamBCAction + +Provides the `[FoamBCs]` block. More information can be found in the [FoamBCs system documentation](syntax/FoamBCs/index.md). + +!syntax description /FoamBCs/AddFoamBCAction + +!syntax parameters /FoamBCs/AddFoamBCAction diff --git a/doc/content/source/actions/AddFoamVariableAction.md b/doc/content/source/actions/AddFoamVariableAction.md new file mode 100644 index 00000000..c26b7123 --- /dev/null +++ b/doc/content/source/actions/AddFoamVariableAction.md @@ -0,0 +1,13 @@ +# AddFoamVariableAction + +!syntax description /FoamVariables/AddFoamVariableAction + +Provides the `[FoamVariables]` block. More information can be found in the [FoamVariables system documentation](syntax/FoamBCs/index.md). + +## Example Input File Syntax + +!! Describe and include an example of how to use the AddFoamVariableAction action. + +!syntax description /FoamVariables/AddFoamVariableAction + +!syntax parameters /FoamVariables/AddFoamVariableAction diff --git a/doc/content/source/auxkernels/HeatFluxAux.md b/doc/content/source/auxkernels/HeatFluxAux.md new file mode 100644 index 00000000..5e6ae51c --- /dev/null +++ b/doc/content/source/auxkernels/HeatFluxAux.md @@ -0,0 +1,17 @@ +# HeatFluxAux + +!syntax description /AuxKernels/HeatFluxAux + +## Overview + +!! Replace these lines with information regarding the HeatFluxAux object. + +## Example Input File Syntax + +!! Describe and include an example of how to use the HeatFluxAux object. + +!syntax parameters /AuxKernels/HeatFluxAux + +!syntax inputs /AuxKernels/HeatFluxAux + +!syntax children /AuxKernels/HeatFluxAux diff --git a/doc/content/source/bcs/FoamFixedGradientBC.md b/doc/content/source/bcs/FoamFixedGradientBC.md new file mode 100644 index 00000000..fdf4864f --- /dev/null +++ b/doc/content/source/bcs/FoamFixedGradientBC.md @@ -0,0 +1,47 @@ +# FoamFixedGradientBC + +!syntax description /FoamBCs/FoamFixedGradientBC + +Imposes Neumann or Flux boundary conditions on OpenFOAM fields using MOOSE input file syntax. Under-the-hood, a auxilliary variable is created in the mirror mesh and the value of this variable +(whether specified through a transfer of AuxKernel) +is imposed as a fixedGradient boundary patch. +If `diffusivity` is specified, the MOOSE variable is imposed a flux, +otherwise as a simple Neumann boundary condition. + +## Example Input File Syntax + +In the case that `diffusivity` is not specified + +``` +[FoamBCs] + [neumann] + type = FoamFixedGradientBC + foam_variable = T + boundary = wall + [] + ... +[] +``` + +If the diffusivity is specified and we wish to apply a heat flux boundary conditions such as in conjugate heat transfer, we use + +``` +[FoamBCs] + [heat_flux] + type = FoamFixedGradientBC + foam_variable = T + boundary = wall + diffusivity = kappa + [] + ... +[] +``` + +where `kappa` is the fluid thermal conductivity in OpenFOAM. + + +!syntax parameters /FoamBCs/FoamFixedGradientBC + +!syntax inputs /FoamBCs/FoamFixedGradientBC + +!syntax children /FoamBCs/FoamFixedGradientBC diff --git a/doc/content/source/bcs/FoamFixedValueBC.md b/doc/content/source/bcs/FoamFixedValueBC.md new file mode 100644 index 00000000..52e0dc83 --- /dev/null +++ b/doc/content/source/bcs/FoamFixedValueBC.md @@ -0,0 +1,23 @@ +# FoamFixedValueBC + +!syntax description /FoamBCs/FoamFixedValueBC + +This class is used to impose Dirichlet boundary conditions on OpenFOAM boundary patches. Like all variable-based OpenFOAM boundary conditions, `FoamFixedValueBC` creates an auxilliary variable under the hood, which is copied to the boundary patch. + +## Example Input File Syntax + +``` +[FoamBCs] + [dirichlet] + type = FoamFixedValueBC + foam_variable = T + boundary = wall + [] +[] +``` + +!syntax parameters /FoamBCs/FoamFixedValueBC + +!syntax inputs /FoamBCs/FoamFixedValueBC + +!syntax children /FoamBCs/FoamFixedValueBC diff --git a/doc/content/source/index.md b/doc/content/source/index.md new file mode 100644 index 00000000..3098ed25 --- /dev/null +++ b/doc/content/source/index.md @@ -0,0 +1,19 @@ +!config navigation collapsible-sections=[None, 'open', 'open', 'open', 'open', 'open'] + +# Input file syntax + +## System documentation + +Systems/blocks that have been introduced in Hippo to facilitate the coupling of MOOSE and OpenFOAM are shown below. + +- [+FoamBC system+](syntax/FoamBCs/index.md) +- [+FoamVariable system+](syntax/FoamVariables/index.md) + +## Source Documentation + +The following is a complete list of documented C++ objects. For instructions +on how to use these objects in Hippo input files, please peruse the links below. +To see the full list of documented MOOSE C++ objects, please consult +the [MOOSE documentation](https://mooseframework.inl.gov/source/index.html). + +!content location=source diff --git a/doc/content/source/mesh/FoamMesh.md b/doc/content/source/mesh/FoamMesh.md new file mode 100644 index 00000000..e41be62a --- /dev/null +++ b/doc/content/source/mesh/FoamMesh.md @@ -0,0 +1,29 @@ +# FoamMesh + +!syntax description /Mesh/FoamMesh + +`FoamMesh` controls the interaction of the OpenFOAM mesh with MOOSE. +From a user perspective, this involves specifying the directory of the OpenFOAM cases +and the patches that are to be mirrored. +Internally, this class also creates a libMesh representation of the OpenFOAM boundary patches. + + +## Example Input File Syntax + +Below is a simple example of `FoamMesh` for an OpenFOAM case in directory `fluid-openfoam` with a boundary patch to be coupled with MOOSE called `wall`. + +``` +[Mesh] + [foam_mesh] + type = FoamMesh + foam_patch = wall + case = fluid-openfoam + [] +[] +``` + +!syntax parameters /Mesh/FoamMesh + +!syntax inputs /Mesh/FoamMesh + +!syntax children /Mesh/FoamMesh diff --git a/doc/content/source/postprocessors/FoamSideAdvectiveFluxIntegral.md b/doc/content/source/postprocessors/FoamSideAdvectiveFluxIntegral.md new file mode 100644 index 00000000..9e59fb1e --- /dev/null +++ b/doc/content/source/postprocessors/FoamSideAdvectiveFluxIntegral.md @@ -0,0 +1,29 @@ +# FoamSideAdvectiveFluxIntegral + +!syntax description /UserObjects/FoamSideAdvectiveFluxIntegral + +An OpenFOAM equivalent of the [`SideAdvectiveFluxIntegral`](https://mooseframework.inl.gov/source/postprocessors/SideAdvectiveFluxIntegral.html), +which calculates the advected flux of a `foam_Variable` by the vector `advective_velocity`, which as a default of velocity vector `U`. + + +## Example Input File Syntax + +To calculate the mass flow rate through a boundary patch, we want the side advective flux integral of the density + +``` +[Postprocessors] + ... + [m_dot] + type = FoamSideAdvectiveFluxIntegral + foam_scalar=rho + boundary = inlet + [] +[] +``` + + +!syntax parameters /UserObjects/FoamSideAdvectiveFluxIntegral + +!syntax inputs /UserObjects/FoamSideAdvectiveFluxIntegral + +!syntax children /UserObjects/FoamSideAdvectiveFluxIntegral diff --git a/doc/content/source/postprocessors/FoamSideAverageFunctionObject.md b/doc/content/source/postprocessors/FoamSideAverageFunctionObject.md new file mode 100644 index 00000000..082b42ef --- /dev/null +++ b/doc/content/source/postprocessors/FoamSideAverageFunctionObject.md @@ -0,0 +1,29 @@ +# FoamSideAverageFunctionObject + +!syntax description /UserObjects/FoamSideAverageFunctionObject + + +This is the same as `FoamSideAverageValue` but for function objects rather than variables. +Calculates the average of a `volScalarField` or `volVectorField` function object over an OpenFOAM boundary patch. +If a vector is specified, a component must also be given. + +## Example Input File Syntax + + +To calculate the average heat flux through a surface, we can average the `wallHeatFlux` function object over a boundary patch. + +``` +[Postprocessors] + [q_avg] + type = FoamSideAverageFunctionObject + function_object = wallHeatFlux + boundary=wall + [] +[] +``` + +!syntax parameters /UserObjects/FoamSideAverageFunctionObject + +!syntax inputs /UserObjects/FoamSideAverageFunctionObject + +!syntax children /UserObjects/FoamSideAverageFunctionObject diff --git a/doc/content/source/postprocessors/FoamSideAverageValue.md b/doc/content/source/postprocessors/FoamSideAverageValue.md new file mode 100644 index 00000000..1f87c247 --- /dev/null +++ b/doc/content/source/postprocessors/FoamSideAverageValue.md @@ -0,0 +1,27 @@ +# FoamSideAverageValue + +!syntax description /UserObjects/FoamSideAverageValue + +An OpenFOAM analogue to MOOSE's `SideAverageValue` postprocessor. +It calculates the average of a `volScalarField` or `volVectorField` over an OpenFOAM boundary patch. +If a vector is specified, `component` must also be specified and must take a value of `x`, `y`, `z`, `normal` or magnitude. + +## Example Input File Syntax + +To calculate the average wall temperature over a boundary patch + +``` +[Postprocessors] + [T_avg] + type = FoamSideAverageValue + foam_variable = T + boundary = wall + [] +[] +``` + +!syntax parameters /UserObjects/FoamSideAverageValue + +!syntax inputs /UserObjects/FoamSideAverageValue + +!syntax children /UserObjects/FoamSideAverageValue diff --git a/doc/content/source/postprocessors/FoamSideIntegratedFunctionObject.md b/doc/content/source/postprocessors/FoamSideIntegratedFunctionObject.md new file mode 100644 index 00000000..30fd9c72 --- /dev/null +++ b/doc/content/source/postprocessors/FoamSideIntegratedFunctionObject.md @@ -0,0 +1,27 @@ +# FoamSideIntegratedFunctionObject + + +!syntax description /UserObjects/FoamSideIntegratedFunctionObject + +This is the same as `FoamSideIntegratedValue` but for function objects rather than variables. +If a vector is specified, a component must also be given. + +## Example Input File Syntax + +To calculate the total heat transferred through a surface, we can integrate the `wallHeatFlux` function object over a boundary patch. + +``` +[Postprocessors] + [q] + type = FoamSideIntegratedFunctionObject + function_object = wallHeatFlux + boundary=wall + [] +[] +``` + +!syntax parameters /UserObjects/FoamSideIntegratedFunctionObject + +!syntax inputs /UserObjects/FoamSideIntegratedFunctionObject + +!syntax children /UserObjects/FoamSideIntegratedFunctionObject diff --git a/doc/content/source/postprocessors/FoamSideIntegratedValue.md b/doc/content/source/postprocessors/FoamSideIntegratedValue.md new file mode 100644 index 00000000..495d84e0 --- /dev/null +++ b/doc/content/source/postprocessors/FoamSideIntegratedValue.md @@ -0,0 +1,29 @@ +# FoamSideIntegratedValue + +!syntax description /UserObjects/FoamSideIntegratedValue + +An OpenFOAM analogue to MOOSE's `SideIntegratedValue` postprocessor. +It calculates the integral of a `volScalarField` or `volVectorField` over an OpenFOAM boundary patch. +If a vector is specified, `component` must also be specified and must take a value of `x`, `y`, `z`, `normal` or magnitude. + +## Example Input File Syntax + +To calculate the volume flow rate over the inlet patch + +``` +[Postprocessors] + [Q] + type = FoamSideIntegratedValue + foam_variable = U + boundary = inlet + component=normal + [] +[] +``` + + +!syntax parameters /UserObjects/FoamSideIntegratedValue + +!syntax inputs /UserObjects/FoamSideIntegratedValue + +!syntax children /UserObjects/FoamSideIntegratedValue diff --git a/doc/content/source/problems/FoamProblem.md b/doc/content/source/problems/FoamProblem.md new file mode 100644 index 00000000..901bc7db --- /dev/null +++ b/doc/content/source/problems/FoamProblem.md @@ -0,0 +1,21 @@ +# FoamProblem + +!syntax description /Problem/FoamProblem + +A MOOSE `ExternalProblem` that coordinates the OpenFOAM simulation from MOOSE +including the transfer of variables between the mirror mesh and OpenFOAM, +as well as the calculation of any OpenFOAM-based postprocessors. +This can be thought of as the root class for the execution of OpenFOAM simulations +within MOOSE. + +``` +[Problem] + type = FoamProblem +[] +``` + +!syntax parameters /Problem/FoamProblem + +!syntax inputs /Problem/FoamProblem + +!syntax children /Problem/FoamProblem diff --git a/doc/content/source/timesteppers/FoamTimeStepper.md b/doc/content/source/timesteppers/FoamTimeStepper.md new file mode 100644 index 00000000..3bf744b0 --- /dev/null +++ b/doc/content/source/timesteppers/FoamTimeStepper.md @@ -0,0 +1,50 @@ +# FoamTimeStepper + + +!syntax description /Executioner/TimeSteppers/FoamTimeStepper + +`FoamTimeStepper`'s prime responsibility is to synchronise MOOSE and OpenFOAM, +providing MOOSE with OpenFOAM's desired time step +and forcing OpenFOAM to take additional steps when MOOSE desires synchronisation. +`FoamTimeStepper` operates in two modes + +1. +Passive mode:+ OpenFOAM uses the values in the case's `controlDict` to set the time step. + e.g. using CFL-adaptive time-stepping if specified. We recommend using this approach. +1. +Active mode:+ `dt`, `end_time`, `start_time` specified, + which overrides the `controlDict` with new constant values. + +## Example Input File Syntax + +To use `FoamTimeStepper` in passive mode + +``` +[Executioner] + ... + [TimeStepper] + [foam_dt] + type = FoamTimeStepper + [] + [] +[] +``` + +To use it in active mode + +``` +[Executioner] + dt = 0.001 + end_time = 10. + ... + [TimeStepper] + [foam_dt] + type = FoamTimeStepper + [] + [] +[] +``` + +!syntax parameters /Executioner/TimeSteppers/FoamTimeStepper + +!syntax inputs /Executioner/TimeSteppers/FoamTimeStepper + +!syntax children /Executioner/TimeSteppers/FoamTimeStepper diff --git a/doc/content/source/variables/FoamFunctionObject.md b/doc/content/source/variables/FoamFunctionObject.md new file mode 100644 index 00000000..0dc5e550 --- /dev/null +++ b/doc/content/source/variables/FoamFunctionObject.md @@ -0,0 +1,27 @@ +# FoamFunctionObject + +!syntax description /FoamVariables/FoamFunctionObject + +## Overview + +Shadows the output of OpenFOAM function objects. +Currently restricted to the `wallHeatFlux` function object, +which is executed at the end of each OpenFOAM time step. +In all other ways it behaves the same as `FoamVariableField`. + +## Example Input File Syntax + +``` +[FoamVariables] + [heat_flux] + type = FoamFunctionObject + foam_variable = wallHeatFlux + [] +[] +``` + +!syntax parameters /FoamVariables/FoamFunctionObject + +!syntax inputs /FoamVariables/FoamFunctionObject + +!syntax children /FoamVariables/FoamFunctionObject diff --git a/doc/content/source/variables/FoamVariableField.md b/doc/content/source/variables/FoamVariableField.md new file mode 100644 index 00000000..ce3396be --- /dev/null +++ b/doc/content/source/variables/FoamVariableField.md @@ -0,0 +1,42 @@ +# FoamVariableField + +!syntax description /FoamVariables/FoamVariableField + +## Overview + +Permits shadowing of an OpenFOAM `volScalarField` using a constant monomial MooseVariable, +with data copied from OpenFOAM at the end of each OpenFOAM time step. +The underlying MOOSE variable (which has the same name) +can be transferred to other MOOSE apps like any other MOOSE variable. +Currently, only the boundary fields are copied. + +## Example Input File Syntax + +Below is mock-up example of a `FoamVariableField` and its transfer to a sub-app. + +``` +[FoamVariables] + [temperature] + type = FoamVariableField + foam_variable = T + [] +[] +... +[Transfers] + [to_subapp] + type = MultiAppGeneralFieldNearestLocationTransfer + source_variable = temperature + to_multi_app = sub_app1 + variable = temp1 + execute_on = same_as_multiapp + [] +[] +``` + +!! Describe and include an example of how to use the FoamVariableField object. + +!syntax parameters /FoamVariables/FoamVariableField + +!syntax inputs /FoamVariables/FoamVariableField + +!syntax children /FoamVariables/FoamVariableField diff --git a/doc/content/syntax/FoamBCs/index.md b/doc/content/syntax/FoamBCs/index.md new file mode 100644 index 00000000..6c8a689b --- /dev/null +++ b/doc/content/syntax/FoamBCs/index.md @@ -0,0 +1,32 @@ +# FoamBCs System + +## Overview + +The `FoamBC` system control how boundary conditions are imposed on OpenFOAM simulations using MOOSE input file syntax. +Currently, the `FoamBC` system focuses on imposing MOOSE variable fields onto OpenFOAM boundary conditions. +The different BCs are imposed in OpenFOAM as either `fixedValue` or `fixedGradient` types reflecting Dirichlet and Neumann BCs respectively. +Currently, the correct BC type needs to be specified in OpenFOAM's `0` directory, although the details will be overriden by Hippo. + +## Example Input File Syntax + +``` +[FoamBCs] + [wall_temp] + type = FoamFixedValueBC + foam_variable = T + boundary = wall1 + [] + [wall_heat_flux] + type = FoamFixedGradientBC + foam_variable = T + boundary = wall2 + diffusivity = kappa # thermal conductivity + [] +[] +``` + +!syntax list /FoamBCs objects=True actions=False subsystems=False + +!syntax list /FoamBCs objects=False actions=False subsystems=True + +!syntax list /FoamBCs objects=False actions=True subsystems=False diff --git a/doc/content/syntax/FoamVariables/index.md b/doc/content/syntax/FoamVariables/index.md new file mode 100644 index 00000000..ffa16761 --- /dev/null +++ b/doc/content/syntax/FoamVariables/index.md @@ -0,0 +1,38 @@ +# FoamVariables System + +## Overview + +The `FoamVariable`s system controls how OpenFOAM scalar variables are shadowed by +counterpart MOOSE variables, +allowing the OpenFOAM quantities to be used as boundary conditions in libMesh-based Moose apps. + +There are two types of `FoamVariable`s +- `FoamVariableField`: for shadowing OpenFOAM `volScalarField`s +- `FoamFunctionObject`: for shadowing the scalar outputs of OpenFOAM `functionObjects` + +Under the hood, the FoamVariables create a constant monomial MooseVariable, +with data transferred from the OpenFOAM variable to a MOOSE variable within the Hippo sub-app +after the OpenFOAM step is complete. This can then be transferred to other MOOSE apps like any other +MOOSE variable. +A more thorough explanation of Hippo's 'mirror mesh' and data transfer can be found here. + +## Example + +``` +[FoamVariables] + [temperature] + type = FoamVariableField + foam_variable = T + [] + [heat_flux] + type = FoamFunctionObject + foam_variable = wallHeatFlux + [] +[] +``` + +!syntax list /FoamVariables objects=True actions=False subsystems=False + +!syntax list /FoamVariables objects=False actions=False subsystems=True + +!syntax list /FoamVariables objects=False actions=True subsystems=False diff --git a/doc/sqa_reports.yml b/doc/sqa_reports.yml new file mode 100644 index 00000000..9950b8d3 --- /dev/null +++ b/doc/sqa_reports.yml @@ -0,0 +1,6 @@ +Applications: + stork: + app_types: + - hippoApp + content_directory: ${ROOT_DIR}/doc/content + log_default: WARNING diff --git a/include/bcs/FoamFixedGradientBC.h b/include/bcs/FoamFixedGradientBC.h index 97041d43..77363396 100644 --- a/include/bcs/FoamFixedGradientBC.h +++ b/include/bcs/FoamFixedGradientBC.h @@ -17,5 +17,5 @@ class FoamFixedGradientBC : public FoamBCBase protected: // name of diffusivity coefficient used to divide flux - std::string _diffusivity_coefficient; + std::string _diffusivity; }; diff --git a/src/bcs/FoamFixedGradientBC.C b/src/bcs/FoamFixedGradientBC.C index 7434d077..fdcd46d1 100644 --- a/src/bcs/FoamFixedGradientBC.C +++ b/src/bcs/FoamFixedGradientBC.C @@ -13,21 +13,18 @@ FoamFixedGradientBC::validParams() auto params = FoamBCBase::validParams(); params.addClassDescription("A FoamBC that imposes a fixed gradient dirichlet boundary condition " "on the OpenFOAM simulation"); - params.addParam("diffusivity_coefficient", + params.addParam("diffusivity", "OpenFOAM scalar field name to be specified if 'v' is " "a flux rather than a gradient"); return params; } FoamFixedGradientBC::FoamFixedGradientBC(const InputParameters & parameters) - : FoamBCBase(parameters), - _diffusivity_coefficient(parameters.get("diffusivity_coefficient")) + : FoamBCBase(parameters), _diffusivity(parameters.get("diffusivity")) { // check that the diffusivity coefficient is a OpenFOAM scalar field - if (!_diffusivity_coefficient.empty() && - !_mesh->foamHasObject(_diffusivity_coefficient)) - mooseError( - "Diffusivity coefficient '", _diffusivity_coefficient, "' not a Foam volScalarField"); + if (!_diffusivity.empty() && !_mesh->foamHasObject(_diffusivity)) + mooseError("Diffusivity '", _diffusivity, "' not a Foam volScalarField"); } void @@ -47,13 +44,13 @@ FoamFixedGradientBC::imposeBoundaryCondition() _mesh->getGradientBCField(subdomain, _foam_variable); assert(grad_array.size() == static_cast(foam_gradient.size())); - // If diffusivity_coefficient is specified grad array is a flux, so result + // If diffusivity is specified grad array is a flux, so result // must be divided by it - if (!_diffusivity_coefficient.empty()) + if (!_diffusivity.empty()) { // Get the underlying diffusivity field auto & coeff = foam_mesh.boundary()[subdomain].lookupPatchField( - _diffusivity_coefficient); + _diffusivity); assert(foam_gradient.size() == coeff.size()); // set gradient diff --git a/src/variables/FoamVariableField.C b/src/variables/FoamVariableField.C index 655eaa70..94adeefc 100644 --- a/src/variables/FoamVariableField.C +++ b/src/variables/FoamVariableField.C @@ -4,7 +4,6 @@ #include "MooseObject.h" #include "MooseTypes.h" #include "MooseVariableFieldBase.h" -#include "MooseVariableFieldBase.h" registerMooseObject("hippoApp", FoamVariableField); @@ -13,8 +12,6 @@ FoamVariableField::validParams() { auto params = MooseObject::validParams(); - params.addRequiredParam("foam_variable", - "OpenFOAM variable or functionObject to be shadowed"); params.addRequiredParam("foam_variable", "OpenFOAM variable or functionObject to be shadowed"); diff --git a/test/tests/bcs/laplace_fixed_gradient/main.i b/test/tests/bcs/laplace_fixed_gradient/main.i index 5adb3c53..54829fdf 100644 --- a/test/tests/bcs/laplace_fixed_gradient/main.i +++ b/test/tests/bcs/laplace_fixed_gradient/main.i @@ -23,7 +23,7 @@ type=FoamFixedGradientBC foam_variable = T boundary = 'right' - diffusivity_coefficient = kappa + diffusivity = kappa [] [] diff --git a/test/tests/bcs/laplace_fixed_gradient/tests b/test/tests/bcs/laplace_fixed_gradient/tests index ab7bf175..0226eb49 100644 --- a/test/tests/bcs/laplace_fixed_gradient/tests +++ b/test/tests/bcs/laplace_fixed_gradient/tests @@ -8,8 +8,8 @@ type = RunException input = main.i prereq = foam_bc_fixed_gradient/setup - expect_err = "Diffusivity coefficient 'kappa1' not a Foam volScalarField" - cli_args = 'FoamBCs/T_flux/diffusivity_coefficient=kappa1' + expect_err = "Diffusivity 'kappa1' not a Foam volScalarField" + cli_args = 'FoamBCs/T_flux/diffusivity=kappa1' allow_warnings = true [] [run] diff --git a/test/tests/fixed-point/flow_over_heated_plate/fluid.i b/test/tests/fixed-point/flow_over_heated_plate/fluid.i index dd4178ff..32b9af95 100644 --- a/test/tests/fixed-point/flow_over_heated_plate/fluid.i +++ b/test/tests/fixed-point/flow_over_heated_plate/fluid.i @@ -24,7 +24,7 @@ [solid_heat_flux] type = FoamFixedGradientBC foam_variable = 'T' - diffusivity_coefficient = kappa + diffusivity = kappa initial_condition = 0 [] [] diff --git a/test/tests/fixed-point/heated_plate_converge/fluid.i b/test/tests/fixed-point/heated_plate_converge/fluid.i index dd4178ff..32b9af95 100644 --- a/test/tests/fixed-point/heated_plate_converge/fluid.i +++ b/test/tests/fixed-point/heated_plate_converge/fluid.i @@ -24,7 +24,7 @@ [solid_heat_flux] type = FoamFixedGradientBC foam_variable = 'T' - diffusivity_coefficient = kappa + diffusivity = kappa initial_condition = 0 [] [] diff --git a/test/tests/fixed-point/laplacian_fixed_gradient/fluid-openfoam.i b/test/tests/fixed-point/laplacian_fixed_gradient/fluid-openfoam.i index 8108e3be..7daeba61 100644 --- a/test/tests/fixed-point/laplacian_fixed_gradient/fluid-openfoam.i +++ b/test/tests/fixed-point/laplacian_fixed_gradient/fluid-openfoam.i @@ -16,7 +16,7 @@ [fluid_heat_flux] type = FoamFixedGradientBC foam_variable = 'T' - diffusivity_coefficient = kappa + diffusivity = kappa initial_condition = 0.075 [] [] diff --git a/test/tests/fixed-point/restart_heated_plate/fluid.i b/test/tests/fixed-point/restart_heated_plate/fluid.i index dd4178ff..32b9af95 100644 --- a/test/tests/fixed-point/restart_heated_plate/fluid.i +++ b/test/tests/fixed-point/restart_heated_plate/fluid.i @@ -24,7 +24,7 @@ [solid_heat_flux] type = FoamFixedGradientBC foam_variable = 'T' - diffusivity_coefficient = kappa + diffusivity = kappa initial_condition = 0 [] [] diff --git a/test/tests/fixed-point/restep_fixed_point/fluid-openfoam.i b/test/tests/fixed-point/restep_fixed_point/fluid-openfoam.i index 34f01b1d..29349074 100644 --- a/test/tests/fixed-point/restep_fixed_point/fluid-openfoam.i +++ b/test/tests/fixed-point/restep_fixed_point/fluid-openfoam.i @@ -16,7 +16,7 @@ [solid_heat_flux] type = FoamFixedGradientBC foam_variable = 'T' - diffusivity_coefficient = kappa + diffusivity = kappa initial_condition = 0 [] [] diff --git a/test/tests/fixed-point/unsteady_fixed_point_converge/fluid-openfoam.i b/test/tests/fixed-point/unsteady_fixed_point_converge/fluid-openfoam.i index 34f01b1d..29349074 100644 --- a/test/tests/fixed-point/unsteady_fixed_point_converge/fluid-openfoam.i +++ b/test/tests/fixed-point/unsteady_fixed_point_converge/fluid-openfoam.i @@ -16,7 +16,7 @@ [solid_heat_flux] type = FoamFixedGradientBC foam_variable = 'T' - diffusivity_coefficient = kappa + diffusivity = kappa initial_condition = 0 [] [] diff --git a/test/tests/fixed-point/unsteady_hc_subcycling/fluid-openfoam.i b/test/tests/fixed-point/unsteady_hc_subcycling/fluid-openfoam.i index 72685c2c..73a88b8e 100644 --- a/test/tests/fixed-point/unsteady_hc_subcycling/fluid-openfoam.i +++ b/test/tests/fixed-point/unsteady_hc_subcycling/fluid-openfoam.i @@ -25,7 +25,7 @@ [solid_heat_flux] type = FoamFixedGradientBC foam_variable = 'T' - diffusivity_coefficient = kappa + diffusivity = kappa initial_condition = 0 [] [] diff --git a/test/tests/fixed-point/unsteady_hc_variable_dt/fluid-openfoam.i b/test/tests/fixed-point/unsteady_hc_variable_dt/fluid-openfoam.i index 72685c2c..73a88b8e 100644 --- a/test/tests/fixed-point/unsteady_hc_variable_dt/fluid-openfoam.i +++ b/test/tests/fixed-point/unsteady_hc_variable_dt/fluid-openfoam.i @@ -25,7 +25,7 @@ [solid_heat_flux] type = FoamFixedGradientBC foam_variable = 'T' - diffusivity_coefficient = kappa + diffusivity = kappa initial_condition = 0 [] [] diff --git a/test/tests/fixed-point/unsteady_heat_conduction/fluid-openfoam.i b/test/tests/fixed-point/unsteady_heat_conduction/fluid-openfoam.i index 7367636a..bba7fb2f 100644 --- a/test/tests/fixed-point/unsteady_heat_conduction/fluid-openfoam.i +++ b/test/tests/fixed-point/unsteady_heat_conduction/fluid-openfoam.i @@ -24,7 +24,7 @@ [solid_heat_flux] type = FoamFixedGradientBC foam_variable = 'T' - diffusivity_coefficient = kappa + diffusivity = kappa initial_condition = 0 [] [] diff --git a/test/tests/mesh/polygonal/fluid-openfoam.i b/test/tests/mesh/polygonal/fluid-openfoam.i index df47e23e..9ddabe82 100644 --- a/test/tests/mesh/polygonal/fluid-openfoam.i +++ b/test/tests/mesh/polygonal/fluid-openfoam.i @@ -17,7 +17,7 @@ type = FoamFixedGradientBC foam_variable = T initial_condition = 0 - diffusivity_coefficient = kappa + diffusivity = kappa [] [] diff --git a/test/tests/mesh/quadrilateral/fluid-openfoam.i b/test/tests/mesh/quadrilateral/fluid-openfoam.i index 30df6206..ee8539b2 100644 --- a/test/tests/mesh/quadrilateral/fluid-openfoam.i +++ b/test/tests/mesh/quadrilateral/fluid-openfoam.i @@ -18,7 +18,7 @@ type = FoamFixedGradientBC foam_variable = T initial_condition = 0 - diffusivity_coefficient = kappa + diffusivity = kappa [] [] diff --git a/test/tests/mesh/triangular/fluid-openfoam.i b/test/tests/mesh/triangular/fluid-openfoam.i index 4af1f206..f9687a30 100644 --- a/test/tests/mesh/triangular/fluid-openfoam.i +++ b/test/tests/mesh/triangular/fluid-openfoam.i @@ -17,7 +17,7 @@ type = FoamFixedGradientBC foam_variable = T initial_condition = 0 - diffusivity_coefficient = kappa + diffusivity = kappa [] [] diff --git a/test/tests/multiapps/flow_over_heated_plate/fluid.i b/test/tests/multiapps/flow_over_heated_plate/fluid.i index 47ab7f00..a593c898 100644 --- a/test/tests/multiapps/flow_over_heated_plate/fluid.i +++ b/test/tests/multiapps/flow_over_heated_plate/fluid.i @@ -17,7 +17,7 @@ type = FoamFixedGradientBC foam_variable = T initial_condition = 0 - diffusivity_coefficient = kappa + diffusivity = kappa [] [] diff --git a/test/tests/multiapps/simplified_heat_exchanger/fluid-bottom.i b/test/tests/multiapps/simplified_heat_exchanger/fluid-bottom.i index 7efc43dd..0e65bdf4 100644 --- a/test/tests/multiapps/simplified_heat_exchanger/fluid-bottom.i +++ b/test/tests/multiapps/simplified_heat_exchanger/fluid-bottom.i @@ -9,7 +9,7 @@ type = FoamFixedGradientBC foam_variable = T initial_condition = 0 - diffusivity_coefficient = kappa + diffusivity = kappa [] [] diff --git a/test/tests/multiapps/simplified_heat_exchanger/fluid-top.i b/test/tests/multiapps/simplified_heat_exchanger/fluid-top.i index 110c369a..7001c08d 100644 --- a/test/tests/multiapps/simplified_heat_exchanger/fluid-top.i +++ b/test/tests/multiapps/simplified_heat_exchanger/fluid-top.i @@ -9,7 +9,7 @@ type = FoamFixedGradientBC foam_variable = T initial_condition = 3 - diffusivity_coefficient = kappa + diffusivity = kappa [] [] diff --git a/test/tests/multiapps/unsteady_heat_conduction_in_infinite_system/fluid-openfoam.i b/test/tests/multiapps/unsteady_heat_conduction_in_infinite_system/fluid-openfoam.i index 4af1f206..f9687a30 100644 --- a/test/tests/multiapps/unsteady_heat_conduction_in_infinite_system/fluid-openfoam.i +++ b/test/tests/multiapps/unsteady_heat_conduction_in_infinite_system/fluid-openfoam.i @@ -17,7 +17,7 @@ type = FoamFixedGradientBC foam_variable = T initial_condition = 0 - diffusivity_coefficient = kappa + diffusivity = kappa [] []