ENH: coupled: enforce consistency. See #2783

This commit is contained in:
mattijs
2023-05-24 13:30:08 +01:00
committed by Andrew Heather
parent fcbfa40b0b
commit adc38d55ac
36 changed files with 387 additions and 51 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2020,2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -132,6 +132,11 @@ void PDRkEpsilon::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push new cell values to
// coupled neighbours. Note that we want to avoid the re-updateCoeffs
// of the wallFunctions so make sure to bypass the evaluate on
// those patches and only do the coupled ones.
epsilon_.boundaryFieldRef().evaluateCoupled<coupledFvPatch>();
// Add the blockage generation term so that it is included consistently
// in both the k and epsilon equations

View File

@ -87,7 +87,13 @@ int main(int argc, char *argv[])
(
fam::ddt(h, Us)
+ fam::div(phi2s, Us)
+ fam::Sp(0.0125*frictionFactor*mag(Us), Us)
+ fam::Sp
(
0.0125
*frictionFactor.internalField()
*mag(Us.internalField()),
Us
)
==
Gs*h
- fam::Sp(Sd, Us)

View File

@ -47,6 +47,7 @@ forAll(Us, faceI)
Us[faceI].z() =
Uinf.value()*0.25*R[faceI].x()*R[faceI].z()/sqr(mag(R[faceI]));
}
Us.boundaryFieldRef().evaluateCoupled<coupledFaPatch>();
Us -= aMesh.faceAreaNormals()*(aMesh.faceAreaNormals() & Us);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
Copyright (C) 2022-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -44,6 +44,8 @@ Description
#include "faceSet.H"
#include "volFields.H"
#include "areaFields.H"
#include "coupledFvPatch.H"
#include "coupledFaPatch.H"
using namespace Foam;
@ -186,6 +188,9 @@ bool setCellFieldType
pfld = pfld.patchInternalField();
}
// Handle any e.g. halo-swaps
field.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
if (!field.write())
{
FatalErrorInFunction
@ -271,6 +276,9 @@ bool setAreaFieldType
}
}
// Handle any e.g. halo-swaps
field.boundaryFieldRef().template evaluateCoupled<coupledFaPatch>();
if (!field.write())
{
FatalErrorInFunction
@ -421,6 +429,9 @@ bool setFaceFieldType
}
}
// Handle any e.g. halo-swaps
field.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
if (!field.write())
{
FatalErrorInFunction

View File

@ -141,7 +141,7 @@ void Foam::fieldsDistributor::readFieldsImpl
// only need to know about themselves.
// Can broadcast decompose = yes/no from master
bitSet localValues(haveMeshOnProc)
bitSet localValues(haveMeshOnProc);
bitSet masterValues(localValues);
Pstream::broadcast(masterValues);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2020,2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -221,6 +221,8 @@ void LamBremhorstKE::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilon_.boundaryFieldRef().evaluateCoupled<coupledFvPatch>();
const volScalarField Rt(this->Rt());
const volScalarField fMu(this->fMu(Rt));

View File

@ -390,6 +390,8 @@ void LienCubicKE::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilon_.boundaryFieldRef().evaluateCoupled<coupledFvPatch>();
const volScalarField f2(this->f2());

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2020,2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -274,6 +274,8 @@ void LienLeschziner::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilon_.boundaryFieldRef().evaluateCoupled<coupledFvPatch>();
const volScalarField f2(this->f2());

View File

@ -274,6 +274,8 @@ void ShihQuadraticKE::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilon_.boundaryFieldRef().evaluateCoupled<coupledFvPatch>();
// Dissipation equation
tmp<fvScalarMatrix> epsEqn

View File

@ -679,6 +679,8 @@ void kkLOmega::correct()
omega_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
omega_.boundaryFieldRef().evaluateCoupled<coupledFvPatch>();
// Turbulence specific dissipation rate equation
tmp<fvScalarMatrix> omegaEqn

View File

@ -619,7 +619,11 @@ void mixtureKEpsilon<BasicTurbulenceModel>::correct()
// Update k, epsilon and G at the wall
kl.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
kl.boundaryFieldRef().evaluateCoupled<coupledFvPatch>();
epsilonl.boundaryFieldRef().updateCoeffs();
epsilonl.boundaryFieldRef().evaluateCoupled<coupledFvPatch>();
Gc.ref().checkOut();
}
@ -639,7 +643,11 @@ void mixtureKEpsilon<BasicTurbulenceModel>::correct()
// Update k, epsilon and G at the wall
kg.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
kg.boundaryFieldRef().evaluateCoupled<coupledFvPatch>();
epsilong.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilong.boundaryFieldRef().evaluateCoupled<coupledFvPatch>();
Gd.ref().checkOut();
}

