-
Notifications
You must be signed in to change notification settings - Fork 7
Implement a HippoInterface class to streamline access to core underlying OpenFOAM and Hippo objects
#125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mattfalcone1997
merged 12 commits into
aurora-multiphysics:main
from
mattfalcone1997:develop-hippo-interface
Aug 26, 2026
Merged
Implement a HippoInterface class to streamline access to core underlying OpenFOAM and Hippo objects
#125
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3cf9309
Initial commit of HippoInterface
mattfalcone1997 92e3ba4
Update postprocessors and bcs with HippoInterface
mattfalcone1997 e10bc7e
Update variables with HippoInterface
mattfalcone1997 8292233
Add test for error if FoamProblem is not used with HippoInterface
mattfalcone1997 7e7aeaf
Remove FoamProblem from actions so errors get raised at the
mattfalcone1997 5cbe683
Make HippoInterface protected
mattfalcone1997 fb9bae1
Update FoamBCBase for new interface
mattfalcone1997 1514300
Fix bug from rebase
mattfalcone1997 c34a9f8
Fix interface test for OF14
mattfalcone1997 ac80f55
Add comments to Hippo interface
mattfalcone1997 af5d662
Implement HippoObject as base class for most Foam-derived objects
mattfalcone1997 1723b30
Update after review with unneeded comments deleted
mattfalcone1997 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #pragma once | ||
|
|
||
| #include "InputParameters.h" | ||
| #include "MooseObject.h" | ||
| #include "fvMesh.H" | ||
|
|
||
| class FoamProblem; | ||
| class FoamMesh; | ||
|
|
||
| /* | ||
| HippoInterface is a base class containing convenient access to common | ||
| Hippo and Foam objects such as Foam::Time, Foam::fvMesh and | ||
| FoamProblem. | ||
| */ | ||
| class HippoInterface | ||
|
k-collie marked this conversation as resolved.
|
||
| { | ||
| public: | ||
| explicit HippoInterface(const MooseObject * moose_object); | ||
|
|
||
| protected: | ||
| // Retrieves FoamProblem | ||
| FoamProblem & getFoamProblem() const; | ||
|
|
||
| // Retrieves FoamMesh | ||
| FoamMesh & getFoamMesh() const; | ||
|
|
||
| // Retrieves Underlying OpenFOAM mesh object | ||
| Foam::fvMesh & getFvMesh() const; | ||
|
|
||
| // Retrieves OpenFOAM time object | ||
| Foam::Time & getFoamTime() const; | ||
|
|
||
| private: | ||
| FoamProblem & _foam_problem; | ||
| static FoamProblem & extractFoamProblem(const MooseObject *); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #pragma once | ||
|
|
||
| #include "InputParameters.h" | ||
| #include "MooseObject.h" | ||
| #include "HippoInterface.h" | ||
|
|
||
| /* | ||
| HippoObject is a base class for MooseObjects accessing OpenFOAM | ||
| objects | ||
| */ | ||
| class HippoObject : public MooseObject, protected HippoInterface | ||
| { | ||
| public: | ||
| static InputParameters validParams(); | ||
| HippoObject(const InputParameters & params); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,24 @@ | ||
| #pragma once | ||
|
|
||
| #include "GeneralPostprocessor.h" | ||
| #include "HippoInterface.h" | ||
| #include "fvCFD_moose.h" | ||
|
|
||
| #include "InputParameters.h" | ||
| #include "Postprocessor.h" | ||
| #include "ElementUserObject.h" | ||
|
|
||
| class FoamPostprocessorBase : public ElementUserObject, public Postprocessor | ||
| class FoamPostprocessorBase : public GeneralPostprocessor, protected HippoInterface | ||
| { | ||
| 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; | ||
| // We still want the Foam Postprocessors to be reported with the other | ||
| // postprocessors but we want to define them empty | ||
| void initialize() final {}; | ||
|
|
||
| virtual void finalize() final; | ||
| void execute() final {}; | ||
|
|
||
| virtual void threadJoin([[maybe_unused]] const UserObject & uo) final {}; | ||
| void finalize() final {}; | ||
|
|
||
| // Compute postprocessor, to be called within FoamProblem | ||
| virtual void compute() = 0; | ||
|
|
||
| protected: | ||
| Foam::fvMesh * _foam_mesh; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #include "FoamProblem.h" | ||
| #include "HippoInterface.h" | ||
| #include "InputParameters.h" | ||
| #include "MooseObject.h" | ||
| #include "OutputInterface.h" | ||
|
|
||
| HippoInterface::HippoInterface(const MooseObject * moose_object) | ||
| : _foam_problem(extractFoamProblem(moose_object)) | ||
| { | ||
| } | ||
|
|
||
| FoamProblem & | ||
| HippoInterface::getFoamProblem() const | ||
| { | ||
| return _foam_problem; | ||
| } | ||
|
|
||
| FoamMesh & | ||
| HippoInterface::getFoamMesh() const | ||
| { | ||
| return _foam_problem.mesh(); | ||
| } | ||
|
|
||
| Foam::fvMesh & | ||
| HippoInterface::getFvMesh() const | ||
| { | ||
| return getFoamMesh().fvMesh(); | ||
| } | ||
|
|
||
| Foam::Time & | ||
| HippoInterface::getFoamTime() const | ||
| { | ||
| return const_cast<Foam::Time &>(getFvMesh().time()); | ||
| } | ||
|
|
||
| FoamProblem & | ||
| HippoInterface::extractFoamProblem(const MooseObject * moose_object) | ||
| { | ||
| const InputParameters & params = moose_object->parameters(); | ||
| auto * problem = params.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"); | ||
| auto * foam_problem = dynamic_cast<FoamProblem *>(problem); | ||
| if (!foam_problem) | ||
| mooseError(moose_object->type(), " can only be used with FoamProblem"); | ||
| return *foam_problem; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #include "HippoObject.h" | ||
|
|
||
| InputParameters | ||
| HippoObject::validParams() | ||
| { | ||
| return MooseObject::validParams(); | ||
| } | ||
|
|
||
| HippoObject::HippoObject(const InputParameters & params) : MooseObject(params), HippoInterface(this) | ||
| { | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.