Skip to content

Conversation

@mattfalcone1997
Copy link
Collaborator

@mattfalcone1997 mattfalcone1997 commented Jul 11, 2025

Summary

Implement backup and restore functionality for the data from OpenFOAM to allow fixed point iteration to be used with MOOSE. A potential advantage to be explored:

  • TFFB boundary coupling could be used with larger time steps by using Picard iteration to converge the boundary.
  • Allow more complex systems to be more tighly coupled

Maybe look to reproduce in the laplacianTestSolver

Related Issue

Resolves #21

Checklist

  • Implementation and testing for simple toy problems that check specific capabilties
    • Setting and resetting variables
    • ODEs
    • Boundary value problems
  • Unsteady heat conduction
    • Variable time step
    • Subcycling
  • Flow past a flat plate
    • Variable properties
    • Gravity
    • Full regression
  • Ensure simulations recoverable

@mattfalcone1997
Copy link
Collaborator Author

The Crank-Nicolson scheme is still failing due to problems backing up the old-old fields. I will try to fix it, but if no,t I will leave it for later PR with a temporary error message preventing back-up if Crank-Nicolson is used

@mattfalcone1997 mattfalcone1997 marked this pull request as ready for review October 30, 2025 16:49
Copy link
Collaborator

@k-collie k-collie left a comment

Choose a reason for hiding this comment

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

Initial comments before rebase and looking at tests

Comment on lines 7 to 9
@$(MAKE) -j $(MOOSE_JOBS) test/OpenFOAM/modules/functionTestSolver/ 1>/dev/null
@$(MAKE) -j $(MOOSE_JOBS) test/OpenFOAM/modules/laplacianTestSolver/ 1>/dev/null
@$(MAKE) -j $(MOOSE_JOBS) test/OpenFOAM/modules/odeTestSolver/ 1>/dev/null
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why bin stdout here? Maybe make -s would do something satisfactory if there's too much output?

_foam_mesh(read_polymesh(_foam_runtime.runTime())),
_patch_counts(),
_patch_offsets()
_foam_mesh(declareRecoverableData<Foam::fvMesh>("foam_mesh",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I changed my mind, this should #include <Restartable.h> because declareRecoverableData comes from there.

Comment on lines 78 to 82
writeBoundary(ostream & stream, const Foam::DimensionedField<Type, GeomMesh> & field)
{
(void)stream;
(void)field;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can do the same with [[maybe_unused]] here

for (auto & field : mesh.curFields<T>())
{
// Remove fields that haven't been stored. Important for subcycling to prevent the old
// fields being which haven't been stored being used on the first time step.
Copy link
Collaborator

Choose a reason for hiding this comment

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

extra "being"

inline void
storeFields(std::ostream & stream, const Foam::fvMesh & mesh, void * context)
{
const auto cur_fields{getFieldkeys<T, strict>(mesh)};
Copy link
Collaborator

Choose a reason for hiding this comment

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

We spoke about returning cur_fields from this function in order to track what we have and haven't backed up from mesh.toc().

…re not backed up. Also make changes based on code review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement backup and restore

2 participants