Skip to content
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
3aab0c2
Add FoamPostprocessor base class
mattfalcone1997 Oct 7, 2025
3c30f86
Add test FoamPostprocessor for input syntax
mattfalcone1997 Oct 7, 2025
34a58e1
Add input syntax test for FoamPostprocessors
mattfalcone1997 Oct 7, 2025
da0b2c0
Use BlockRestrictable base class for FoamPostprocessor
mattfalcone1997 Oct 8, 2025
c242915
Update tests to include boundaries
mattfalcone1997 Oct 8, 2025
3212f1e
Add initial side average foam postprocessor
mattfalcone1997 Oct 8, 2025
b812998
Create working side average postprocessor
mattfalcone1997 Oct 8, 2025
dbee885
Remove unnecessary action tests
mattfalcone1997 Oct 8, 2025
f274432
Add postprocessor test solver
mattfalcone1997 Oct 8, 2025
b3bfff1
Make use of current element info in postprocessor
mattfalcone1997 Oct 8, 2025
acfbcd6
Add test for FoamSideAverageValue postprocessor
mattfalcone1997 Oct 8, 2025
0c9d93e
Updated FoamProcessor so it computes with FoamProblem
mattfalcone1997 Oct 9, 2025
ab557d8
Add table for Foam Postprocessors
mattfalcone1997 Oct 10, 2025
3823599
Add additional error checks to exisiting Foam Postprocessors
mattfalcone1997 Oct 10, 2025
af701b7
Update Postprocessor test solver to be based on fluid solver
mattfalcone1997 Oct 10, 2025
8f8792d
Update side average test to use fluid-based solver
mattfalcone1997 Oct 10, 2025
18dc1b3
Add advective flux postprocessor for calculating mass flux
mattfalcone1997 Oct 10, 2025
02f1b4e
Add tests for FoamSideAdvectiveFluxIntegral
mattfalcone1997 Oct 10, 2025
aa6af7f
Update side average so components of vectors can used
mattfalcone1997 Oct 10, 2025
2491921
Improve comments for foam postprocessors
mattfalcone1997 Oct 10, 2025
243e9e8
Add parallel tests for postprocessors
mattfalcone1997 Oct 10, 2025
ffc896f
Remove FoamPostprocessor block after rebase
mattfalcone1997 Nov 16, 2025
4a704f3
Apply git patch from postprocessor BC branch to get all updates for F…
mattfalcone1997 Jan 16, 2026
2a52b95
Update after initial review of source
mattfalcone1997 Jan 16, 2026
192f2d5
Add separate tests for average and integrated flux postprocessors
mattfalcone1997 Jan 16, 2026
81fd65b
Add test for invalid scalars for advective flux integral postprocessor
mattfalcone1997 Jan 16, 2026
efa55c4
Add test for wallHeatFlux (using function objects)
mattfalcone1997 Jan 16, 2026
a783bd9
Fix file ends in foam_modules.mk
mattfalcone1997 Jan 16, 2026
1110245
Incorporate initial review changes
mattfalcone1997 Jan 29, 2026
d99f673
Add tests for multiple boundaries for side advective flux integral
mattfalcone1997 Jan 29, 2026
732c092
Add tests for multiple boundaries for side average value
mattfalcone1997 Jan 29, 2026
5cae496
Add tests for multiple boundaries for side integrated value
mattfalcone1997 Jan 29, 2026
4637d20
Refactor integrated postprocessors to separate value from function
mattfalcone1997 Jan 29, 2026
521cd59
Add average postprocessors for function objects
mattfalcone1997 Jan 29, 2026
192dc99
Update integrated value tests
mattfalcone1997 Jan 29, 2026
aaac42d
Add tests for average function object postprocessors
mattfalcone1997 Jan 29, 2026
2e8b293
Add test to check function object is valid
mattfalcone1997 Jan 29, 2026
b180c1d
Move Foam includes from postprocessors to fvCFD_moose.h
mattfalcone1997 Jan 29, 2026
25756c4
Remove unnecessary includes
mattfalcone1997 Jan 29, 2026
b3fcc03
Add further comments
mattfalcone1997 Jan 30, 2026
d9cd77b
Simplify integrated postprocessors
mattfalcone1997 Jan 30, 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
31 changes: 31 additions & 0 deletions include/postprocessors/FoamPostprocessorBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once

#include "InputParameters.h"
#include "Postprocessor.h"
#include "ElementUserObject.h"
#include "fvMesh.H"

