November 21, 2018, 09:41
|
accessing 0 time directory in coded functionObject
|
#1
|
Member
Join Date: Apr 2018
Location: UK
Posts: 64
Rep Power: 4
|
Hi there,
I am hoping to get some help with coded function objects in openFoam.
I have written a function object to compute the radius of a bubble based on volume fraction alpha and cell volume as follows (compressibleInterFoam):
Code:
// section of coded to be executed, in controlDict
forAll(centers, I)
{
if (alpha[I] < th)
{
// TO COMPUTE RADIUS
// compute numerator, time-varying
sumNumerator += (1-alpha[I])*(V[I]); // per time-step
// compute denominator, constant at t = 0
sumDenominator += (1-alpha[I])*(V[I]); // CHANGE TO ACCESS VALUES AT TIME = 0 -- how?
// At each time-step
bracket = pow(sumNumerator/sumDenominator, 1/3);
// compute Radius
Radius = Rstart*bracket;
}
}
However, I cannot seem to figure out how to access the properties at time directory 0.
The code compiles and runs but with the above setting the radius clearly stays constant for all time-directories.
Please help. Any advice will be greatly appreciated.
p.s. I know I can do something similar in swak4Foam but so far I have not managed to make this work for my current version (v5.0) and I want to try out some coding in OpenFOAM and c++ as an exercise (still a newbie).
|
|
|