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

Printing capillary number in the calculation of dynamic alpha contact angle

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 16, 2018, 08:05
Smile Printing capillary number in the calculation of dynamic alpha contact angle
  #1
New Member
 
Zanh
Join Date: Jun 2017
Posts: 8
Rep Power: 9
zangthanh is on a distinguished road
Hello every FOAMER,

Thank you very much for all of your post and reply because I have learnt many thing from it through this forum.

Currently, I am using InterFoam to study the case of capillary rise with dynamic alpha contact angle Cox's model. The new library for Cox's contact angle was compiled. My trouble is that I would like to plot the capillary number with time. Anyone please give me advice.

Thank you very much, any comment is the great help for me

Zang

Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

\*---------------------------------------------------------------------------*/

#include "dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volMesh.H"
#include "volFields.H"
#include "interfacePropertiesThetaD.H"
#include "surfaceFields.H"



//* * * * * * * * * * * * * * * * static Member Data  * * * * * * * * * * * * * * //



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

Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::
dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField
(
    const fvPatch& p,
    const DimensionedField<scalar, volMesh>& iF
)
:
    alphaContactAngleThetaDFvPatchScalarField(p, iF),
    thetaS_(0.0),
    //uTheta_(0.0),
    //thetaA_(0.0),
    nuName_("nu1"),
    //rhoName_("rho"),
    transportPropertiesName_("transportProperties")
{}


Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::
dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField
(
    const dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField& gcpsf,
    const fvPatch& p,
    const DimensionedField<scalar, volMesh>& iF,
    const fvPatchFieldMapper& mapper
)
:
    alphaContactAngleThetaDFvPatchScalarField(gcpsf, p, iF, mapper),
    thetaS_(gcpsf.thetaS_),
    //uTheta_(gcpsf.uTheta_),
    //thetaA_(gcpsf.thetaA_),
    nuName_(gcpsf.nuName_),
    //rhoName_(gcpsf.rhoName_),
    transportPropertiesName_(gcpsf.transportPropertiesName_)
{}


Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::
dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField
(
    const fvPatch& p,
    const DimensionedField<scalar, volMesh>& iF,
    const dictionary& dict
)
:
    alphaContactAngleThetaDFvPatchScalarField(p, iF, dict),
    thetaS_(readScalar(dict.lookup("thetaS"))),
    //uTheta_(readScalar(dict.lookup("uTheta"))),
    //thetaA_(readScalar(dict.lookup("thetaA"))),
    nuName_(dict.lookupOrDefault<word>("nu1", "nu1")),
    rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
    transportPropertiesName_(dict.lookupOrDefault<word>("transportProperties", "transportProperties"))
{
    evaluate();
}


Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::
dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField
(
    const dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField& gcpsf
)
:
    alphaContactAngleThetaDFvPatchScalarField(gcpsf),
    thetaS_(gcpsf.thetaS_),
    //uTheta_(gcpsf.uTheta_),
    //thetaA_(gcpsf.thetaA_),
    nuName_(gcpsf.nuName_),
    //rhoName_(gcpsf.rhoName_),
    transportPropertiesName_(gcpsf.transportPropertiesName_)
{}


Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::
dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField
(
    const dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField& gcpsf,
    const DimensionedField<scalar, volMesh>& iF
)

:
    alphaContactAngleThetaDFvPatchScalarField(gcpsf, iF),
    thetaS_(gcpsf.thetaS_),
    //uTheta_(gcpsf.uTheta_),
    //thetaA_(gcpsf.thetaA_),
    nuName_(gcpsf.nuName_),
    //rhoName_(gcpsf.rhoName_),
    transportPropertiesName_(gcpsf.transportPropertiesName_)
{}


// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //



