ENH: cyclicAMI-topoChange: allow restart. Fixes #3265

This commit is contained in:
Cristóbal Ibáñez 2024-11-18 11:51:18 +00:00 committed by mattijs
parent 7f1120f6ed
commit f5310ca48c
3 changed files with 32 additions and 1 deletions

View File

@ -27,6 +27,7 @@ It is likely incomplete...
- Bernhard Gschaider - Bernhard Gschaider
- Andrew Heather - Andrew Heather
- David Hill - David Hill
- Cristóbal Ibáñez
- Yoshiaki Inoue - Yoshiaki Inoue
- Mattijs Janssens - Mattijs Janssens
- Andrew Jackson - Andrew Jackson

View File

@ -31,6 +31,7 @@ License
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "cyclicAMIPolyPatch.H" #include "cyclicAMIPolyPatch.H"
#include "cyclicACMIPolyPatch.H"
#include "polyTopoChange.H" #include "polyTopoChange.H"
#include "MeshObject.H" #include "MeshObject.H"
#include "lduMesh.H" #include "lduMesh.H"
@ -83,6 +84,35 @@ bool Foam::dynamicMotionSolverFvMeshAMI::init(const bool doInit)
} }
motionPtr_ = motionSolver::New(*this); motionPtr_ = motionSolver::New(*this);
// allow restarts during initialization to match patch field values if
// required
const auto& pbm = boundaryMesh();
bool changeRequired = false;
for (label patchi = 0; patchi < pbm.nNonProcessor(); ++patchi)
{
const auto* cycAmiPtr = isA<cyclicAMIPolyPatch>(pbm[patchi]);
if (cycAmiPtr)
{
changeRequired = cycAmiPtr->createAMIFaces() || changeRequired;
}
else
{
const auto* cycAcmiPtr = isA<cyclicACMIPolyPatch>(pbm[patchi]);
if (cycAcmiPtr)
{
changeRequired =
cycAcmiPtr->cyclicAMIPolyPatch::createAMIFaces()
|| changeRequired;
}
}
}
if (returnReduceOr(changeRequired))
{
update();
}
return true; return true;
} }

View File

@ -32,7 +32,7 @@ writeInterval 0.1;
purgeWrite 0; purgeWrite 0;
writeFormat ascii; writeFormat binary; //ascii;
writePrecision 6; writePrecision 6;