Project 2- Creating a custom IOObject in Visual Studio Code
aim:The total pressure ptotal is the contribution of the static pressure and the dynamic pressure . To calculate this, we decide to write a coded function object called p_total
- reads in the fields p and U
- creates a field p_total (using IOobject)
- computes the expression

- writes the file p_total to the disk
step1:coping pitzDaily case from tutorial simpleFoam to run folder
now we creat a new cpp fh will be as followsile with the name ptotal.cpp and write the program in it which will be as follows
#include "fvCFD.H"
//simplifying the code using the namespace command
using namespace std;
int main(int argc,char *argv[])
{
Foam::argList::noBanner();
//removing the openfoam banner in the terminal
timeSelector::addOptions();
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
instantList Times = timeSelector::select0(runTime,args);
forAll(Times,i)//for all the time steps
{
runTime.setTime(Times[i],i);
Info<<"Time: "<
now we need to complie this. for this we creat a make folder and creat 2 files in it with names
1.files
2.options
files
ptotal.C
EXE = $(FOAM_USER_APPBIN)/ptotal
options
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume
now we navigate t o foldercompling using wmake command using terminal
then its created a folder name as "linux64GccDPint32pt" now we copy the pitzdaily folder from incompressible in tutorial into the run folder. we navigat
e to this pitzdaily in the run and execute the following commands
blockMesh
simpleFoam
ptotal
Results:
ptotal

pressure