Foam::tmp<Foam::scalarField>
Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::theta
(
    const fvPatchVectorField& Up,
    const fvsPatchVectorField& nHat
)   const
{
    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);
    
    const fvPatchField<scalar>& nu = patch().lookupPatchField<volScalarField, scalar>(nuName_);
    //const fvPatchField<scalar>& rho = patch().lookupPatchField<volScalarField, scalar>(rhoName_);
    const dictionary& transportProperties = db().lookupObject<IOdictionary>(transportPropertiesName_);
    const dimensionedScalar sigma = transportProperties.lookup("sigma");
    const dimensionedScalar rhoFluid1 = transportProperties.lookup("rhoFluid1");
    
    scalarField Ca = nu1*rhoFluid1.value()*(uwall)/sigma.value();
    
    return pow((pow(thetaS_, 3)+5.0*Ca), 1.0/3.0);
}


void Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::write(Ostream& os) const
{
    alphaContactAngleThetaDFvPatchScalarField::write(os);
    os.writeKeyword("thetaS") << thetaS_ << token::END_STATEMENT << nl;
    //os.writeKeyword("uTheta") << uTheta_ << token::END_STATEMENT << nl;
    // os.writeKeyword("thetaA") << thetaA_ << token::END_STATEMENT << nl;
    //os.writeKeyword("thetaR") << thetaR_ << token::END_STATEMENT << nl;
    writeEntry("value", os);
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
    makePatchTypeField
    (
        fvPatchScalarField,
        dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField
    );
}


// ************************************************************************* //
zangthanh is offline   Reply With Quote

Old   June 17, 2018, 06:23
Default
  #2
Member
 
Vince
Join Date: Mar 2017
Posts: 45
Rep Power: 9
hyFoam is on a distinguished road
Hi Zang,


You could create a functionObject to monitor Ca. Some examples are given in: $WM_PROJECT_DIR/src/functionObjects/field


You just need to create a duplicate and edit the relevant entries to match your needs.



Thanks,


Vincent
hyFoam is offline   Reply With Quote

Old   April 20, 2020, 13:25
Default
  #3
New Member
 
Rajesh Kumar
Join Date: Apr 2009
Posts: 25
Rep Power: 17
rajeshkunwar is on a distinguished road
Dear Zang,

Please share your experience with the Cox's model. Did you compare Cox's results with that of Kistler's model? Will you please share the Cox's model OpenFoam code.

Kind regards
Rajesh

Quote:
Originally Posted by zangthanh View Post
Hello every FOAMER,

Thank you very much for all of your post and reply because I have learnt many thing from it through this forum.

Currently, I am using InterFoam to study the case of capillary rise with dynamic alpha contact angle Cox's model. The new library for Cox's contact angle was compiled. My trouble is that I would like to plot the capillary number with time. Anyone please give me advice.

Thank you very much, any comment is the great help for me

Zang

Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

\*---------------------------------------------------------------------------*/

#include "dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField.H"
#include "mathematicalConstants.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volMesh.H"
#include "volFields.H"
#include "interfacePropertiesThetaD.H"
#include "surfaceFields.H"



//* * * * * * * * * * * * * * * * static Member Data  * * * * * * * * * * * * * * //



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

Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::
dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField
(
    const fvPatch& p,
    const DimensionedField<scalar, volMesh>& iF
)
:
    alphaContactAngleThetaDFvPatchScalarField(p, iF),
    thetaS_(0.0),
    //uTheta_(0.0),
    //thetaA_(0.0),
    nuName_("nu1"),
    //rhoName_("rho"),
    transportPropertiesName_("transportProperties")
{}


Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::
dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField
(
    const dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField& gcpsf,
    const fvPatch& p,
    const DimensionedField<scalar, volMesh>& iF,
    const fvPatchFieldMapper& mapper
)
:
    alphaContactAngleThetaDFvPatchScalarField(gcpsf, p, iF, mapper),
    thetaS_(gcpsf.thetaS_),
    //uTheta_(gcpsf.uTheta_),
    //thetaA_(gcpsf.thetaA_),
    nuName_(gcpsf.nuName_),
    //rhoName_(gcpsf.rhoName_),
    transportPropertiesName_(gcpsf.transportPropertiesName_)
{}


Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::
dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField
(
    const fvPatch& p,
    const DimensionedField<scalar, volMesh>& iF,
    const dictionary& dict
)
:
    alphaContactAngleThetaDFvPatchScalarField(p, iF, dict),
    thetaS_(readScalar(dict.lookup("thetaS"))),
    //uTheta_(readScalar(dict.lookup("uTheta"))),
    //thetaA_(readScalar(dict.lookup("thetaA"))),
    nuName_(dict.lookupOrDefault<word>("nu1", "nu1")),
    rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
    transportPropertiesName_(dict.lookupOrDefault<word>("transportProperties", "transportProperties"))
{
    evaluate();
}


Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::
dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField
(
    const dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField& gcpsf
)
:
    alphaContactAngleThetaDFvPatchScalarField(gcpsf),
    thetaS_(gcpsf.thetaS_),
    //uTheta_(gcpsf.uTheta_),
    //thetaA_(gcpsf.thetaA_),
    nuName_(gcpsf.nuName_),
    //rhoName_(gcpsf.rhoName_),
    transportPropertiesName_(gcpsf.transportPropertiesName_)
{}


Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::
dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField
(
    const dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField& gcpsf,
    const DimensionedField<scalar, volMesh>& iF
)