class FoamPostprocessorBase : public ElementUserObject, public Postprocessor
{
public:
static InputParameters validParams();

FoamPostprocessorBase(const InputParameters & params);

// We dont want the usual UserObject functions to be executed
// But we still want the Foam Postprocessors to be reported with the other
// Foam postprocessors
virtual void initialize() final;

virtual void execute() final;

virtual void finalize() final;

virtual void threadJoin(const UserObject & uo) final;

// Compute postprocessor, to be called within FoamProblem
virtual void compute() = 0;

protected:
Foam::fvMesh * _foam_mesh;
};
20 changes: 20 additions & 0 deletions include/postprocessors/FoamSideAdvectiveFluxIntegral.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once
#include "FoamSidePostprocessor.h"

class FoamSideAdvectiveFluxIntegral : public FoamSidePostprocessor
{
public:
static InputParameters validParams();

FoamSideAdvectiveFluxIntegral(const InputParameters & params);

virtual PostprocessorValue getValue() const override;

virtual void compute() override;

protected:
Real _value;

std::string _foam_scalar;
std::string _advection_velocity;
};
16 changes: 16 additions & 0 deletions include/postprocessors/FoamSideAverageValue.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once
#include "FoamSideIntegratedValue.h"
#include "InputParameters.h"

#include <functionObjects/field/wallHeatFlux/wallHeatFlux.H>
#include <functionObjects/field/wallShearStress/wallShearStress.H>

class FoamSideAverageValue : public FoamSideIntegratedValue
{
public:
static InputParameters validParams() { return FoamSideIntegratedValue::validParams(); }

FoamSideAverageValue(const InputParameters & params);

virtual void compute() override;
};
30 changes: 30 additions & 0 deletions include/postprocessors/FoamSideIntegratedValue.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once
#include "FoamSidePostprocessor.h"
#include <functionObjects/field/wallHeatFlux/wallHeatFlux.H>
#include <functionObjects/field/wallShearStress/wallShearStress.H>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We spotted this PR doesn't build in debug mode because of the problem documented in fvCFD.H. You can move your necessary includes there and include foam things via that file.

All your foam includes in header files can be replaced with forward declarations.


static MooseEnum _pp_function_objects("wallHeatFlux wallShearStress");

class FoamSideIntegratedValue : public FoamSidePostprocessor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would you think about splitting this class into FoamSideIntegratedFunctionObject and FoamSideIntegratedValue? It feels like this class is doing 2 things - maybe the common functionality could be put into a shared base class or some class you compose.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good idea

{
public:
static InputParameters validParams();

FoamSideIntegratedValue(const InputParameters & params);

virtual PostprocessorValue getValue() const override;

virtual void compute() override;

protected:
/// Creates function objects to be executed by compute
void createFunctionObject();

Real _value;

std::string _foam_variable;

bool _is_vector;

Foam::functionObject * _function_object;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You own _function_object so you should clean it up in the destructor.

};
15 changes: 15 additions & 0 deletions include/postprocessors/FoamSidePostprocessor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include "FoamPostprocessorBase.h"
#include "MooseTypes.h"

class FoamSidePostprocessor : public FoamPostprocessorBase
{
public:
static InputParameters validParams();

FoamSidePostprocessor(const InputParameters & params);

protected:
std::vector<SubdomainName> _boundary;
};
5 changes: 5 additions & 0 deletions include/problems/FoamProblem.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "FoamMesh.h"
#include "FoamPostprocessorBase.h"
#include "FoamSolver.h"
#include "FoamVariableField.h"
#include "FoamBCBase.h"
Expand Down Expand Up @@ -42,9 +43,13 @@ class FoamProblem : public ExternalProblem
// check FoamBCs and print summarising table
void verifyFoamBCs();

// check FoamPostprocessors and print summarising table
void verifyFoamPostprocessors();

FoamMesh * _foam_mesh = nullptr;
Hippo::FoamSolver _solver;

std::vector<FoamVariableField *> _foam_variables;
std::vector<FoamBCBase *> _foam_bcs;
std::vector<FoamPostprocessorBase *> _foam_postprocessor;
};
45 changes: 45 additions & 0 deletions src/postprocessors/FoamPostprocessorBase.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include "FoamMesh.h"
#include "FoamPostprocessorBase.h"
#include "InputParameters.h"
#include "Postprocessor.h"
#include "ElementUserObject.h"
#include "FoamProblem.h"

