Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2b4ae44
Create working side average postprocessor
mattfalcone1997 Oct 8, 2025
6fa9116
Updated FoamProcessor so it computes with FoamProblem
mattfalcone1997 Oct 9, 2025
7fbd7de
Add initial implementation of mass flow rate inlet BC
mattfalcone1997 Oct 14, 2025
a21f346
Simplify mass flow rate BC
mattfalcone1997 Oct 14, 2025
a99aa41
Add initial makeshift test for mass flow rate BC
mattfalcone1997 Oct 14, 2025
fe6e08e
Fix bugs in mass flow rate inlet implementation
mattfalcone1997 Oct 14, 2025
03b801c
Remove unnecessary headers
mattfalcone1997 Oct 16, 2025
0747b18
Add initial implementation of mapped inlet mass flow rate boundary co…
mattfalcone1997 Nov 1, 2025
660baf8
Add initial implementation of the mapped inlet test solver
mattfalcone1997 Nov 1, 2025
55ab1e3
Simplify mapped inlet test solver
mattfalcone1997 Nov 3, 2025
c31a3dd
Fix basic mapped inlet implementation
mattfalcone1997 Nov 3, 2025
a5b8233
Change mapped inlet test solver to use a rank independent test function
mattfalcone1997 Nov 3, 2025
38d803c
Add test for mapped inlet mass flow rate BC
mattfalcone1997 Nov 3, 2025
1595c22
Fix error in mapped inlet test
mattfalcone1997 Nov 3, 2025
1586e43
Use BBox to reduce communication for mapped inlet
mattfalcone1997 Nov 5, 2025
cb052b9
Add mapped inlet base class
mattfalcone1997 Nov 5, 2025
f62cb3e
Add scalar bulk mapped inlet BC
mattfalcone1997 Nov 5, 2025
71179dc
Rename mapped inlet test case
mattfalcone1997 Nov 5, 2025
aac3e4d
Correct gold file reference for mass flow rate BC
mattfalcone1997 Nov 5, 2025
0d79474
Implement new FoamVariableBCBase class and propagate changes
mattfalcone1997 Nov 6, 2025
0e62203
Implement new FoamPostprocessorBCBase class and propagate
mattfalcone1997 Nov 6, 2025
692cfaa
Add default creation of Receiver for Postprocessor-based BCs
mattfalcone1997 Nov 6, 2025
691b270
Implement different scaling approaches for the scalar bulk mapped inlet
mattfalcone1997 Nov 6, 2025
27b0974
Implement fixed value and fixed gradient postprocessor BCs
mattfalcone1997 Nov 7, 2025
8d64df2
Clean up code and register postprocessor BC objects
mattfalcone1997 Nov 7, 2025
abe149d
Add tests for postprocessor BCs
mattfalcone1997 Nov 7, 2025
fc57ab2
Improve mapped inlet tests, in particular the different bounding box …
mattfalcone1997 Nov 8, 2025
336a514
Add test for the mapped inlet subtract scaling method
mattfalcone1997 Nov 8, 2025
91d5a71
Improve tests and code after review
mattfalcone1997 Nov 8, 2025
6b7e9ae
Implement initial fix to edge case where offset is on the cell face
mattfalcone1997 Nov 10, 2025
80275f7
Fix bugs causing seg faults
mattfalcone1997 Nov 11, 2025
e5ba3e6
Add option of not scaling the bulk when using mapped inlet
mattfalcone1997 Nov 11, 2025
ae88262
Add scale factor to mass flow rate BCs
mattfalcone1997 Nov 16, 2025
eab6a09
Fix bugs after rebase
mattfalcone1997 Nov 16, 2025
5d0377f
Add integrated value foam postprocessor
mattfalcone1997 Dec 18, 2025
66d9c34
Fix errors associated with rebase
mattfalcone1997 Feb 7, 2026
1a6a302
Remove mapped inlet classes to separate branch
mattfalcone1997 Feb 8, 2026
700655a
Remove thermal hydraulics from modules
mattfalcone1997 Feb 10, 2026
af9690f
Remove unnecessary verify test from mass flow rate BC
mattfalcone1997 Feb 10, 2026
0b06067
Remove unnecessary parameters from BCs
mattfalcone1997 Feb 10, 2026
78a8aba
Minor refactor after review
mattfalcone1997 Feb 10, 2026
734057c
Move listFromVector to internals namespace
mattfalcone1997 Feb 10, 2026
d96ddaf
Remove FoamControlledTimeStepper after rebase
mattfalcone1997 Apr 20, 2026
8e327fb
Update after code review
mattfalcone1997 May 22, 2026
91e2450
Separate flux and neumann boundary conditions
mattfalcone1997 May 22, 2026
6b6fe3d
Add postprocessor diffusion flux BCs
mattfalcone1997 May 22, 2026
3673b1f
Add tests for diffusion flux
mattfalcone1997 May 22, 2026
3518bb2
Update documentation changes with the boundary condition update
mattfalcone1997 May 22, 2026
7d8fec5
Update postprocessor-based BCs on code review
mattfalcone1997 Jun 4, 2026
0e4f71d
Remove whitespace from tests
mattfalcone1997 Jun 4, 2026
96f0629
Remove allow_warnings
mattfalcone1997 Jun 4, 2026
41d1689
Update tests using np.testing and adding clarifying comments
mattfalcone1997 Jun 4, 2026
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ RDG := no
RICHARDS := no
STOCHASTIC_TOOLS := no
TENSOR_MECHANICS := no
THERMAL_HYDRAULICS := no
XFEM := no

