CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Implementation of Dynamic Contact Angle

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 29, 2017, 21:09
Default Implementation of Dynamic Contact Angle
  #1
New Member
 
Santosh
Join Date: Nov 2013
Location: USA
Posts: 12
Rep Power: 13
konangsh is on a distinguished road
Hil,
I am trying to implement Cox's dynamic contact angle model, and cant figure out what I am doing wrong! I am able to compile transportProperties, interfaceProperties, and interFoam in my local directory. But the solver crashes as soon as I try to run it. Can someone help me pls?

My code is this:

// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //

const Foam::scalar Foam::dynamicCoxAlphaContactAngleFvPatchScalarFiel d::convertToRad = Foam::constant::mathematical:i/180;
const Foam::scalar Foam::dynamicCoxAlphaContactAngleFvPatchScalarFiel d::convertToDeg = 180/Foam::constant::mathematical:i;
const Foam::scalar Foam::dynamicCoxAlphaContactAngleFvPatchScalarFiel d::theta0 = 90;

// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

Foam::dynamicCoxAlphaContactAngleFvPatchScalarFiel d::
dynamicCoxAlphaContactAngleFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
alphaContactAngleFvPatchScalarField(p, iF),
thetaA_(0.0),
thetaR_(0.0)
{}

Foam::dynamicCoxAlphaContactAngleFvPatchScalarFiel d::
dynamicCoxAlphaContactAngleFvPatchScalarField
(
const dynamicCoxAlphaContactAngleFvPatchScalarField& gcpsf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
alphaContactAngleFvPatchScalarField(gcpsf, p, iF, mapper),
thetaA_(gcpsf.thetaA_),
thetaR_(gcpsf.thetaR_)
{}

Foam::dynamicCoxAlphaContactAngleFvPatchScalarFiel d::
dynamicCoxAlphaContactAngleFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
alphaContactAngleFvPatchScalarField(p, iF, dict),
thetaA_(readScalar(dict.lookup("thetaA"))),
thetaR_(readScalar(dict.lookup("thetaR")))
{
Info<< "Dynamic contact angle (Cox) is being used\n" << endl;
evaluate();
}

Foam::dynamicCoxAlphaContactAngleFvPatchScalarFiel d::
dynamicCoxAlphaContactAngleFvPatchScalarField
(
const dynamicCoxAlphaContactAngleFvPatchScalarField& gcpsf
)
:
alphaContactAngleFvPatchScalarField(gcpsf),
thetaA_(gcpsf.thetaA_),
thetaR_(gcpsf.thetaR_)
{}

Foam::dynamicCoxAlphaContactAngleFvPatchScalarFiel d::
dynamicCoxAlphaContactAngleFvPatchScalarField
(
const dynamicCoxAlphaContactAngleFvPatchScalarField& gcpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
alphaContactAngleFvPatchScalarField(gcpsf, iF),
thetaA_(gcpsf.thetaA_),
thetaR_(gcpsf.thetaR_)
{}


// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField>
Foam::dynamicCoxAlphaContactAngleFvPatchScalarFiel d::theta
(
const fvPatchVectorField& Up,
const fvsPatchVectorField& nHat
) const
{

const fvPatchField<scalar>& nup = patch().lookupPatchField<const::Foam::volScalarFie ld, scalar>("nu");
const fvPatchField<scalar>& rhop = patch().lookupPatchField<const::Foam::volScalarFie ld, scalar>("rho");

const vectorField nf(patch().nf());
// Calculated the component of the velocity parallel to the wall
vectorField Uwall(Up.patchInternalField() - Up);
Uwall -= (nf & Uwall)*nf;

// Find the direction of the interface parallel to the wall
vectorField nWall(nHat - (nf & nHat)*nf);

// Normalise nWall
nWall /= (mag(nWall) + SMALL);

// Calculate Uwall resolved normal to the interface parallel to
// the interface
scalarField uwall(nWall & Uwall);

// Calculate local Capillary number
scalarField Ca = nup*rhop*mag(uwall)/sigmap;
Info<< "Capillary number (Cox) was evaluated\n" << endl;

scalarField thetaDp(patch().size(), (theta0));

/* Calculate and return the value of contact angle on patch faces,
a general approach: the product of Uwall and nWall is negative
for advancing and positiv for receding motion. */

forAll(uwall, pfacei)
{
if(uwall[pfacei] < 0.0)
{
thetaDp[pfacei] = pow((pow(thetaA_,3)+144*Ca[pfacei]),0.3333);
}
else if (uwall[pfacei] > 0.0)
{
thetaDp[pfacei] = pow((pow(thetaR_,3)+144*Ca[pfacei]),0.3333);
}
}

return (thetaDp);
}
konangsh is offline   Reply With Quote

Old   June 27, 2018, 03:50
Default
  #2
New Member
 
Zanh
Join Date: Jun 2017
Posts: 8
Rep Power: 9
zangthanh is on a distinguished road
Hi Konangsh,
I hope you solved your problems. if not, could you please show the error?
zangthanh is offline   Reply With Quote

Reply

Tags
dynamic contact angle, interface properties


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic contact angle rmousavibt Fluent UDF and Scheme Programming 12 October 31, 2021 23:38
Dynamic Contact Angle UDF in Fluent codyn Fluent UDF and Scheme Programming 2 August 25, 2016 00:54
Normal vector, slope and aspect angle g_niro Main CFD Forum 0 February 2, 2011 18:24
Dynamic contact angle Aireen FLUENT 1 August 10, 2006 17:01
Dynamic contact angle Aireen FLUENT 2 July 5, 2006 14:14


All times are GMT -4. The time now is 00:49.