InputParameters
FoamPostprocessorBase::validParams()
{
auto params = ElementUserObject::validParams();
params += Postprocessor::validParams();
return params;
}

FoamPostprocessorBase::FoamPostprocessorBase(const InputParameters & params)
: ElementUserObject(params), Postprocessor(this), _foam_mesh(nullptr)
{
FoamProblem * problem = dynamic_cast<FoamProblem *>(&getSubProblem());
if (!problem)
mooseError("Foam-based Postprocessors can only be used with FoamProblem");

_foam_mesh = &problem->mesh().fvMesh();
}

void
FoamPostprocessorBase::initialize()
{
}

void
FoamPostprocessorBase::execute()
{
}

void
FoamPostprocessorBase::finalize()
{
}

void
FoamPostprocessorBase::threadJoin(const UserObject & uo)
Copy link
Collaborator

@k-collie k-collie Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[[maybe_unused]]

{
(void)uo;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[[maybe_unused]]

}
66 changes: 66 additions & 0 deletions src/postprocessors/FoamSideAdvectiveFluxIntegral.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include "ElementUserObject.h"
#include "FoamSideAdvectiveFluxIntegral.h"
#include "InputParameters.h"
#include "MooseTypes.h"
#include "FoamMesh.h"

registerMooseObject("hippoApp", FoamSideAdvectiveFluxIntegral);

InputParameters
FoamSideAdvectiveFluxIntegral::validParams()
{
auto params = FoamSidePostprocessor::validParams();
params.addClassDescription(
"Class that calculates the average or scalar on a OpenFOAM boundary patch.");
params.addRequiredParam<std::string>("foam_scalar", "Foam scalar being advected.");
params.addParam<std::string>("advective_velocity", "U", "Advection velocity");
return params;
}

FoamSideAdvectiveFluxIntegral::FoamSideAdvectiveFluxIntegral(const InputParameters & params)
: FoamSidePostprocessor(params),
_value(0.),
_foam_scalar(params.get<std::string>("foam_scalar")),
_advection_velocity(params.get<std::string>("advective_velocity"))
{

if (!_foam_mesh->foundObject<Foam::volScalarField>(_foam_scalar))
mooseError("foam_scalar '", _foam_scalar, "' not found.");

if (!_foam_mesh->foundObject<Foam::volVectorField>(_advection_velocity))
mooseError("advective_velocity '", _advection_velocity, "' not found.");
}

void
FoamSideAdvectiveFluxIntegral::compute()
{
_value = 0.;
for (auto & boundary : _boundary)
{
auto & var_array =
_foam_mesh->boundary()[boundary].lookupPatchField<Foam::volScalarField, double>(
_foam_scalar);

auto & vel_array =
_foam_mesh->boundary()[boundary].lookupPatchField<Foam::volVectorField, double>(
_advection_velocity);

auto & areas = _foam_mesh->boundary()[boundary].magSf();
auto && normals = _foam_mesh->boundary()[boundary].nf();

// integrate locally
for (int i = 0; i < var_array.size(); ++i)
{
_value += var_array[i] * areas[i] * (normals->data()[i] & vel_array[i]);
}
}

// Sum across ranks
gatherSum(_value);
}

PostprocessorValue
FoamSideAdvectiveFluxIntegral::getValue() const
{
return _value;
}
34 changes: 34 additions & 0 deletions src/postprocessors/FoamSideAverageValue.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "Field.H"
#include "FoamSideAverageValue.h"
#include "FoamSideIntegratedValue.h"
#include "InputParameters.h"

registerMooseObject("hippoApp", FoamSideAverageValue);

FoamSideAverageValue::FoamSideAverageValue(const InputParameters & params)
: FoamSideIntegratedValue(params)
{
}

void
FoamSideAverageValue::compute()
{

FoamSideIntegratedValue::compute();

Real volume = 0.;
// loop over boundary ids
for (auto & boundary : _boundary)
{
auto & areas = _foam_mesh->boundary()[boundary].magSf();
for (int i = 0; i < areas.size(); ++i)
{
volume += areas[i];
}
}
// sum over ranks
gatherSum(volume);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it area instead of volume


// divide by area
_value /= volume;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like how this updates _value computed from FoamSideIntegratedValue::compute, maybe we could design this away.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just trying to match the implementation used in MOOSE, but I agree, I will change it

}
Loading