:
    alphaContactAngleThetaDFvPatchScalarField(gcpsf, iF),
    thetaS_(gcpsf.thetaS_),
    //uTheta_(gcpsf.uTheta_),
    //thetaA_(gcpsf.thetaA_),
    nuName_(gcpsf.nuName_),
    //rhoName_(gcpsf.rhoName_),
    transportPropertiesName_(gcpsf.transportPropertiesName_)
{}


// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //



Foam::tmp<Foam::scalarField>
Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::theta
(
    const fvPatchVectorField& Up,
    const fvsPatchVectorField& nHat
)   const
{
    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);
    
    const fvPatchField<scalar>& nu = patch().lookupPatchField<volScalarField, scalar>(nuName_);
    //const fvPatchField<scalar>& rho = patch().lookupPatchField<volScalarField, scalar>(rhoName_);
    const dictionary& transportProperties = db().lookupObject<IOdictionary>(transportPropertiesName_);
    const dimensionedScalar sigma = transportProperties.lookup("sigma");
    const dimensionedScalar rhoFluid1 = transportProperties.lookup("rhoFluid1");
    
    scalarField Ca = nu1*rhoFluid1.value()*(uwall)/sigma.value();
    
    return pow((pow(thetaS_, 3)+5.0*Ca), 1.0/3.0);
}


void Foam::dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField::write(Ostream& os) const
{
    alphaContactAngleThetaDFvPatchScalarField::write(os);
    os.writeKeyword("thetaS") << thetaS_ << token::END_STATEMENT << nl;
    //os.writeKeyword("uTheta") << uTheta_ << token::END_STATEMENT << nl;
    // os.writeKeyword("thetaA") << thetaA_ << token::END_STATEMENT << nl;
    //os.writeKeyword("thetaR") << thetaR_ << token::END_STATEMENT << nl;
    writeEntry("value", os);
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
    makePatchTypeField
    (
        fvPatchScalarField,
        dynamicAlphaContactAngleCoxModel5CoefFvPatchScalarField
    );
}


// ************************************************************************* //
rajeshkunwar is offline   Reply With Quote

Reply

Tags
capillary number, interfoam, plot, print


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 issue: fluent UDF couldn't set the correct contact angle FelixJJ FLUENT 2 October 20, 2021 03:39
[snappyHexMesh] Error snappyhexmesh - Multiple outside loops avinashjagdale OpenFOAM Meshing & Mesh Conversion 53 March 8, 2019 10:42
dynamic contact angle udf returns no value to solver shiraz_man67 Fluent UDF and Scheme Programming 5 July 3, 2018 15:51
decomposePar -allRegions stru OpenFOAM Pre-Processing 2 August 25, 2015 04:58
SigFpe when running ANY application in parallel Pj. OpenFOAM Running, Solving & CFD 3 April 23, 2015 15:53


All times are GMT -4. The time now is 15:01.