diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C index e8c36a390c0d7856a78ba92d59c184ed8a9154ff..c7152d8030fa6b40fe015e4d85c05ee217842402 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C @@ -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 diff --git a/applications/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C b/applications/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C index 4cf01b79a005d0adc617b35a4709b768fa2d437a..02878bf9e4fc05ac88c92a97bf57f737f4726dd3 100644 --- a/applications/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C +++ b/applications/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C @@ -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) diff --git a/applications/solvers/finiteArea/sphereSurfactantFoam/createFaFields.H b/applications/solvers/finiteArea/sphereSurfactantFoam/createFaFields.H index 8ba4602445505c73bed8b519b6f378079db0acb2..514c6157d40b8cde41971bece4c85692b212823f 100644 --- a/applications/solvers/finiteArea/sphereSurfactantFoam/createFaFields.H +++ b/applications/solvers/finiteArea/sphereSurfactantFoam/createFaFields.H @@ -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); diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index 2865c0e1df1155d6d66eb059c2fe226aa16be2a3..d4312085a79242d240b55a907c6f6ebe2af57ecb 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -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 diff --git a/src/OpenFOAM/parallel/fieldsDistributor/fieldsDistributorTemplates.C b/src/OpenFOAM/parallel/fieldsDistributor/fieldsDistributorTemplates.C index 31635263889d194e0917b241ba738f25cdd01b7b..e260e16b53d09d45c4949df602ee1cce97b5cc29 100644 --- a/src/OpenFOAM/parallel/fieldsDistributor/fieldsDistributorTemplates.C +++ b/src/OpenFOAM/parallel/fieldsDistributor/fieldsDistributorTemplates.C @@ -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); diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LamBremhorstKE/LamBremhorstKE.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LamBremhorstKE/LamBremhorstKE.C index 6844e216a47cdb22f20760e19d0c632973be2f1b..30717fd6a3eab9bd97f0534022119b9124a61237 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LamBremhorstKE/LamBremhorstKE.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LamBremhorstKE/LamBremhorstKE.C @@ -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)); diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienCubicKE/LienCubicKE.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienCubicKE/LienCubicKE.C index cc03139c53abf176805b22974b6a9d7cf5275362..9e25620447ef513945bae4a38a286e2f5526891a 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienCubicKE/LienCubicKE.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienCubicKE/LienCubicKE.C @@ -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()); diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienLeschziner/LienLeschziner.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienLeschziner/LienLeschziner.C index 21d0870960e4bf831d4c58574ce2a8490591eee7..30a5c54dde83fb733ef489b3f9903dce02bbb132 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienLeschziner/LienLeschziner.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/LienLeschziner/LienLeschziner.C @@ -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()); diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/ShihQuadraticKE/ShihQuadraticKE.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/ShihQuadraticKE/ShihQuadraticKE.C index 727ee0ddef83968f68771eec7c4477889bd1a0ca..1444ef3bb5cb9d4dbd225210171536b3b82031bd 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/ShihQuadraticKE/ShihQuadraticKE.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/ShihQuadraticKE/ShihQuadraticKE.C @@ -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 diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/kkLOmega/kkLOmega.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/kkLOmega/kkLOmega.C index 149940e33cf235629362aa7276ef6caa640d47cb..e95b9b3ca4f132ec03e1a4131f31329b590f09ad 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/kkLOmega/kkLOmega.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/kkLOmega/kkLOmega.C @@ -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 diff --git a/src/TurbulenceModels/phaseCompressible/RAS/mixtureKEpsilon/mixtureKEpsilon.C b/src/TurbulenceModels/phaseCompressible/RAS/mixtureKEpsilon/mixtureKEpsilon.C index b2c743253ceeed8835bba3ec5146abb1b6ccc237..35aa10c5b0760a7291423442960f24b8d5d60400 100644 --- a/src/TurbulenceModels/phaseCompressible/RAS/mixtureKEpsilon/mixtureKEpsilon.C +++ b/src/TurbulenceModels/phaseCompressible/RAS/mixtureKEpsilon/mixtureKEpsilon.C @@ -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(); } diff --git a/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.C b/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.C index 80f5bfa87af1689ad3a6ed7940f444fe640d61d3..ba6661b871dfb8edc6fd7f04e1246c15718430d7 100644 --- a/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.C +++ b/src/TurbulenceModels/turbulenceModels/Base/kOmegaSST/kOmegaSSTBase.C @@ -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 ( diff --git a/src/TurbulenceModels/turbulenceModels/RAS/EBRSM/EBRSM.C b/src/TurbulenceModels/turbulenceModels/RAS/EBRSM/EBRSM.C index db19a5deff0263fda7c3dd81dc1ef83a2536035a..cafc50905a6c351ceddef3ad6c992cd838dbb03a 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/EBRSM/EBRSM.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/EBRSM/EBRSM.C @@ -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 diff --git a/src/TurbulenceModels/turbulenceModels/RAS/LRR/LRR.C b/src/TurbulenceModels/turbulenceModels/RAS/LRR/LRR.C index cb20f989b88336c09696a1053093691fc60bda88..9bd6a8d6660756ceab344cf1bae0fea2804ab11d 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/LRR/LRR.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/LRR/LRR.C @@ -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 diff --git a/src/TurbulenceModels/turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C b/src/TurbulenceModels/turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C index c70797140b4d744de0a8ff56e80360ab31161d3f..3f7df45d61766b0a2230b3477d1a7938acf290ae 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/RNGkEpsilon/RNGkEpsilon.C @@ -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 diff --git a/src/TurbulenceModels/turbulenceModels/RAS/SSG/SSG.C b/src/TurbulenceModels/turbulenceModels/RAS/SSG/SSG.C index 721d7b86b5868c99886cfea5b600bf9225fdd567..6b1fa3291fe08d788e547afcb832eb5088441790 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/SSG/SSG.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/SSG/SSG.C @@ -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 diff --git a/src/TurbulenceModels/turbulenceModels/RAS/kEpsilon/kEpsilon.C b/src/TurbulenceModels/turbulenceModels/RAS/kEpsilon/kEpsilon.C index 62e3aa813ba74ea43070b89bc3fefeeed792ad74..ead17ff204995edd0f6ae1e771b7830d0c1e0987 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/kEpsilon/kEpsilon.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/kEpsilon/kEpsilon.C @@ -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 diff --git a/src/TurbulenceModels/turbulenceModels/RAS/kEpsilonPhitF/kEpsilonPhitF.C b/src/TurbulenceModels/turbulenceModels/RAS/kEpsilonPhitF/kEpsilonPhitF.C index c3169d640ad266661fc9b36934194fa6182c8881..5e27438de2b32f64fdeb48b7d883f847b3e0339e 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/kEpsilonPhitF/kEpsilonPhitF.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/kEpsilonPhitF/kEpsilonPhitF.C @@ -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 diff --git a/src/TurbulenceModels/turbulenceModels/RAS/kOmega/kOmega.C b/src/TurbulenceModels/turbulenceModels/RAS/kOmega/kOmega.C index 0035d5c666ac4a35881d011c205ea62bab3ebcd7..77721813cff127c5acac2966e359f4933e636226 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/kOmega/kOmega.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/kOmega/kOmega.C @@ -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 diff --git a/src/TurbulenceModels/turbulenceModels/RAS/realizableKE/realizableKE.C b/src/TurbulenceModels/turbulenceModels/RAS/realizableKE/realizableKE.C index 633ec4e00bed6fd1742221163471c0f0451d5bc4..6e08625a61a3e53f6f0236557a56dfb2e93d7857 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/realizableKE/realizableKE.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/realizableKE/realizableKE.C @@ -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 diff --git a/src/atmosphericModels/functionObjects/ObukhovLength/ObukhovLength.C b/src/atmosphericModels/functionObjects/ObukhovLength/ObukhovLength.C index 68e8d0eef7ac745ae210a1d7a14da6bd4238ec22..9c81e138140263ff019ff865b653d7ea49e699cd 100644 --- a/src/atmosphericModels/functionObjects/ObukhovLength/ObukhovLength.C +++ b/src/atmosphericModels/functionObjects/ObukhovLength/ObukhovLength.C @@ -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; diff --git a/src/atmosphericModels/turbulenceModels/RAS/kEpsilonLopesdaCosta/kEpsilonLopesdaCosta.C b/src/atmosphericModels/turbulenceModels/RAS/kEpsilonLopesdaCosta/kEpsilonLopesdaCosta.C index ffda9c451e11950f720287e3d6ed1d9d42b4ab0e..7f6a4f8d676f5fb8f63d2a10acb7b807ba357921 100644 --- a/src/atmosphericModels/turbulenceModels/RAS/kEpsilonLopesdaCosta/kEpsilonLopesdaCosta.C +++ b/src/atmosphericModels/turbulenceModels/RAS/kEpsilonLopesdaCosta/kEpsilonLopesdaCosta.C @@ -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)); diff --git a/src/combustionModels/EDC/EDC.C b/src/combustionModels/EDC/EDC.C index 5d22a9f137b4c35cfa94091b537efba901b0f3ca..3e55ba9ce1c7850bddf216edc799c01727a1ef85 100644 --- a/src/combustionModels/EDC/EDC.C +++ b/src/combustionModels/EDC/EDC.C @@ -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 : " diff --git a/src/combustionModels/PaSR/PaSR.C b/src/combustionModels/PaSR/PaSR.C index 63a223c88d3fab6751be471dea2e1b50bae79e2c..63559a0aafe1197a1f5f2c67d7d8600d8c06f3d8 100644 --- a/src/combustionModels/PaSR/PaSR.C +++ b/src/combustionModels/PaSR/PaSR.C @@ -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(); } } diff --git a/src/finiteVolume/cfdTools/general/bound/bound.C b/src/finiteVolume/cfdTools/general/bound/bound.C index 4e96f8c5a75cf4a5501a5772ea1ca9505b1d3aee..9c6c269ed56348b1568e10ce0263e99b6d9099a2 100644 --- a/src/finiteVolume/cfdTools/general/bound/bound.C +++ b/src/finiteVolume/cfdTools/general/bound/bound.C @@ -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; diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.C index 2b16e0a36c547e668831ac1f52bae2aeba21355e..14bd9c621789863ac3ce1b4b02c437a4af448711 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.C @@ -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 { diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C index a7ec7a31af427000d787e8dccc6760c22d9945e0..3c395b5ae0fc97985f2df6c408270cfb0901a165 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C @@ -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 { diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.C index b94f628cad3c3e35ab7cd79ac4f645762942558e..375c6daed8c6730054b8ea4422292dcf7fda3f38 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.C @@ -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 { diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.C index 61e3186cdf3cdbabbd8dc3a143ea2a727fac185f..9e2fcab68471398dfd935453bf0104e6740e8086 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/SLTSDdtScheme/SLTSDdtScheme.C @@ -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 { diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/backwardDdtScheme/backwardDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/backwardDdtScheme/backwardDdtScheme.C index ef0f0aedf31e89c02b5e8fbd60004356d9e15085..8d77b3c00952fd14e2fa1e0e0a575172446a22f8 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/backwardDdtScheme/backwardDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/backwardDdtScheme/backwardDdtScheme.C @@ -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 { diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C index a97020624877279b2314d629803fbe1140dd6d0a..849852f75440c5853beae341917ecd30cc1a0026 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/steadyStateDdtScheme/steadyStateDdtScheme.C @@ -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; } diff --git a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/directionalMeshWave/directionalMeshWavePatchDistMethod.C b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/directionalMeshWave/directionalMeshWavePatchDistMethod.C index 45d36c44eedfd17830ea8772518a332596b29138..7610085b70b2bba18d6acb4256134d5793cae4b8 100644 --- a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/directionalMeshWave/directionalMeshWavePatchDistMethod.C +++ b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/directionalMeshWave/directionalMeshWavePatchDistMethod.C @@ -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(); diff --git a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWave/meshWavePatchDistMethod.C b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWave/meshWavePatchDistMethod.C index c3a13cf6338a3669e532121c9375320a9d60d1c2..0a4504b313de0a11f09440d8d3e251791a4552cf 100644 --- a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWave/meshWavePatchDistMethod.C +++ b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWave/meshWavePatchDistMethod.C @@ -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(); diff --git a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWaveAddressing/meshWaveAddressingPatchDistMethod.C b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWaveAddressing/meshWaveAddressingPatchDistMethod.C index bf9fb619b63a757ad4f01cf49e2201fff6f628ec..035173a417293eca1252997291a3f1943d68557d 100644 --- a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWaveAddressing/meshWaveAddressingPatchDistMethod.C +++ b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWaveAddressing/meshWaveAddressingPatchDistMethod.C @@ -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()); } diff --git a/src/finiteVolume/fvMesh/wallDist/wallDistAddressing/wallDistAddressing.C b/src/finiteVolume/fvMesh/wallDist/wallDistAddressing/wallDistAddressing.C index 80c97e1541c8876a2360b987d6e508aa5ca17ae7..c6639c2857181ce8cc4f9032f4632a6075500cce 100644 --- a/src/finiteVolume/fvMesh/wallDist/wallDistAddressing/wallDistAddressing.C +++ b/src/finiteVolume/fvMesh/wallDist/wallDistAddressing/wallDistAddressing.C @@ -238,6 +238,9 @@ void Foam::wallDistAddressing::correct(volScalarField& y) ); } + // Make sure boundary values are up to date + y.correctBoundaryConditions(); + // Extract all addressing // ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C index 3b55b76d946abf2df54149a108d8f8f1715877f2..a306b2dadd4ab51143fde7293cc0ae9d97dd347b 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C @@ -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;