DimensionedField, GeometricField: Consistent field-access interface

This commit is contained in:
Will Bainbridge
2024-03-19 16:19:43 +00:00
parent 5039aec60d
commit 24a3bfdd17
78 changed files with 630 additions and 377 deletions

View File

@ -3,7 +3,12 @@
if (ign.igniting()) if (ign.igniting())
{ {
// Calculate volume of ignition kernel // 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); dimensionedScalar Ak("Ak", dimArea, 0.0);
if (Vk.value() > small) if (Vk.value() > small)
@ -78,7 +83,7 @@
( (
fvc::div(nf, b, "div(phiSt,b)") - b*fvc::div(nf) + dMgb 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); StCorr.value() = max(min((Ak/AkEst).value(), 10.0), 1.0);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,10 +36,12 @@ Description
/rho.primitiveField() /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 = 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 Info<< "St courant Number mean: " << meanStCoNum
<< " max: " << StCoNum << endl; << " max: " << StCoNum << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,10 +37,12 @@ Description
); );
const scalar CoNum = const scalar CoNum =
0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue();
const scalar meanCoNum = 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 // Gravity wave Courant number
const scalar waveCoNum = 0.25*gMax const scalar waveCoNum = 0.25*gMax
@ -48,7 +50,7 @@ Description
fvc::surfaceSum fvc::surfaceSum
( (
fvc::interpolate(sqrt(h))*mesh.magSf() fvc::interpolate(sqrt(h))*mesh.magSf()
)().primitiveField()/mesh.V().field() )().primitiveField()/mesh.V().primitiveField()
)*sqrt(magg).value()*runTime.deltaTValue(); )*sqrt(magg).value()*runTime.deltaTValue();
Info<< "Courant number mean: " << meanCoNum Info<< "Courant number mean: " << meanCoNum

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,7 +42,8 @@ void Foam::solvers::VoFSolver::setRDeltaT()
const volScalarField rDeltaT0("rDeltaT0", rDeltaT); const volScalarField rDeltaT0("rDeltaT0", rDeltaT);
// Set the reciprocal time-step from the local Courant number // 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 // Clip to user-defined maximum and minimum time-steps
scalar minRDeltaT = gMin(rDeltaT.primitiveField()); scalar minRDeltaT = gMin(rDeltaT.primitiveField());

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -69,7 +69,12 @@ Foam::dimensionedScalar Foam::solvers::XiFluid::StCorr
if (ign.igniting()) if (ign.igniting())
{ {
// Calculate volume of ignition kernel // 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); dimensionedScalar Ak("Ak", dimArea, 0.0);
if (Vk.value() > small) 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 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); StCorr.value() = max(min((Ak/AkEst).value(), 10.0), 1.0);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -89,12 +89,14 @@ void Foam::solvers::fluidSolver::meshCourantNo() const
const scalar meshCoNum const scalar meshCoNum
( (
0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue() 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue()
); );
const scalar meanMeshCoNum 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 Info<< "Mesh Courant Number mean: " << meanMeshCoNum
@ -115,10 +117,12 @@ void Foam::solvers::fluidSolver::correctCoNum
fvc::surfaceSum(mag(phi))().primitiveField()/rho.primitiveField() 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 = 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 Info<< "Courant Number mean: " << meanCoNum
<< " max: " << CoNum << endl; << " max: " << CoNum << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -53,7 +53,8 @@ void Foam::solvers::incompressibleFluid::setRDeltaT()
const volScalarField rDeltaT0("rDeltaT0", rDeltaT); const volScalarField rDeltaT0("rDeltaT0", rDeltaT);
// Set the reciprocal time-step from the local Courant number // 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 // Clip to user-defined maximum and minimum time-steps
scalar minRDeltaT = gMin(rDeltaT.primitiveField()); scalar minRDeltaT = gMin(rDeltaT.primitiveField());

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -52,7 +52,10 @@ tmp<scalarField> curvatureSeparation::calcInvR1
const volVectorField& U const volVectorField& U
) const ) const
{ {
const vectorField UHat(U.field()/(mag(U.field()) + rootVSmall)); const vectorField UHat
(
U.primitiveField()/(mag(U.primitiveField()) + rootVSmall)
);
tmp<scalarField> tinvR1(-(UHat & (UHat & gradNHat_))); tmp<scalarField> tinvR1(-(UHat & (UHat & gradNHat_)));
scalarField& invR1 = tinvR1.ref(); scalarField& invR1 = tinvR1.ref();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -124,8 +124,8 @@ inline Foam::fv::filmCloudTransfer::CloudToFilmTransferRate
prop/cloudMesh.boundary()[cloudPatchi].magSf() prop/cloudMesh.boundary()[cloudPatchi].magSf()
); );
tSu.ref().field() /= film_.VbyA; tSu.ref().primitiveFieldRef() /= film_.VbyA;
tSu.ref().field() /= mesh().time().deltaTValue(); tSu.ref().primitiveFieldRef() /= mesh().time().deltaTValue();
} }
return tSu; return tSu;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -172,10 +172,12 @@ void Foam::solvers::isothermalFilm::correctCoNum()
{ {
const scalarField sumPhi(fvc::surfaceSum(mag(phi))().primitiveField()); 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 = 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 Info<< "Courant Number mean: " << meanCoNum
<< " max: " << CoNum << endl; << " max: " << CoNum << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -78,7 +78,8 @@ Foam::solvers::isothermalFilm::pe() const
// Add the pressure caused normal momentum sources (e.g., parcels impinging // Add the pressure caused normal momentum sources (e.g., parcels impinging
// with a normal velocity) // 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; return p;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -316,7 +316,7 @@ void Foam::solvers::isothermalFluid::preSolve()
for (label i = 1; i <= rhoUf().nOldTimes(false); ++ i) 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);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -51,14 +51,16 @@ void Foam::solvers::isothermalFluid::setRDeltaT()
const volScalarField rDeltaT0("rDeltaT0", rDeltaT); const volScalarField rDeltaT0("rDeltaT0", rDeltaT);
// Set the reciprocal time-step from the local Courant number // 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 // Set the reciprocal time-step from the local acoustic Courant number
if (pimple.transonic()) if (pimple.transonic())
{ {
surfaceScalarField phid("phid", fvc::interpolate(psi)*fvc::flux(U)); surfaceScalarField phid("phid", fvc::interpolate(psi)*fvc::flux(U));
rDeltaT.ref() = max rDeltaT.internalFieldRef() =
max
( (
rDeltaT(), rDeltaT(),
fvc::surfaceSum(mag(phid))()()/((2*maxCo)*mesh.V()*psi()) fvc::surfaceSum(mag(phid))()()/((2*maxCo)*mesh.V()*psi())

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -45,7 +45,7 @@ void Foam::solvers::multicomponentFluid::setRDeltaT()
const scalar maxCo(pimpleDict.lookup<scalar>("maxCo")); const scalar maxCo(pimpleDict.lookup<scalar>("maxCo"));
// Set the reciprocal time-step from the local Courant number // Set the reciprocal time-step from the local Courant number
rDeltaT.ref() = rDeltaT.internalFieldRef() =
fvc::surfaceSum(mag(phi))()()/((2*maxCo)*mesh.V()*rho()); fvc::surfaceSum(mag(phi))()()/((2*maxCo)*mesh.V()*rho());
// Clip to user-defined maximum and minimum time-steps // Clip to user-defined maximum and minimum time-steps
@ -80,10 +80,10 @@ void Foam::solvers::multicomponentFluid::setRDeltaT()
); );
Info<< " Temperature = " Info<< " Temperature = "
<< 1/(gMax(rDeltaTT.field()) + vSmall) << ", " << 1/(gMax(rDeltaTT.primitiveField()) + vSmall) << ", "
<< 1/(gMin(rDeltaTT.field()) + vSmall) << endl; << 1/(gMin(rDeltaTT.primitiveField()) + vSmall) << endl;
rDeltaT.ref() = max(rDeltaT(), rDeltaTT); rDeltaT.internalFieldRef() = max(rDeltaT(), rDeltaTT);
} }
// Reaction rate time scale // Reaction rate time scale
@ -120,7 +120,7 @@ void Foam::solvers::multicomponentFluid::setRDeltaT()
foundY = true; foundY = true;
scalar Yrefi = Yref.lookup<scalar>(Yi.name()); scalar Yrefi = Yref.lookup<scalar>(Yi.name());
rDeltaTY.field() = max rDeltaTY.primitiveFieldRef() = max
( (
mag mag
( (
@ -136,10 +136,10 @@ void Foam::solvers::multicomponentFluid::setRDeltaT()
if (foundY) if (foundY)
{ {
Info<< " Composition = " Info<< " Composition = "
<< 1/(gMax(rDeltaTY.field()) + vSmall) << ", " << 1/(gMax(rDeltaTY.primitiveField()) + vSmall) << ", "
<< 1/(gMin(rDeltaTY.field()) + vSmall) << endl; << 1/(gMin(rDeltaTY.primitiveField()) + vSmall) << endl;
rDeltaT.ref() = max(rDeltaT(), rDeltaTY); rDeltaT.internalFieldRef() = max(rDeltaT(), rDeltaTY);
} }
else else
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -110,7 +110,7 @@ Foam::fv::interfaceTurbulenceDamping::interfaceFraction
} }
} }
scalarField& a = A.field(); scalarField& a = A.primitiveFieldRef();
forAll(a, i) forAll(a, i)
{ {
if (sumnSf[i] > small) if (sumnSf[i] > small)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -148,7 +148,7 @@ Foam::tmp<Foam::volScalarField> Foam::dragModels::segregated::K() const
) )
); );
tK.ref().ref() = lambda*sqr(magGradI)*muI; tK.ref().internalFieldRef() = lambda*sqr(magGradI)*muI;
tK.ref().correctBoundaryConditions(); tK.ref().correctBoundaryConditions();
return tK; return tK;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -91,7 +91,8 @@ Foam::phaseTransferModels::cavitation::dmdtf() const
const volScalarField::Internal pSat1(cavitation_->pSat1()); const volScalarField::Internal pSat1(cavitation_->pSat1());
const volScalarField::Internal pSat2(cavitation_->pSat2()); 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(); tResult.ref().correctBoundaryConditions();
return tResult; return tResult;
@ -112,7 +113,7 @@ Foam::phaseTransferModels::cavitation::d2mdtdpf() const
const Pair<tmp<volScalarField::Internal>> coeffs(cavitation_->mDot12P()); const Pair<tmp<volScalarField::Internal>> coeffs(cavitation_->mDot12P());
tResult.ref().ref() = coeffs[0] - coeffs[1]; tResult.ref().internalFieldRef() = coeffs[0] - coeffs[1];
tResult.ref().correctBoundaryConditions(); tResult.ref().correctBoundaryConditions();
return tResult; return tResult;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License 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 = 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 Info<< "Courant Number mean: " << meanCoNum
<< " max: " << CoNum << endl; << " max: " << CoNum << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -53,7 +53,8 @@ void Foam::solvers::multiphaseEuler::setRDeltaT()
} }
// Set the reciprocal time-step from the local Courant number // 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 // Clip to user-defined maximum and minimum time-steps
scalar minRDeltaT = gMin(rDeltaT.primitiveField()); scalar minRDeltaT = gMin(rDeltaT.primitiveField());

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -50,10 +50,13 @@ void Foam::solvers::multiphaseVoFSolver::correctCoNum()
*fvc::surfaceSum(mag(phi))().primitiveField() *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 = 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 Info<< "Interface Courant Number mean: " << meanAlphaCoNum
<< " max: " << alphaCoNum << endl; << " max: " << alphaCoNum << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -76,7 +76,8 @@ void Foam::solvers::multiphaseVoFSolver::setInterfaceRDeltaT
{ {
const volScalarField alphaBar(fvc::average(phases[phasei])); const volScalarField alphaBar(fvc::average(phases[phasei]));
rDeltaT.ref() = max rDeltaT.internalFieldRef() =
max
( (
rDeltaT(), rDeltaT(),
pos0(alphaBar() - alphaSpreadMin) pos0(alphaBar() - alphaSpreadMin)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,7 +30,7 @@ License
void Foam::solvers::shockFluid::pressureCorrector() void Foam::solvers::shockFluid::pressureCorrector()
{ {
const volScalarField& psi = thermo.psi(); const volScalarField& psi = thermo.psi();
p_.ref() = rho()/psi(); p_.internalFieldRef() = rho()/psi();
p_.correctBoundaryConditions(); p_.correctBoundaryConditions();
rho_.boundaryFieldRef() == psi.boundaryField()*p.boundaryField(); rho_.boundaryFieldRef() == psi.boundaryField()*p.boundaryField();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,7 +49,8 @@ void Foam::solvers::shockFluid::setRDeltaT(const surfaceScalarField& amaxSf)
); );
// Set the reciprocal time-step from the local Courant number // 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 // Clip to user-defined maximum and minimum time-steps
scalar minRDeltaT = gMin(rDeltaT.primitiveField()); scalar minRDeltaT = gMin(rDeltaT.primitiveField());

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -51,10 +51,13 @@ void Foam::solvers::shockFluid::correctCoNum(const surfaceScalarField& amaxSf)
{ {
const scalarField sumAmaxSf(fvc::surfaceSum(amaxSf)().primitiveField()); 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 = 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 Info<< "Courant Number mean: " << meanCoNum
<< " max: " << CoNum << endl; << " max: " << CoNum << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -84,7 +84,8 @@ void Foam::solvers::twoPhaseVoFSolver::setInterfaceRDeltaT
volScalarField alpha1Bar(fvc::average(alpha1)); volScalarField alpha1Bar(fvc::average(alpha1));
rDeltaT.ref() = max rDeltaT.internalFieldRef() =
max
( (
rDeltaT(), rDeltaT(),
pos0(alpha1Bar() - alphaSpreadMin) pos0(alpha1Bar() - alphaSpreadMin)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,10 +49,13 @@ void Foam::solvers::twoPhaseVoFSolver::correctCoNum()
*fvc::surfaceSum(mag(phi))().primitiveField() *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 = 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 Info<< "Interface Courant Number mean: " << meanAlphaCoNum
<< " max: " << alphaCoNum << endl; << " max: " << alphaCoNum << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -125,7 +125,7 @@ Foam::fvFieldDecomposer::decomposeVolInternalField
), ),
procMeshes_[proci], procMeshes_[proci],
field.dimensions(), field.dimensions(),
Field<Type>(field.field(), cellProcAddressing_[proci]) Field<Type>(field.primitiveField(), cellProcAddressing_[proci])
) )
); );
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -120,7 +120,7 @@ Foam::fvFieldReconstructor::reconstructVolInternalField
// Set the cell values in the reconstructed field // Set the cell values in the reconstructed field
internalField.rmap internalField.rmap
( (
procField.field(), procField.primitiveField(),
cellProcAddressing_[proci] cellProcAddressing_[proci]
); );
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -55,7 +55,7 @@ Foam::laplaceFilter::laplaceFilter(const fvMesh& mesh, scalar widthCoeff)
calculatedFvPatchScalarField::typeName 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 calculatedFvPatchScalarField::typeName
) )
{ {
coeff_.ref() = pow(mesh.V(), 2.0/3.0)/widthCoeff_; coeff_.internalFieldRef() = pow(mesh.V(), 2.0/3.0)/widthCoeff_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -413,7 +413,8 @@ tmp<volScalarField> SpalartAllmarasDES<BasicMomentumTransportModel>::k() const
dimLength, dimLength,
zeroGradientFvPatchScalarField::typeName zeroGradientFvPatchScalarField::typeName
); );
dTildaExtrapolated.ref() = dTilda(chi, fv1, fvc::grad(this->U_)); dTildaExtrapolated.internalFieldRef() =
dTilda(chi, fv1, fvc::grad(this->U_));
dTildaExtrapolated.correctBoundaryConditions(); dTildaExtrapolated.correctBoundaryConditions();
tmp<volScalarField> tk tmp<volScalarField> tk

