CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Initialization of IOobject (

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:


volScalarField cosTheta_;

const volScalarField& cosTheta() const
return cosTheta_;



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?



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 13:31.