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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,10 +36,12 @@ Description
/rho.primitiveField()
);
StCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
StCoNum = 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue();
const scalar meanStCoNum =
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
0.5
*(gSum(sumPhi)/gSum(mesh.V().primitiveField()))
*runTime.deltaTValue();
Info<< "St courant Number mean: " << meanStCoNum
<< " max: " << StCoNum << endl;

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -69,7 +69,12 @@ Foam::dimensionedScalar Foam::solvers::XiFluid::StCorr
if (ign.igniting())
{
// Calculate volume of ignition kernel
const dimensionedScalar Vk("Vk", dimVolume, gSum(c*mesh.V().field()));
const dimensionedScalar Vk
(
"Vk",
dimVolume,
gSum(c*mesh.V().primitiveField())
);
dimensionedScalar Ak("Ak", dimArea, 0.0);
if (Vk.value() > small)
@ -144,7 +149,7 @@ Foam::dimensionedScalar Foam::solvers::XiFluid::StCorr
(
fvc::div(nf, b, "div(phiSt,b)") - b*fvc::div(nf) + dMgb
);
const dimensionedScalar AkEst = gSum(mgb*mesh.V().field());
const dimensionedScalar AkEst = gSum(mgb*mesh.V().primitiveField());
StCorr.value() = max(min((Ak/AkEst).value(), 10.0), 1.0);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -78,7 +78,8 @@ Foam::solvers::isothermalFilm::pe() const
// Add the pressure caused normal momentum sources (e.g., parcels impinging
// with a normal velocity)
p.ref() += VbyA*(nHat & (fvModels().source(alpha, rho, U) & U));
p.internalFieldRef() +=
VbyA*(nHat & (fvModels().source(alpha, rho, U) & U));
return p;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -82,10 +82,12 @@ void Foam::solvers::multiphaseEuler::correctCoNum()
);
}
CoNum_ = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
CoNum_ = 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue();
const scalar meanCoNum =
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
0.5
*(gSum(sumPhi)/gSum(mesh.V().primitiveField()))
*runTime.deltaTValue();
Info<< "Courant Number mean: " << meanCoNum
<< " max: " << CoNum << endl;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,7 +45,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func \
) \
); \
\
Func(tRes.ref().field(), df1.field()); \
Func(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \
\
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(); \
\
@ -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; \
} \
@ -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(); \
\
@ -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; \
} \
@ -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(); \
\
@ -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(); \
\
@ -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(); \
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; \
} \
@ -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(); \
\
@ -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; \
} \
@ -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(); \
\
@ -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; \
} \
@ -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(); \
\
@ -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(); \
\
@ -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(); \
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; \
} \
@ -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(); \
\
@ -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; \
} \
@ -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(); \
\

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,10 +38,12 @@ scalar meanCoNum = 0.0;
fvc::surfaceSum(mag(phi))().primitiveField()/rho.primitiveField()
);
CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
CoNum = 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue();
meanCoNum =
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
0.5
*(gSum(sumPhi)/gSum(mesh.V().primitiveField()))
*runTime.deltaTValue();
}
Info<< "Courant Number mean: " << meanCoNum

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,10 +38,12 @@ scalar meanCoNum = 0.0;
fvc::surfaceSum(mag(phi))().primitiveField()
);
CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
CoNum = 0.5*gMax(sumPhi/mesh.V().primitiveField())*runTime.deltaTValue();
meanCoNum =
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
0.5
*(gSum(sumPhi)/gSum(mesh.V().primitiveField()))
*runTime.deltaTValue();
}
Info<< "Courant Number mean: " << meanCoNum

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1628,7 +1628,7 @@ bool Foam::fvMeshStitcher::disconnectThis
surfaceScalarField phi(mesh_.phi());
for (label i = 1; i < mesh_.phi().nOldTimes(false); ++ i)
{
phi.oldTime(i) == mesh_.phi().oldTime(i);
phi.oldTimeRef(i) == mesh_.phi().oldTime(i);
}
conformCorrectMeshPhi(phi);
mesh_.conform(phi);
@ -1774,7 +1774,7 @@ bool Foam::fvMeshStitcher::connectThis
surfaceScalarField phi(mesh_.phi());
for (label i = 1; i <= mesh_.phi().nOldTimes(false); ++ i)
{
phi.oldTime(i) == mesh_.phi().oldTime(i);
phi.oldTimeRef(i) == mesh_.phi().oldTime(i);
}
unconformCorrectMeshPhi(polyFacesBf, Sf, Cf, phi);
mesh_.unconform(polyFacesBf, Sf, Cf, phi);

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -111,7 +111,7 @@ bool Foam::fvMeshDistributors::loadBalancer::update()
forAllConstIter(HashTable<cpuLoad*>, cpuLoads, iter)
{
sumCpuLoad += sum(iter()->field());
sumCpuLoad += sum(iter()->primitiveField());
}
const scalar cellCFDCpuTime = returnReduce
@ -157,7 +157,7 @@ bool Foam::fvMeshDistributors::loadBalancer::update()
label loadi = 1;
forAllConstIter(HashTable<cpuLoad*>, cpuLoads, iter)
{
const scalarField& cpuLoadField = iter()->field();
const scalarField& cpuLoadField = iter()->primitiveField();
forAll(cpuLoadField, i)
{
@ -173,7 +173,7 @@ bool Foam::fvMeshDistributors::loadBalancer::update()
forAllConstIter(HashTable<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)
{
phi.oldTime(i).boundaryFieldRef()[origPatchi] +=
phi.oldTimeRef(i).boundaryFieldRef()[origPatchi] +=
fvMeshStitcherTools::fieldRMapSum
(
phi.oldTime(i).boundaryField()[nccPatchi],
@ -157,7 +157,7 @@ void Foam::fvMeshStitchers::moving::conformCorrectMeshPhi
origFvp.start()
);
phi.oldTime(i).boundaryFieldRef()[nccPatchi].clear();
phi.oldTimeRef(i).boundaryFieldRef()[nccPatchi].clear();
}
}
}
@ -879,7 +879,7 @@ void Foam::fvMeshStitchers::moving::unconformErrorFaceCorrectMeshPhi
);
phiErrorbs[i] = phi.oldTime(i).boundaryField() - tphib();
phi.oldTime(i).boundaryFieldRef() = tphib;
phi.oldTimeRef(i).boundaryFieldRef() = tphib;
}
// Add the mesh flux error into the error patch so that the mesh fluxes
@ -909,7 +909,7 @@ void Foam::fvMeshStitchers::moving::unconformErrorFaceCorrectMeshPhi
for (label i = 0; i <= phi.nOldTimes(false); ++ i)
{
fvsPatchField<scalar>& phip =
phi.oldTime(i).boundaryFieldRef()[errorPatchi];
phi.oldTimeRef(i).boundaryFieldRef()[errorPatchi];
phip[errorPatchFacei0] +=
phiErrorbs[i][nccPatchi][nccPatchFacei]/2;
phip[errorPatchFacei1] +=
@ -1049,7 +1049,7 @@ void Foam::fvMeshStitchers::moving::unconformCorrectMeshPhi
// the area taken from the old original faces
for (label i = 0; i <= phi.nOldTimes(false); ++ i)
{
phi.oldTime(i).boundaryFieldRef() =
phi.oldTimeRef(i).boundaryFieldRef() =
fvMeshStitcherTools::unconformedBoundaryField
(
phi.oldTime(i).boundaryField(),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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