View File

@ -150,8 +150,8 @@ void Foam::epsilonWallFunctionFvPatchScalarField::updateCoeffsMaster()
UIndirectList<scalar>(G, wallCells()) = UIndirectList<scalar>(G, wallCells()) =
(1 - wallCellFraction())*scalarField(G, wallCells()) (1 - wallCellFraction())*scalarField(G, wallCells())
+ wallCellFraction()*wallCellGPtr_(); + wallCellFraction()*wallCellGPtr_();
UIndirectList<scalar>(epsilon.ref(), wallCells()) = UIndirectList<scalar>(epsilon, wallCells()) =
(1 - wallCellFraction())*scalarField(epsilon.ref(), wallCells()) (1 - wallCellFraction())*scalarField(epsilon, wallCells())
+ wallCellFraction()*wallCellEpsilonPtr_(); + wallCellFraction()*wallCellEpsilonPtr_();
} }

View File

@ -181,8 +181,8 @@ void Foam::omegaWallFunctionFvPatchScalarField::updateCoeffsMaster()
UIndirectList<scalar>(G, wallCells()) = UIndirectList<scalar>(G, wallCells()) =
(1 - wallCellFraction())*scalarField(G, wallCells()) (1 - wallCellFraction())*scalarField(G, wallCells())
+ wallCellFraction()*wallCellGPtr_(); + wallCellFraction()*wallCellGPtr_();
UIndirectList<scalar>(omega.ref(), wallCells()) = UIndirectList<scalar>(omega, wallCells()) =
(1 - wallCellFraction())*scalarField(omega.ref(), wallCells()) (1 - wallCellFraction())*scalarField(omega, wallCells())
+ wallCellFraction()*wallCellOmegaPtr_(); + wallCellFraction()*wallCellOmegaPtr_();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -75,7 +75,7 @@ public:
) )
: :
gf_(gf), gf_(gf),
gf0_(gf.oldTime()) gf0_(gf.oldTimeRef())
{ {
if (nSubCycles > 1) if (nSubCycles > 1)
{ {
@ -163,7 +163,7 @@ public:
forAll(gfPtrs_, i) forAll(gfPtrs_, i)
{ {
gf0Ptrs_[i] = &gfPtrs_[i]->oldTime(); gf0Ptrs_[i] = &gfPtrs_[i]->oldTimeRef();
gf_0Ptrs_.set gf_0Ptrs_.set
( (

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -436,6 +436,14 @@ DimensionedField<Type, GeoMesh>::~DimensionedField()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type, class GeoMesh>
Foam::Field<Type>& Foam::DimensionedField<Type, GeoMesh>::primitiveFieldRef()
{
this->setUpToDate();
return *this;
}
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
tmp tmp
< <
@ -518,7 +526,7 @@ dimensioned<Type> DimensionedField<Type, GeoMesh>::average() const
( (
this->name() + ".average()", this->name() + ".average()",
this->dimensions(), this->dimensions(),
gAverage(field()) gAverage(primitiveField())
); );
return Average; return Average;
@ -537,7 +545,7 @@ dimensioned<Type> DimensionedField<Type, GeoMesh>::weightedAverage
( (
this->name() + ".weightedAverage(weights)", this->name() + ".weightedAverage(weights)",
this->dimensions(), this->dimensions(),
gSum(weightField*field())/gSum(weightField) gSum(weightField*primitiveField())/gSum(weightField)
) )
); );
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -294,9 +294,11 @@ public:
//- Return non-const access to dimensions //- Return non-const access to dimensions
inline dimensionSet& dimensions(); inline dimensionSet& dimensions();
inline const Field<Type>& field() const; //- Return a reference to the internal field
Field<Type>& primitiveFieldRef();
inline Field<Type>& field(); //- Return a const-reference to the primitive field
inline const Field<Type>& primitiveField() const;
//- Return a component field of the field //- Return a component field of the field
tmp<DimensionedField<cmptType, GeoMesh>> component tmp<DimensionedField<cmptType, GeoMesh>> component

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -55,7 +55,7 @@ pow
) )
); );
pow<Type, r, GeoMesh>(tPow.ref().field(), df.field()); pow<Type, r, GeoMesh>(tPow.ref().primitiveFieldRef(), df.primitiveField());
return tPow; return tPow;
} }
@ -81,7 +81,7 @@ pow
pow(df.dimensions(), r) pow(df.dimensions(), r)
); );
pow<Type, r, GeoMesh>(tPow.ref().field(), df.field()); pow<Type, r, GeoMesh>(tPow.ref().primitiveFieldRef(), df.primitiveField());
tdf.clear(); tdf.clear();
@ -104,7 +104,7 @@ sqr(const DimensionedField<Type, GeoMesh>& df)
) )
); );
sqr(tSqr.ref().field(), df.field()); sqr(tSqr.ref().primitiveFieldRef(), df.primitiveField());
return tSqr; return tSqr;
} }
@ -125,7 +125,7 @@ sqr(const tmp<DimensionedField<Type, GeoMesh>>& tdf)
sqr(df.dimensions()) sqr(df.dimensions())
); );
sqr(tSqr.ref().field(), df.field()); sqr(tSqr.ref().primitiveFieldRef(), df.primitiveField());
tdf.clear(); tdf.clear();
@ -149,7 +149,7 @@ tmp<DimensionedField<scalar, GeoMesh>> magSqr
) )
); );
magSqr(tMagSqr.ref().field(), df.field()); magSqr(tMagSqr.ref().primitiveFieldRef(), df.primitiveField());
return tMagSqr; return tMagSqr;
} }
@ -170,7 +170,7 @@ tmp<DimensionedField<scalar, GeoMesh>> magSqr
sqr(df.dimensions()) sqr(df.dimensions())
); );
magSqr(tMagSqr.ref().field(), df.field()); magSqr(tMagSqr.ref().primitiveFieldRef(), df.primitiveField());
tdf.clear(); tdf.clear();
@ -194,7 +194,7 @@ tmp<DimensionedField<scalar, GeoMesh>> mag
) )
); );
mag(tMag.ref().field(), df.field()); mag(tMag.ref().primitiveFieldRef(), df.primitiveField());
return tMag; return tMag;
} }
@ -215,7 +215,7 @@ tmp<DimensionedField<scalar, GeoMesh>> mag
df.dimensions() df.dimensions()
); );
mag(tMag.ref().field(), df.field()); mag(tMag.ref().primitiveFieldRef(), df.primitiveField());
tdf.clear(); tdf.clear();
@ -243,7 +243,7 @@ cmptAv(const DimensionedField<Type, GeoMesh>& df)
) )
); );
cmptAv(CmptAv.ref().field(), df.field()); cmptAv(CmptAv.ref().primitiveFieldRef(), df.primitiveField());
return CmptAv; return CmptAv;
} }
@ -269,7 +269,7 @@ cmptAv(const tmp<DimensionedField<Type, GeoMesh>>& tdf)
df.dimensions() df.dimensions()
); );
cmptAv(CmptAv.ref().field(), df.field()); cmptAv(CmptAv.ref().primitiveFieldRef(), df.primitiveField());
tdf.clear(); tdf.clear();
@ -291,7 +291,7 @@ dimensioned<returnType> func \
( \ ( \
#func "(" + df.name() + ')', \ #func "(" + df.name() + ')', \
df.dimensions(), \ 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; \ return tRes; \
} \ } \
@ -388,7 +393,12 @@ operator op \
df1.dimensions() op df2.dimensions() \ 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(); \ tdf2.clear(); \
\ \
@ -415,7 +425,12 @@ operator op \
df1.dimensions() op df2.dimensions() \ 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(); \ tdf1.clear(); \
\ \
@ -444,7 +459,12 @@ operator op \
df1.dimensions() op df2.dimensions() \ 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(); \ tdf1.clear(); \
tdf2.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; \ return tRes; \
} \ } \
@ -509,7 +534,12 @@ operator op \
df1.dimensions() op dvs.dimensions() \ 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(); \ 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; \ return tRes; \
} \ } \
@ -583,7 +618,12 @@ operator op \
dvs.dimensions() op df1.dimensions() \ 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(); \ tdf1.clear(); \
\ \

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -45,7 +45,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \ ) \
); \ ); \
\ \
Func(tRes.ref().field(), df1.field()); \ Func(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \
\ \
return tRes; \ return tRes; \
} \ } \
@ -68,7 +68,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \ ) \
); \ ); \
\ \
Func(tRes.ref().field(), df1.field()); \ Func(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \
\ \
tdf1.clear(); \ tdf1.clear(); \
\ \
@ -96,7 +96,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \ ) \
); \ ); \
\ \
Foam::OpFunc(tRes.ref().field(), df1.field()); \ Foam::OpFunc(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \
\ \
return tRes; \ return tRes; \
} \ } \
@ -119,7 +119,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \ ) \
); \ ); \
\ \
Foam::OpFunc(tRes.ref().field(), df1.field()); \ Foam::OpFunc(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \
\ \
tdf1.clear(); \ tdf1.clear(); \
\ \
@ -148,7 +148,12 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \ ) \
); \ ); \
\ \
Func(tRes.ref().field(), df1.field(), df2.field()); \ Func \
( \
tRes.ref().primitiveFieldRef(), \
df1.primitiveField(), \
df2.primitiveField() \
); \
\ \
return tRes; \ return tRes; \
} \ } \
@ -172,7 +177,12 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \ ) \
); \ ); \
\ \
Func(tRes.ref().field(), df1.field(), df2.field()); \ Func \
( \
tRes.ref().primitiveFieldRef(), \
df1.primitiveField(), \
df2.primitiveField() \
); \
\ \
tdf2.clear(); \ tdf2.clear(); \
\ \
@ -198,7 +208,12 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \ ) \
); \ ); \
\ \
Func(tRes.ref().field(), df1.field(), df2.field()); \ Func \
( \
tRes.ref().primitiveFieldRef(), \
df1.primitiveField(), \
df2.primitiveField() \
); \
\ \
tdf1.clear(); \ tdf1.clear(); \
\ \
@ -226,7 +241,12 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \ ) \
); \ ); \
\ \
Func(tRes.ref().field(), df1.field(), df2.field()); \ Func \
( \
tRes.ref().primitiveFieldRef(), \
df1.primitiveField(), \
df2.primitiveField() \
); \
\ \
tdf1.clear(); \ tdf1.clear(); \
tdf2.clear(); \ tdf2.clear(); \
@ -256,7 +276,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \ ) \
); \ ); \
\ \
Func(tRes.ref().field(), dt1.value(), df2.field()); \ Func(tRes.ref().primitiveFieldRef(), dt1.value(), df2.primitiveField()); \
\ \
return tRes; \ return tRes; \
} \ } \
@ -291,7 +311,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \ ) \
); \ ); \
\ \
Func(tRes.ref().field(), dt1.value(), df2.field()); \ Func(tRes.ref().primitiveFieldRef(), dt1.value(), df2.primitiveField()); \
\ \
tdf2.clear(); \ tdf2.clear(); \
\ \
@ -328,7 +348,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \ ) \
); \ ); \
\ \
Func(tRes.ref().field(), df1.field(), dt2.value()); \ Func(tRes.ref().primitiveFieldRef(), df1.primitiveField(), dt2.value()); \
\ \
return tRes; \ return tRes; \
} \ } \
@ -363,7 +383,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \ ) \
); \ ); \
\ \
Func(tRes.ref().field(), df1.field(), dt2.value()); \ Func(tRes.ref().primitiveFieldRef(), df1.primitiveField(), dt2.value()); \
\ \
tdf1.clear(); \ tdf1.clear(); \
\ \
@ -407,7 +427,12 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \ ) \
); \ ); \
\ \
Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \ Foam::OpFunc \
( \
tRes.ref().primitiveFieldRef(), \
df1.primitiveField(), \
df2.primitiveField() \
); \
\ \
return tRes; \ return tRes; \
} \ } \
@ -431,7 +456,12 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \ ) \
); \ ); \
\ \
Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \ Foam::OpFunc \
( \
tRes.ref().primitiveFieldRef(), \
df1.primitiveField(), \
df2.primitiveField() \
); \
\ \
tdf2.clear(); \ tdf2.clear(); \
\ \
@ -457,7 +487,12 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \ ) \
); \ ); \
\ \
Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \ Foam::OpFunc \
( \
tRes.ref().primitiveFieldRef(), \
df1.primitiveField(), \
df2.primitiveField() \
); \
\ \
tdf1.clear(); \ tdf1.clear(); \
\ \
@ -485,7 +520,12 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \ ) \
); \ ); \
\ \
Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \ Foam::OpFunc \
( \
tRes.ref().primitiveFieldRef(), \
df1.primitiveField(), \
df2.primitiveField() \
); \
\ \
tdf1.clear(); \ tdf1.clear(); \
tdf2.clear(); \ tdf2.clear(); \
@ -515,7 +555,12 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \ ) \
); \ ); \
\ \
Foam::OpFunc(tRes.ref().field(), dt1.value(), df2.field()); \ Foam::OpFunc \
( \
tRes.ref().primitiveFieldRef(), \
dt1.value(), \
df2.primitiveField() \
); \
\ \
return tRes; \ return tRes; \
} \ } \
@ -550,7 +595,12 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \ ) \
); \ ); \
\ \
Foam::OpFunc(tRes.ref().field(), dt1.value(), tdf2().field()); \ Foam::OpFunc \
( \
tRes.ref().primitiveFieldRef(), \
dt1.value(), \
tdf2().primitiveField() \
); \
\ \
tdf2.clear(); \ tdf2.clear(); \
\ \
@ -587,7 +637,12 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \ ) \
); \ ); \
\ \
Foam::OpFunc(tRes.ref().field(), df1.field(), dt2.value()); \ Foam::OpFunc \
( \
tRes.ref().primitiveFieldRef(), \
df1.primitiveField(), \
dt2.value() \
); \
\ \
return tRes; \ return tRes; \
} \ } \
@ -622,7 +677,12 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
) \ ) \
); \ ); \
\ \
Foam::OpFunc(tRes.ref().field(), tdf1().field(), dt2.value()); \ Foam::OpFunc \
( \
tRes.ref().primitiveFieldRef(), \
tdf1().primitiveField(), \
dt2.value() \
); \
\ \
tdf1.clear(); \ tdf1.clear(); \
\ \

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,6 +23,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
@ -58,14 +60,7 @@ Foam::DimensionedField<Type, GeoMesh>::dimensions()
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
inline const Foam::Field<Type>& inline const Foam::Field<Type>&
Foam::DimensionedField<Type, GeoMesh>::field() const Foam::DimensionedField<Type, GeoMesh>::primitiveField() const
{
return *this;
}
template<class Type, class GeoMesh>
inline Foam::Field<Type>&
Foam::DimensionedField<Type, GeoMesh>::field()
{ {
return *this; return *this;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -52,7 +52,7 @@ tmp<DimensionedField<scalar, GeoMesh>> stabilise
) )
); );
stabilise(tRes.ref().field(), dsf.field(), ds.value()); stabilise(tRes.ref().primitiveFieldRef(), dsf.primitiveField(), ds.value());
return tRes; return tRes;
} }
@ -74,7 +74,7 @@ tmp<DimensionedField<scalar, GeoMesh>> stabilise
dsf.dimensions() + ds.dimensions() dsf.dimensions() + ds.dimensions()
); );
stabilise(tRes.ref().field(), dsf.field(), ds.value()); stabilise(tRes.ref().primitiveFieldRef(), dsf.primitiveField(), ds.value());
tdsf.clear(); tdsf.clear();
@ -125,7 +125,12 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
) )
); );
pow(tPow.ref().field(), dsf1.field(), dsf2.field()); pow
(
tPow.ref().primitiveFieldRef(),
dsf1.primitiveField(),
dsf2.primitiveField()
);
return tPow; return tPow;
} }
@ -161,7 +166,12 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
dimless dimless
); );
pow(tPow.ref().field(), dsf1.field(), dsf2.field()); pow
(
tPow.ref().primitiveFieldRef(),
dsf1.primitiveField(),
dsf2.primitiveField()
);
tdsf1.clear(); tdsf1.clear();
@ -199,7 +209,12 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
dimless dimless
); );
pow(tPow.ref().field(), dsf1.field(), dsf2.field()); pow
(
tPow.ref().primitiveFieldRef(),
dsf1.primitiveField(),
dsf2.primitiveField()
);
tdsf2.clear(); tdsf2.clear();
@ -240,7 +255,12 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
dimless dimless
); );
pow(tPow.ref().field(), dsf1.field(), dsf2.field()); pow
(
tPow.ref().primitiveFieldRef(),
dsf1.primitiveField(),
dsf2.primitiveField()
);
tdsf1.clear(); tdsf1.clear();
tdsf2.clear(); tdsf2.clear();
@ -273,7 +293,7 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
) )
); );
pow(tPow.ref().field(), dsf.field(), ds.value()); pow(tPow.ref().primitiveFieldRef(), dsf.primitiveField(), ds.value());
return tPow; return tPow;
} }
@ -302,7 +322,7 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
pow(dsf.dimensions(), ds) pow(dsf.dimensions(), ds)
); );
pow(tPow.ref().field(), dsf.field(), ds.value()); pow(tPow.ref().primitiveFieldRef(), dsf.primitiveField(), ds.value());
tdsf.clear(); tdsf.clear();
@ -363,7 +383,7 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
) )
); );
pow(tPow.ref().field(), ds.value(), dsf.field()); pow(tPow.ref().primitiveFieldRef(), ds.value(), dsf.primitiveField());
return tPow; return tPow;
} }
@ -399,7 +419,7 @@ tmp<DimensionedField<scalar, GeoMesh>> pow
dimless dimless
); );
pow(tPow.ref().field(), ds.value(), dsf.field()); pow(tPow.ref().primitiveFieldRef(), ds.value(), dsf.primitiveField());
tdsf.clear(); tdsf.clear();
@ -446,7 +466,12 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
) )
); );
atan2(tAtan2.ref().field(), dsf1.field(), dsf2.field()); atan2
(
tAtan2.ref().primitiveFieldRef(),
dsf1.primitiveField(),
dsf2.primitiveField()
);
return tAtan2; return tAtan2;
} }
@ -468,7 +493,12 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
atan2(dsf1.dimensions(), dsf2.dimensions()) atan2(dsf1.dimensions(), dsf2.dimensions())
); );
atan2(tAtan2.ref().field(), dsf1.field(), dsf2.field()); atan2
(
tAtan2.ref().primitiveFieldRef(),
dsf1.primitiveField(),
dsf2.primitiveField()
);
tdsf1.clear(); tdsf1.clear();
@ -492,7 +522,12 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
atan2(dsf1.dimensions(), dsf2.dimensions()) atan2(dsf1.dimensions(), dsf2.dimensions())
); );
atan2(tAtan2.ref().field(), dsf1.field(), dsf2.field()); atan2
(
tAtan2.ref().primitiveFieldRef(),
dsf1.primitiveField(),
dsf2.primitiveField()
);
tdsf2.clear(); tdsf2.clear();
@ -518,7 +553,12 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
atan2(dsf1.dimensions(), dsf2.dimensions()) atan2(dsf1.dimensions(), dsf2.dimensions())
); );
atan2(tAtan2.ref().field(), dsf1.field(), dsf2.field()); atan2
(
tAtan2.ref().primitiveFieldRef(),
dsf1.primitiveField(),
dsf2.primitiveField()
);
tdsf1.clear(); tdsf1.clear();
tdsf2.clear(); tdsf2.clear();
@ -544,7 +584,7 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
) )
); );
atan2(tAtan2.ref().field(), dsf.field(), ds.value()); atan2(tAtan2.ref().primitiveFieldRef(), dsf.primitiveField(), ds.value());
return tAtan2; return tAtan2;
} }
@ -565,7 +605,7 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
atan2(dsf.dimensions(), ds) atan2(dsf.dimensions(), ds)
); );
atan2(tAtan2.ref().field(), dsf.field(), ds.value()); atan2(tAtan2.ref().primitiveFieldRef(), dsf.primitiveField(), ds.value());
tdsf.clear(); tdsf.clear();
@ -610,7 +650,7 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
) )
); );
atan2(tAtan2.ref().field(), ds.value(), dsf.field()); atan2(tAtan2.ref().primitiveFieldRef(), ds.value(), dsf.primitiveField());
return tAtan2; return tAtan2;
} }
@ -632,7 +672,7 @@ tmp<DimensionedField<scalar, GeoMesh>> atan2
atan2(ds, dsf.dimensions()) atan2(ds, dsf.dimensions())
); );
atan2(tAtan2.ref().field(), ds.value(), dsf.field()); atan2(tAtan2.ref().primitiveFieldRef(), ds.value(), dsf.primitiveField());
tdsf.clear(); tdsf.clear();
@ -729,7 +769,7 @@ tmp<DimensionedField<scalar, GeoMesh>> func \
) \ ) \
); \ ); \
\ \
func(tFunc.ref().field(), n, dsf.field()); \ func(tFunc.ref().primitiveFieldRef(), n, dsf.primitiveField()); \
\ \
return tFunc; \ return tFunc; \
} \ } \
@ -760,7 +800,7 @@ tmp<DimensionedField<scalar, GeoMesh>> func \
) \ ) \
); \ ); \
\ \
func(tFunc.ref().field(), n, dsf.field()); \ func(tFunc.ref().primitiveFieldRef(), n, dsf.primitiveField()); \
\ \
tdsf.clear(); \ tdsf.clear(); \
\ \

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -72,7 +72,7 @@ public:
inline Type operator[](const label) const; inline Type operator[](const label) const;
inline UniformField field() const; inline UniformField primitiveField() const;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,7 +49,7 @@ inline Type Foam::UniformField<Type>::operator[](const label) const
template<class Type> template<class Type>
inline Foam::UniformField<Type> Foam::UniformField<Type>::field() const inline Foam::UniformField<Type> Foam::UniformField<Type>::primitiveField() const
{ {
return UniformField(value_); return UniformField(value_);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -71,7 +71,7 @@ public:
inline one operator[](const label) const; inline one operator[](const label) const;
inline oneField field() const; inline oneField primitiveField() const;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License 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(); return oneField();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -54,6 +54,11 @@ class zeroField
{ {
public: public:
// Public Typedefs
typedef zeroField FieldType;
// Constructors // Constructors
//- Construct null //- Construct null
@ -65,7 +70,7 @@ public:
inline scalar operator[](const label) const; inline scalar operator[](const label) const;
inline zeroField field() const; inline zeroField primitiveField() const;
inline zeroField operator()() const; inline zeroField operator()() const;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License 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(); return zeroField();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1052,7 +1052,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::~GeometricField()
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
typename typename
Foam::GeometricField<Type, PatchField, GeoMesh>::Internal& Foam::GeometricField<Type, PatchField, GeoMesh>::Internal&
Foam::GeometricField<Type, PatchField, GeoMesh>::ref() Foam::GeometricField<Type, PatchField, GeoMesh>::internalFieldRef()
{ {
this->setUpToDate(); this->setUpToDate();
storeOldTimes(); storeOldTimes();
@ -1196,7 +1196,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::oldTime() const
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>& Foam::GeometricField<Type, PatchField, GeoMesh>&
Foam::GeometricField<Type, PatchField, GeoMesh>::oldTime() Foam::GeometricField<Type, PatchField, GeoMesh>::oldTimeRef()
{ {
static_cast<const GeometricField<Type, PatchField, GeoMesh>&>(*this) static_cast<const GeometricField<Type, PatchField, GeoMesh>&>(*this)
.oldTime(); .oldTime();
@ -1222,7 +1222,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::oldTime(const label n) const
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>& Foam::GeometricField<Type, PatchField, GeoMesh>&
Foam::GeometricField<Type, PatchField, GeoMesh>::oldTime(const label n) Foam::GeometricField<Type, PatchField, GeoMesh>::oldTimeRef(const label n)
{ {
if (n == 0) if (n == 0)
{ {
@ -1230,7 +1230,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::oldTime(const label n)
} }
else else
{ {
return oldTime().oldTime(n - 1); return oldTimeRef().oldTimeRef(n - 1);
} }
} }
@ -1638,7 +1638,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=
// Only assign field contents not ID // Only assign field contents not ID
ref() = gf(); internalFieldRef() = gf.internalField();
boundaryFieldRef() = gf.boundaryField(); boundaryFieldRef() = gf.boundaryField();
} }
@ -1660,7 +1660,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=
// Only assign field contents not ID // Only assign field contents not ID
ref() = move(gf()); internalFieldRef() = move(gf.internalField());
boundaryFieldRef() = move(gf.boundaryField()); boundaryFieldRef() = move(gf.boundaryField());
} }
@ -1688,11 +1688,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=
if (tgf.isTmp()) if (tgf.isTmp())
{ {
// Transfer the storage from the tmp primitiveFieldRef().transfer(tgf.ref());
primitiveFieldRef().transfer
(
const_cast<Field<Type>&>(gf.primitiveField())
);
} }
else else
{ {
@ -1711,7 +1707,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=
const dimensioned<Type>& dt const dimensioned<Type>& dt
) )
{ {
ref() = dt; internalFieldRef() = dt;
boundaryFieldRef() = dt.value(); boundaryFieldRef() = dt.value();
} }
@ -1722,7 +1718,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=
const zero& const zero&
) )
{ {
ref() = Zero; internalFieldRef() = Zero;
boundaryFieldRef() = Zero; boundaryFieldRef() = Zero;
} }
@ -1739,7 +1735,17 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator==
// Only assign field contents not ID // 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(); boundaryFieldRef() == gf.boundaryField();
tgf.clear(); tgf.clear();
@ -1752,7 +1758,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator==
const dimensioned<Type>& dt const dimensioned<Type>& dt
) )
{ {
ref() = dt; internalFieldRef() = dt;
boundaryFieldRef() == dt.value(); boundaryFieldRef() == dt.value();
} }
@ -1763,7 +1769,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator==
const zero& const zero&
) )
{ {
ref() = Zero; internalFieldRef() = Zero;
boundaryFieldRef() == Zero; boundaryFieldRef() == Zero;
} }
@ -1778,7 +1784,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator op \
{ \ { \
checkField(*this, gf, #op); \ checkField(*this, gf, #op); \
\ \
ref() op gf(); \ internalFieldRef() op gf.internalField(); \
boundaryFieldRef() op gf.boundaryField(); \ boundaryFieldRef() op gf.boundaryField(); \
} \ } \
\ \
@ -1798,7 +1804,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator op \
const dimensioned<TYPE>& dt \ const dimensioned<TYPE>& dt \
) \ ) \
{ \ { \
ref() op dt; \ internalFieldRef() op dt; \
boundaryFieldRef() op dt.value(); \ boundaryFieldRef() op dt.value(); \
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -394,7 +394,7 @@ public:
//- Return a reference to the dimensioned internal field //- Return a reference to the dimensioned internal field
// Note: this increments the event counter and checks the // Note: this increments the event counter and checks the
// old-time fields; avoid in loops. // old-time fields; avoid in loops.
Internal& ref(); Internal& internalFieldRef();
//- Return a const-reference to the dimensioned internal field //- Return a const-reference to the dimensioned internal field
inline const Internal& internalField() const; inline const Internal& internalField() const;
@ -404,12 +404,12 @@ public:
// for FV equations // for FV equations
inline const Internal& v() const; 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 // Note: this increments the event counter and checks the
// old-time fields; avoid in loops. // old-time fields; avoid in loops.
typename Internal::FieldType& primitiveFieldRef(); 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; inline const typename Internal::FieldType& primitiveField() const;
//- Return a reference to the boundary field //- Return a reference to the boundary field
@ -443,7 +443,7 @@ public:
//- Return non-const old time field //- Return non-const old time field
// (Not a good idea but it is used for sub-cycling) // (Not a good idea but it is used for sub-cycling)
GeometricField<Type, PatchField, GeoMesh>& oldTime(); GeometricField<Type, PatchField, GeoMesh>& oldTimeRef();
//- Return the n-th old time field //- Return the n-th old time field
const GeometricField<Type, PatchField, GeoMesh>& oldTime const GeometricField<Type, PatchField, GeoMesh>& oldTime
@ -453,7 +453,7 @@ public:
//- Return the n-th non-const old time field //- Return the n-th non-const old time field
// (Not a good idea but it is used for sub-cycling) // (Not a good idea but it is used for sub-cycling)
GeometricField<Type, PatchField, GeoMesh>& oldTime(const label n); GeometricField<Type, PatchField, GeoMesh>& oldTimeRef(const label n);
//- Store the field as the previous iteration value //- Store the field as the previous iteration value
void storePrevIter() const; void storePrevIter() const;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -103,7 +103,7 @@ void MapGeometricFields
// Map the internal field // Map the internal field
MapInternalField<Type, MeshMapper, GeoMesh>() MapInternalField<Type, MeshMapper, GeoMesh>()
( (
field.ref(), field.internalFieldRef(),
mapper mapper
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -64,6 +64,7 @@ public:
typedef oneFieldField Boundary; typedef oneFieldField Boundary;
typedef one cmptType; typedef one cmptType;
// Constructors // Constructors
//- Construct null //- Construct null
@ -77,12 +78,12 @@ public:
inline one operator[](const label) const; inline one operator[](const label) const;
inline oneField field() const; inline geometricOneField oldTime() const;
inline oneField oldTime() const;
inline Internal operator()() const; inline Internal operator()() const;
inline Internal internalField() const;
inline Internal v() const; inline Internal v() const;
inline typename Internal::FieldType primitiveField() const; inline typename Internal::FieldType primitiveField() const;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License 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(); return geometricOneField();
}
inline Foam::oneField Foam::geometricOneField::oldTime() const
{
return oneField();
} }
@ -58,6 +52,13 @@ Foam::geometricOneField::operator()() const
} }
inline Foam::geometricOneField::Internal
Foam::geometricOneField::internalField() const
{
return oneField();
}
inline Foam::geometricOneField::Internal inline Foam::geometricOneField::Internal
Foam::geometricOneField::v() const Foam::geometricOneField::v() const
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -57,6 +57,14 @@ class geometricZeroField
public: public:
// Public Typedefs
typedef zeroField Internal;
typedef zeroField Patch;
typedef zeroFieldField Boundary;
typedef zero cmptType;
// Constructors // Constructors
//- Construct null //- Construct null
@ -70,13 +78,17 @@ public:
inline scalar operator[](const label) const; 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;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,27 +32,49 @@ inline const Foam::dimensionSet& Foam::geometricZeroField::dimensions() const
return dimless; return dimless;
} }
inline Foam::scalar Foam::geometricZeroField::operator[](const label) const inline Foam::scalar Foam::geometricZeroField::operator[](const label) const
{ {
return scalar(0); 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(); return zeroField();
} }
inline Foam::zeroField Foam::geometricZeroField::operator()() const
inline Foam::geometricZeroField::Internal
Foam::geometricZeroField::internalField() const
{ {
return zeroField(); 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(); return zeroField();
} }
inline Foam::zeroFieldField Foam::geometricZeroField::boundaryField() const
inline Foam::geometricZeroField::Boundary
Foam::geometricZeroField::boundaryField() const
{ {
return zeroFieldField(); return zeroFieldField();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,10 +38,12 @@ scalar meanCoNum = 0.0;
fvc::surfaceSum(mag(phi))().primitiveField()/rho.primitiveField() 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 = 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 Info<< "Courant Number mean: " << meanCoNum

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,10 +38,12 @@ scalar meanCoNum = 0.0;
fvc::surfaceSum(mag(phi))().primitiveField() 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 = 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 Info<< "Courant Number mean: " << meanCoNum

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -381,14 +381,14 @@ CrankNicolsonDdtScheme<Type>::fvcDdt
{ {
dimensionedScalar rDtCoef0 = rDtCoef0_(ddt0); dimensionedScalar rDtCoef0 = rDtCoef0_(ddt0);
ddt0.ref() = ddt0.internalFieldRef() =
( (
(rDtCoef0*dt)*(mesh().V0() - mesh().V00()) (rDtCoef0*dt)*(mesh().V0() - mesh().V00())
- mesh().V00()*offCentre_(ddt0.internalField()) - mesh().V00()*offCentre_(ddt0.internalField())
)/mesh().V0(); )/mesh().V0();
} }
tdtdt.ref().ref() = tdtdt.ref().internalFieldRef() =
( (
(rDtCoef*dt)*(mesh().V() - mesh().V0()) (rDtCoef*dt)*(mesh().V() - mesh().V0())
- mesh().V0()*offCentre_(ddt0.internalField()) - mesh().V0()*offCentre_(ddt0.internalField())

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -66,7 +66,7 @@ volumeIntegrate
template<class Type> template<class Type>
tmp<Field<Type>> volumeIntegrate(const DimensionedField<Type, volMesh>& df) tmp<Field<Type>> volumeIntegrate(const DimensionedField<Type, volMesh>& df)
{ {
return df.mesh().V()*df.field(); return df.mesh().V()*df.primitiveField();
} }
@ -74,7 +74,7 @@ template<class Type>
tmp<Field<Type>> tmp<Field<Type>>
volumeIntegrate(const tmp<DimensionedField<Type, volMesh>>& tdf) volumeIntegrate(const tmp<DimensionedField<Type, volMesh>>& tdf)
{ {
tmp<Field<Type>> tdidf = tdf().mesh().V()*tdf().field(); tmp<Field<Type>> tdidf = tdf().mesh().V()*tdf().primitiveField();
tdf.clear(); tdf.clear();
return tdidf; return tdidf;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,7 +49,7 @@ Foam::fvm::Su
); );
fvMatrix<Type>& fvm = tfvm.ref(); fvMatrix<Type>& fvm = tfvm.ref();
fvm.source() -= mesh.V()*su.field(); fvm.source() -= mesh.V()*su.primitiveField();
return tfvm; return tfvm;
} }
@ -115,7 +115,7 @@ Foam::fvm::Sp
); );
fvMatrix<Type>& fvm = tfvm.ref(); fvMatrix<Type>& fvm = tfvm.ref();
fvm.diag() += mesh.V()*sp.field(); fvm.diag() += mesh.V()*sp.primitiveField();
return tfvm; return tfvm;
} }
@ -207,9 +207,9 @@ Foam::fvm::SuSp
); );
fvMatrix<Type>& fvm = tfvm.ref(); fvMatrix<Type>& 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(); *vf.primitiveField();
return tfvm; return tfvm;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1172,7 +1172,7 @@ void Foam::fvMatrix<Type>::operator+=
) )
{ {
checkMethod(*this, su, "+="); checkMethod(*this, su, "+=");
source() -= su.mesh().V()*su.field(); source() -= su.mesh().V()*su.primitiveField();
} }
@ -1205,7 +1205,7 @@ void Foam::fvMatrix<Type>::operator-=
) )
{ {
checkMethod(*this, su, "-="); checkMethod(*this, su, "-=");
source() += su.mesh().V()*su.field(); source() += su.mesh().V()*su.primitiveField();
} }
@ -1274,14 +1274,17 @@ void Foam::fvMatrix<Type>::operator*=
) )
{ {
dimensions_ *= dsf.dimensions(); dimensions_ *= dsf.dimensions();
lduMatrix::operator*=(dsf.field()); lduMatrix::operator*=(dsf.primitiveField());
source_ *= dsf.field(); source_ *= dsf.primitiveField();
forAll(boundaryCoeffs_, patchi) forAll(boundaryCoeffs_, patchi)
{ {
scalarField pisf scalarField pisf
( (
dsf.mesh().boundary()[patchi].patchInternalField(dsf.field()) dsf.mesh().boundary()[patchi].patchInternalField
(
dsf.primitiveField()
)
); );
internalCoeffs_[patchi] *= pisf; internalCoeffs_[patchi] *= pisf;
@ -1345,14 +1348,17 @@ void Foam::fvMatrix<Type>::operator/=
) )
{ {
dimensions_ /= dsf.dimensions(); dimensions_ /= dsf.dimensions();
lduMatrix::operator/=(dsf.field()); lduMatrix::operator/=(dsf.primitiveField());
source_ /= dsf.field(); source_ /= dsf.primitiveField();
forAll(boundaryCoeffs_, patchi) forAll(boundaryCoeffs_, patchi)
{ {
scalarField pisf scalarField pisf
( (
dsf.mesh().boundary()[patchi].patchInternalField(dsf.field()) dsf.mesh().boundary()[patchi].patchInternalField
(
dsf.primitiveField()
)
); );
internalCoeffs_[patchi] /= pisf; internalCoeffs_[patchi] /= pisf;
@ -1571,7 +1577,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator==
{ {
checkMethod(A, su, "=="); checkMethod(A, su, "==");
tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A));
tC.ref().source() += su.mesh().V()*su.field(); tC.ref().source() += su.mesh().V()*su.primitiveField();
return tC; return tC;
} }
@ -1584,7 +1590,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator==
{ {
checkMethod(A, tsu(), "=="); checkMethod(A, tsu(), "==");
tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A));
tC.ref().source() += tsu().mesh().V()*tsu().field(); tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
tsu.clear(); tsu.clear();
return tC; return tC;
} }
@ -1612,7 +1618,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator==
{ {
checkMethod(tA(), su, "=="); checkMethod(tA(), su, "==");
tmp<fvMatrix<Type>> tC(tA.ptr()); tmp<fvMatrix<Type>> tC(tA.ptr());
tC.ref().source() += su.mesh().V()*su.field(); tC.ref().source() += su.mesh().V()*su.primitiveField();
return tC; return tC;
} }
@ -1625,7 +1631,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator==
{ {
checkMethod(tA(), tsu(), "=="); checkMethod(tA(), tsu(), "==");
tmp<fvMatrix<Type>> tC(tA.ptr()); tmp<fvMatrix<Type>> tC(tA.ptr());
tC.ref().source() += tsu().mesh().V()*tsu().field(); tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
tsu.clear(); tsu.clear();
return tC; return tC;
} }
@ -1777,7 +1783,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+
{ {
checkMethod(A, su, "+"); checkMethod(A, su, "+");
tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A));
tC.ref().source() -= su.mesh().V()*su.field(); tC.ref().source() -= su.mesh().V()*su.primitiveField();
return tC; return tC;
} }
@ -1790,7 +1796,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+
{ {
checkMethod(A, tsu(), "+"); checkMethod(A, tsu(), "+");
tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A));
tC.ref().source() -= tsu().mesh().V()*tsu().field(); tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
tsu.clear(); tsu.clear();
return tC; return tC;
} }
@ -1818,7 +1824,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+
{ {
checkMethod(tA(), su, "+"); checkMethod(tA(), su, "+");
tmp<fvMatrix<Type>> tC(tA.ptr()); tmp<fvMatrix<Type>> tC(tA.ptr());
tC.ref().source() -= su.mesh().V()*su.field(); tC.ref().source() -= su.mesh().V()*su.primitiveField();
return tC; return tC;
} }
@ -1831,7 +1837,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+
{ {
checkMethod(tA(), tsu(), "+"); checkMethod(tA(), tsu(), "+");
tmp<fvMatrix<Type>> tC(tA.ptr()); tmp<fvMatrix<Type>> tC(tA.ptr());
tC.ref().source() -= tsu().mesh().V()*tsu().field(); tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
tsu.clear(); tsu.clear();
return tC; return tC;
} }
@ -1859,7 +1865,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+
{ {
checkMethod(A, su, "+"); checkMethod(A, su, "+");
tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A));
tC.ref().source() -= su.mesh().V()*su.field(); tC.ref().source() -= su.mesh().V()*su.primitiveField();
return tC; return tC;
} }
@ -1872,7 +1878,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+
{ {
checkMethod(A, tsu(), "+"); checkMethod(A, tsu(), "+");
tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A));
tC.ref().source() -= tsu().mesh().V()*tsu().field(); tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
tsu.clear(); tsu.clear();
return tC; return tC;
} }
@ -1900,7 +1906,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+
{ {
checkMethod(tA(), su, "+"); checkMethod(tA(), su, "+");
tmp<fvMatrix<Type>> tC(tA.ptr()); tmp<fvMatrix<Type>> tC(tA.ptr());
tC.ref().source() -= su.mesh().V()*su.field(); tC.ref().source() -= su.mesh().V()*su.primitiveField();
return tC; return tC;
} }
@ -1913,7 +1919,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+
{ {
checkMethod(tA(), tsu(), "+"); checkMethod(tA(), tsu(), "+");
tmp<fvMatrix<Type>> tC(tA.ptr()); tmp<fvMatrix<Type>> tC(tA.ptr());
tC.ref().source() -= tsu().mesh().V()*tsu().field(); tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
tsu.clear(); tsu.clear();
return tC; return tC;
} }
@ -1996,7 +2002,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator-
{ {
checkMethod(A, su, "-"); checkMethod(A, su, "-");
tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A));
tC.ref().source() += su.mesh().V()*su.field(); tC.ref().source() += su.mesh().V()*su.primitiveField();
return tC; return tC;
} }
@ -2009,7 +2015,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator-
{ {
checkMethod(A, tsu(), "-"); checkMethod(A, tsu(), "-");
tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A));
tC.ref().source() += tsu().mesh().V()*tsu().field(); tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
tsu.clear(); tsu.clear();
return tC; return tC;
} }
@ -2037,7 +2043,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator-
{ {
checkMethod(tA(), su, "-"); checkMethod(tA(), su, "-");
tmp<fvMatrix<Type>> tC(tA.ptr()); tmp<fvMatrix<Type>> tC(tA.ptr());
tC.ref().source() += su.mesh().V()*su.field(); tC.ref().source() += su.mesh().V()*su.primitiveField();
return tC; return tC;
} }
@ -2050,7 +2056,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator-
{ {
checkMethod(tA(), tsu(), "-"); checkMethod(tA(), tsu(), "-");
tmp<fvMatrix<Type>> tC(tA.ptr()); tmp<fvMatrix<Type>> tC(tA.ptr());
tC.ref().source() += tsu().mesh().V()*tsu().field(); tC.ref().source() += tsu().mesh().V()*tsu().primitiveField();
tsu.clear(); tsu.clear();
return tC; return tC;
} }
@ -2079,7 +2085,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator-
checkMethod(A, su, "-"); checkMethod(A, su, "-");
tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A));
tC.ref().negate(); tC.ref().negate();
tC.ref().source() -= su.mesh().V()*su.field(); tC.ref().source() -= su.mesh().V()*su.primitiveField();
return tC; return tC;
} }
@ -2093,7 +2099,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator-
checkMethod(A, tsu(), "-"); checkMethod(A, tsu(), "-");
tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A));
tC.ref().negate(); tC.ref().negate();
tC.ref().source() -= tsu().mesh().V()*tsu().field(); tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
tsu.clear(); tsu.clear();
return tC; return tC;
} }
@ -2123,7 +2129,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator-
checkMethod(tA(), su, "-"); checkMethod(tA(), su, "-");
tmp<fvMatrix<Type>> tC(tA.ptr()); tmp<fvMatrix<Type>> tC(tA.ptr());
tC.ref().negate(); tC.ref().negate();
tC.ref().source() -= su.mesh().V()*su.field(); tC.ref().source() -= su.mesh().V()*su.primitiveField();
return tC; return tC;
} }
@ -2137,7 +2143,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator-
checkMethod(tA(), tsu(), "-"); checkMethod(tA(), tsu(), "-");
tmp<fvMatrix<Type>> tC(tA.ptr()); tmp<fvMatrix<Type>> tC(tA.ptr());
tC.ref().negate(); tC.ref().negate();
tC.ref().source() -= tsu().mesh().V()*tsu().field(); tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField();
tsu.clear(); tsu.clear();
return tC; return tC;
} }
@ -2483,7 +2489,7 @@ Foam::operator&
{ {
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{ {
scalarField psiCmpt(psi.field().component(cmpt)); scalarField psiCmpt(psi.primitiveField().component(cmpt));
scalarField boundaryDiagCmpt(M.diag()); scalarField boundaryDiagCmpt(M.diag());
M.addBoundaryDiag(boundaryDiagCmpt, cmpt); M.addBoundaryDiag(boundaryDiagCmpt, cmpt);
Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt); Mphi.primitiveFieldRef().replace(cmpt, -boundaryDiagCmpt*psiCmpt);
@ -2494,7 +2500,8 @@ Foam::operator&
Mphi.primitiveFieldRef() = Zero; 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()); M.addBoundarySource(Mphi.primitiveFieldRef());
Mphi.primitiveFieldRef() /= -psi.mesh().V(); Mphi.primitiveFieldRef() /= -psi.mesh().V();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -53,19 +53,19 @@ void Foam::MULES::correct
{ {
psi.primitiveFieldRef() = psi.primitiveFieldRef() =
( (
rho.field()*psi.primitiveField()*rDeltaT rho.primitiveField()*psi.primitiveField()*rDeltaT
+ Su.field() + Su.primitiveField()
- psiIf - psiIf
)/(rho.field()*rDeltaT - Sp.field()); )/(rho.primitiveField()*rDeltaT - Sp.primitiveField());
} }
else else
{ {
psi.primitiveFieldRef() = psi.primitiveFieldRef() =
( (
rho.field()*psi.primitiveField()*rDeltaT rho.primitiveField()*psi.primitiveField()*rDeltaT
+ Su.field() + Su.primitiveField()
- psiIf - psiIf
)/(rho.field()*rDeltaT - Sp.field()); )/(rho.primitiveField()*rDeltaT - Sp.primitiveField());
} }
psi.correctBoundaryConditions(); psi.correctBoundaryConditions();
@ -383,17 +383,17 @@ void Foam::MULES::limiterCorr
psiMaxn = psiMaxn =
V V
*( *(
(rho.field()*rDeltaT - Sp.field())*psiMaxn (rho.primitiveField()*rDeltaT - Sp.primitiveField())*psiMaxn
- Su.field() - Su.primitiveField()
- rho.field()*psi.primitiveField()*rDeltaT - rho.primitiveField()*psi.primitiveField()*rDeltaT
); );
psiMinn = psiMinn =
V V
*( *(
Su.field() Su.primitiveField()
- (rho.field()*rDeltaT - Sp.field())*psiMinn - (rho.primitiveField()*rDeltaT - Sp.primitiveField())*psiMinn
+ rho.field()*psi.primitiveField()*rDeltaT + rho.primitiveField()*psi.primitiveField()*rDeltaT
); );
scalarField sumlPhip(psiIf.size()); scalarField sumlPhip(psiIf.size());

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -57,20 +57,20 @@ void Foam::MULES::explicitSolve
{ {
psiIf = psiIf =
( (
mesh.Vsc0()().field()*rho.oldTime().field() mesh.Vsc0()().primitiveField()*rho.oldTime().primitiveField()
*psi0*rDeltaT/mesh.Vsc()().field() *psi0*rDeltaT/mesh.Vsc()().primitiveField()
+ Su.field() + Su.primitiveField()
- psiIf - psiIf
)/(rho.field()*rDeltaT - Sp.field()); )/(rho.primitiveField()*rDeltaT - Sp.primitiveField());
} }
else else
{ {
psiIf = psiIf =
( (
rho.oldTime().field()*psi0*rDeltaT rho.oldTime().primitiveField()*psi0*rDeltaT
+ Su.field() + Su.primitiveField()
- psiIf - psiIf
)/(rho.field()*rDeltaT - Sp.field()); )/(rho.primitiveField()*rDeltaT - Sp.primitiveField());
} }
psi.correctBoundaryConditions(); psi.correctBoundaryConditions();
@ -380,19 +380,19 @@ void Foam::MULES::limiter
psiMaxn = psiMaxn =
V V
*( *(
(rho.field()*rDeltaT - Sp.field())*psiMaxn (rho.primitiveField()*rDeltaT - Sp.primitiveField())*psiMaxn
- Su.field() - Su.primitiveField()
) )
- (V0().field()*rDeltaT)*rho.oldTime().field()*psi0 - (V0().primitiveField()*rDeltaT)*rho.oldTime().primitiveField()*psi0
+ sumPhiBD; + sumPhiBD;
psiMinn = psiMinn =
V V
*( *(
Su.field() Su.primitiveField()
- (rho.field()*rDeltaT - Sp.field())*psiMinn - (rho.primitiveField()*rDeltaT - Sp.primitiveField())*psiMinn
) )
+ (V0().field()*rDeltaT)*rho.oldTime().field()*psi0 + (V0().primitiveField()*rDeltaT)*rho.oldTime().primitiveField()*psi0
- sumPhiBD; - sumPhiBD;
} }
else else
@ -400,18 +400,18 @@ void Foam::MULES::limiter
psiMaxn = psiMaxn =
V V
*( *(
(rho.field()*rDeltaT - Sp.field())*psiMaxn (rho.primitiveField()*rDeltaT - Sp.primitiveField())*psiMaxn
- Su.field() - Su.primitiveField()
- (rho.oldTime().field()*rDeltaT)*psi0 - (rho.oldTime().primitiveField()*rDeltaT)*psi0
) )
+ sumPhiBD; + sumPhiBD;
psiMinn = psiMinn =
V V
*( *(
Su.field() Su.primitiveField()
- (rho.field()*rDeltaT - Sp.field())*psiMinn - (rho.primitiveField()*rDeltaT - Sp.primitiveField())*psiMinn
+ (rho.oldTime().field()*rDeltaT)*psi0 + (rho.oldTime().primitiveField()*rDeltaT)*psi0
) )
- sumPhiBD; - sumPhiBD;
} }

