diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options index 0a16d78b2f..941407a03c 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options @@ -21,6 +21,7 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionFaModels\lnInclude + EXE_LIBS = \ -lfiniteVolume \ -lfvOptions \ diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C index 299653602d..d2293d3624 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,6 +54,7 @@ Description #include "loopControl.H" #include "pressureControl.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) @@ -80,6 +81,8 @@ int main(int argc, char *argv[]) #include "solidRegionDiffusionNo.H" #include "setInitialMultiRegionDeltaT.H" + #include "createCoupledRegions.H" + while (runTime.run()) { #include "readTimeControls.H" @@ -109,8 +112,6 @@ int main(int argc, char *argv[]) forAll(fluidRegions, i) { - Info<< "\nSolving for fluid region " - << fluidRegions[i].name() << endl; #include "setRegionFluidFields.H" #include "readFluidMultiRegionPIMPLEControls.H" #include "solveFluid.H" @@ -118,13 +119,35 @@ int main(int argc, char *argv[]) forAll(solidRegions, i) { - Info<< "\nSolving for solid region " - << solidRegions[i].name() << endl; #include "setRegionSolidFields.H" #include "readSolidMultiRegionPIMPLEControls.H" #include "solveSolid.H" } + if (coupled) + { + Info<< "\nSolving energy coupled regions " << endl; + fvMatrixAssemblyPtr->solve(); + #include "correctThermos.H" + + forAll(fluidRegions, i) + { + #include "setRegionFluidFields.H" + #include "readFluidMultiRegionPIMPLEControls.H" + Info<< "\nSolving for fluid region " + << fluidRegions[i].name() << endl; + // --- PISO loop + for (int corr=0; corr 1) { @@ -152,10 +175,28 @@ int main(int argc, char *argv[]) #include "readSolidMultiRegionPIMPLEControls.H" #include "solveSolid.H" } + + if (coupled) + { + Info<< "\nSolving energy coupled regions " << endl; + fvMatrixAssemblyPtr->solve(); + #include "correctThermos.H" + + forAll(fluidRegions, i) + { + #include "setRegionFluidFields.H" + rho = thermo.rho(); + } + } } } } + if (coupled) + { + fvMatrixAssemblyPtr->clear(); + } + runTime.write(); runTime.printExecutionTime(Info); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options index 241a4ff1a6..02b07edfa5 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I./fluid \ -I./solid \ -I../solid \ + -I./../include \ -I$(LIB_SRC)/finiteVolume/cfdTools \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ @@ -35,3 +36,4 @@ EXE_LIBS = \ -lregionModels \ -lsampling \ -lregionFaModels + diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C index 67dcd84f95..ab8f50c0a7 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -66,6 +66,7 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMeshes.H" #include "createFields.H" + #include "createCoupledRegions.H" #include "initContinuityErrs.H" while (runTime.loop()) @@ -83,13 +84,27 @@ int main(int argc, char *argv[]) forAll(solidRegions, i) { - Info<< "\nSolving for solid region " - << solidRegions[i].name() << endl; #include "setRegionSolidFields.H" #include "readSolidMultiRegionSIMPLEControls.H" #include "solveSolid.H" } + + if (coupled) + { + Info<< "\nSolving energy coupled regions" << endl; + fvMatrixAssemblyPtr->solve(); + #include "correctThermos.H" + + forAll(fluidRegions, i) + { + #include "setRegionFluidFields.H" + #include "readSolidMultiRegionSIMPLEControls.H" + #include "pEqn.H" + turb.correct(); + } + } + // Additional loops for energy solution only { loopControl looping(runTime, "SIMPLE", "energyCoupling"); @@ -116,9 +131,27 @@ int main(int argc, char *argv[]) #include "readSolidMultiRegionSIMPLEControls.H" #include "solveSolid.H" } + + if (coupled) + { + Info<< "\nSolving energy coupled regions.. " << endl; + fvMatrixAssemblyPtr->solve(); + #include "correctThermos.H" + + forAll(fluidRegions, i) + { + #include "setRegionFluidFields.H" + turb.correct(); + } + } } } + if (coupled) + { + fvMatrixAssemblyPtr->clear(); + } + runTime.write(); runTime.printExecutionTime(Info); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/EEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/EEqn.H index daf3af8f2d..526e2b8757 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/EEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/EEqn.H @@ -20,13 +20,20 @@ fvOptions.constrain(EEqn); - EEqn.solve(); + if (coupled) + { + fvMatrixAssemblyPtr->addFvMatrix(EEqn); + } + else + { + EEqn.solve(); - fvOptions.correct(he); + fvOptions.correct(he); - thermo.correct(); - rad.correct(); + thermo.correct(); + rad.correct(); - Info<< "Min/max T:" << min(thermo.T()).value() << ' ' - << max(thermo.T()).value() << endl; + Info<< "Min/max T:" << min(thermo.T()).value() << ' ' + << max(thermo.T()).value() << endl; + } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/UEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/UEqn.H index f9712b548e..c279edfe34 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/UEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/UEqn.H @@ -2,7 +2,7 @@ MRF.correctBoundaryVelocity(U); - tmp tUEqn + UEqn = ( fvm::div(phi, U) + MRF.DDt(rho, U) @@ -10,7 +10,6 @@ == fvOptions(rho, U) ); - fvVectorMatrix& UEqn = tUEqn.ref(); UEqn.relax(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H index f414d0eab2..0047fb1606 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H @@ -21,6 +21,8 @@ PtrList rhoMin(fluidRegions.size()); PtrList MRFfluid(fluidRegions.size()); PtrList fluidFvOptions(fluidRegions.size()); +PtrList UEqFluid(fluidRegions.size()); + const uniformDimensionedVectorField& g = meshObjects::gravity::New(runTime); // Populate fluid field pointer lists @@ -222,5 +224,11 @@ forAll(fluidRegions, i) new fv::options(fluidRegions[i]) ); + UEqFluid.set + ( + i, + new fvVectorMatrix(UFluid[i], dimForce) + ); + turbulence[i].validate(); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H index c4cc0d6c3c..fe3d742816 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H @@ -2,7 +2,7 @@ volScalarField rAU("rAU", 1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh)); - tUEqn.clear(); + //tUEqn.clear(); surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H index 814c930275..28c4418da8 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H @@ -22,6 +22,8 @@ IOMRFZoneList& MRF = MRFfluid[i]; fv::options& fvOptions = fluidFvOptions[i]; + fvVectorMatrix& UEqn = UEqFluid[i]; + const dimensionedScalar initialMass ( "initialMass", diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/solveFluid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/solveFluid.H index b43a949043..c033bf0396 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/solveFluid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/solveFluid.H @@ -12,8 +12,10 @@ #include "UEqn.H" #include "EEqn.H" - #include "pEqn.H" - - turb.correct(); + if (!coupled) + { + #include "pEqn.H" + turb.correct(); + } } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H index 2b6306e5c2..4c545e7a2d 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H @@ -16,13 +16,21 @@ fvOptions.constrain(hEqn); - hEqn.solve(); + if (coupled) + { + fvMatrixAssemblyPtr->addFvMatrix(hEqn); + } + else + { + Info<< "\nSolving for solid region " + << solidRegions[i].name() << endl; - fvOptions.correct(h); + hEqn.solve(); + fvOptions.correct(h); + thermo.correct(); + + Info<< "Min/max T:" << min(thermo.T()).value() << ' ' + << max(thermo.T()).value() << endl; + } } - - thermo.correct(); - - Info<< "Min/max T:" << min(thermo.T()).value() << ' ' - << max(thermo.T()).value() << endl; } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/Make/options index 4662932e47..566ee29621 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/Make/options +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/Make/options @@ -7,6 +7,7 @@ EXE_INC = \ -I${phaseSystem}/twoPhaseCompressibleTurbulenceModels/lnInclude \ -I${phaseSystem}/multiphaseSystem/lnInclude \ -I./fluid \ + -I./solid \ -I../solid \ -I../fluid \ -I../include \ diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/solid/solveSolid.H new file mode 100644 index 0000000000..791e0d6405 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionTwoPhaseEulerFoam/solid/solveSolid.H @@ -0,0 +1,39 @@ +if (finalIter) +{ + mesh.data::add("finalIteration", true); +} + +{ + for (int nonOrth=0; nonOrth<=nNonOrthCorr; ++nonOrth) + { + fvScalarMatrix hEqn + ( + fvm::ddt(betav*rho, h) + - ( + thermo.isotropic() + ? fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)") + : fvm::laplacian(betav*taniAlpha(), h, "laplacian(alpha,h)") + ) + == + fvOptions(rho, h) + ); + + hEqn.relax(); + + fvOptions.constrain(hEqn); + + hEqn.solve(mesh.solver(h.select(finalIter))); + + fvOptions.correct(h); + } + + thermo.correct(); + + Info<< "Min/max T:" << min(thermo.T()).value() << ' ' + << max(thermo.T()).value() << endl; +} + +if (finalIter) +{ + mesh.data::remove("finalIteration"); +} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H index 8f30905c40..39d238abce 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H @@ -27,13 +27,19 @@ fvOptions.constrain(EEqn); - EEqn.solve(mesh.solver(he.select(finalIter))); + if (coupled) + { + fvMatrixAssemblyPtr->addFvMatrix(EEqn); + } + else + { + EEqn.solve(mesh.solver(he.select(finalIter))); + fvOptions.correct(he); - fvOptions.correct(he); + thermo.correct(); + rad.correct(); - thermo.correct(); - rad.correct(); - - Info<< "Min/max T:" << min(thermo.T()).value() << ' ' - << max(thermo.T()).value() << endl; + Info<< "Min/max T:" << min(thermo.T()).value() << ' ' + << max(thermo.T()).value() << endl; + } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H index 9b5ce0e396..65654eeefe 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H @@ -2,7 +2,7 @@ MRF.correctBoundaryVelocity(U); - tmp tUEqn + UEqn = ( fvm::ddt(rho, U) + fvm::div(phi, U) + MRF.DDt(rho, U) @@ -10,7 +10,6 @@ == fvOptions(rho, U) ); - fvVectorMatrix& UEqn = tUEqn.ref(); UEqn.relax(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H index 1c9db4f887..826e27720e 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H @@ -16,6 +16,8 @@ PtrList::fieldTable> fieldsFluid(fluidRegions.size()); PtrList QdotFluid(fluidRegions.size()); +PtrList UEqFluid(fluidRegions.size()); + List initialMassFluid(fluidRegions.size()); List frozenFlowFluid(fluidRegions.size(), false); @@ -293,6 +295,12 @@ forAll(fluidRegions, i) new fv::options(fluidRegions[i]) ); + UEqFluid.set + ( + i, + new fvVectorMatrix(UFluid[i], dimForce) + ); + turbulenceFluid[i].validate(); pRefCellFluid[i] = -1; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H index d7710d085d..4b1ade67e8 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H @@ -49,6 +49,8 @@ IOMRFZoneList& MRF = MRFfluid[i]; fv::options& fvOptions = fluidFvOptions[i]; + fvVectorMatrix& UEqn = UEqFluid[i]; + const dimensionedScalar initialMass ( "initialMass", diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/solveFluid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/solveFluid.H index d4d18e9fdd..d111ffd366 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/solveFluid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/solveFluid.H @@ -18,15 +18,20 @@ else #include "YEqn.H" #include "EEqn.H" - // --- PISO loop - for (int corr=0; corr> fvMatrixAssemblyPtr; + +forAll(fluidRegions, i) +{ + const rhoThermo& thermo = refCast(thermoFluid[i]); + const auto& bpsi = thermo.T().boundaryField(); + + forAll (bpsi, patchI) + { + if (bpsi[patchI].useImplicit()) + { + coupled = true; + } + } +} + +forAll(solidRegions, i) +{ + solidThermo& thermo = thermos[i]; + const auto& bpsi = thermo.T().boundaryField(); + + forAll (bpsi, patchI) + { + if (bpsi[patchI].useImplicit()) + { + coupled = true; + } + } +} + +forAll(fluidRegions, i) +{ + const rhoThermo& thermo = refCast(thermoFluid[i]); + if (coupled) + { + Info << "Create fvMatrixAssembly." << endl; + fvMatrixAssemblyPtr.reset + ( + new fvMatrix + ( + thermo.he(), + dimEnergy/dimTime + ) + ); + break; + } +} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H index 791e0d6405..913d20bce6 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H @@ -1,39 +1,45 @@ -if (finalIter) { - mesh.data::add("finalIteration", true); -} + fvScalarMatrix hEqn + ( + fvm::ddt(betav*rho, h) + - ( + thermo.isotropic() + ? fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)") + : fvm::laplacian(betav*taniAlpha(), h, "laplacian(alpha,h)") + ) + == + fvOptions(rho, h) + ); -{ - for (int nonOrth=0; nonOrth<=nNonOrthCorr; ++nonOrth) + hEqn.relax(); + + fvOptions.constrain(hEqn); + + if (coupled) { - fvScalarMatrix hEqn - ( - fvm::ddt(betav*rho, h) - - ( - thermo.isotropic() - ? fvm::laplacian(betav*thermo.alpha(), h, "laplacian(alpha,h)") - : fvm::laplacian(betav*taniAlpha(), h, "laplacian(alpha,h)") - ) - == - fvOptions(rho, h) - ); + fvMatrixAssemblyPtr->addFvMatrix(hEqn); + } + else + { + Info<< "\nSolving for solid region "<< solidRegions[i].name() << endl; - hEqn.relax(); - - fvOptions.constrain(hEqn); + if (finalIter) + { + mesh.data::add("finalIteration", true); + } hEqn.solve(mesh.solver(h.select(finalIter))); fvOptions.correct(h); + + thermo.correct(); + + Info<< "Min/max T:" << min(thermo.T()).value() << ' ' + << max(thermo.T()).value() << endl; + + if (finalIter) + { + mesh.data::remove("finalIteration"); + } } - - thermo.correct(); - - Info<< "Min/max T:" << min(thermo.T()).value() << ' ' - << max(thermo.T()).value() << endl; -} - -if (finalIter) -{ - mesh.data::remove("finalIteration"); } diff --git a/applications/solvers/incompressible/pimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pEqn.H index d1c090f7d1..35182c9415 100644 --- a/applications/solvers/incompressible/pimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pEqn.H @@ -11,6 +11,7 @@ else phiHbyA += MRF.zeroFilter(fvc::interpolate(rAU)); } + MRF.makeRelative(phiHbyA); if (p.needReference()) diff --git a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/Make/options b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/Make/options index 98ce2f9477..b9fc8596f5 100644 --- a/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/Make/options +++ b/applications/solvers/multiphase/interCondensatingEvaporatingFoam/temperaturePhaseChangeTwoPhaseMixtures/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ @@ -9,6 +10,7 @@ EXE_INC = \ LIB_LIBS = \ -lfiniteVolume \ + -lmeshTools \ -lgeometricVoF \ -ltwoPhaseMixture \ -linterfaceProperties \ diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Make/options b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Make/options index 2e61e4ba77..6f70f673dc 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Make/options +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude @@ -8,4 +9,5 @@ LIB_LIBS = \ -ltwoPhaseMixture \ -ltwoPhaseProperties \ -lincompressibleTransportModels \ - -lfiniteVolume + -lfiniteVolume \ + -lmeshTools diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index f37def5122..1af3509c2f 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -431,6 +431,7 @@ $(lduAddressing)/lduAddressing.C $(lduAddressing)/lduInterface/lduInterface.C $(lduAddressing)/lduInterface/processorLduInterface.C $(lduAddressing)/lduInterface/cyclicLduInterface.C +$(lduAddressing)/lduInterface/lduPrimitiveProcessorInterface.C lduInterfaceFields = $(lduAddressing)/lduInterfaceFields $(lduInterfaceFields)/lduInterfaceField/lduInterfaceField.C diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H index c9d138baa5..404a5a34a5 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H @@ -48,8 +48,7 @@ SourceFiles namespace Foam { -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - +// Forward declarations class lduMatrix; /*---------------------------------------------------------------------------*\ @@ -101,6 +100,8 @@ public: ( Field&, const bool add, + const lduAddressing&, + const label interfacei, const Field&, const scalarField&, const Pstream::commsTypes commsType @@ -115,6 +116,8 @@ public: ( Field&, const bool add, + const lduAddressing&, + const label interfacei, const Field&, const scalarField&, const Pstream::commsTypes commsType diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C index 3d6aed4ca5..d549f2e73a 100644 --- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C +++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -53,6 +54,8 @@ void Foam::LduMatrix::initMatrixInterfaces ( result, add, + lduMesh_.lduAddr(), + interfacei, psiif, interfaceCoeffs[interfacei], //Amultiplier(interfaceCoeffs[interfacei]), @@ -80,6 +83,8 @@ void Foam::LduMatrix::initMatrixInterfaces ( result, add, + lduMesh_.lduAddr(), + interfacei, psiif, interfaceCoeffs[interfacei], //Amultiplier(interfaceCoeffs[interfacei]), @@ -128,6 +133,8 @@ void Foam::LduMatrix::updateMatrixInterfaces ( result, add, + lduMesh_.lduAddr(), + interfacei, psiif, interfaceCoeffs[interfacei], //Amultiplier(interfaceCoeffs[interfacei]), @@ -153,6 +160,8 @@ void Foam::LduMatrix::updateMatrixInterfaces ( result, add, + lduMesh_.lduAddr(), + interfacei, psiif, interfaceCoeffs[interfacei], //Amultiplier(interfaceCoeffs[interfacei]), @@ -165,6 +174,8 @@ void Foam::LduMatrix::updateMatrixInterfaces ( result, add, + lduMesh_.lduAddr(), + interfacei, psiif, interfaceCoeffs[interfacei], //Amultiplier(interfaceCoeffs[interfacei]), @@ -189,6 +200,8 @@ void Foam::LduMatrix::updateMatrixInterfaces ( result, add, + lduMesh_.lduAddr(), + interfacei, psiif, interfaceCoeffs[interfacei], //Amultiplier(interfaceCoeffs[interfacei]), diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H index 430322a993..25ea7c1dae 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H @@ -72,6 +72,7 @@ public: // Member Functions + // Access //- Return faceCell addressing @@ -87,6 +88,14 @@ public: const labelUList& internalData ) const = 0; + //- Return the values of the given internal data adjacent to + //- the interface as a field using faceCell mapping + virtual tmp interfaceInternalField + ( + const labelUList& internalData, + const labelUList& faceCells + ) const = 0; + //- Initialise transfer of internal field adjacent to the interface virtual void initInternalFieldTransfer ( @@ -95,12 +104,23 @@ public: ) const {} + //- Initialise transfer of internal field adjacent to the interface + //- using faceCells mapping + virtual void initInternalFieldTransfer + ( + const Pstream::commsTypes commsType, + const labelUList& iF, + const labelUList& faceCells + ) const + {} + //- Transfer and return internal field adjacent to the interface virtual tmp internalFieldTransfer ( const Pstream::commsTypes commsType, const labelUList& iF ) const = 0; + }; diff --git a/src/overset/lduPrimitiveProcessorInterface/lduPrimitiveProcessorInterface.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduPrimitiveProcessorInterface.C similarity index 78% rename from src/overset/lduPrimitiveProcessorInterface/lduPrimitiveProcessorInterface.C rename to src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduPrimitiveProcessorInterface.C index 13ca7bff6c..2df7eeec30 100644 --- a/src/overset/lduPrimitiveProcessorInterface/lduPrimitiveProcessorInterface.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduPrimitiveProcessorInterface.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2017 OpenCFD Ltd. + Copyright (C) 2016-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -65,11 +65,23 @@ Foam::lduPrimitiveProcessorInterface::interfaceInternalField const labelUList& internalData ) const { - tmp tfld(new labelField(faceCells_.size())); - labelField& fld = tfld.ref(); - forAll(faceCells_, i) + return interfaceInternalField(internalData, faceCells_); +} + + +Foam::tmp +Foam::lduPrimitiveProcessorInterface::interfaceInternalField +( + const labelUList& internalData, + const labelUList& faceCells +) const +{ + auto tfld = tmp::New(faceCells.size()); + auto& fld = tfld.ref(); + + forAll(faceCells, i) { - fld[i] = internalData[faceCells_[i]]; + fld[i] = internalData[faceCells[i]]; } return tfld; } @@ -85,6 +97,21 @@ void Foam::lduPrimitiveProcessorInterface::initInternalFieldTransfer } +void Foam::lduPrimitiveProcessorInterface::initInternalFieldTransfer +( + const Pstream::commsTypes commsType, + const labelUList& iF, + const labelUList& faceCells +) const +{ + processorLduInterface::send + ( + commsType, + interfaceInternalField(iF, faceCells)() + ); +} + + Foam::tmp Foam::lduPrimitiveProcessorInterface::internalFieldTransfer ( @@ -95,5 +122,4 @@ Foam::lduPrimitiveProcessorInterface::internalFieldTransfer return processorLduInterface::receive