本文整理汇总了C++中volScalarField::primitiveField方法的典型用法代码示例。如果您正苦于以下问题:C++ volScalarField::primitiveField方法的具体用法?C++ volScalarField::primitiveField怎么用?C++ volScalarField::primitiveField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类volScalarField
的用法示例。
在下文中一共展示了volScalarField::primitiveField方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sum
void phaseChangeModel::correct
(
const scalar dt,
scalarField& availableMass,
volScalarField& dMass,
volScalarField& dEnergy
)
{
if (!active())
{
return;
}
correctModel
(
dt,
availableMass,
dMass,
dEnergy
);
latestMassPC_ = sum(dMass.primitiveField());
totalMassPC_ += latestMassPC_;
availableMass -= dMass;
dMass.correctBoundaryConditions();
if (writeTime())
{
scalar phaseChangeMass = getModelProperty<scalar>("phaseChangeMass");
phaseChangeMass += returnReduce(totalMassPC_, sumOp<scalar>());
setModelProperty<scalar>("phaseChangeMass", phaseChangeMass);
totalMassPC_ = 0.0;
}
}
示例2: path
void writeCellGraph
(
const volScalarField& vsf,
const word& graphFormat
)
{
fileName path(vsf.time().path()/"graphs"/vsf.time().timeName());
mkDir(path);
graph
(
vsf.name(),
"x",
vsf.name(),
vsf.mesh().C().primitiveField().component(vector::X),
vsf.primitiveField()
).write(path/vsf.name(), graphFormat);
}
示例3:
Foam::scalar Foam::compressibleCourantNo
(
const fvMesh& mesh,
const Time& runTime,
const volScalarField& rho,
const surfaceScalarField& phi
)
{
scalarField sumPhi
(
fvc::surfaceSum(mag(phi))().primitiveField()
/ rho.primitiveField()
);
scalar CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
scalar meanCoNum =
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
Info<< "Region: " << mesh.name() << " Courant Number mean: " << meanCoNum
<< " max: " << CoNum << endl;
return CoNum;
}
示例4: mesh
tmp<fvMatrix<Type>>
EulerD2dt2Scheme<Type>::fvmD2dt2
(
const volScalarField& rho,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type>> tfvm
(
new fvMatrix<Type>
(
vf,
rho.dimensions()*vf.dimensions()*dimVol
/dimTime/dimTime
)
);
fvMatrix<Type>& fvm = tfvm.ref();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
scalar rDeltaT2 = 4.0/sqr(deltaT + deltaT0);
if (mesh().moving())
{
scalar quarterRdeltaT2 = 0.25*rDeltaT2;
const scalarField VV0rhoRho0
(
(mesh().V() + mesh().V0())
*(rho.primitiveField() + rho.oldTime().primitiveField())
);
const scalarField V0V00rho0Rho00
(
(mesh().V0() + mesh().V00())
*(
rho.oldTime().primitiveField()
+ rho.oldTime().oldTime().primitiveField()
)
);
fvm.diag() = (coefft*quarterRdeltaT2)*VV0rhoRho0;
fvm.source() = quarterRdeltaT2*
(
(coefft*VV0rhoRho0 + coefft00*V0V00rho0Rho00)
*vf.oldTime().primitiveField()
- (coefft00*V0V00rho0Rho00)
*vf.oldTime().oldTime().primitiveField()
);
}
else
{
scalar halfRdeltaT2 = 0.5*rDeltaT2;
const scalarField rhoRho0
(
rho.primitiveField()
+ rho.oldTime().primitiveField()
);
const scalarField rho0Rho00
(
rho.oldTime().primitiveField()
+ rho.oldTime().oldTime().primitiveField()
);
fvm.diag() = (coefft*halfRdeltaT2)*mesh().V()*rhoRho0;
fvm.source() = halfRdeltaT2*mesh().V()*
(
(coefft*rhoRho0 + coefft00*rho0Rho00)
*vf.oldTime().primitiveField()
- (coefft00*rho0Rho00)
*vf.oldTime().oldTime().primitiveField()
);
}
return tfvm;
}