View File

@ -1399,7 +1399,7 @@ void Foam::fvMesh::conform(const surfaceScalarField& phi)
{ {
for (label i = 0; i <= phi.nOldTimes(); ++ i) 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) for (label i = 0; i <= phi.nOldTimes(); ++ i)
{ {
phiRef().oldTime(i) == phi.oldTime(i); phiRef().oldTimeRef(i) == phi.oldTime(i);
} }
} }
} }

View File

@ -1628,7 +1628,7 @@ bool Foam::fvMeshStitcher::disconnectThis
surfaceScalarField phi(mesh_.phi()); surfaceScalarField phi(mesh_.phi());
for (label i = 1; i < mesh_.phi().nOldTimes(false); ++ i) 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); conformCorrectMeshPhi(phi);
mesh_.conform(phi); mesh_.conform(phi);
@ -1774,7 +1774,7 @@ bool Foam::fvMeshStitcher::connectThis
surfaceScalarField phi(mesh_.phi()); surfaceScalarField phi(mesh_.phi());
for (label i = 1; i <= mesh_.phi().nOldTimes(false); ++ i) 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); unconformCorrectMeshPhi(polyFacesBf, Sf, Cf, phi);
mesh_.unconform(polyFacesBf, Sf, Cf, phi); mesh_.unconform(polyFacesBf, Sf, Cf, phi);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -233,7 +233,9 @@ public:
); );
Co.primitiveFieldRef() = Co.primitiveFieldRef() =
(sumPhi/mesh.V().field())*(0.5*mesh.time().deltaTValue()); (sumPhi/mesh.V().primitiveField())
*(0.5*mesh.time().deltaTValue());
Co.correctBoundaryConditions(); Co.correctBoundaryConditions();
return surfaceScalarField::New return surfaceScalarField::New

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -84,7 +84,7 @@ bool Foam::functionObjects::CourantNo::calc()
) )
); );
tCo->ref() = tCo->internalFieldRef() =
byRho byRho
( (
(0.5*time_.deltaT()) (0.5*time_.deltaT())

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -86,7 +86,7 @@ bool Foam::functionObjects::writeCellVolumes::write()
calculatedFvPatchField<scalar>::typeName calculatedFvPatchField<scalar>::typeName
); );
V.ref() = mesh_.V(); V.internalFieldRef() = mesh_.V();
Log << " Writing cell-volumes field " << V.name() Log << " Writing cell-volumes field " << V.name()
<< " to " << time_.name() << endl; << " to " << time_.name() << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -111,7 +111,7 @@ bool Foam::fvMeshDistributors::loadBalancer::update()
forAllConstIter(HashTable<cpuLoad*>, cpuLoads, iter) forAllConstIter(HashTable<cpuLoad*>, cpuLoads, iter)
{ {
sumCpuLoad += sum(iter()->field()); sumCpuLoad += sum(iter()->primitiveField());
} }
const scalar cellCFDCpuTime = returnReduce const scalar cellCFDCpuTime = returnReduce
@ -157,7 +157,7 @@ bool Foam::fvMeshDistributors::loadBalancer::update()
label loadi = 1; label loadi = 1;
forAllConstIter(HashTable<cpuLoad*>, cpuLoads, iter) forAllConstIter(HashTable<cpuLoad*>, cpuLoads, iter)
{ {
const scalarField& cpuLoadField = iter()->field(); const scalarField& cpuLoadField = iter()->primitiveField();
forAll(cpuLoadField, i) forAll(cpuLoadField, i)
{ {
@ -173,7 +173,7 @@ bool Foam::fvMeshDistributors::loadBalancer::update()
forAllConstIter(HashTable<cpuLoad*>, cpuLoads, iter) forAllConstIter(HashTable<cpuLoad*>, cpuLoads, iter)
{ {
weights += iter()->field(); weights += iter()->primitiveField();
} }
} }

View File

@ -148,7 +148,7 @@ void Foam::fvMeshStitchers::moving::conformCorrectMeshPhi
for (label i = 0; i <= phi.nOldTimes(false); ++ i) for (label i = 0; i <= phi.nOldTimes(false); ++ i)
{ {
phi.oldTime(i).boundaryFieldRef()[origPatchi] += phi.oldTimeRef(i).boundaryFieldRef()[origPatchi] +=
fvMeshStitcherTools::fieldRMapSum fvMeshStitcherTools::fieldRMapSum
( (
phi.oldTime(i).boundaryField()[nccPatchi], phi.oldTime(i).boundaryField()[nccPatchi],
@ -157,7 +157,7 @@ void Foam::fvMeshStitchers::moving::conformCorrectMeshPhi
origFvp.start() 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(); 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 // 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) for (label i = 0; i <= phi.nOldTimes(false); ++ i)
{ {
fvsPatchField<scalar>& phip = fvsPatchField<scalar>& phip =
phi.oldTime(i).boundaryFieldRef()[errorPatchi]; phi.oldTimeRef(i).boundaryFieldRef()[errorPatchi];
phip[errorPatchFacei0] += phip[errorPatchFacei0] +=
phiErrorbs[i][nccPatchi][nccPatchFacei]/2; phiErrorbs[i][nccPatchi][nccPatchFacei]/2;
phip[errorPatchFacei1] += phip[errorPatchFacei1] +=
@ -1049,7 +1049,7 @@ void Foam::fvMeshStitchers::moving::unconformCorrectMeshPhi
// the area taken from the old original faces // the area taken from the old original faces
for (label i = 0; i <= phi.nOldTimes(false); ++ i) for (label i = 0; i <= phi.nOldTimes(false); ++ i)
{ {
phi.oldTime(i).boundaryFieldRef() = phi.oldTimeRef(i).boundaryFieldRef() =
fvMeshStitcherTools::unconformedBoundaryField fvMeshStitcherTools::unconformedBoundaryField
( (
phi.oldTime(i).boundaryField(), phi.oldTime(i).boundaryField(),

View File

@ -69,7 +69,7 @@ Foam::tmp<Foam::volScalarField> Foam::fv::phaseChange::vifToVf
extrapolatedCalculatedFvPatchField<scalar>::typeName extrapolatedCalculatedFvPatchField<scalar>::typeName
); );
tvf->ref() = tvif(); tvf->internalFieldRef() = tvif();
tvf->correctBoundaryConditions(); tvf->correctBoundaryConditions();
tvif.clear(); tvif.clear();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -71,11 +71,11 @@ Foam::fv::zeroDimensionalMassSourceBase::calcM0D() const
IOobject::groupName("alpha", phaseName) IOobject::groupName("alpha", phaseName)
); );
tm.ref().ref() += alpha()*rho()*mesh().V(); tm.ref().internalFieldRef() += alpha()*rho()*mesh().V();
} }
else else
{ {
tm.ref().ref() += rho()*mesh().V(); tm.ref().internalFieldRef() += rho()*mesh().V();
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -579,8 +579,8 @@ void Foam::MomentumCloud<CloudType>::restoreState()
template<class CloudType> template<class CloudType>
void Foam::MomentumCloud<CloudType>::resetSourceTerms() void Foam::MomentumCloud<CloudType>::resetSourceTerms()
{ {
UTransRef().field() = Zero; UTransRef().primitiveFieldRef() = Zero;
UCoeffRef().field() = 0.0; UCoeffRef().primitiveFieldRef() = 0.0;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -252,7 +252,7 @@ void Foam::ReactingCloud<CloudType>::resetSourceTerms()
CloudType::resetSourceTerms(); CloudType::resetSourceTerms();
forAll(rhoTrans_, i) forAll(rhoTrans_, i)
{ {
rhoTrans_[i].field() = 0.0; rhoTrans_[i].primitiveFieldRef() = 0.0;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -405,14 +405,14 @@ template<class CloudType>
void Foam::ThermoCloud<CloudType>::resetSourceTerms() void Foam::ThermoCloud<CloudType>::resetSourceTerms()
{ {
CloudType::resetSourceTerms(); CloudType::resetSourceTerms();
hsTrans_->field() = 0.0; hsTrans_->primitiveFieldRef() = 0.0;
hsCoeff_->field() = 0.0; hsCoeff_->primitiveFieldRef() = 0.0;
if (radiation_) if (radiation_)
{ {
radAreaP_->field() = 0.0; radAreaP_->primitiveFieldRef() = 0.0;
radT4_->field() = 0.0; radT4_->primitiveFieldRef() = 0.0;
radAreaPT4_->field() = 0.0; radAreaPT4_->primitiveFieldRef() = 0.0;
} }
} }

View File

@ -305,7 +305,7 @@ inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::Ep() const
const scalar dt = this->db().time().deltaTValue(); const scalar dt = this->db().time().deltaTValue();
const scalarField& V = this->mesh().V(); const scalarField& V = this->mesh().V();
const scalar epsilon = constProps_.epsilon0(); const scalar epsilon = constProps_.epsilon0();
const scalarField& sumAreaPT4 = radAreaPT4_->field(); const scalarField& sumAreaPT4 = radAreaPT4_->primitiveField();
Ep = sumAreaPT4*epsilon*physicoChemical::sigma.value()/V/dt; Ep = sumAreaPT4*epsilon*physicoChemical::sigma.value()/V/dt;
} }
@ -333,7 +333,7 @@ inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::ap() const
const scalar dt = this->db().time().deltaTValue(); const scalar dt = this->db().time().deltaTValue();
const scalarField& V = this->mesh().V(); const scalarField& V = this->mesh().V();
const scalar epsilon = constProps_.epsilon0(); const scalar epsilon = constProps_.epsilon0();
const scalarField& sumAreaP = radAreaP_->field(); const scalarField& sumAreaP = radAreaP_->primitiveField();
ap = sumAreaP*epsilon/V/dt; ap = sumAreaP*epsilon/V/dt;
} }
@ -363,7 +363,7 @@ Foam::ThermoCloud<CloudType>::sigmap() const
const scalarField& V = this->mesh().V(); const scalarField& V = this->mesh().V();
const scalar epsilon = constProps_.epsilon0(); const scalar epsilon = constProps_.epsilon0();
const scalar f = constProps_.f0(); 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; sigmap = sumAreaP*(1.0 - f)*(1.0 - epsilon)/V/dt;
} }

View File

@ -1637,8 +1637,8 @@ void Foam::fvMeshDistribute::sendMesh
<< mesh.boundaryMesh() << mesh.boundaryMesh()
//*** Write the old-time volumes if present //*** Write the old-time volumes if present
// << mesh.V0().field() // << mesh.V0().primitiveField()
// << mesh.V0().field() // << mesh.V00().primitiveField()
<< zonePoints << zonePoints
<< zoneFaces << zoneFaces

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -81,7 +81,7 @@ Foam::saturationModels::function1Temperature::Tsat
volScalarField::Internal& Tsat = tTsat.ref(); volScalarField::Internal& Tsat = tTsat.ref();
Tsat.field() = function_->value(p.field()); Tsat.primitiveFieldRef() = function_->value(p.primitiveField());
return tTsat; return tTsat;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,10 +38,13 @@ scalar alphaCoNum = 0;
*fvc::surfaceSum(mag(phi))().primitiveField() *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 = 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 Info<< "Interface Courant Number mean: " << meanAlphaCoNum
<< " max: " << alphaCoNum << endl; << " max: " << alphaCoNum << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -77,7 +77,7 @@ Foam::surfaceTensionModels::temperatureDependent::sigma() const
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_); const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
sigma.field() = sigma_->value(T.field()); sigma.primitiveFieldRef() = sigma_->value(T.primitiveField());
volScalarField::Boundary& sigmaBf = sigma.boundaryFieldRef(); volScalarField::Boundary& sigmaBf = sigma.boundaryFieldRef();
const volScalarField::Boundary& TBf = T.boundaryField(); const volScalarField::Boundary& TBf = T.boundaryField();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -269,7 +269,7 @@ Foam::twoPhaseMixture::interfaceFraction() const
} }
} }
scalarField& a = A.field(); scalarField& a = A.primitiveFieldRef();
forAll(a, i) forAll(a, i)
{ {
if (sumnSf[i] > small) if (sumnSf[i] > small)