Project 2- Creating a custom IOObject in Visual Studio Code
code for to caclaute the P_Total perssure
functions
{
#includeFunc streamlines
// Adding Total_Pressure using codedFunctionObject
totalPressure
{
//Mandatory entries
type coded;
libs ("libutilityFunctionObjects.so");
name pTotal;
enabled true;
executeControl timeStep;
executeInterval 50;
WriteControl timeStep;
writeInterval 50;
codeWrite
#{
const volVectorField& U = mesh().lookupObject<volVectorField>("U");
const volScalarField& p = mesh().lookupObject<volScalarField>("p");
Info << "Creating pTotal Field" << nl << endl;
volScalarField pTotal
(
IOobject
(
"pTotal",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
p + 0.5*magSqr(U)
);
pTotal.write();
#};
};
}