include $(MOOSE_DIR)/modules/modules.mk
Expand Down
3 changes: 1 addition & 2 deletions doc/content/hit/step_by_step/fluid.i
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@

[FoamBCs]
[solid_heat_flux]
type = FoamFixedGradientBC
type = FoamDiffusionFluxBC
foam_variable = 'T'
diffusivity_coefficient = kappa
initial_condition = 0
[]
[]
Expand Down
2 changes: 1 addition & 1 deletion doc/content/shell_tube_hx.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Both `inner.i` and `outer.i` are the same:
```

Note that this is a different type to the step-by-step example where a
`FoamFixedGradientBC` is used.
`FoamDiffusionFluxBC` is used.

## Imposing the fluid heat flux on the solid

Expand Down
9 changes: 3 additions & 6 deletions doc/content/step_by_step.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,16 @@ and so can be transferred between MOOSE apps.

Hippo also implements the `FoamBC` system that allows you to impose boundary conditions
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`.
`kappa` is the name of the thermal conductivity variable in OpenFOAM.
on the temperature field, which can be done using `FoamDiffusionFluxBC`. A diffusivity can be specified,
although the default is the thermal conductivity `kappa`, which is what we require here.

```toml
# fluid.i

[FoamBCs]
[solid_heat_flux]
type = FoamFixedGradientBC
type = FoamDiffusionFluxBC
foam_variable = T
diffusivity_coefficient = kappa
[]
[]
```
Expand Down
7 changes: 6 additions & 1 deletion include/actions/AddFoamBCAction.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#pragma once

#include "InputParameters.h"
#include "MooseObjectAction.h"
#include "FoamProblem.h"

#include <MooseObjectAction.h>

class AddFoamBCAction : public MooseObjectAction
{
Expand All @@ -15,4 +17,7 @@ class AddFoamBCAction : public MooseObjectAction
protected:
// Create AuxVariable associated with new-style BCs
void createAuxVariable();

// Create Receiver for Postprocessor-based BCs
void createReceiver(FoamProblem & problem);
};
8 changes: 7 additions & 1 deletion include/bcs/FoamBCBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include <MooseObject.h>
#include <MooseTypes.h>
#include <MooseVariableFieldBase.h>
#include "VariadicTable.h"

typedef std::tuple<std::string, std::string, std::string, std::string, std::string> BCInfoTableRow;