View File

@ -524,8 +524,33 @@ void kOmegaSSTBase<BasicEddyViscosityModel>::correct()
volScalarField::Internal GbyNu0(this->GbyNu0(tgradU(), S2));
volScalarField::Internal G(this->GName(), nut*GbyNu0);
// - boundary condition changes a cell value
// - normally this would be triggered through correctBoundaryConditions
// - which would do
// - fvPatchField::evaluate() which calls
// - fvPatchField::updateCoeffs()
// - however any processor boundary conditions already start sending
// at initEvaluate so would send over the old value.
// - avoid this by explicitly calling updateCoeffs early and then
// only doing the boundary conditions that rely on initEvaluate
// (currently only coupled ones)
//- 1. Explicitly swap values on coupled boundary conditions
// Update omega and G at the wall
omega_.boundaryFieldRef().updateCoeffs();
// omegaWallFunctions change the cell value! Make sure to push these to
// coupled neighbours. Note that we want to avoid the re-updateCoeffs
// of the wallFunctions so make sure to bypass the evaluate on
// those patches and only do the coupled ones.
omega_.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
////- 2. Make sure the boundary condition calls updateCoeffs from
//// initEvaluate
//// (so before any swap is done - requires all coupled bcs to be
//// after wall bcs. Unfortunately this conflicts with cyclicACMI)
//omega_.correctBoundaryConditions();
const volScalarField CDkOmega
(

View File

@ -474,6 +474,8 @@ void EBRSM<BasicTurbulenceModel>::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilon_.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
// (M:Eq. C.14)
tmp<fvScalarMatrix> epsEqn

View File

@ -295,6 +295,8 @@ void LRR<BasicTurbulenceModel>::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilon_.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
// Dissipation equation
tmp<fvScalarMatrix> epsEqn

View File

@ -281,6 +281,8 @@ void RNGkEpsilon<BasicTurbulenceModel>::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilon_.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
// Dissipation equation
tmp<fvScalarMatrix> epsEqn

View File

@ -305,6 +305,8 @@ void SSG<BasicTurbulenceModel>::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilon_.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
// Dissipation equation
tmp<fvScalarMatrix> epsEqn

View File

@ -253,6 +253,8 @@ void kEpsilon<BasicTurbulenceModel>::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilon_.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
// Dissipation equation
tmp<fvScalarMatrix> epsEqn

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2020,2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -412,6 +412,8 @@ void kEpsilonPhitF<BasicTurbulenceModel>::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilon_.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
// Turbulent kinetic energy dissipation rate equation (LUU:Eq. 4)
// k/T ~ epsilon

View File

@ -211,6 +211,8 @@ void kOmega<BasicTurbulenceModel>::correct()
// Update omega and G at the wall
omega_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
omega_.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
// Turbulence specific dissipation rate equation
tmp<fvScalarMatrix> omegaEqn

View File

@ -276,6 +276,8 @@ void realizableKE<BasicTurbulenceModel>::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilon_.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
// SAF: limiting thermo->nu(). If psiThermo is used rho might be < 0
// temporarily when p < 0 then nu < 0 which needs limiting

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 ENERCON GmbH
Copyright (C) 2020 OpenCFD Ltd
Copyright (C) 2020,2023 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -33,6 +33,8 @@ License
#include "mapPolyMesh.H"
#include "addToRunTimeSelectionTable.H"
#include "zeroGradientFvPatchField.H"
#include "coupledFvPatchField.H"
#include "processorFvPatchField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -125,16 +127,52 @@ bool Foam::functionObjects::ObukhovLength::calcOL()
)
);
// Special bit of coding here to handle cyclics
// - sign(B) can easily be positive in one cell but negative in its
// coupled cell
// - so cyclic value might evaluate to 0
// - which upsets the division
// - note that instead of sign() any other field might have the same
// positive and negative coupled values - it is just a lot less likely
// - problem is that overridden patch types do not propagate - use in-place
// operations only
volScalarField denom
(
IOobject
(
"denom",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
sign(B)
);
// Override interpolated value on interpolated coupled patches
for (auto& pfld : denom.boundaryFieldRef())
{
if
(
isA<coupledFvPatchField<scalar>>(pfld)
&& !isA<processorFvPatchField<scalar>>(pfld)
)
{
pfld = pfld.patchInternalField();
}
}
denom *= kappa_*max(mag(B), dimensionedScalar(B.dimensions(), VSMALL));
// (O:Eq. 26)
*result1 = // ObukhovLength
-min
(
dimensionedScalar(dimLength, ROOTVGREAT), // neutral stratification
pow3(*result2)/
(
sign(B)*kappa_
*max(mag(B), dimensionedScalar(B.dimensions(), VSMALL))
)
pow3(*result2)/denom
);
return isNew;

View File

@ -421,6 +421,8 @@ void kEpsilonLopesdaCosta<BasicTurbulenceModel>::correct()
// Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs();
// Push any changed cell values to coupled neighbours
epsilon_.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
volScalarField::Internal magU(mag(U));
volScalarField::Internal magU3(pow3(magU));

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2020,2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -143,6 +143,9 @@ void Foam::combustionModels::EDC<ReactionThermo>::correct()
);
}
}
// Evaluate bcs
kappa_.correctBoundaryConditions();
}
else
{
@ -171,6 +174,9 @@ void Foam::combustionModels::EDC<ReactionThermo>::correct()
);
}
}
// Evaluate bcs
kappa_.correctBoundaryConditions();
}
Info<< "Chemistry time solved max/min : "

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019,2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -99,6 +99,9 @@ void Foam::combustionModels::PaSR<ReactionThermo>::correct()
kappa_[i] = 1.0;
}
}
// Evaluate bcs
kappa_.correctBoundaryConditions();
}
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,6 +57,9 @@ Foam::bound(volScalarField& vsf, const dimensionedScalar& lowerBound)
);
vsf.boundaryFieldRef() = max(vsf.boundaryField(), lowerBound.value());
// Give coupled bcs chance to update since cell values changed
vsf.boundaryFieldRef().evaluateCoupled<coupledFvPatch>();
}
return vsf;

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -178,6 +179,11 @@ CoEulerDdtScheme<Type>::fvcDdt
rDeltaT.primitiveField()*dt.value()
*(1.0 - mesh().Vsc0()/mesh().Vsc());
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
@ -214,7 +220,7 @@ CoEulerDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -232,6 +238,13 @@ CoEulerDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -266,7 +279,7 @@ CoEulerDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -284,6 +297,13 @@ CoEulerDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -318,7 +338,7 @@ CoEulerDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -339,6 +359,13 @@ CoEulerDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -374,7 +401,7 @@ CoEulerDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -404,6 +431,13 @@ CoEulerDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2020-2021 OpenCFD Ltd.
Copyright (C) 2020-2021,2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -393,6 +393,11 @@ CrankNicolsonDdtScheme<Type>::fvcDdt
(rDtCoef*dt)*(mesh().V() - mesh().V0())
- mesh().V0()*offCentre_(ddt0.internalField())
)/mesh().V();
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
}
return tdtdt;
@ -447,7 +452,7 @@ CrankNicolsonDdtScheme<Type>::fvcDdt
);
}
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -465,6 +470,13 @@ CrankNicolsonDdtScheme<Type>::fvcDdt
) - offCentre_(ff(ddt0.boundaryField()))
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -535,7 +547,7 @@ CrankNicolsonDdtScheme<Type>::fvcDdt
);
}
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -555,6 +567,13 @@ CrankNicolsonDdtScheme<Type>::fvcDdt
) - offCentre_(ff(ddt0.boundaryField()))
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -629,7 +648,7 @@ CrankNicolsonDdtScheme<Type>::fvcDdt
);
}
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -651,6 +670,13 @@ CrankNicolsonDdtScheme<Type>::fvcDdt
) - offCentre_(ff(ddt0.boundaryField()))
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -738,7 +764,7 @@ CrankNicolsonDdtScheme<Type>::fvcDdt
);
}
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -772,6 +798,13 @@ CrankNicolsonDdtScheme<Type>::fvcDdt
) - offCentre_(ff(ddt0.boundaryField()))
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -104,7 +105,7 @@ EulerDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -120,6 +121,13 @@ EulerDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -154,7 +162,7 @@ EulerDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -170,6 +178,13 @@ EulerDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -204,7 +219,7 @@ EulerDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -223,6 +238,13 @@ EulerDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -258,7 +280,7 @@ EulerDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -285,6 +307,13 @@ EulerDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -183,6 +184,11 @@ SLTSDdtScheme<Type>::fvcDdt
tdtdt.ref().primitiveFieldRef() =
rDeltaT.primitiveField()*dt.value()*(1.0 - mesh().V0()/mesh().V());
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
@ -219,7 +225,7 @@ SLTSDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -237,6 +243,13 @@ SLTSDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -271,7 +284,7 @@ SLTSDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -289,6 +302,13 @@ SLTSDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -323,7 +343,7 @@ SLTSDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -344,6 +364,13 @@ SLTSDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -379,7 +406,7 @@ SLTSDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -409,6 +436,13 @@ SLTSDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017,2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -152,7 +152,7 @@ backwardDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -178,6 +178,13 @@ backwardDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -224,7 +231,7 @@ backwardDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -250,6 +257,13 @@ backwardDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -296,7 +310,7 @@ backwardDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -325,6 +339,13 @@ backwardDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{
@ -372,7 +393,7 @@ backwardDdtScheme<Type>::fvcDdt
if (mesh().moving())
{
return tmp<GeometricField<Type, fvPatchField, volMesh>>
tmp<GeometricField<Type, fvPatchField, volMesh>> tdtdt
(
new GeometricField<Type, fvPatchField, volMesh>
(
@ -418,6 +439,13 @@ backwardDdtScheme<Type>::fvcDdt
)
)
);
// Different operation on boundary v.s. internal so re-evaluate
// coupled boundaries
tdtdt.ref().boundaryFieldRef().
template evaluateCoupled<coupledFvPatch>();
return tdtdt;
}
else
{

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -374,20 +375,25 @@ tmp<surfaceScalarField> steadyStateDdtScheme<Type>::meshPhi
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return tmp<surfaceScalarField>::New
auto tphi
(
IOobject
tmp<surfaceScalarField>::New
(
"meshPhi",
mesh().time().timeName(),
mesh().thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh(),
dimensionedScalar(dimVolume/dimTime, Zero)
IOobject
(
"meshPhi",
mesh().time().timeName(),
mesh().thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh(),
dimensionedScalar(dimVolume/dimTime, Zero)
)
);
tphi.ref().setOriented();
return tphi;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020,2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -150,6 +150,10 @@ bool Foam::patchDistMethods::directionalMeshWave::correct
}
}
// Make sure boundary values are up-to-date
y.correctBoundaryConditions();
n.correctBoundaryConditions();
// Transfer number of unset values
this->nUnset_ = wave.nUnset();

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020,2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -99,6 +99,9 @@ bool Foam::patchDistMethods::meshWave::correct(volScalarField& y)
}
}
// Make sure boundary values are up-to-date
y.correctBoundaryConditions();
// Transfer number of unset values
nUnset_ = wave.nUnset();
@ -155,6 +158,10 @@ bool Foam::patchDistMethods::meshWave::correct
}
}
// Make sure boundary values are up-to-date
y.correctBoundaryConditions();
n.correctBoundaryConditions();
// Transfer number of unset values
nUnset_ = wave.nUnset();

