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,18 +51,20 @@ void Foam::solvers::isothermalFluid::setRDeltaT()
const volScalarField rDeltaT0("rDeltaT0", rDeltaT);
// Set the reciprocal time-step from the local Courant number
rDeltaT.ref() = fvc::surfaceSum(mag(phi))()()/((2*maxCo)*mesh.V()*rho());
rDeltaT.internalFieldRef() =
fvc::surfaceSum(mag(phi))()()/((2*maxCo)*mesh.V()*rho());
// Set the reciprocal time-step from the local acoustic Courant number
if (pimple.transonic())
{
surfaceScalarField phid("phid", fvc::interpolate(psi)*fvc::flux(U));
rDeltaT.ref() = max
(
rDeltaT(),
fvc::surfaceSum(mag(phid))()()/((2*maxCo)*mesh.V()*psi())
);
rDeltaT.internalFieldRef() =
max
(
rDeltaT(),
fvc::surfaceSum(mag(phid))()()/((2*maxCo)*mesh.V()*psi())
);
}
// Clip to user-defined maximum and minimum time-steps

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,13 +76,14 @@ void Foam::solvers::multiphaseVoFSolver::setInterfaceRDeltaT
{
const volScalarField alphaBar(fvc::average(phases[phasei]));
rDeltaT.ref() = max
(
rDeltaT(),
pos0(alphaBar() - alphaSpreadMin)
*pos0(alphaSpreadMax - alphaBar())
*alphaCoRdeltaT
);
rDeltaT.internalFieldRef() =
max
(
rDeltaT(),
pos0(alphaBar() - alphaSpreadMin)
*pos0(alphaSpreadMax - alphaBar())
*alphaCoRdeltaT
);
}
}

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,14 +84,15 @@ void Foam::solvers::twoPhaseVoFSolver::setInterfaceRDeltaT
volScalarField alpha1Bar(fvc::average(alpha1));
rDeltaT.ref() = max
(
rDeltaT(),
pos0(alpha1Bar() - alphaSpreadMin)
*pos0(alphaSpreadMax - alpha1Bar())
*fvc::surfaceSum(mag(phi))()()
/((2*maxAlphaCo)*mesh.V())
);
rDeltaT.internalFieldRef() =
max
(
rDeltaT(),
pos0(alpha1Bar() - alphaSpreadMin)
*pos0(alphaSpreadMax - alpha1Bar())
*fvc::surfaceSum(mag(phi))()()
/((2*maxAlphaCo)*mesh.V())
);
}
// Update the boundary values of the reciprocal time-step

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]
);
}