class FoamBCBase : public MooseObject, public Coupleable
{
Expand All @@ -26,7 +29,10 @@ class FoamBCBase : public MooseObject, public Coupleable
// returns the name of the foam boundaries the BC applies to
std::vector<SubdomainName> boundary() const { return _boundary; };

virtual void initialSetup();
virtual void initialSetup() = 0;
Comment thread
k-collie marked this conversation as resolved.

// Add information about BC to table
virtual BCInfoTableRow getInfoRow() const = 0;

protected:
// OpenFOAM variable which this BC is to be imposed on
Expand Down
17 changes: 17 additions & 0 deletions include/bcs/FoamDiffusionFluxBC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include "FoamVariableBCBase.h"

class FoamDiffusionFluxBC : public FoamVariableBCBase
{
public:
static InputParameters validParams();
explicit FoamDiffusionFluxBC(const InputParameters & params);

// Impose boundary conditions (to be called from FoamProblem class)
virtual void imposeBoundaryCondition() override;

protected:
// diffusivity name for flux condition
const std::string _diffusivity;
};
19 changes: 19 additions & 0 deletions include/bcs/FoamDiffusionFluxPostprocessorBC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include "FoamPostprocessorBCBase.h"
#include "InputParameters.h"

class FoamDiffusionFluxPostprocessorBC : public FoamPostprocessorBCBase
{
public:
static InputParameters validParams();

FoamDiffusionFluxPostprocessorBC(const InputParameters & params);

// impose boundary condition
virtual void imposeBoundaryCondition() override;

protected:
// name of diffusivity coefficient used to divide flux
std::string _diffusivity;
};
8 changes: 2 additions & 6 deletions include/bcs/FoamFixedGradientBC.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "FoamBCBase.h"
#include "FoamVariableBCBase.h"
#include "InputParameters.h"

class FoamFixedGradientBC : public FoamBCBase
class FoamFixedGradientBC : public FoamVariableBCBase
{
public:
// Validate input file parameters
Expand All @@ -14,8 +14,4 @@ class FoamFixedGradientBC : public FoamBCBase

// Impose boundary conditions (to be called from FoamProblem class)
virtual void imposeBoundaryCondition() override;

protected:
// name of diffusivity coefficient used to divide flux
std::string _diffusivity_coefficient;
};
15 changes: 15 additions & 0 deletions include/bcs/FoamFixedGradientPostprocessorBC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include "FoamPostprocessorBCBase.h"
#include "InputParameters.h"

class FoamFixedGradientPostprocessorBC : public FoamPostprocessorBCBase
{
public:
static InputParameters validParams();

FoamFixedGradientPostprocessorBC(const InputParameters & params);

// impose boundary condition
virtual void imposeBoundaryCondition() override;
};
4 changes: 2 additions & 2 deletions include/bcs/FoamFixedValueBC.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "FoamBCBase.h"
#include "FoamVariableBCBase.h"
#include "InputParameters.h"

class FoamFixedValueBC : public FoamBCBase
class FoamFixedValueBC : public FoamVariableBCBase
{
public:
// Validate input file parameters
Expand Down
14 changes: 14 additions & 0 deletions include/bcs/FoamFixedValuePostprocessorBC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include "FoamPostprocessorBCBase.h"

class FoamFixedValuePostprocessorBC : public FoamPostprocessorBCBase
{
public:
static InputParameters validParams();

FoamFixedValuePostprocessorBC(const InputParameters & params);

// Impose boundary conditions (to be called from FoamProblem class)
virtual void imposeBoundaryCondition() override;
};
17 changes: 17 additions & 0 deletions include/bcs/FoamMassFlowRateInletBC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "FoamPostprocessorBCBase.h"
#include "InputParameters.h"
#include "MooseTypes.h"
#include "PostprocessorInterface.h"

class FoamMassFlowRateInletBC : public FoamPostprocessorBCBase
{
public:
static InputParameters validParams();

FoamMassFlowRateInletBC(const InputParameters & params);

virtual void imposeBoundaryCondition() override;

protected:
const Real _scale_factor;
};
27 changes: 27 additions & 0 deletions include/bcs/FoamPostprocessorBCBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once

#include "FoamBCBase.h"
#include "InputParameters.h"
#include "MooseTypes.h"
#include "PostprocessorInterface.h"

class FoamPostprocessorBCBase : public FoamBCBase, public PostprocessorInterface
{
public:
static InputParameters validParams();

explicit FoamPostprocessorBCBase(const InputParameters & params);

// returns the moose Postprocessor imposed on OpenFOAM
VariableName moosePostprocessor() const { return _pp_name; }

virtual void initialSetup() override {};

virtual BCInfoTableRow getInfoRow() const override;

protected:
const PostprocessorName _pp_name;

// Reference to Moose PostprocessorValue used to impose BC
const PostprocessorValue & _pp_value;
};
30 changes: 30 additions & 0 deletions include/bcs/FoamVariableBCBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include "FoamBCBase.h"
#include "InputParameters.h"
#include <functional>

class FoamVariableBCBase : public FoamBCBase
{
public:
static InputParameters validParams();

explicit FoamVariableBCBase(const InputParameters & params);

// returns the moose AuxVariable imposed on OpenFOAM
VariableName mooseVariable() const { return _moose_var->get().name(); }

virtual void initialSetup() override;

virtual BCInfoTableRow getInfoRow() const override;

protected:
// Get the value of the MOOSE variable at an element
Real variableValueAtElement(const libMesh::Elem & elem) const;

// Get the data vector of the MOOSE field on a subdomain
std::vector<Real> getMooseVariableArray(int subdomainId) const;

// Pointer to Moose variable used to impose BC
std::optional<std::reference_wrapper<MooseVariableFieldBase>> _moose_var;
};
11 changes: 9 additions & 2 deletions include/mesh/FoamMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,19 @@ class FoamMesh : public MooseMesh
return _foam_mesh.foundObject<T>(name);
}

// Returns the patch array for field and subdomain
template <typename GeoField, typename Type>
Foam::fvPatchField<Type> & getBCField(SubdomainID subdomain, Foam::word const & field)
{
return const_cast<Foam::fvPatchField<Type> &>(
_foam_mesh.boundary()[subdomain].lookupPatchField<GeoField, Type>(field));
}

// Returns the gradient BC array for field and subdomain
template <typename GeoField, typename Type>
Foam::Field<Type> & getGradientBCField(SubdomainID subdomain, Foam::word const & field)
{
auto & var = const_cast<Foam::fvPatchField<Type> &>(
_foam_mesh.boundary()[subdomain].lookupPatchField<GeoField, Type>(field));
auto & var = getBCField<GeoField, Type>(subdomain, field);
return Foam::refCast<Foam::fixedGradientFvPatchField<Type>>(var).gradient();
}

Expand Down
14 changes: 14 additions & 0 deletions include/util/hippoUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,19 @@ copyParamFromParam(InputParameters & dst, const InputParameters & src, const std
if (src.isParamValid(name_in))
dst.set<T>(name_in) = src.get<T>(name_in);
}

template <typename StrType>
inline std::string
listFromVector(std::vector<StrType> vec, StrType sep = ", ")
{
if (vec.size() == 0)
return std::string();
else if (vec.size() == 1)
return vec.at(0);

std::string str{vec[0]};
auto binary_op = [&](const std::string & acc, const std::string & it) { return acc + sep + it; };
return std::accumulate(vec.begin() + 1, vec.end(), str, binary_op);
}
}
}
27 changes: 26 additions & 1 deletion src/actions/AddFoamBCAction.C
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@

