solver modules: Moved constructing the face velocity/momentum into preSolve()

The velocity boundary conditions are corrected before the construction of the
face velocity or momentum but for multi-region cases with interacting velocity
boundary conditions this is only possible after all the region solver modules
have been constructed so it is better to delay the optional construction of the
face velocity/momentum until preSolve().
This commit is contained in:
Henry Weller
2023-05-30 14:59:58 +01:00
parent 6ba5869bf2
commit 8a1dd2eb9a
4 changed files with 82 additions and 82 deletions

View File

@ -146,27 +146,6 @@ Foam::solvers::VoFSolver::VoFSolver
{
mesh.schemes().setFluxRequired(p_rgh.name());
if (mesh.dynamic() || MRF.size())
{
Info<< "Constructing face momentum Uf" << endl;
// Ensure the U BCs are up-to-date before constructing Uf
U_.correctBoundaryConditions();
Uf = new surfaceVectorField
(
IOobject
(
"Uf",
runTime.name(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvc::interpolate(U_)
);
}
if (LTS)
{
Info<< "Using LTS" << endl;
@ -221,6 +200,27 @@ void Foam::solvers::VoFSolver::preSolve()
// Read the controls
readControls();
if ((mesh.dynamic() || MRF.size()) && !Uf.valid())
{
Info<< "Constructing face momentum Uf" << endl;
// Ensure the U BCs are up-to-date before constructing Uf
U_.correctBoundaryConditions();
Uf = new surfaceVectorField
(
IOobject
(
"Uf",
runTime.name(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvc::interpolate(U_)
);
}
if (transient())
{
correctCoNum();