CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Initialization of IOobject (http://www.cfd-online.com/Forums/openfoam-programming-development/111751-initialization-ioobject.html)

boeleman January 14, 2013 16:55

Initialization of IOobject
 
Dear FOAMers,

I am working to implement the pinning force on a droplet resulting from contact angle hysteresis. With this force implemented it would, for example, be possible to simulate a small droplet sticking to an inclined or vertical wall. However, I am having problems with the implementation and I am hoping some one knows what I am doing wrong. The equation I want to add has the form F = sigma (cos(Theta) - cos(Theta_e)), where sigma is the surface tension, Theta is the actual contact angle, and Theta_e is the equilibrium contact angle. To this end I decided to define a parameter called cosTheta in the interfaceProperties library, which will be used in my solver. I decided to model this new parameter after the existing parameter K (curvature) and added the following lines:

$(LIB_SRC)/transportModels/interfaceProperties/interfaceProperties.H:

volScalarField cosTheta_;

const volScalarField& cosTheta() const
{
return cosTheta_;
}

and

$(LIB_SRC)/transportModels/interfaceProperties/interfaceProperties.C:

cosTheta_
(
IOobject
(
"cosTheta",
alpha1_.time().timeName(),
alpha1_.mesh()
),
alpha1_.mesh(),
dimensionedScalar("cosTheta", dimless, 0.0)
)

I.e. I exactly copied the lines for K and K_, but replaced K with cosTheta and made it dimensionless. This code compiles fine but crashes at the end when running it. Running my code with Valgrind gives the error: "Uninitialised value was created by a stack allocation". This makes me thing that my variable is not initialized, and that OpenFoam tries to destruct an uninitialized value and crashes. Does anyone have any idea how an IOobject gets initialized and how I can get rid of this crash?

Thanks,

Arnout

boeleman January 15, 2013 15:27

Found the solution. I compiled my library with wmake lib instead of wmake libso.


All times are GMT -4. The time now is 19:11.