OpenFOAM allows the user to carry out a variety of calculations at run-time, that is, while the simulation is progressing. A typical example of this might be calculating the lift and drag forces on a building and dumping this to a data file.
These additional functions are defined by appending a "function" object to the controlDict file. ODS allows you to append arbitrary text to the end of your controlDict by creating a text-file in Blender and naming it "controlDict.append".
Text to add to your controlDict.append text file in the Blender text editor:
functions
{
forces
{
type forces;
functionObjectLibs ("libforces.so");
outputControl timeStep;
outputInterval 1;
patches ( "Building" );
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1.2; // Reference density, fluid
CofR (0 0 0); // Origin for moment calculations
}
forceCoeffs
{
type forceCoeffs;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 1;
patches ( "Building" );
pName p;
UName U;
rhoName rhoInf; // Indicates incompressible
rhoInf 1.2; // Reference density, fluid
log true;
liftDir (0 0 1);
dragDir (0 1 0);
CofR (0 0 0); // Axle midpoint on ground
pitchAxis (0 1 0);
magUInf 20;
lRef 30; // Diameter of cylinder
Aref 9000; // Ref. Area = cross sectional area
}
}