From 24a3bfdd17e1a69fcfc16453909cca5b5f9ee99a Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 19 Mar 2024 16:19:43 +0000 Subject: [PATCH] DimensionedField, GeometricField: Consistent field-access interface --- .../legacy/combustion/PDRFoam/StCorr.H | 9 +- .../legacy/combustion/PDRFoam/StCourantNo.H | 8 +- .../shallowWaterFoam/CourantNo.H | 10 +- applications/modules/VoFSolver/setRDeltaT.C | 5 +- .../modules/XiFluid/thermophysicalPredictor.C | 11 +- .../modules/fluidSolver/fluidSolver.C | 14 ++- .../modules/incompressibleFluid/setRDeltaT.C | 5 +- .../curvatureSeparation/curvatureSeparation.C | 7 +- .../filmCloudTransfer/filmCloudTransfer.C | 6 +- .../modules/isothermalFilm/isothermalFilm.C | 8 +- .../isothermalFilm/momentumPredictor.C | 5 +- .../modules/isothermalFluid/isothermalFluid.C | 4 +- .../modules/isothermalFluid/setRDeltaT.C | 16 +-- .../modules/multicomponentFluid/setRDeltaT.C | 18 +-- .../interfaceTurbulenceDamping.C | 4 +- .../dragModels/segregated/segregated.C | 4 +- .../cavitation/cavitation.C | 7 +- .../modules/multiphaseEuler/multiphaseEuler.C | 8 +- .../modules/multiphaseEuler/setRDeltaT.C | 5 +- .../multiphaseVoFSolver/multiphaseVoFSolver.C | 9 +- .../multiphaseVoFSolver/setInterfaceRDeltaT.C | 17 +-- .../modules/shockFluid/pressureCorrector.C | 4 +- applications/modules/shockFluid/setRDeltaT.C | 5 +- applications/modules/shockFluid/shockFluid.C | 9 +- .../twoPhaseVoFSolver/setInterfaceRDeltaT.C | 19 ++-- .../twoPhaseVoFSolver/twoPhaseVoFSolver.C | 9 +- .../decomposePar/fvFieldDecomposerTemplates.C | 4 +- .../fvFieldReconstructorTemplates.C | 4 +- .../LESfilters/laplaceFilter/laplaceFilter.C | 6 +- .../SpalartAllmarasDES/SpalartAllmarasDES.C | 5 +- .../epsilonWallFunctionFvPatchScalarField.C | 4 +- .../omegaWallFunctionFvPatchScalarField.C | 4 +- src/OpenFOAM/algorithms/subCycle/subCycle.H | 6 +- .../DimensionedField/DimensionedField.C | 14 ++- .../DimensionedField/DimensionedField.H | 8 +- .../DimensionedFieldFunctions.C | 80 +++++++++---- .../DimensionedFieldFunctionsM.C | 106 ++++++++++++++---- .../DimensionedField/DimensionedFieldI.H | 13 +-- .../DimensionedScalarField.C | 82 ++++++++++---- .../fields/Fields/UniformField/UniformField.H | 4 +- .../Fields/UniformField/UniformFieldI.H | 4 +- .../fields/Fields/oneField/oneField.H | 4 +- .../fields/Fields/oneField/oneFieldI.H | 4 +- .../fields/Fields/zeroField/zeroField.H | 9 +- .../fields/Fields/zeroField/zeroFieldI.H | 4 +- .../GeometricField/GeometricField.C | 44 ++++---- .../GeometricField/GeometricField.H | 12 +- .../GeometricField/MapGeometricFields.H | 4 +- .../geometricOneField/geometricOneField.H | 9 +- .../geometricOneField/geometricOneFieldI.H | 19 ++-- .../geometricZeroField/geometricZeroField.H | 22 +++- .../geometricZeroField/geometricZeroFieldI.H | 32 +++++- .../compressible/compressibleCourantNo.H | 8 +- .../cfdTools/incompressible/CourantNo.H | 8 +- .../CrankNicolsonDdtScheme.C | 6 +- .../finiteVolume/fvc/fvcVolumeIntegrate.C | 6 +- src/finiteVolume/finiteVolume/fvm/fvmSup.C | 10 +- .../fvMatrices/fvMatrix/fvMatrix.C | 69 +++++++----- .../solvers/MULES/CMULESTemplates.C | 26 ++--- .../fvMatrices/solvers/MULES/MULESTemplates.C | 40 +++---- src/finiteVolume/fvMesh/fvMesh.C | 4 +- .../fvMeshStitcher/fvMeshStitcher.C | 4 +- .../schemes/cellCoBlended/cellCoBlended.H | 6 +- .../field/CourantNo/CourantNo.C | 4 +- .../field/writeCellVolumes/writeCellVolumes.C | 4 +- .../fvMeshDistributorsLoadBalancer.C | 8 +- .../moving/fvMeshStitchersMoving.C | 10 +- .../derived/phaseChange/phaseChange.C | 2 +- .../zeroDimensionalMassSourceBase.C | 6 +- .../Templates/MomentumCloud/MomentumCloud.C | 6 +- .../Templates/ReactingCloud/ReactingCloud.C | 4 +- .../Templates/ThermoCloud/ThermoCloud.C | 12 +- .../Templates/ThermoCloud/ThermoCloudI.H | 6 +- .../fvMeshDistribute/fvMeshDistribute.C | 4 +- .../function1Temperature.C | 4 +- src/twoPhaseModels/VoF/alphaCourantNo.H | 9 +- .../temperatureDependentSurfaceTension.C | 4 +- .../twoPhaseMixture/twoPhaseMixture.C | 4 +- 78 files changed, 630 insertions(+), 377 deletions(-) diff --git a/applications/legacy/combustion/PDRFoam/StCorr.H b/applications/legacy/combustion/PDRFoam/StCorr.H index 364279b81d..3dc83a2e98 100644 --- a/applications/legacy/combustion/PDRFoam/StCorr.H +++ b/applications/legacy/combustion/PDRFoam/StCorr.H @@ -3,7 +3,12 @@ if (ign.igniting()) { // Calculate volume of ignition kernel - dimensionedScalar Vk("Vk", dimVolume, gSum(c*mesh.V().field())); + dimensionedScalar Vk + ( + "Vk", + dimVolume, + gSum(c*mesh.V().primitiveField()) + ); dimensionedScalar Ak("Ak", dimArea, 0.0); if (Vk.value() > small) @@ -78,7 +83,7 @@ ( fvc::div(nf, b, "div(phiSt,b)") - b*fvc::div(nf) + dMgb ); - dimensionedScalar AkEst = gSum(mgb*mesh.V().field()); + dimensionedScalar AkEst = gSum(mgb*mesh.V().primitiveField()); StCorr.value() = max(min((Ak/AkEst).value(), 10.0), 1.0); diff --git a/applications/legacy/combustion/PDRFoam/StCourantNo.H b/applications/legacy/combustion/PDRFoam/StCourantNo.H index 378451dee1..098fc6819f 100644 --- a/applications/legacy/combustion/PDRFoam/StCourantNo.H +++ b/applications/legacy/combustion/PDRFoam/StCourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,10 +36,12 @@ Description /rho.primitiveField() ); - StCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + StCoNum = 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue(); const scalar meanStCoNum = - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + 0.5 + *(gSum(sumPhi)/gSum(mesh.V().primitiveField())) + *runTime.deltaTValue(); Info<< "St courant Number mean: " << meanStCoNum << " max: " << StCoNum << endl; diff --git a/applications/legacy/incompressible/shallowWaterFoam/CourantNo.H b/applications/legacy/incompressible/shallowWaterFoam/CourantNo.H index 811c72ef9e..bf538ed9ef 100644 --- a/applications/legacy/incompressible/shallowWaterFoam/CourantNo.H +++ b/applications/legacy/incompressible/shallowWaterFoam/CourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,10 +37,12 @@ Description ); const scalar CoNum = - 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue(); const scalar meanCoNum = - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + 0.5 + *(gSum(sumPhi)/gSum(mesh.V().primitiveField())) + *runTime.deltaTValue(); // Gravity wave Courant number const scalar waveCoNum = 0.25*gMax @@ -48,7 +50,7 @@ Description fvc::surfaceSum ( fvc::interpolate(sqrt(h))*mesh.magSf() - )().primitiveField()/mesh.V().field() + )().primitiveField()/mesh.V().primitiveField() )*sqrt(magg).value()*runTime.deltaTValue(); Info<< "Courant number mean: " << meanCoNum diff --git a/applications/modules/VoFSolver/setRDeltaT.C b/applications/modules/VoFSolver/setRDeltaT.C index 451aac7410..94f97bbe02 100644 --- a/applications/modules/VoFSolver/setRDeltaT.C +++ b/applications/modules/VoFSolver/setRDeltaT.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,7 +42,8 @@ void Foam::solvers::VoFSolver::setRDeltaT() const volScalarField rDeltaT0("rDeltaT0", rDeltaT); // Set the reciprocal time-step from the local Courant number - rDeltaT.ref() = fvc::surfaceSum(mag(phi))()()/((2*maxCo)*mesh.V()); + rDeltaT.internalFieldRef() = + fvc::surfaceSum(mag(phi))()()/((2*maxCo)*mesh.V()); // Clip to user-defined maximum and minimum time-steps scalar minRDeltaT = gMin(rDeltaT.primitiveField()); diff --git a/applications/modules/XiFluid/thermophysicalPredictor.C b/applications/modules/XiFluid/thermophysicalPredictor.C index 15a325eedc..077a776d3d 100644 --- a/applications/modules/XiFluid/thermophysicalPredictor.C +++ b/applications/modules/XiFluid/thermophysicalPredictor.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,7 +69,12 @@ Foam::dimensionedScalar Foam::solvers::XiFluid::StCorr if (ign.igniting()) { // Calculate volume of ignition kernel - const dimensionedScalar Vk("Vk", dimVolume, gSum(c*mesh.V().field())); + const dimensionedScalar Vk + ( + "Vk", + dimVolume, + gSum(c*mesh.V().primitiveField()) + ); dimensionedScalar Ak("Ak", dimArea, 0.0); if (Vk.value() > small) @@ -144,7 +149,7 @@ Foam::dimensionedScalar Foam::solvers::XiFluid::StCorr ( fvc::div(nf, b, "div(phiSt,b)") - b*fvc::div(nf) + dMgb ); - const dimensionedScalar AkEst = gSum(mgb*mesh.V().field()); + const dimensionedScalar AkEst = gSum(mgb*mesh.V().primitiveField()); StCorr.value() = max(min((Ak/AkEst).value(), 10.0), 1.0); diff --git a/applications/modules/fluidSolver/fluidSolver.C b/applications/modules/fluidSolver/fluidSolver.C index ad13d91d25..5696574bb3 100644 --- a/applications/modules/fluidSolver/fluidSolver.C +++ b/applications/modules/fluidSolver/fluidSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -89,12 +89,14 @@ void Foam::solvers::fluidSolver::meshCourantNo() const const scalar meshCoNum ( - 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue() + 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue() ); const scalar meanMeshCoNum ( - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue() + 0.5 + *(gSum(sumPhi)/gSum(mesh.V().primitiveField())) + *runTime.deltaTValue() ); Info<< "Mesh Courant Number mean: " << meanMeshCoNum @@ -115,10 +117,12 @@ void Foam::solvers::fluidSolver::correctCoNum fvc::surfaceSum(mag(phi))().primitiveField()/rho.primitiveField() ); - CoNum_ = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + CoNum_ = 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue(); const scalar meanCoNum = - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + 0.5 + *(gSum(sumPhi)/gSum(mesh.V().primitiveField())) + *runTime.deltaTValue(); Info<< "Courant Number mean: " << meanCoNum << " max: " << CoNum << endl; diff --git a/applications/modules/incompressibleFluid/setRDeltaT.C b/applications/modules/incompressibleFluid/setRDeltaT.C index ab29885de9..237cf87617 100644 --- a/applications/modules/incompressibleFluid/setRDeltaT.C +++ b/applications/modules/incompressibleFluid/setRDeltaT.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,7 +53,8 @@ void Foam::solvers::incompressibleFluid::setRDeltaT() const volScalarField rDeltaT0("rDeltaT0", rDeltaT); // Set the reciprocal time-step from the local Courant number - rDeltaT.ref() = fvc::surfaceSum(mag(phi))()()/((2*maxCo)*mesh.V()); + rDeltaT.internalFieldRef() = + fvc::surfaceSum(mag(phi))()()/((2*maxCo)*mesh.V()); // Clip to user-defined maximum and minimum time-steps scalar minRDeltaT = gMin(rDeltaT.primitiveField()); diff --git a/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/ejectionModels/curvatureSeparation/curvatureSeparation.C b/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/ejectionModels/curvatureSeparation/curvatureSeparation.C index dc15f10a6a..35468c787f 100644 --- a/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/ejectionModels/curvatureSeparation/curvatureSeparation.C +++ b/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/ejectionModels/curvatureSeparation/curvatureSeparation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,7 +52,10 @@ tmp curvatureSeparation::calcInvR1 const volVectorField& U ) const { - const vectorField UHat(U.field()/(mag(U.field()) + rootVSmall)); + const vectorField UHat + ( + U.primitiveField()/(mag(U.primitiveField()) + rootVSmall) + ); tmp tinvR1(-(UHat & (UHat & gradNHat_))); scalarField& invR1 = tinvR1.ref(); diff --git a/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/filmCloudTransfer.C b/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/filmCloudTransfer.C index 33210e4e21..be07bd4110 100644 --- a/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/filmCloudTransfer.C +++ b/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/filmCloudTransfer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -124,8 +124,8 @@ inline Foam::fv::filmCloudTransfer::CloudToFilmTransferRate prop/cloudMesh.boundary()[cloudPatchi].magSf() ); - tSu.ref().field() /= film_.VbyA; - tSu.ref().field() /= mesh().time().deltaTValue(); + tSu.ref().primitiveFieldRef() /= film_.VbyA; + tSu.ref().primitiveFieldRef() /= mesh().time().deltaTValue(); } return tSu; diff --git a/applications/modules/isothermalFilm/isothermalFilm.C b/applications/modules/isothermalFilm/isothermalFilm.C index ce87917979..fb65659957 100644 --- a/applications/modules/isothermalFilm/isothermalFilm.C +++ b/applications/modules/isothermalFilm/isothermalFilm.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -172,10 +172,12 @@ void Foam::solvers::isothermalFilm::correctCoNum() { const scalarField sumPhi(fvc::surfaceSum(mag(phi))().primitiveField()); - CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + CoNum = 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue(); const scalar meanCoNum = - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + 0.5 + *(gSum(sumPhi)/gSum(mesh.V().primitiveField())) + *runTime.deltaTValue(); Info<< "Courant Number mean: " << meanCoNum << " max: " << CoNum << endl; diff --git a/applications/modules/isothermalFilm/momentumPredictor.C b/applications/modules/isothermalFilm/momentumPredictor.C index db3cdbd708..f51723ea27 100644 --- a/applications/modules/isothermalFilm/momentumPredictor.C +++ b/applications/modules/isothermalFilm/momentumPredictor.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -78,7 +78,8 @@ Foam::solvers::isothermalFilm::pe() const // Add the pressure caused normal momentum sources (e.g., parcels impinging // with a normal velocity) - p.ref() += VbyA*(nHat & (fvModels().source(alpha, rho, U) & U)); + p.internalFieldRef() += + VbyA*(nHat & (fvModels().source(alpha, rho, U) & U)); return p; } diff --git a/applications/modules/isothermalFluid/isothermalFluid.C b/applications/modules/isothermalFluid/isothermalFluid.C index 4d13684207..d8bac748b6 100644 --- a/applications/modules/isothermalFluid/isothermalFluid.C +++ b/applications/modules/isothermalFluid/isothermalFluid.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -316,7 +316,7 @@ void Foam::solvers::isothermalFluid::preSolve() for (label i = 1; i <= rhoUf().nOldTimes(false); ++ i) { - rhoU().oldTime(i) == rho.oldTime(i)*U.oldTime(i); + rhoU().oldTimeRef(i) == rho.oldTime(i)*U.oldTime(i); } } diff --git a/applications/modules/isothermalFluid/setRDeltaT.C b/applications/modules/isothermalFluid/setRDeltaT.C index e09fb6d1c4..da960f47b6 100644 --- a/applications/modules/isothermalFluid/setRDeltaT.C +++ b/applications/modules/isothermalFluid/setRDeltaT.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,18 +51,20 @@ void Foam::solvers::isothermalFluid::setRDeltaT() const volScalarField rDeltaT0("rDeltaT0", rDeltaT); // Set the reciprocal time-step from the local Courant number - rDeltaT.ref() = fvc::surfaceSum(mag(phi))()()/((2*maxCo)*mesh.V()*rho()); + rDeltaT.internalFieldRef() = + fvc::surfaceSum(mag(phi))()()/((2*maxCo)*mesh.V()*rho()); // Set the reciprocal time-step from the local acoustic Courant number if (pimple.transonic()) { surfaceScalarField phid("phid", fvc::interpolate(psi)*fvc::flux(U)); - rDeltaT.ref() = max - ( - rDeltaT(), - fvc::surfaceSum(mag(phid))()()/((2*maxCo)*mesh.V()*psi()) - ); + rDeltaT.internalFieldRef() = + max + ( + rDeltaT(), + fvc::surfaceSum(mag(phid))()()/((2*maxCo)*mesh.V()*psi()) + ); } // Clip to user-defined maximum and minimum time-steps diff --git a/applications/modules/multicomponentFluid/setRDeltaT.C b/applications/modules/multicomponentFluid/setRDeltaT.C index e02cc8f729..51a8d59723 100644 --- a/applications/modules/multicomponentFluid/setRDeltaT.C +++ b/applications/modules/multicomponentFluid/setRDeltaT.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,7 +45,7 @@ void Foam::solvers::multicomponentFluid::setRDeltaT() const scalar maxCo(pimpleDict.lookup("maxCo")); // Set the reciprocal time-step from the local Courant number - rDeltaT.ref() = + rDeltaT.internalFieldRef() = fvc::surfaceSum(mag(phi))()()/((2*maxCo)*mesh.V()*rho()); // Clip to user-defined maximum and minimum time-steps @@ -80,10 +80,10 @@ void Foam::solvers::multicomponentFluid::setRDeltaT() ); Info<< " Temperature = " - << 1/(gMax(rDeltaTT.field()) + vSmall) << ", " - << 1/(gMin(rDeltaTT.field()) + vSmall) << endl; + << 1/(gMax(rDeltaTT.primitiveField()) + vSmall) << ", " + << 1/(gMin(rDeltaTT.primitiveField()) + vSmall) << endl; - rDeltaT.ref() = max(rDeltaT(), rDeltaTT); + rDeltaT.internalFieldRef() = max(rDeltaT(), rDeltaTT); } // Reaction rate time scale @@ -120,7 +120,7 @@ void Foam::solvers::multicomponentFluid::setRDeltaT() foundY = true; scalar Yrefi = Yref.lookup(Yi.name()); - rDeltaTY.field() = max + rDeltaTY.primitiveFieldRef() = max ( mag ( @@ -136,10 +136,10 @@ void Foam::solvers::multicomponentFluid::setRDeltaT() if (foundY) { Info<< " Composition = " - << 1/(gMax(rDeltaTY.field()) + vSmall) << ", " - << 1/(gMin(rDeltaTY.field()) + vSmall) << endl; + << 1/(gMax(rDeltaTY.primitiveField()) + vSmall) << ", " + << 1/(gMin(rDeltaTY.primitiveField()) + vSmall) << endl; - rDeltaT.ref() = max(rDeltaT(), rDeltaTY); + rDeltaT.internalFieldRef() = max(rDeltaT(), rDeltaTY); } else { diff --git a/applications/modules/multiphaseEuler/fvModels/interfaceTurbulenceDamping/interfaceTurbulenceDamping.C b/applications/modules/multiphaseEuler/fvModels/interfaceTurbulenceDamping/interfaceTurbulenceDamping.C index 59906ba33b..21272fb4c5 100644 --- a/applications/modules/multiphaseEuler/fvModels/interfaceTurbulenceDamping/interfaceTurbulenceDamping.C +++ b/applications/modules/multiphaseEuler/fvModels/interfaceTurbulenceDamping/interfaceTurbulenceDamping.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -110,7 +110,7 @@ Foam::fv::interfaceTurbulenceDamping::interfaceFraction } } - scalarField& a = A.field(); + scalarField& a = A.primitiveFieldRef(); forAll(a, i) { if (sumnSf[i] > small) diff --git a/applications/modules/multiphaseEuler/interfacialModels/dragModels/segregated/segregated.C b/applications/modules/multiphaseEuler/interfacialModels/dragModels/segregated/segregated.C index c4277bfe5c..7733c82f89 100644 --- a/applications/modules/multiphaseEuler/interfacialModels/dragModels/segregated/segregated.C +++ b/applications/modules/multiphaseEuler/interfacialModels/dragModels/segregated/segregated.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -148,7 +148,7 @@ Foam::tmp Foam::dragModels::segregated::K() const ) ); - tK.ref().ref() = lambda*sqr(magGradI)*muI; + tK.ref().internalFieldRef() = lambda*sqr(magGradI)*muI; tK.ref().correctBoundaryConditions(); return tK; diff --git a/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/cavitation/cavitation.C b/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/cavitation/cavitation.C index 4a17c4a719..61a2e798b1 100644 --- a/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/cavitation/cavitation.C +++ b/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/cavitation/cavitation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -91,7 +91,8 @@ Foam::phaseTransferModels::cavitation::dmdtf() const const volScalarField::Internal pSat1(cavitation_->pSat1()); const volScalarField::Internal pSat2(cavitation_->pSat2()); - tResult.ref().ref() = coeffs[0]*(p - pSat1) - coeffs[1]*(p - pSat2); + tResult.ref().internalFieldRef() = + coeffs[0]*(p - pSat1) - coeffs[1]*(p - pSat2); tResult.ref().correctBoundaryConditions(); return tResult; @@ -112,7 +113,7 @@ Foam::phaseTransferModels::cavitation::d2mdtdpf() const const Pair> coeffs(cavitation_->mDot12P()); - tResult.ref().ref() = coeffs[0] - coeffs[1]; + tResult.ref().internalFieldRef() = coeffs[0] - coeffs[1]; tResult.ref().correctBoundaryConditions(); return tResult; diff --git a/applications/modules/multiphaseEuler/multiphaseEuler.C b/applications/modules/multiphaseEuler/multiphaseEuler.C index e85fd97096..9960eaa089 100644 --- a/applications/modules/multiphaseEuler/multiphaseEuler.C +++ b/applications/modules/multiphaseEuler/multiphaseEuler.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -82,10 +82,12 @@ void Foam::solvers::multiphaseEuler::correctCoNum() ); } - CoNum_ = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + CoNum_ = 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue(); const scalar meanCoNum = - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + 0.5 + *(gSum(sumPhi)/gSum(mesh.V().primitiveField())) + *runTime.deltaTValue(); Info<< "Courant Number mean: " << meanCoNum << " max: " << CoNum << endl; diff --git a/applications/modules/multiphaseEuler/setRDeltaT.C b/applications/modules/multiphaseEuler/setRDeltaT.C index cfd37ec593..e3a3f11b75 100644 --- a/applications/modules/multiphaseEuler/setRDeltaT.C +++ b/applications/modules/multiphaseEuler/setRDeltaT.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,7 +53,8 @@ void Foam::solvers::multiphaseEuler::setRDeltaT() } // Set the reciprocal time-step from the local Courant number - rDeltaT.ref() = fvc::surfaceSum(maxPhi)()()/((2*maxCo)*mesh.V()); + rDeltaT.internalFieldRef() = + fvc::surfaceSum(maxPhi)()()/((2*maxCo)*mesh.V()); // Clip to user-defined maximum and minimum time-steps scalar minRDeltaT = gMin(rDeltaT.primitiveField()); diff --git a/applications/modules/multiphaseVoFSolver/multiphaseVoFSolver.C b/applications/modules/multiphaseVoFSolver/multiphaseVoFSolver.C index db22e23815..a5a7d2641a 100644 --- a/applications/modules/multiphaseVoFSolver/multiphaseVoFSolver.C +++ b/applications/modules/multiphaseVoFSolver/multiphaseVoFSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,10 +50,13 @@ void Foam::solvers::multiphaseVoFSolver::correctCoNum() *fvc::surfaceSum(mag(phi))().primitiveField() ); - alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + alphaCoNum = + 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue(); const scalar meanAlphaCoNum = - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + 0.5 + *(gSum(sumPhi)/gSum(mesh.V().primitiveField())) + *runTime.deltaTValue(); Info<< "Interface Courant Number mean: " << meanAlphaCoNum << " max: " << alphaCoNum << endl; diff --git a/applications/modules/multiphaseVoFSolver/setInterfaceRDeltaT.C b/applications/modules/multiphaseVoFSolver/setInterfaceRDeltaT.C index dbbd736b28..42eda0fe90 100644 --- a/applications/modules/multiphaseVoFSolver/setInterfaceRDeltaT.C +++ b/applications/modules/multiphaseVoFSolver/setInterfaceRDeltaT.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,13 +76,14 @@ void Foam::solvers::multiphaseVoFSolver::setInterfaceRDeltaT { const volScalarField alphaBar(fvc::average(phases[phasei])); - rDeltaT.ref() = max - ( - rDeltaT(), - pos0(alphaBar() - alphaSpreadMin) - *pos0(alphaSpreadMax - alphaBar()) - *alphaCoRdeltaT - ); + rDeltaT.internalFieldRef() = + max + ( + rDeltaT(), + pos0(alphaBar() - alphaSpreadMin) + *pos0(alphaSpreadMax - alphaBar()) + *alphaCoRdeltaT + ); } } diff --git a/applications/modules/shockFluid/pressureCorrector.C b/applications/modules/shockFluid/pressureCorrector.C index 7d93660f3b..24456e7468 100644 --- a/applications/modules/shockFluid/pressureCorrector.C +++ b/applications/modules/shockFluid/pressureCorrector.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,7 +30,7 @@ License void Foam::solvers::shockFluid::pressureCorrector() { const volScalarField& psi = thermo.psi(); - p_.ref() = rho()/psi(); + p_.internalFieldRef() = rho()/psi(); p_.correctBoundaryConditions(); rho_.boundaryFieldRef() == psi.boundaryField()*p.boundaryField(); } diff --git a/applications/modules/shockFluid/setRDeltaT.C b/applications/modules/shockFluid/setRDeltaT.C index 4c5687f220..065a3abb54 100644 --- a/applications/modules/shockFluid/setRDeltaT.C +++ b/applications/modules/shockFluid/setRDeltaT.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,7 +49,8 @@ void Foam::solvers::shockFluid::setRDeltaT(const surfaceScalarField& amaxSf) ); // Set the reciprocal time-step from the local Courant number - rDeltaT.ref() = fvc::surfaceSum(amaxSf)()()/((2*maxCo)*mesh.V()); + rDeltaT.internalFieldRef() = + fvc::surfaceSum(amaxSf)()()/((2*maxCo)*mesh.V()); // Clip to user-defined maximum and minimum time-steps scalar minRDeltaT = gMin(rDeltaT.primitiveField()); diff --git a/applications/modules/shockFluid/shockFluid.C b/applications/modules/shockFluid/shockFluid.C index 16f320402b..d2273b0c23 100644 --- a/applications/modules/shockFluid/shockFluid.C +++ b/applications/modules/shockFluid/shockFluid.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,10 +51,13 @@ void Foam::solvers::shockFluid::correctCoNum(const surfaceScalarField& amaxSf) { const scalarField sumAmaxSf(fvc::surfaceSum(amaxSf)().primitiveField()); - CoNum_ = 0.5*gMax(sumAmaxSf/mesh.V().field())*runTime.deltaTValue(); + CoNum_ = + 0.5*gMax(sumAmaxSf/mesh.V().primitiveField())*runTime.deltaTValue(); const scalar meanCoNum = - 0.5*(gSum(sumAmaxSf)/gSum(mesh.V().field()))*runTime.deltaTValue(); + 0.5 + *(gSum(sumAmaxSf)/gSum(mesh.V().primitiveField())) + *runTime.deltaTValue(); Info<< "Courant Number mean: " << meanCoNum << " max: " << CoNum << endl; diff --git a/applications/modules/twoPhaseVoFSolver/setInterfaceRDeltaT.C b/applications/modules/twoPhaseVoFSolver/setInterfaceRDeltaT.C index 25c9e34767..0a5f18fe2f 100644 --- a/applications/modules/twoPhaseVoFSolver/setInterfaceRDeltaT.C +++ b/applications/modules/twoPhaseVoFSolver/setInterfaceRDeltaT.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,14 +84,15 @@ void Foam::solvers::twoPhaseVoFSolver::setInterfaceRDeltaT volScalarField alpha1Bar(fvc::average(alpha1)); - rDeltaT.ref() = max - ( - rDeltaT(), - pos0(alpha1Bar() - alphaSpreadMin) - *pos0(alphaSpreadMax - alpha1Bar()) - *fvc::surfaceSum(mag(phi))()() - /((2*maxAlphaCo)*mesh.V()) - ); + rDeltaT.internalFieldRef() = + max + ( + rDeltaT(), + pos0(alpha1Bar() - alphaSpreadMin) + *pos0(alphaSpreadMax - alpha1Bar()) + *fvc::surfaceSum(mag(phi))()() + /((2*maxAlphaCo)*mesh.V()) + ); } // Update the boundary values of the reciprocal time-step diff --git a/applications/modules/twoPhaseVoFSolver/twoPhaseVoFSolver.C b/applications/modules/twoPhaseVoFSolver/twoPhaseVoFSolver.C index a4de8544e2..2b5df0711e 100644 --- a/applications/modules/twoPhaseVoFSolver/twoPhaseVoFSolver.C +++ b/applications/modules/twoPhaseVoFSolver/twoPhaseVoFSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,10 +49,13 @@ void Foam::solvers::twoPhaseVoFSolver::correctCoNum() *fvc::surfaceSum(mag(phi))().primitiveField() ); - alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + alphaCoNum = + 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue(); const scalar meanAlphaCoNum = - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + 0.5 + *(gSum(sumPhi)/gSum(mesh.V().primitiveField())) + *runTime.deltaTValue(); Info<< "Interface Courant Number mean: " << meanAlphaCoNum << " max: " << alphaCoNum << endl; diff --git a/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposerTemplates.C b/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposerTemplates.C index f4a6024461..067cacea81 100644 --- a/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposerTemplates.C +++ b/applications/utilities/parallelProcessing/decomposePar/fvFieldDecomposerTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -125,7 +125,7 @@ Foam::fvFieldDecomposer::decomposeVolInternalField ), procMeshes_[proci], field.dimensions(), - Field(field.field(), cellProcAddressing_[proci]) + Field(field.primitiveField(), cellProcAddressing_[proci]) ) ); } diff --git a/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructorTemplates.C b/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructorTemplates.C index 9ef76367c3..2d60474b43 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructorTemplates.C +++ b/applications/utilities/parallelProcessing/reconstructPar/fvFieldReconstructorTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -120,7 +120,7 @@ Foam::fvFieldReconstructor::reconstructVolInternalField // Set the cell values in the reconstructed field internalField.rmap ( - procField.field(), + procField.primitiveField(), cellProcAddressing_[proci] ); } diff --git a/src/MomentumTransportModels/momentumTransportModels/LES/LESfilters/laplaceFilter/laplaceFilter.C b/src/MomentumTransportModels/momentumTransportModels/LES/LESfilters/laplaceFilter/laplaceFilter.C index 5d762f2f1c..9ede998860 100644 --- a/src/MomentumTransportModels/momentumTransportModels/LES/LESfilters/laplaceFilter/laplaceFilter.C +++ b/src/MomentumTransportModels/momentumTransportModels/LES/LESfilters/laplaceFilter/laplaceFilter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,7 +55,7 @@ Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, scalar widthCoeff) calculatedFvPatchScalarField::typeName ) { - coeff_.ref() = pow(mesh.V(), 2.0/3.0)/widthCoeff_; + coeff_.internalFieldRef() = pow(mesh.V(), 2.0/3.0)/widthCoeff_; } @@ -79,7 +79,7 @@ Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, const dictionary& bd) calculatedFvPatchScalarField::typeName ) { - coeff_.ref() = pow(mesh.V(), 2.0/3.0)/widthCoeff_; + coeff_.internalFieldRef() = pow(mesh.V(), 2.0/3.0)/widthCoeff_; } diff --git a/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C b/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C index 9e1e3831e0..e34b9ae7cf 100644 --- a/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C +++ b/src/MomentumTransportModels/momentumTransportModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -413,7 +413,8 @@ tmp SpalartAllmarasDES::k() const dimLength, zeroGradientFvPatchScalarField::typeName ); - dTildaExtrapolated.ref() = dTilda(chi, fv1, fvc::grad(this->U_)); + dTildaExtrapolated.internalFieldRef() = + dTilda(chi, fv1, fvc::grad(this->U_)); dTildaExtrapolated.correctBoundaryConditions(); tmp tk diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index 24464ef2a1..8152aaea22 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -150,8 +150,8 @@ void Foam::epsilonWallFunctionFvPatchScalarField::updateCoeffsMaster() UIndirectList(G, wallCells()) = (1 - wallCellFraction())*scalarField(G, wallCells()) + wallCellFraction()*wallCellGPtr_(); - UIndirectList(epsilon.ref(), wallCells()) = - (1 - wallCellFraction())*scalarField(epsilon.ref(), wallCells()) + UIndirectList(epsilon, wallCells()) = + (1 - wallCellFraction())*scalarField(epsilon, wallCells()) + wallCellFraction()*wallCellEpsilonPtr_(); } diff --git a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index d7bd28de9a..1d44b7e3f1 100644 --- a/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/MomentumTransportModels/momentumTransportModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -181,8 +181,8 @@ void Foam::omegaWallFunctionFvPatchScalarField::updateCoeffsMaster() UIndirectList(G, wallCells()) = (1 - wallCellFraction())*scalarField(G, wallCells()) + wallCellFraction()*wallCellGPtr_(); - UIndirectList(omega.ref(), wallCells()) = - (1 - wallCellFraction())*scalarField(omega.ref(), wallCells()) + UIndirectList(omega, wallCells()) = + (1 - wallCellFraction())*scalarField(omega, wallCells()) + wallCellFraction()*wallCellOmegaPtr_(); } diff --git a/src/OpenFOAM/algorithms/subCycle/subCycle.H b/src/OpenFOAM/algorithms/subCycle/subCycle.H index 373659bf4f..65a35738a5 100644 --- a/src/OpenFOAM/algorithms/subCycle/subCycle.H +++ b/src/OpenFOAM/algorithms/subCycle/subCycle.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,7 +75,7 @@ public: ) : gf_(gf), - gf0_(gf.oldTime()) + gf0_(gf.oldTimeRef()) { if (nSubCycles > 1) { @@ -163,7 +163,7 @@ public: forAll(gfPtrs_, i) { - gf0Ptrs_[i] = &gfPtrs_[i]->oldTime(); + gf0Ptrs_[i] = &gfPtrs_[i]->oldTimeRef(); gf_0Ptrs_.set ( diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C index 2e9c113ea1..4f35cdc839 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -436,6 +436,14 @@ DimensionedField::~DimensionedField() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +Foam::Field& Foam::DimensionedField::primitiveFieldRef() +{ + this->setUpToDate(); + return *this; +} + + template tmp < @@ -518,7 +526,7 @@ dimensioned DimensionedField::average() const ( this->name() + ".average()", this->dimensions(), - gAverage(field()) + gAverage(primitiveField()) ); return Average; @@ -537,7 +545,7 @@ dimensioned DimensionedField::weightedAverage ( this->name() + ".weightedAverage(weights)", this->dimensions(), - gSum(weightField*field())/gSum(weightField) + gSum(weightField*primitiveField())/gSum(weightField) ) ); } diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H index fec6ebdada..09f2af61a5 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -294,9 +294,11 @@ public: //- Return non-const access to dimensions inline dimensionSet& dimensions(); - inline const Field& field() const; + //- Return a reference to the internal field + Field& primitiveFieldRef(); - inline Field& field(); + //- Return a const-reference to the primitive field + inline const Field& primitiveField() const; //- Return a component field of the field tmp> component diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.C index 5d751e7737..20e31705f4 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctions.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,7 +55,7 @@ pow ) ); - pow(tPow.ref().field(), df.field()); + pow(tPow.ref().primitiveFieldRef(), df.primitiveField()); return tPow; } @@ -81,7 +81,7 @@ pow pow(df.dimensions(), r) ); - pow(tPow.ref().field(), df.field()); + pow(tPow.ref().primitiveFieldRef(), df.primitiveField()); tdf.clear(); @@ -104,7 +104,7 @@ sqr(const DimensionedField& df) ) ); - sqr(tSqr.ref().field(), df.field()); + sqr(tSqr.ref().primitiveFieldRef(), df.primitiveField()); return tSqr; } @@ -125,7 +125,7 @@ sqr(const tmp>& tdf) sqr(df.dimensions()) ); - sqr(tSqr.ref().field(), df.field()); + sqr(tSqr.ref().primitiveFieldRef(), df.primitiveField()); tdf.clear(); @@ -149,7 +149,7 @@ tmp> magSqr ) ); - magSqr(tMagSqr.ref().field(), df.field()); + magSqr(tMagSqr.ref().primitiveFieldRef(), df.primitiveField()); return tMagSqr; } @@ -170,7 +170,7 @@ tmp> magSqr sqr(df.dimensions()) ); - magSqr(tMagSqr.ref().field(), df.field()); + magSqr(tMagSqr.ref().primitiveFieldRef(), df.primitiveField()); tdf.clear(); @@ -194,7 +194,7 @@ tmp> mag ) ); - mag(tMag.ref().field(), df.field()); + mag(tMag.ref().primitiveFieldRef(), df.primitiveField()); return tMag; } @@ -215,7 +215,7 @@ tmp> mag df.dimensions() ); - mag(tMag.ref().field(), df.field()); + mag(tMag.ref().primitiveFieldRef(), df.primitiveField()); tdf.clear(); @@ -243,7 +243,7 @@ cmptAv(const DimensionedField& df) ) ); - cmptAv(CmptAv.ref().field(), df.field()); + cmptAv(CmptAv.ref().primitiveFieldRef(), df.primitiveField()); return CmptAv; } @@ -269,7 +269,7 @@ cmptAv(const tmp>& tdf) df.dimensions() ); - cmptAv(CmptAv.ref().field(), df.field()); + cmptAv(CmptAv.ref().primitiveFieldRef(), df.primitiveField()); tdf.clear(); @@ -291,7 +291,7 @@ dimensioned func \ ( \ #func "(" + df.name() + ')', \ df.dimensions(), \ - dfunc(df.field()) \ + dfunc(df.primitiveField()) \ ); \ } \ \ @@ -363,7 +363,12 @@ operator op \ ) \ ); \ \ - Foam::opFunc(tRes.ref().field(), df1.field(), df2.field()); \ + Foam::opFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + df2.primitiveField() \ + ); \ \ return tRes; \ } \ @@ -388,7 +393,12 @@ operator op \ df1.dimensions() op df2.dimensions() \ ); \ \ - Foam::opFunc(tRes.ref().field(), df1.field(), df2.field()); \ + Foam::opFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + df2.primitiveField() \ + ); \ \ tdf2.clear(); \ \ @@ -415,7 +425,12 @@ operator op \ df1.dimensions() op df2.dimensions() \ ); \ \ - Foam::opFunc(tRes.ref().field(), df1.field(), df2.field()); \ + Foam::opFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + df2.primitiveField() \ + ); \ \ tdf1.clear(); \ \ @@ -444,7 +459,12 @@ operator op \ df1.dimensions() op df2.dimensions() \ ); \ \ - Foam::opFunc(tRes.ref().field(), df1.field(), df2.field()); \ + Foam::opFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + df2.primitiveField() \ + ); \ \ tdf1.clear(); \ tdf2.clear(); \ @@ -472,7 +492,12 @@ operator op \ ) \ ); \ \ - Foam::opFunc(tRes.ref().field(), df1.field(), dvs.value()); \ + Foam::opFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + dvs.value() \ + ); \ \ return tRes; \ } \ @@ -509,7 +534,12 @@ operator op \ df1.dimensions() op dvs.dimensions() \ ); \ \ - Foam::opFunc(tRes.ref().field(), df1.field(), dvs.value()); \ + Foam::opFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + dvs.value() \ + ); \ \ tdf1.clear(); \ \ @@ -547,7 +577,12 @@ operator op \ ) \ ); \ \ - Foam::opFunc(tRes.ref().field(), dvs.value(), df1.field()); \ + Foam::opFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + dvs.value(), \ + df1.primitiveField() \ + ); \ \ return tRes; \ } \ @@ -583,7 +618,12 @@ operator op \ dvs.dimensions() op df1.dimensions() \ ); \ \ - Foam::opFunc(tRes.ref().field(), dvs.value(), df1.field()); \ + Foam::opFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + dvs.value(), \ + df1.primitiveField() \ + ); \ \ tdf1.clear(); \ \ diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctionsM.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctionsM.C index 215f377f6d..25845d9860 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctionsM.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctionsM.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,7 +45,7 @@ tmp> Func \ ) \ ); \ \ - Func(tRes.ref().field(), df1.field()); \ + Func(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \ \ return tRes; \ } \ @@ -68,7 +68,7 @@ tmp> Func \ ) \ ); \ \ - Func(tRes.ref().field(), df1.field()); \ + Func(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \ \ tdf1.clear(); \ \ @@ -96,7 +96,7 @@ tmp> operator Op \ ) \ ); \ \ - Foam::OpFunc(tRes.ref().field(), df1.field()); \ + Foam::OpFunc(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \ \ return tRes; \ } \ @@ -119,7 +119,7 @@ tmp> operator Op \ ) \ ); \ \ - Foam::OpFunc(tRes.ref().field(), df1.field()); \ + Foam::OpFunc(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \ \ tdf1.clear(); \ \ @@ -148,7 +148,12 @@ tmp> Func \ ) \ ); \ \ - Func(tRes.ref().field(), df1.field(), df2.field()); \ + Func \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + df2.primitiveField() \ + ); \ \ return tRes; \ } \ @@ -172,7 +177,12 @@ tmp> Func \ ) \ ); \ \ - Func(tRes.ref().field(), df1.field(), df2.field()); \ + Func \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + df2.primitiveField() \ + ); \ \ tdf2.clear(); \ \ @@ -198,7 +208,12 @@ tmp> Func \ ) \ ); \ \ - Func(tRes.ref().field(), df1.field(), df2.field()); \ + Func \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + df2.primitiveField() \ + ); \ \ tdf1.clear(); \ \ @@ -226,7 +241,12 @@ tmp> Func \ ) \ ); \ \ - Func(tRes.ref().field(), df1.field(), df2.field()); \ + Func \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + df2.primitiveField() \ + ); \ \ tdf1.clear(); \ tdf2.clear(); \ @@ -256,7 +276,7 @@ tmp> Func \ ) \ ); \ \ - Func(tRes.ref().field(), dt1.value(), df2.field()); \ + Func(tRes.ref().primitiveFieldRef(), dt1.value(), df2.primitiveField()); \ \ return tRes; \ } \ @@ -291,7 +311,7 @@ tmp> Func \ ) \ ); \ \ - Func(tRes.ref().field(), dt1.value(), df2.field()); \ + Func(tRes.ref().primitiveFieldRef(), dt1.value(), df2.primitiveField()); \ \ tdf2.clear(); \ \ @@ -328,7 +348,7 @@ tmp> Func \ ) \ ); \ \ - Func(tRes.ref().field(), df1.field(), dt2.value()); \ + Func(tRes.ref().primitiveFieldRef(), df1.primitiveField(), dt2.value()); \ \ return tRes; \ } \ @@ -363,7 +383,7 @@ tmp> Func \ ) \ ); \ \ - Func(tRes.ref().field(), df1.field(), dt2.value()); \ + Func(tRes.ref().primitiveFieldRef(), df1.primitiveField(), dt2.value()); \ \ tdf1.clear(); \ \ @@ -407,7 +427,12 @@ tmp> operator Op \ ) \ ); \ \ - Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \ + Foam::OpFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + df2.primitiveField() \ + ); \ \ return tRes; \ } \ @@ -431,7 +456,12 @@ tmp> operator Op \ ) \ ); \ \ - Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \ + Foam::OpFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + df2.primitiveField() \ + ); \ \ tdf2.clear(); \ \ @@ -457,7 +487,12 @@ tmp> operator Op \ ) \ ); \ \ - Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \ + Foam::OpFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + df2.primitiveField() \ + ); \ \ tdf1.clear(); \ \ @@ -485,7 +520,12 @@ tmp> operator Op \ ) \ ); \ \ - Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \ + Foam::OpFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + df2.primitiveField() \ + ); \ \ tdf1.clear(); \ tdf2.clear(); \ @@ -496,7 +536,7 @@ tmp> operator Op \ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \ +#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \ \ TEMPLATE \ tmp> operator Op \ @@ -515,7 +555,12 @@ tmp> operator Op \ ) \ ); \ \ - Foam::OpFunc(tRes.ref().field(), dt1.value(), df2.field()); \ + Foam::OpFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + dt1.value(), \ + df2.primitiveField() \ + ); \ \ return tRes; \ } \ @@ -550,7 +595,12 @@ tmp> operator Op \ ) \ ); \ \ - Foam::OpFunc(tRes.ref().field(), dt1.value(), tdf2().field()); \ + Foam::OpFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + dt1.value(), \ + tdf2().primitiveField() \ + ); \ \ tdf2.clear(); \ \ @@ -568,7 +618,7 @@ tmp> operator Op \ } -#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \ +#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \ \ TEMPLATE \ tmp> operator Op \ @@ -587,7 +637,12 @@ tmp> operator Op \ ) \ ); \ \ - Foam::OpFunc(tRes.ref().field(), df1.field(), dt2.value()); \ + Foam::OpFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + df1.primitiveField(), \ + dt2.value() \ + ); \ \ return tRes; \ } \ @@ -622,7 +677,12 @@ tmp> operator Op \ ) \ ); \ \ - Foam::OpFunc(tRes.ref().field(), tdf1().field(), dt2.value()); \ + Foam::OpFunc \ + ( \ + tRes.ref().primitiveFieldRef(), \ + tdf1().primitiveField(), \ + dt2.value() \ + ); \ \ tdf1.clear(); \ \ diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H index d327205d30..f772ac23cd 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,6 +23,8 @@ License \*---------------------------------------------------------------------------*/ +#include "DimensionedField.H" + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template @@ -58,14 +60,7 @@ Foam::DimensionedField::dimensions() template inline const Foam::Field& -Foam::DimensionedField::field() const -{ - return *this; -} - -template -inline Foam::Field& -Foam::DimensionedField::field() +Foam::DimensionedField::primitiveField() const { return *this; } diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.C index 9a3e0a1163..3111a15596 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,7 +52,7 @@ tmp> stabilise ) ); - stabilise(tRes.ref().field(), dsf.field(), ds.value()); + stabilise(tRes.ref().primitiveFieldRef(), dsf.primitiveField(), ds.value()); return tRes; } @@ -74,7 +74,7 @@ tmp> stabilise dsf.dimensions() + ds.dimensions() ); - stabilise(tRes.ref().field(), dsf.field(), ds.value()); + stabilise(tRes.ref().primitiveFieldRef(), dsf.primitiveField(), ds.value()); tdsf.clear(); @@ -125,7 +125,12 @@ tmp> pow ) ); - pow(tPow.ref().field(), dsf1.field(), dsf2.field()); + pow + ( + tPow.ref().primitiveFieldRef(), + dsf1.primitiveField(), + dsf2.primitiveField() + ); return tPow; } @@ -161,7 +166,12 @@ tmp> pow dimless ); - pow(tPow.ref().field(), dsf1.field(), dsf2.field()); + pow + ( + tPow.ref().primitiveFieldRef(), + dsf1.primitiveField(), + dsf2.primitiveField() + ); tdsf1.clear(); @@ -199,7 +209,12 @@ tmp> pow dimless ); - pow(tPow.ref().field(), dsf1.field(), dsf2.field()); + pow + ( + tPow.ref().primitiveFieldRef(), + dsf1.primitiveField(), + dsf2.primitiveField() + ); tdsf2.clear(); @@ -240,7 +255,12 @@ tmp> pow dimless ); - pow(tPow.ref().field(), dsf1.field(), dsf2.field()); + pow + ( + tPow.ref().primitiveFieldRef(), + dsf1.primitiveField(), + dsf2.primitiveField() + ); tdsf1.clear(); tdsf2.clear(); @@ -273,7 +293,7 @@ tmp> pow ) ); - pow(tPow.ref().field(), dsf.field(), ds.value()); + pow(tPow.ref().primitiveFieldRef(), dsf.primitiveField(), ds.value()); return tPow; } @@ -302,7 +322,7 @@ tmp> pow pow(dsf.dimensions(), ds) ); - pow(tPow.ref().field(), dsf.field(), ds.value()); + pow(tPow.ref().primitiveFieldRef(), dsf.primitiveField(), ds.value()); tdsf.clear(); @@ -363,7 +383,7 @@ tmp> pow ) ); - pow(tPow.ref().field(), ds.value(), dsf.field()); + pow(tPow.ref().primitiveFieldRef(), ds.value(), dsf.primitiveField()); return tPow; } @@ -399,7 +419,7 @@ tmp> pow dimless ); - pow(tPow.ref().field(), ds.value(), dsf.field()); + pow(tPow.ref().primitiveFieldRef(), ds.value(), dsf.primitiveField()); tdsf.clear(); @@ -446,7 +466,12 @@ tmp> atan2 ) ); - atan2(tAtan2.ref().field(), dsf1.field(), dsf2.field()); + atan2 + ( + tAtan2.ref().primitiveFieldRef(), + dsf1.primitiveField(), + dsf2.primitiveField() + ); return tAtan2; } @@ -468,7 +493,12 @@ tmp> atan2 atan2(dsf1.dimensions(), dsf2.dimensions()) ); - atan2(tAtan2.ref().field(), dsf1.field(), dsf2.field()); + atan2 + ( + tAtan2.ref().primitiveFieldRef(), + dsf1.primitiveField(), + dsf2.primitiveField() + ); tdsf1.clear(); @@ -492,7 +522,12 @@ tmp> atan2 atan2(dsf1.dimensions(), dsf2.dimensions()) ); - atan2(tAtan2.ref().field(), dsf1.field(), dsf2.field()); + atan2 + ( + tAtan2.ref().primitiveFieldRef(), + dsf1.primitiveField(), + dsf2.primitiveField() + ); tdsf2.clear(); @@ -518,7 +553,12 @@ tmp> atan2 atan2(dsf1.dimensions(), dsf2.dimensions()) ); - atan2(tAtan2.ref().field(), dsf1.field(), dsf2.field()); + atan2 + ( + tAtan2.ref().primitiveFieldRef(), + dsf1.primitiveField(), + dsf2.primitiveField() + ); tdsf1.clear(); tdsf2.clear(); @@ -544,7 +584,7 @@ tmp> atan2 ) ); - atan2(tAtan2.ref().field(), dsf.field(), ds.value()); + atan2(tAtan2.ref().primitiveFieldRef(), dsf.primitiveField(), ds.value()); return tAtan2; } @@ -565,7 +605,7 @@ tmp> atan2 atan2(dsf.dimensions(), ds) ); - atan2(tAtan2.ref().field(), dsf.field(), ds.value()); + atan2(tAtan2.ref().primitiveFieldRef(), dsf.primitiveField(), ds.value()); tdsf.clear(); @@ -610,7 +650,7 @@ tmp> atan2 ) ); - atan2(tAtan2.ref().field(), ds.value(), dsf.field()); + atan2(tAtan2.ref().primitiveFieldRef(), ds.value(), dsf.primitiveField()); return tAtan2; } @@ -632,7 +672,7 @@ tmp> atan2 atan2(ds, dsf.dimensions()) ); - atan2(tAtan2.ref().field(), ds.value(), dsf.field()); + atan2(tAtan2.ref().primitiveFieldRef(), ds.value(), dsf.primitiveField()); tdsf.clear(); @@ -729,7 +769,7 @@ tmp> func \ ) \ ); \ \ - func(tFunc.ref().field(), n, dsf.field()); \ + func(tFunc.ref().primitiveFieldRef(), n, dsf.primitiveField()); \ \ return tFunc; \ } \ @@ -760,7 +800,7 @@ tmp> func \ ) \ ); \ \ - func(tFunc.ref().field(), n, dsf.field()); \ + func(tFunc.ref().primitiveFieldRef(), n, dsf.primitiveField()); \ \ tdsf.clear(); \ \ diff --git a/src/OpenFOAM/fields/Fields/UniformField/UniformField.H b/src/OpenFOAM/fields/Fields/UniformField/UniformField.H index 1b2b1857ea..0bd1836dc2 100644 --- a/src/OpenFOAM/fields/Fields/UniformField/UniformField.H +++ b/src/OpenFOAM/fields/Fields/UniformField/UniformField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -72,7 +72,7 @@ public: inline Type operator[](const label) const; - inline UniformField field() const; + inline UniformField primitiveField() const; }; diff --git a/src/OpenFOAM/fields/Fields/UniformField/UniformFieldI.H b/src/OpenFOAM/fields/Fields/UniformField/UniformFieldI.H index 5f9ee0fb54..0bd0de9711 100644 --- a/src/OpenFOAM/fields/Fields/UniformField/UniformFieldI.H +++ b/src/OpenFOAM/fields/Fields/UniformField/UniformFieldI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,7 +49,7 @@ inline Type Foam::UniformField::operator[](const label) const template -inline Foam::UniformField Foam::UniformField::field() const +inline Foam::UniformField Foam::UniformField::primitiveField() const { return UniformField(value_); } diff --git a/src/OpenFOAM/fields/Fields/oneField/oneField.H b/src/OpenFOAM/fields/Fields/oneField/oneField.H index 7c2336eae0..3dcf3e3781 100644 --- a/src/OpenFOAM/fields/Fields/oneField/oneField.H +++ b/src/OpenFOAM/fields/Fields/oneField/oneField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -71,7 +71,7 @@ public: inline one operator[](const label) const; - inline oneField field() const; + inline oneField primitiveField() const; }; diff --git a/src/OpenFOAM/fields/Fields/oneField/oneFieldI.H b/src/OpenFOAM/fields/Fields/oneField/oneFieldI.H index 892a2f1f60..f930ea4424 100644 --- a/src/OpenFOAM/fields/Fields/oneField/oneFieldI.H +++ b/src/OpenFOAM/fields/Fields/oneField/oneFieldI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,7 @@ inline Foam::one Foam::oneField::operator[](const label) const } -inline Foam::oneField Foam::oneField::field() const +inline Foam::oneField Foam::oneField::primitiveField() const { return oneField(); } diff --git a/src/OpenFOAM/fields/Fields/zeroField/zeroField.H b/src/OpenFOAM/fields/Fields/zeroField/zeroField.H index 67ba598aad..b0f5da0fd0 100644 --- a/src/OpenFOAM/fields/Fields/zeroField/zeroField.H +++ b/src/OpenFOAM/fields/Fields/zeroField/zeroField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -54,6 +54,11 @@ class zeroField { public: + // Public Typedefs + + typedef zeroField FieldType; + + // Constructors //- Construct null @@ -65,7 +70,7 @@ public: inline scalar operator[](const label) const; - inline zeroField field() const; + inline zeroField primitiveField() const; inline zeroField operator()() const; diff --git a/src/OpenFOAM/fields/Fields/zeroField/zeroFieldI.H b/src/OpenFOAM/fields/Fields/zeroField/zeroFieldI.H index 2690d28ff4..9140ae431b 100644 --- a/src/OpenFOAM/fields/Fields/zeroField/zeroFieldI.H +++ b/src/OpenFOAM/fields/Fields/zeroField/zeroFieldI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,7 @@ inline Foam::scalar Foam::zeroField::operator[](const label) const } -inline Foam::zeroField Foam::zeroField::field() const +inline Foam::zeroField Foam::zeroField::primitiveField() const { return zeroField(); } diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index 1d265312b4..8b3f23127e 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -1052,7 +1052,7 @@ Foam::GeometricField::~GeometricField() template class PatchField, class GeoMesh> typename Foam::GeometricField::Internal& -Foam::GeometricField::ref() +Foam::GeometricField::internalFieldRef() { this->setUpToDate(); storeOldTimes(); @@ -1196,7 +1196,7 @@ Foam::GeometricField::oldTime() const template class PatchField, class GeoMesh> Foam::GeometricField& -Foam::GeometricField::oldTime() +Foam::GeometricField::oldTimeRef() { static_cast&>(*this) .oldTime(); @@ -1222,7 +1222,7 @@ Foam::GeometricField::oldTime(const label n) const template class PatchField, class GeoMesh> Foam::GeometricField& -Foam::GeometricField::oldTime(const label n) +Foam::GeometricField::oldTimeRef(const label n) { if (n == 0) { @@ -1230,7 +1230,7 @@ Foam::GeometricField::oldTime(const label n) } else { - return oldTime().oldTime(n - 1); + return oldTimeRef().oldTimeRef(n - 1); } } @@ -1638,7 +1638,7 @@ void Foam::GeometricField::operator= // Only assign field contents not ID - ref() = gf(); + internalFieldRef() = gf.internalField(); boundaryFieldRef() = gf.boundaryField(); } @@ -1660,7 +1660,7 @@ void Foam::GeometricField::operator= // Only assign field contents not ID - ref() = move(gf()); + internalFieldRef() = move(gf.internalField()); boundaryFieldRef() = move(gf.boundaryField()); } @@ -1688,11 +1688,7 @@ void Foam::GeometricField::operator= if (tgf.isTmp()) { - // Transfer the storage from the tmp - primitiveFieldRef().transfer - ( - const_cast&>(gf.primitiveField()) - ); + primitiveFieldRef().transfer(tgf.ref()); } else { @@ -1711,7 +1707,7 @@ void Foam::GeometricField::operator= const dimensioned& dt ) { - ref() = dt; + internalFieldRef() = dt; boundaryFieldRef() = dt.value(); } @@ -1722,7 +1718,7 @@ void Foam::GeometricField::operator= const zero& ) { - ref() = Zero; + internalFieldRef() = Zero; boundaryFieldRef() = Zero; } @@ -1739,7 +1735,17 @@ void Foam::GeometricField::operator== // Only assign field contents not ID - ref() = gf(); + this->dimensions() = gf.dimensions(); + + if (tgf.isTmp()) + { + primitiveFieldRef().transfer(tgf.ref()); + } + else + { + primitiveFieldRef() = gf.primitiveField(); + } + boundaryFieldRef() == gf.boundaryField(); tgf.clear(); @@ -1752,7 +1758,7 @@ void Foam::GeometricField::operator== const dimensioned& dt ) { - ref() = dt; + internalFieldRef() = dt; boundaryFieldRef() == dt.value(); } @@ -1763,7 +1769,7 @@ void Foam::GeometricField::operator== const zero& ) { - ref() = Zero; + internalFieldRef() = Zero; boundaryFieldRef() == Zero; } @@ -1778,7 +1784,7 @@ void Foam::GeometricField::operator op \ { \ checkField(*this, gf, #op); \ \ - ref() op gf(); \ + internalFieldRef() op gf.internalField(); \ boundaryFieldRef() op gf.boundaryField(); \ } \ \ @@ -1798,7 +1804,7 @@ void Foam::GeometricField::operator op \ const dimensioned& dt \ ) \ { \ - ref() op dt; \ + internalFieldRef() op dt; \ boundaryFieldRef() op dt.value(); \ } diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index efc0ed9872..4eef13d494 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -394,7 +394,7 @@ public: //- Return a reference to the dimensioned internal field // Note: this increments the event counter and checks the // old-time fields; avoid in loops. - Internal& ref(); + Internal& internalFieldRef(); //- Return a const-reference to the dimensioned internal field inline const Internal& internalField() const; @@ -404,12 +404,12 @@ public: // for FV equations inline const Internal& v() const; - //- Return a reference to the internal field + //- Return a reference to the primitive field // Note: this increments the event counter and checks the // old-time fields; avoid in loops. typename Internal::FieldType& primitiveFieldRef(); - //- Return a const-reference to the internal field + //- Return a const-reference to the primitive field inline const typename Internal::FieldType& primitiveField() const; //- Return a reference to the boundary field @@ -443,7 +443,7 @@ public: //- Return non-const old time field // (Not a good idea but it is used for sub-cycling) - GeometricField& oldTime(); + GeometricField& oldTimeRef(); //- Return the n-th old time field const GeometricField& oldTime @@ -453,7 +453,7 @@ public: //- Return the n-th non-const old time field // (Not a good idea but it is used for sub-cycling) - GeometricField& oldTime(const label n); + GeometricField& oldTimeRef(const label n); //- Store the field as the previous iteration value void storePrevIter() const; diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/MapGeometricFields.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/MapGeometricFields.H index 980781fd5b..4157825ad9 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/MapGeometricFields.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/MapGeometricFields.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -103,7 +103,7 @@ void MapGeometricFields // Map the internal field MapInternalField() ( - field.ref(), + field.internalFieldRef(), mapper ); diff --git a/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H index d5f88f8c1a..922905282f 100644 --- a/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H +++ b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -64,6 +64,7 @@ public: typedef oneFieldField Boundary; typedef one cmptType; + // Constructors //- Construct null @@ -77,12 +78,12 @@ public: inline one operator[](const label) const; - inline oneField field() const; - - inline oneField oldTime() const; + inline geometricOneField oldTime() const; inline Internal operator()() const; + inline Internal internalField() const; + inline Internal v() const; inline typename Internal::FieldType primitiveField() const; diff --git a/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneFieldI.H b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneFieldI.H index cf63d1b45f..4bdbe3e712 100644 --- a/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneFieldI.H +++ b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneFieldI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,15 +39,9 @@ inline Foam::one Foam::geometricOneField::operator[](const label) const } -inline Foam::oneField Foam::geometricOneField::field() const +inline Foam::geometricOneField Foam::geometricOneField::oldTime() const { - return oneField(); -} - - -inline Foam::oneField Foam::geometricOneField::oldTime() const -{ - return oneField(); + return geometricOneField(); } @@ -58,6 +52,13 @@ Foam::geometricOneField::operator()() const } +inline Foam::geometricOneField::Internal +Foam::geometricOneField::internalField() const +{ + return oneField(); +} + + inline Foam::geometricOneField::Internal Foam::geometricOneField::v() const { diff --git a/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H index 6a0e4f3d02..d349363bdc 100644 --- a/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H +++ b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,6 +57,14 @@ class geometricZeroField public: + // Public Typedefs + + typedef zeroField Internal; + typedef zeroField Patch; + typedef zeroFieldField Boundary; + typedef zero cmptType; + + // Constructors //- Construct null @@ -70,13 +78,17 @@ public: inline scalar operator[](const label) const; - inline zeroField field() const; + inline geometricZeroField oldTime() const; - inline zeroField operator()() const; + inline Internal operator()() const; - inline zeroField oldTime() const; + inline Internal internalField() const; - inline zeroFieldField boundaryField() const; + inline Internal v() const; + + inline typename Internal::FieldType primitiveField() const; + + inline Boundary boundaryField() const; }; diff --git a/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroFieldI.H b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroFieldI.H index c398720e0b..1a5f600b93 100644 --- a/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroFieldI.H +++ b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroFieldI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,27 +32,49 @@ inline const Foam::dimensionSet& Foam::geometricZeroField::dimensions() const return dimless; } + inline Foam::scalar Foam::geometricZeroField::operator[](const label) const { return scalar(0); } -inline Foam::zeroField Foam::geometricZeroField::field() const + +inline Foam::geometricZeroField Foam::geometricZeroField::oldTime() const +{ + return geometricZeroField(); +} + + +inline Foam::geometricZeroField::Internal +Foam::geometricZeroField::operator()() const { return zeroField(); } -inline Foam::zeroField Foam::geometricZeroField::operator()() const + +inline Foam::geometricZeroField::Internal +Foam::geometricZeroField::internalField() const { return zeroField(); } -inline Foam::zeroField Foam::geometricZeroField::oldTime() const + +inline Foam::geometricZeroField::Internal +Foam::geometricZeroField::v() const +{ + return Internal(); +} + + +inline typename Foam::geometricZeroField::Internal::FieldType +Foam::geometricZeroField::primitiveField() const { return zeroField(); } -inline Foam::zeroFieldField Foam::geometricZeroField::boundaryField() const + +inline Foam::geometricZeroField::Boundary +Foam::geometricZeroField::boundaryField() const { return zeroFieldField(); } diff --git a/src/finiteVolume/cfdTools/compressible/compressibleCourantNo.H b/src/finiteVolume/cfdTools/compressible/compressibleCourantNo.H index 18d1bc5b5c..305634a5dc 100644 --- a/src/finiteVolume/cfdTools/compressible/compressibleCourantNo.H +++ b/src/finiteVolume/cfdTools/compressible/compressibleCourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,10 +38,12 @@ scalar meanCoNum = 0.0; fvc::surfaceSum(mag(phi))().primitiveField()/rho.primitiveField() ); - CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + CoNum = 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue(); meanCoNum = - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + 0.5 + *(gSum(sumPhi)/gSum(mesh.V().primitiveField())) + *runTime.deltaTValue(); } Info<< "Courant Number mean: " << meanCoNum diff --git a/src/finiteVolume/cfdTools/incompressible/CourantNo.H b/src/finiteVolume/cfdTools/incompressible/CourantNo.H index 94a2fcdb70..36a1371758 100644 --- a/src/finiteVolume/cfdTools/incompressible/CourantNo.H +++ b/src/finiteVolume/cfdTools/incompressible/CourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,10 +38,12 @@ scalar meanCoNum = 0.0; fvc::surfaceSum(mag(phi))().primitiveField() ); - CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + CoNum = 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue(); meanCoNum = - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + 0.5 + *(gSum(sumPhi)/gSum(mesh.V().primitiveField())) + *runTime.deltaTValue(); } Info<< "Courant Number mean: " << meanCoNum diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C index 237ccd6ff8..4ec0480f00 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -381,14 +381,14 @@ CrankNicolsonDdtScheme::fvcDdt { dimensionedScalar rDtCoef0 = rDtCoef0_(ddt0); - ddt0.ref() = + ddt0.internalFieldRef() = ( (rDtCoef0*dt)*(mesh().V0() - mesh().V00()) - mesh().V00()*offCentre_(ddt0.internalField()) )/mesh().V0(); } - tdtdt.ref().ref() = + tdtdt.ref().internalFieldRef() = ( (rDtCoef*dt)*(mesh().V() - mesh().V0()) - mesh().V0()*offCentre_(ddt0.internalField()) diff --git a/src/finiteVolume/finiteVolume/fvc/fvcVolumeIntegrate.C b/src/finiteVolume/finiteVolume/fvc/fvcVolumeIntegrate.C index a157c1b4d9..97f281c5fa 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcVolumeIntegrate.C +++ b/src/finiteVolume/finiteVolume/fvc/fvcVolumeIntegrate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -66,7 +66,7 @@ volumeIntegrate template tmp> volumeIntegrate(const DimensionedField& df) { - return df.mesh().V()*df.field(); + return df.mesh().V()*df.primitiveField(); } @@ -74,7 +74,7 @@ template tmp> volumeIntegrate(const tmp>& tdf) { - tmp> tdidf = tdf().mesh().V()*tdf().field(); + tmp> tdidf = tdf().mesh().V()*tdf().primitiveField(); tdf.clear(); return tdidf; } diff --git a/src/finiteVolume/finiteVolume/fvm/fvmSup.C b/src/finiteVolume/finiteVolume/fvm/fvmSup.C index c4eab3be8f..b62f96b8fb 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmSup.C +++ b/src/finiteVolume/finiteVolume/fvm/fvmSup.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,7 +49,7 @@ Foam::fvm::Su ); fvMatrix& fvm = tfvm.ref(); - fvm.source() -= mesh.V()*su.field(); + fvm.source() -= mesh.V()*su.primitiveField(); return tfvm; } @@ -115,7 +115,7 @@ Foam::fvm::Sp ); fvMatrix& fvm = tfvm.ref(); - fvm.diag() += mesh.V()*sp.field(); + fvm.diag() += mesh.V()*sp.primitiveField(); return tfvm; } @@ -207,9 +207,9 @@ Foam::fvm::SuSp ); fvMatrix& fvm = tfvm.ref(); - fvm.diag() += mesh.V()*max(susp.field(), scalar(0)); + fvm.diag() += mesh.V()*max(susp.primitiveField(), scalar(0)); - fvm.source() -= mesh.V()*min(susp.field(), scalar(0)) + fvm.source() -= mesh.V()*min(susp.primitiveField(), scalar(0)) *vf.primitiveField(); return tfvm; diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index a5d9f5e1b1..6754e892e9 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -1172,7 +1172,7 @@ void Foam::fvMatrix::operator+= ) { checkMethod(*this, su, "+="); - source() -= su.mesh().V()*su.field(); + source() -= su.mesh().V()*su.primitiveField(); } @@ -1205,7 +1205,7 @@ void Foam::fvMatrix::operator-= ) { checkMethod(*this, su, "-="); - source() += su.mesh().V()*su.field(); + source() += su.mesh().V()*su.primitiveField(); } @@ -1274,14 +1274,17 @@ void Foam::fvMatrix::operator*= ) { dimensions_ *= dsf.dimensions(); - lduMatrix::operator*=(dsf.field()); - source_ *= dsf.field(); + lduMatrix::operator*=(dsf.primitiveField()); + source_ *= dsf.primitiveField(); forAll(boundaryCoeffs_, patchi) { scalarField pisf ( - dsf.mesh().boundary()[patchi].patchInternalField(dsf.field()) + dsf.mesh().boundary()[patchi].patchInternalField + ( + dsf.primitiveField() + ) ); internalCoeffs_[patchi] *= pisf; @@ -1345,14 +1348,17 @@ void Foam::fvMatrix::operator/= ) { dimensions_ /= dsf.dimensions(); - lduMatrix::operator/=(dsf.field()); - source_ /= dsf.field(); + lduMatrix::operator/=(dsf.primitiveField()); + source_ /= dsf.primitiveField(); forAll(boundaryCoeffs_, patchi) { scalarField pisf ( - dsf.mesh().boundary()[patchi].patchInternalField(dsf.field()) + dsf.mesh().boundary()[patchi].patchInternalField + ( + dsf.primitiveField() + ) ); internalCoeffs_[patchi] /= pisf; @@ -1571,7 +1577,7 @@ Foam::tmp> Foam::operator== { checkMethod(A, su, "=="); tmp> tC(new fvMatrix(A)); - tC.ref().source() += su.mesh().V()*su.field(); + tC.ref().source() += su.mesh().V()*su.primitiveField(); return tC; } @@ -1584,7 +1590,7 @@ Foam::tmp> Foam::operator== { checkMethod(A, tsu(), "=="); tmp> tC(new fvMatrix(A)); - tC.ref().source() += tsu().mesh().V()*tsu().field(); + tC.ref().source() += tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; } @@ -1612,7 +1618,7 @@ Foam::tmp> Foam::operator== { checkMethod(tA(), su, "=="); tmp> tC(tA.ptr()); - tC.ref().source() += su.mesh().V()*su.field(); + tC.ref().source() += su.mesh().V()*su.primitiveField(); return tC; } @@ -1625,7 +1631,7 @@ Foam::tmp> Foam::operator== { checkMethod(tA(), tsu(), "=="); tmp> tC(tA.ptr()); - tC.ref().source() += tsu().mesh().V()*tsu().field(); + tC.ref().source() += tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; } @@ -1777,7 +1783,7 @@ Foam::tmp> Foam::operator+ { checkMethod(A, su, "+"); tmp> tC(new fvMatrix(A)); - tC.ref().source() -= su.mesh().V()*su.field(); + tC.ref().source() -= su.mesh().V()*su.primitiveField(); return tC; } @@ -1790,7 +1796,7 @@ Foam::tmp> Foam::operator+ { checkMethod(A, tsu(), "+"); tmp> tC(new fvMatrix(A)); - tC.ref().source() -= tsu().mesh().V()*tsu().field(); + tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; } @@ -1818,7 +1824,7 @@ Foam::tmp> Foam::operator+ { checkMethod(tA(), su, "+"); tmp> tC(tA.ptr()); - tC.ref().source() -= su.mesh().V()*su.field(); + tC.ref().source() -= su.mesh().V()*su.primitiveField(); return tC; } @@ -1831,7 +1837,7 @@ Foam::tmp> Foam::operator+ { checkMethod(tA(), tsu(), "+"); tmp> tC(tA.ptr()); - tC.ref().source() -= tsu().mesh().V()*tsu().field(); + tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; } @@ -1859,7 +1865,7 @@ Foam::tmp> Foam::operator+ { checkMethod(A, su, "+"); tmp> tC(new fvMatrix(A)); - tC.ref().source() -= su.mesh().V()*su.field(); + tC.ref().source() -= su.mesh().V()*su.primitiveField(); return tC; } @@ -1872,7 +1878,7 @@ Foam::tmp> Foam::operator+ { checkMethod(A, tsu(), "+"); tmp> tC(new fvMatrix(A)); - tC.ref().source() -= tsu().mesh().V()*tsu().field(); + tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; } @@ -1900,7 +1906,7 @@ Foam::tmp> Foam::operator+ { checkMethod(tA(), su, "+"); tmp> tC(tA.ptr()); - tC.ref().source() -= su.mesh().V()*su.field(); + tC.ref().source() -= su.mesh().V()*su.primitiveField(); return tC; } @@ -1913,7 +1919,7 @@ Foam::tmp> Foam::operator+ { checkMethod(tA(), tsu(), "+"); tmp> tC(tA.ptr()); - tC.ref().source() -= tsu().mesh().V()*tsu().field(); + tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; } @@ -1996,7 +2002,7 @@ Foam::tmp> Foam::operator- { checkMethod(A, su, "-"); tmp> tC(new fvMatrix(A)); - tC.ref().source() += su.mesh().V()*su.field(); + tC.ref().source() += su.mesh().V()*su.primitiveField(); return tC; } @@ -2009,7 +2015,7 @@ Foam::tmp> Foam::operator- { checkMethod(A, tsu(), "-"); tmp> tC(new fvMatrix(A)); - tC.ref().source() += tsu().mesh().V()*tsu().field(); + tC.ref().source() += tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; } @@ -2037,7 +2043,7 @@ Foam::tmp> Foam::operator- { checkMethod(tA(), su, "-"); tmp> tC(tA.ptr()); - tC.ref().source() += su.mesh().V()*su.field(); + tC.ref().source() += su.mesh().V()*su.primitiveField(); return tC; } @@ -2050,7 +2056,7 @@ Foam::tmp> Foam::operator- { checkMethod(tA(), tsu(), "-"); tmp> tC(tA.ptr()); - tC.ref().source() += tsu().mesh().V()*tsu().field(); + tC.ref().source() += tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; } @@ -2079,7 +2085,7 @@ Foam::tmp> Foam::operator- checkMethod(A, su, "-"); tmp> tC(new fvMatrix(A)); tC.ref().negate(); - tC.ref().source() -= su.mesh().V()*su.field(); + tC.ref().source() -= su.mesh().V()*su.primitiveField(); return tC; } @@ -2093,7 +2099,7 @@ Foam::tmp> Foam::operator- checkMethod(A, tsu(), "-"); tmp> tC(new fvMatrix(A)); tC.ref().negate(); - tC.ref().source() -= tsu().mesh().V()*tsu().field(); + tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; } @@ -2123,7 +2129,7 @@ Foam::tmp> Foam::operator- checkMethod(tA(), su, "-"); tmp> tC(tA.ptr()); tC.ref().negate(); - tC.ref().source() -= su.mesh().V()*su.field(); + tC.ref().source() -= su.mesh().V()*su.primitiveField(); return tC; } @@ -2137,7 +2143,7 @@ Foam::tmp> Foam::operator- checkMethod(tA(), tsu(), "-"); tmp> tC(tA.ptr()); tC.ref().negate(); - tC.ref().source() -= tsu().mesh().V()*tsu().field(); + tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; } @@ -2483,7 +2489,7 @@ Foam::operator& { for (direction cmpt=0; cmpt::nComponents; cmpt++) { - scalarField psiCmpt(psi.field().component(cmpt)); + scalarField psiCmpt(psi.primitiveField().component(cmpt)); scalarField boundaryDiagCmpt(M.diag()); M.addBoundaryDiag(boundaryDiagCmpt, cmpt); Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt); @@ -2494,7 +2500,8 @@ Foam::operator& Mphi.primitiveFieldRef() = Zero; } - Mphi.primitiveFieldRef() += M.lduMatrix::H(psi.field()) + M.source(); + Mphi.primitiveFieldRef() += + M.lduMatrix::H(psi.primitiveField()) + M.source(); M.addBoundarySource(Mphi.primitiveFieldRef()); Mphi.primitiveFieldRef() /= -psi.mesh().V(); diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C index 6d968b911c..5feb372f04 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,19 +53,19 @@ void Foam::MULES::correct { psi.primitiveFieldRef() = ( - rho.field()*psi.primitiveField()*rDeltaT - + Su.field() + rho.primitiveField()*psi.primitiveField()*rDeltaT + + Su.primitiveField() - psiIf - )/(rho.field()*rDeltaT - Sp.field()); + )/(rho.primitiveField()*rDeltaT - Sp.primitiveField()); } else { psi.primitiveFieldRef() = ( - rho.field()*psi.primitiveField()*rDeltaT - + Su.field() + rho.primitiveField()*psi.primitiveField()*rDeltaT + + Su.primitiveField() - psiIf - )/(rho.field()*rDeltaT - Sp.field()); + )/(rho.primitiveField()*rDeltaT - Sp.primitiveField()); } psi.correctBoundaryConditions(); @@ -383,17 +383,17 @@ void Foam::MULES::limiterCorr psiMaxn = V *( - (rho.field()*rDeltaT - Sp.field())*psiMaxn - - Su.field() - - rho.field()*psi.primitiveField()*rDeltaT + (rho.primitiveField()*rDeltaT - Sp.primitiveField())*psiMaxn + - Su.primitiveField() + - rho.primitiveField()*psi.primitiveField()*rDeltaT ); psiMinn = V *( - Su.field() - - (rho.field()*rDeltaT - Sp.field())*psiMinn - + rho.field()*psi.primitiveField()*rDeltaT + Su.primitiveField() + - (rho.primitiveField()*rDeltaT - Sp.primitiveField())*psiMinn + + rho.primitiveField()*psi.primitiveField()*rDeltaT ); scalarField sumlPhip(psiIf.size()); diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C index 2ceed54711..e2f97b1cb7 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,20 +57,20 @@ void Foam::MULES::explicitSolve { psiIf = ( - mesh.Vsc0()().field()*rho.oldTime().field() - *psi0*rDeltaT/mesh.Vsc()().field() - + Su.field() + mesh.Vsc0()().primitiveField()*rho.oldTime().primitiveField() + *psi0*rDeltaT/mesh.Vsc()().primitiveField() + + Su.primitiveField() - psiIf - )/(rho.field()*rDeltaT - Sp.field()); + )/(rho.primitiveField()*rDeltaT - Sp.primitiveField()); } else { psiIf = ( - rho.oldTime().field()*psi0*rDeltaT - + Su.field() + rho.oldTime().primitiveField()*psi0*rDeltaT + + Su.primitiveField() - psiIf - )/(rho.field()*rDeltaT - Sp.field()); + )/(rho.primitiveField()*rDeltaT - Sp.primitiveField()); } psi.correctBoundaryConditions(); @@ -380,19 +380,19 @@ void Foam::MULES::limiter psiMaxn = V *( - (rho.field()*rDeltaT - Sp.field())*psiMaxn - - Su.field() + (rho.primitiveField()*rDeltaT - Sp.primitiveField())*psiMaxn + - Su.primitiveField() ) - - (V0().field()*rDeltaT)*rho.oldTime().field()*psi0 + - (V0().primitiveField()*rDeltaT)*rho.oldTime().primitiveField()*psi0 + sumPhiBD; psiMinn = V *( - Su.field() - - (rho.field()*rDeltaT - Sp.field())*psiMinn + Su.primitiveField() + - (rho.primitiveField()*rDeltaT - Sp.primitiveField())*psiMinn ) - + (V0().field()*rDeltaT)*rho.oldTime().field()*psi0 + + (V0().primitiveField()*rDeltaT)*rho.oldTime().primitiveField()*psi0 - sumPhiBD; } else @@ -400,18 +400,18 @@ void Foam::MULES::limiter psiMaxn = V *( - (rho.field()*rDeltaT - Sp.field())*psiMaxn - - Su.field() - - (rho.oldTime().field()*rDeltaT)*psi0 + (rho.primitiveField()*rDeltaT - Sp.primitiveField())*psiMaxn + - Su.primitiveField() + - (rho.oldTime().primitiveField()*rDeltaT)*psi0 ) + sumPhiBD; psiMinn = V *( - Su.field() - - (rho.field()*rDeltaT - Sp.field())*psiMinn - + (rho.oldTime().field()*rDeltaT)*psi0 + Su.primitiveField() + - (rho.primitiveField()*rDeltaT - Sp.primitiveField())*psiMinn + + (rho.oldTime().primitiveField()*rDeltaT)*psi0 ) - sumPhiBD; } diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 5915ccdac4..b1cc65644e 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -1399,7 +1399,7 @@ void Foam::fvMesh::conform(const surfaceScalarField& phi) { for (label i = 0; i <= phi.nOldTimes(); ++ i) { - phiRef().oldTime(i) == phi.oldTime(i); + phiRef().oldTimeRef(i) == phi.oldTime(i); } } } @@ -1503,7 +1503,7 @@ void Foam::fvMesh::unconform { for (label i = 0; i <= phi.nOldTimes(); ++ i) { - phiRef().oldTime(i) == phi.oldTime(i); + phiRef().oldTimeRef(i) == phi.oldTime(i); } } } diff --git a/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.C b/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.C index 7fa43f632e..6903eae24a 100644 --- a/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.C +++ b/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.C @@ -1628,7 +1628,7 @@ bool Foam::fvMeshStitcher::disconnectThis surfaceScalarField phi(mesh_.phi()); for (label i = 1; i < mesh_.phi().nOldTimes(false); ++ i) { - phi.oldTime(i) == mesh_.phi().oldTime(i); + phi.oldTimeRef(i) == mesh_.phi().oldTime(i); } conformCorrectMeshPhi(phi); mesh_.conform(phi); @@ -1774,7 +1774,7 @@ bool Foam::fvMeshStitcher::connectThis surfaceScalarField phi(mesh_.phi()); for (label i = 1; i <= mesh_.phi().nOldTimes(false); ++ i) { - phi.oldTime(i) == mesh_.phi().oldTime(i); + phi.oldTimeRef(i) == mesh_.phi().oldTime(i); } unconformCorrectMeshPhi(polyFacesBf, Sf, Cf, phi); mesh_.unconform(polyFacesBf, Sf, Cf, phi); diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/cellCoBlended/cellCoBlended.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/cellCoBlended/cellCoBlended.H index 602ad8be8f..62ab864200 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/cellCoBlended/cellCoBlended.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/cellCoBlended/cellCoBlended.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -233,7 +233,9 @@ public: ); Co.primitiveFieldRef() = - (sumPhi/mesh.V().field())*(0.5*mesh.time().deltaTValue()); + (sumPhi/mesh.V().primitiveField()) + *(0.5*mesh.time().deltaTValue()); + Co.correctBoundaryConditions(); return surfaceScalarField::New diff --git a/src/functionObjects/field/CourantNo/CourantNo.C b/src/functionObjects/field/CourantNo/CourantNo.C index 5feba39431..859d781899 100644 --- a/src/functionObjects/field/CourantNo/CourantNo.C +++ b/src/functionObjects/field/CourantNo/CourantNo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -84,7 +84,7 @@ bool Foam::functionObjects::CourantNo::calc() ) ); - tCo->ref() = + tCo->internalFieldRef() = byRho ( (0.5*time_.deltaT()) diff --git a/src/functionObjects/field/writeCellVolumes/writeCellVolumes.C b/src/functionObjects/field/writeCellVolumes/writeCellVolumes.C index 4c1dfeb03f..9a2ddad043 100644 --- a/src/functionObjects/field/writeCellVolumes/writeCellVolumes.C +++ b/src/functionObjects/field/writeCellVolumes/writeCellVolumes.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -86,7 +86,7 @@ bool Foam::functionObjects::writeCellVolumes::write() calculatedFvPatchField::typeName ); - V.ref() = mesh_.V(); + V.internalFieldRef() = mesh_.V(); Log << " Writing cell-volumes field " << V.name() << " to " << time_.name() << endl; diff --git a/src/fvMeshDistributors/loadBalancer/fvMeshDistributorsLoadBalancer.C b/src/fvMeshDistributors/loadBalancer/fvMeshDistributorsLoadBalancer.C index 417cec5670..0d07d6ce87 100644 --- a/src/fvMeshDistributors/loadBalancer/fvMeshDistributorsLoadBalancer.C +++ b/src/fvMeshDistributors/loadBalancer/fvMeshDistributorsLoadBalancer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -111,7 +111,7 @@ bool Foam::fvMeshDistributors::loadBalancer::update() forAllConstIter(HashTable, cpuLoads, iter) { - sumCpuLoad += sum(iter()->field()); + sumCpuLoad += sum(iter()->primitiveField()); } const scalar cellCFDCpuTime = returnReduce @@ -157,7 +157,7 @@ bool Foam::fvMeshDistributors::loadBalancer::update() label loadi = 1; forAllConstIter(HashTable, cpuLoads, iter) { - const scalarField& cpuLoadField = iter()->field(); + const scalarField& cpuLoadField = iter()->primitiveField(); forAll(cpuLoadField, i) { @@ -173,7 +173,7 @@ bool Foam::fvMeshDistributors::loadBalancer::update() forAllConstIter(HashTable, cpuLoads, iter) { - weights += iter()->field(); + weights += iter()->primitiveField(); } } diff --git a/src/fvMeshStitchers/moving/fvMeshStitchersMoving.C b/src/fvMeshStitchers/moving/fvMeshStitchersMoving.C index e99cca7c63..2453ff85ef 100644 --- a/src/fvMeshStitchers/moving/fvMeshStitchersMoving.C +++ b/src/fvMeshStitchers/moving/fvMeshStitchersMoving.C @@ -148,7 +148,7 @@ void Foam::fvMeshStitchers::moving::conformCorrectMeshPhi for (label i = 0; i <= phi.nOldTimes(false); ++ i) { - phi.oldTime(i).boundaryFieldRef()[origPatchi] += + phi.oldTimeRef(i).boundaryFieldRef()[origPatchi] += fvMeshStitcherTools::fieldRMapSum ( phi.oldTime(i).boundaryField()[nccPatchi], @@ -157,7 +157,7 @@ void Foam::fvMeshStitchers::moving::conformCorrectMeshPhi origFvp.start() ); - phi.oldTime(i).boundaryFieldRef()[nccPatchi].clear(); + phi.oldTimeRef(i).boundaryFieldRef()[nccPatchi].clear(); } } } @@ -879,7 +879,7 @@ void Foam::fvMeshStitchers::moving::unconformErrorFaceCorrectMeshPhi ); phiErrorbs[i] = phi.oldTime(i).boundaryField() - tphib(); - phi.oldTime(i).boundaryFieldRef() = tphib; + phi.oldTimeRef(i).boundaryFieldRef() = tphib; } // Add the mesh flux error into the error patch so that the mesh fluxes @@ -909,7 +909,7 @@ void Foam::fvMeshStitchers::moving::unconformErrorFaceCorrectMeshPhi for (label i = 0; i <= phi.nOldTimes(false); ++ i) { fvsPatchField& phip = - phi.oldTime(i).boundaryFieldRef()[errorPatchi]; + phi.oldTimeRef(i).boundaryFieldRef()[errorPatchi]; phip[errorPatchFacei0] += phiErrorbs[i][nccPatchi][nccPatchFacei]/2; phip[errorPatchFacei1] += @@ -1049,7 +1049,7 @@ void Foam::fvMeshStitchers::moving::unconformCorrectMeshPhi // the area taken from the old original faces for (label i = 0; i <= phi.nOldTimes(false); ++ i) { - phi.oldTime(i).boundaryFieldRef() = + phi.oldTimeRef(i).boundaryFieldRef() = fvMeshStitcherTools::unconformedBoundaryField ( phi.oldTime(i).boundaryField(), diff --git a/src/fvModels/derived/phaseChange/phaseChange.C b/src/fvModels/derived/phaseChange/phaseChange.C index 50a27aaa56..1a1d826512 100644 --- a/src/fvModels/derived/phaseChange/phaseChange.C +++ b/src/fvModels/derived/phaseChange/phaseChange.C @@ -69,7 +69,7 @@ Foam::tmp Foam::fv::phaseChange::vifToVf extrapolatedCalculatedFvPatchField::typeName ); - tvf->ref() = tvif(); + tvf->internalFieldRef() = tvif(); tvf->correctBoundaryConditions(); tvif.clear(); diff --git a/src/fvModels/derived/zeroDimensionalMassSource/zeroDimensionalMassSourceBase.C b/src/fvModels/derived/zeroDimensionalMassSource/zeroDimensionalMassSourceBase.C index 3e7da1d5cd..58164cc1ef 100644 --- a/src/fvModels/derived/zeroDimensionalMassSource/zeroDimensionalMassSourceBase.C +++ b/src/fvModels/derived/zeroDimensionalMassSource/zeroDimensionalMassSourceBase.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -71,11 +71,11 @@ Foam::fv::zeroDimensionalMassSourceBase::calcM0D() const IOobject::groupName("alpha", phaseName) ); - tm.ref().ref() += alpha()*rho()*mesh().V(); + tm.ref().internalFieldRef() += alpha()*rho()*mesh().V(); } else { - tm.ref().ref() += rho()*mesh().V(); + tm.ref().internalFieldRef() += rho()*mesh().V(); } } diff --git a/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.C b/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.C index 47c6a49f61..8535a860e6 100644 --- a/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -579,8 +579,8 @@ void Foam::MomentumCloud::restoreState() template void Foam::MomentumCloud::resetSourceTerms() { - UTransRef().field() = Zero; - UCoeffRef().field() = 0.0; + UTransRef().primitiveFieldRef() = Zero; + UCoeffRef().primitiveFieldRef() = 0.0; } diff --git a/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.C index 12ed85665b..16bacf42ef 100644 --- a/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -252,7 +252,7 @@ void Foam::ReactingCloud::resetSourceTerms() CloudType::resetSourceTerms(); forAll(rhoTrans_, i) { - rhoTrans_[i].field() = 0.0; + rhoTrans_[i].primitiveFieldRef() = 0.0; } } diff --git a/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.C index cb5a487fdb..102dbc6ed0 100644 --- a/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -405,14 +405,14 @@ template void Foam::ThermoCloud::resetSourceTerms() { CloudType::resetSourceTerms(); - hsTrans_->field() = 0.0; - hsCoeff_->field() = 0.0; + hsTrans_->primitiveFieldRef() = 0.0; + hsCoeff_->primitiveFieldRef() = 0.0; if (radiation_) { - radAreaP_->field() = 0.0; - radT4_->field() = 0.0; - radAreaPT4_->field() = 0.0; + radAreaP_->primitiveFieldRef() = 0.0; + radT4_->primitiveFieldRef() = 0.0; + radAreaPT4_->primitiveFieldRef() = 0.0; } } diff --git a/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloudI.H index 1820f1861f..c5c1954b9e 100644 --- a/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloudI.H +++ b/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloudI.H @@ -305,7 +305,7 @@ inline Foam::tmp Foam::ThermoCloud::Ep() const const scalar dt = this->db().time().deltaTValue(); const scalarField& V = this->mesh().V(); const scalar epsilon = constProps_.epsilon0(); - const scalarField& sumAreaPT4 = radAreaPT4_->field(); + const scalarField& sumAreaPT4 = radAreaPT4_->primitiveField(); Ep = sumAreaPT4*epsilon*physicoChemical::sigma.value()/V/dt; } @@ -333,7 +333,7 @@ inline Foam::tmp Foam::ThermoCloud::ap() const const scalar dt = this->db().time().deltaTValue(); const scalarField& V = this->mesh().V(); const scalar epsilon = constProps_.epsilon0(); - const scalarField& sumAreaP = radAreaP_->field(); + const scalarField& sumAreaP = radAreaP_->primitiveField(); ap = sumAreaP*epsilon/V/dt; } @@ -363,7 +363,7 @@ Foam::ThermoCloud::sigmap() const const scalarField& V = this->mesh().V(); const scalar epsilon = constProps_.epsilon0(); const scalar f = constProps_.f0(); - const scalarField& sumAreaP = radAreaP_->field(); + const scalarField& sumAreaP = radAreaP_->primitiveField(); sigmap = sumAreaP*(1.0 - f)*(1.0 - epsilon)/V/dt; } diff --git a/src/polyTopoChange/fvMeshDistribute/fvMeshDistribute.C b/src/polyTopoChange/fvMeshDistribute/fvMeshDistribute.C index 3f35ef245b..9e761bb96b 100644 --- a/src/polyTopoChange/fvMeshDistribute/fvMeshDistribute.C +++ b/src/polyTopoChange/fvMeshDistribute/fvMeshDistribute.C @@ -1637,8 +1637,8 @@ void Foam::fvMeshDistribute::sendMesh << mesh.boundaryMesh() //*** Write the old-time volumes if present - // << mesh.V0().field() - // << mesh.V0().field() + // << mesh.V0().primitiveField() + // << mesh.V00().primitiveField() << zonePoints << zoneFaces diff --git a/src/thermophysicalModels/saturationModels/function1Temperature/function1Temperature.C b/src/thermophysicalModels/saturationModels/function1Temperature/function1Temperature.C index e1d7358f54..4ab1299403 100644 --- a/src/thermophysicalModels/saturationModels/function1Temperature/function1Temperature.C +++ b/src/thermophysicalModels/saturationModels/function1Temperature/function1Temperature.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -81,7 +81,7 @@ Foam::saturationModels::function1Temperature::Tsat volScalarField::Internal& Tsat = tTsat.ref(); - Tsat.field() = function_->value(p.field()); + Tsat.primitiveFieldRef() = function_->value(p.primitiveField()); return tTsat; } diff --git a/src/twoPhaseModels/VoF/alphaCourantNo.H b/src/twoPhaseModels/VoF/alphaCourantNo.H index cf0ae763a1..ad12f52306 100644 --- a/src/twoPhaseModels/VoF/alphaCourantNo.H +++ b/src/twoPhaseModels/VoF/alphaCourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,10 +38,13 @@ scalar alphaCoNum = 0; *fvc::surfaceSum(mag(phi))().primitiveField() ); - alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + alphaCoNum = + 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue(); const scalar meanAlphaCoNum = - 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + 0.5 + *(gSum(sumPhi)/gSum(mesh.V().primitiveField())) + *runTime.deltaTValue(); Info<< "Interface Courant Number mean: " << meanAlphaCoNum << " max: " << alphaCoNum << endl; diff --git a/src/twoPhaseModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C b/src/twoPhaseModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C index aaba11735b..1009dcfc77 100644 --- a/src/twoPhaseModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C +++ b/src/twoPhaseModels/interfaceProperties/surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -77,7 +77,7 @@ Foam::surfaceTensionModels::temperatureDependent::sigma() const const volScalarField& T = mesh_.lookupObject(TName_); - sigma.field() = sigma_->value(T.field()); + sigma.primitiveFieldRef() = sigma_->value(T.primitiveField()); volScalarField::Boundary& sigmaBf = sigma.boundaryFieldRef(); const volScalarField::Boundary& TBf = T.boundaryField(); diff --git a/src/twoPhaseModels/twoPhaseMixture/twoPhaseMixture.C b/src/twoPhaseModels/twoPhaseMixture/twoPhaseMixture.C index 98dac55c96..0abd65934b 100644 --- a/src/twoPhaseModels/twoPhaseMixture/twoPhaseMixture.C +++ b/src/twoPhaseModels/twoPhaseMixture/twoPhaseMixture.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -269,7 +269,7 @@ Foam::twoPhaseMixture::interfaceFraction() const } } - scalarField& a = A.field(); + scalarField& a = A.primitiveFieldRef(); forAll(a, i) { if (sumnSf[i] > small)