View File

@ -99,6 +99,26 @@ bool Foam::patchDistMethods::meshWaveAddressing::correct
y = wDist.y();
// Note: copying value only so might not be consistent with supplied
// patch types (e.g. zeroGradient when called from wallDist). Assume
// only affected ones are the supplied patches ...
{
auto& bfld = y.boundaryFieldRef();
const label startOfRequests = UPstream::nRequests();
for (const label patchi : patchIDs_)
{
bfld[patchi].initEvaluate(UPstream::commsTypes::nonBlocking);
}
// Wait for outstanding requests
UPstream::waitRequests(startOfRequests);
for (const label patchi : patchIDs_)
{
bfld[patchi].evaluate(UPstream::commsTypes::nonBlocking);
}
}
// Only calculate n if the field is defined
if (notNull(n))
@ -109,6 +129,8 @@ bool Foam::patchDistMethods::meshWaveAddressing::correct
pnf == pnf.patch().nf();
}
// No problem with inconsistency as for y (see above) since doing
// correctBoundaryConditions on actual n field.
wDist.map(n, mapDistribute::transform());
}

View File

@ -238,6 +238,9 @@ void Foam::wallDistAddressing::correct(volScalarField& y)
);
}
// Make sure boundary values are up to date
y.correctBoundaryConditions();
// Extract all addressing
// ~~~~~~~~~~~~~~~~~~~~~~

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020-2021 OpenCFD Ltd.
Copyright (C) 2020-2021,2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -574,6 +574,7 @@ Foam::StandardChemistryModel<ReactionThermo, ThermoType>::Qdot() const
Qdot[celli] -= hi*RR_[i][celli];
}
}
tQdot.ref().correctBoundaryConditions();
}
return tQdot;