Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 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
f39ff7c
Make minor changes in response to code review
mattfalcone1997 Feb 5, 2026
bde9a4b
Update class descriptions for postprocessors
mattfalcone1997 Feb 6, 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
5 changes: 5 additions & 0 deletions include/base/foam/fvCFD_moose.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,9 @@
#include <uniformDimensionedFields.H>
#include <ddtScheme.H>

// FoamSideIntegratedFunctionObject.h
#include <functionObject.H>
#include <functionObjects/field/wallHeatFlux/wallHeatFlux.H>
#include <functionObjects/field/wallShearStress/wallShearStress.H>

#undef NotImplemented
32 changes: 32 additions & 0 deletions include/postprocessors/FoamPostprocessorBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include "fvCFD_moose.h"

#include "InputParameters.h"
#include "Postprocessor.h"
#include "ElementUserObject.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([[maybe_unused]] 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;
};
17 changes: 17 additions & 0 deletions include/postprocessors/FoamSideAverageFunctionObject.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include "FoamSideIntegratedFunctionObject.h"
#include "InputParameters.h"

class FoamSideAverageFunctionObject : public FoamSideIntegratedFunctionObject
{
public:
static InputParameters validParams();

FoamSideAverageFunctionObject(const InputParameters & params)
: FoamSideIntegratedFunctionObject(params)
{
}

virtual void compute() override;
};
13 changes: 13 additions & 0 deletions include/postprocessors/FoamSideAverageValue.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once
#include "FoamSideIntegratedValue.h"
#include "InputParameters.h"

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

FoamSideAverageValue(const InputParameters & params);

virtual void compute() override;
};
19 changes: 19 additions & 0 deletions include/postprocessors/FoamSideIntegratedBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once
#include "FoamSidePostprocessor.h"

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

FoamSideIntegratedBase(const InputParameters & params);

virtual PostprocessorValue getValue() const override;

protected:
virtual Real integrateValue(const std::string & variable);

Real getArea();

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

#include "FoamSideIntegratedBase.h"
#include "InputParameters.h"

#include <memory>

class FoamSideIntegratedFunctionObject : public FoamSideIntegratedBase
{
public:
static InputParameters validParams();

FoamSideIntegratedFunctionObject(const InputParameters & params);

virtual void compute() override;

protected:
/// Creates function objects to be executed by compute
std::unique_ptr<Foam::functionObject> createFunctionObject(const std::string & fo_name);

std::unique_ptr<Foam::functionObject> _function_object;
};
15 changes: 15 additions & 0 deletions include/postprocessors/FoamSideIntegratedValue.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#include "FoamSideIntegratedBase.h"

class FoamSideIntegratedValue : public FoamSideIntegratedBase
{
public:
static InputParameters validParams();

FoamSideIntegratedValue(const InputParameters & params);

virtual void compute() override;

protected:
const std::string & _foam_variable;
};
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;
};
39 changes: 39 additions & 0 deletions src/postprocessors/FoamPostprocessorBase.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#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()
{
}
64 changes: 64 additions & 0 deletions src/postprocessors/FoamSideAdvectiveFluxIntegral.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include "FoamSideAdvectiveFluxIntegral.h"
#include "InputParameters.h"
#include "MooseTypes.h"

registerMooseObject("hippoApp", FoamSideAdvectiveFluxIntegral);

InputParameters
FoamSideAdvectiveFluxIntegral::validParams()
{
auto params = FoamSidePostprocessor::validParams();
params.addClassDescription("Class that calculates the integrated advective flux of a scalar over "
"OpenFOAM boundary patches.");
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;
}
19 changes: 19 additions & 0 deletions src/postprocessors/FoamSideAverageFunctionObject.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "FoamSideAverageFunctionObject.h"

registerMooseObject("hippoApp", FoamSideAverageFunctionObject);

InputParameters
FoamSideAverageFunctionObject::validParams()
{
InputParameters params = FoamSideIntegratedFunctionObject::validParams();
params.addClassDescription(
"Class that averages a function object over OpenFOAM boundary patches.");
return params;
}

void
FoamSideAverageFunctionObject::compute()
{
_function_object->execute();
_value = integrateValue(_function_object->name()) / getArea();
}
23 changes: 23 additions & 0 deletions src/postprocessors/FoamSideAverageValue.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "FoamSideAverageValue.h"
#include "InputParameters.h"

registerMooseObject("hippoApp", FoamSideAverageValue);

InputParameters
FoamSideAverageValue::validParams()
{
InputParameters params = FoamSideIntegratedValue::validParams();
params.addClassDescription("Class that averages a variable over OpenFOAM boundary patches.");
return params;
}

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

void
FoamSideAverageValue::compute()
{
_value = integrateValue(_foam_variable) / getArea();
}
Loading