registerMooseAction("hippoApp", AddFoamBCAction, "add_foam_bc");

namespace
{
inline bool
findParamKey(const InputParameters & params, const std::string & key)
{
return std::find_if(params.begin(),
params.end(),
[&](const auto & param) { return param.first == key; }) != params.end();
}
}

InputParameters
AddFoamBCAction::validParams()
{
Expand All @@ -27,9 +38,14 @@ AddFoamBCAction::act()
mooseError("FoamBCs system can only be used with FoamProblem.");

// Do not create aux variable if variable provided.
if (!_moose_object_pars.isParamSetByUser("v"))
if (findParamKey(_moose_object_pars, "v") && !_moose_object_pars.isParamSetByUser("v"))
createAuxVariable();

// Create receiver if pp_name not provided and pp_name is an allowed parameter
if (findParamKey(_moose_object_pars, "pp_name") &&
!_moose_object_pars.isParamSetByUser("pp_name"))
createReceiver(*foam_problem);
Comment thread
k-collie marked this conversation as resolved.

foam_problem->addObject<FoamBCBase>(_type, _name, _moose_object_pars, false);
}
}
Expand All @@ -56,3 +72,12 @@ AddFoamBCAction::createAuxVariable()
std::static_pointer_cast<Action>(_action_factory.create(class_name, name(), action_params));
_awh.addActionBlock(action);
}

void
AddFoamBCAction::createReceiver(FoamProblem & problem)
{
auto params = _factory.getValidParams("Receiver");

Hippo::internal::copyParamFromParam<Real>(params, _moose_object_pars, "default");
problem.addPostprocessor("Receiver", name(), params);
}
Loading
Loading