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

How to vary wall contact angle in the solver

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 8, 2005, 13:00
Default Hi, I would like to specify
  #1
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 18
hsieh is on a distinguished road
Hi,

I would like to specify wall contact angle as a function of time in the solver. Can anyone here post how to access wall contact angle?

I know how to specify U/p/gamma, but, not wall contact angle. Thanks!

Pei

PS:
//Get index of patch
label inletPatchID = mesh.bundaryMesh().findPatchID("inlet");

//Get reference to boundary value
vectorField& inletU = U.boundaryField()[inletPatchID];

//Manipulate value
inletU += vector(0.1, 0, 0);
hsieh is offline   Reply With Quote

Old   September 8, 2005, 16:37
Default HI, After studying the inte
  #2
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 18
hsieh is on a distinguished road
HI,

After studying the interFoam.C carefully (and everything under interFoam directory), it looks like there are a quite a few things calculated in interfaceProperties.C (including contact angle) at time 0. This is only done once before the time loop.

I have tried to include interfaceProperties.H within the time loop and added runTime info into interfaceProperties.C so that theta0 is a function of time - but, this failed (I included createTime.H into interfaceProperties.H so that it has runTime info) - cannot even compile.

One case I am playing with now has a 40 degree contact angle. Because I can only initialize the air/liquid interface to 90 degree using setFields, I am seeing very bad results in the first few hundreds time steps and the solve had a very difficult time recovering from that. So, I thought, if I gradually decrease the wall contact angle from 90 to 40 (say within 100 time steps), then, I might get a stable run.

Your assistance will be highly appreciated.

pei
hsieh is offline   Reply With Quote

Old   September 9, 2005, 14:06
Default QUOTE: "Because I can only ini
  #3
ali
Member
 
Ali Heidari
Join Date: Mar 2009
Location: Surrey, London, United Kingdom
Posts: 39
Rep Power: 17
ali is on a distinguished road
QUOTE: "Because I can only initialize the air/liquid interface to 90 degree using setFields"

I guess I have wondered about the initialization. Is there a tool in OpenFOAM for intializing gamma as a circular thing rather than a square (like in damBreak)?

I searched src/meshTools/ and couldn't find such a thing.


Pei, still, you can do a trick for initializing a non-90 contact angle. Say, if you have a drop with a specific contact angle, you can initialize gamma as a circular disk (where location of center of disk determines different contact angles) If it's lower than your bottom boundary you can get a contact angle<90>90. You can program it using a very simple code you could write, then just map your original gamma field to your mesh in openFOAM using mapFields.

Of course, it's hard for any code to deal with initially wrong contact angle.
ali is offline   Reply With Quote

Old   September 9, 2005, 14:07
Default QUOTE: "Because I can only ini
  #4
ali
Member
 
Ali Heidari
Join Date: Mar 2009
Location: Surrey, London, United Kingdom
Posts: 39
Rep Power: 17
ali is on a distinguished road
QUOTE: "Because I can only initialize the air/liquid interface to 90 degree using setFields"

I guess I have wondered about the initialization. Is there a tool in OpenFOAM for intializing gamma as a circular thing rather than a square (like in damBreak)?

I searched src/meshTools/ and couldn't find such a thing.


Pei, still, you can do a trick for initializing a non-90 contact angle. Say, if you have a drop with a specific contact angle, you can initialize gamma as a circular disk (where location of center of disk determines different contact angles) If it's lower than your bottom boundary you can get a contact angle less than and if it's above bottom boundary, you get contact angle higher than 90. You can program it using a very simple code you could write, then just map your original gamma field to your mesh in openFOAM using mapFields.

Of course, it's hard for any code to deal with initially wrong contact angle.
ali is offline   Reply With Quote

Old   September 9, 2005, 15:26
Default Hi, Ali, Thanks a lot for t
  #5
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 18
hsieh is on a distinguished road
Hi, Ali,

Thanks a lot for the reply!

There are two reasons that I am interesting in varying wall contact in the time loop in the solver:

1. I have a less than 40 degree contact angle. By gradually changing from 90 degree (initialized gamma field) to 40 degree (or less) might make the results more stable (I am actually not sure about this).
2. In some experiment data I have seen, once liquids flow through a tube (followed by air), surface energy could change depending the type of liquids (blood could deposit proteins on the tube wall and effectively changing the wall contact angle). I am hoping to vary wall contact angle during a run in this case.

I included interfaceProperties.H in the time loop of interFoam.C. But, I am having trouble accessing "runTime" in interfaceProperties so that contact angle is a function of time.

pei
hsieh is offline   Reply With Quote

Old   September 12, 2005, 07:00
Default You can access the time portio
  #6
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
You can access the time portion of the database from anywhere via the following calls:

<registered>.mesh().time().timeName()

where <registered> is typically any volType field. So in interfaceProperties you can simply go

scalar ctime = gamma_.mesh().time().timeName();

or something similar to get the current time.
eugene is offline   Reply With Quote

Old   September 13, 2005, 09:59
Default Thanks Eugene! After studyi
  #7
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 18
hsieh is on a distinguished road
Thanks Eugene!

After studying interFoam.C/interfaceProperties.C/contactAngle.H stuffs, it looks like varying contact angle is not as straight forward as varying velocity/pressure. I need to play with this more.

Pei
hsieh is offline   Reply With Quote

Old   February 28, 2010, 09:22
Default intital set
  #8
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
im not sure about ali suggestion , but if you want to initialize gamma
there is a program which called "funkysetfield"
you can find more information in wiki
nimasam is offline   Reply With Quote

Old   June 11, 2024, 09:37
Default
  #9
Senior Member
 
Klaus
Join Date: Mar 2009
Posts: 281
Rep Power: 22
klausb will become famous soon enough
How to read the deltaT value defined in the controlDict from within the PCG.C source code?

This doesn't work:

// get deltaT value defined in the controlDict
double dT_ = this->mesh().time().deltaTValue();

The context is:


Code:
/*-------------------------myPCG.C--------------------------------------------------*/

#include "myPCG.H"
#include "PrecisionAdaptor.H"
#include "TimeStepDataStorage.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
    defineTypeNameAndDebug(myPCG, 0);

    lduMatrix::solver::addsymMatrixConstructorToTable<myPCG>
        addmyPCGSymMatrixConstructorToTable_;
        
    TimeStepDataStorage timestepDataStorage;
    
}


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

Foam::myPCG::myPCG
(
    const word& fieldName,
    const lduMatrix& matrix,  // was const lduMatrix& matrix,
    const FieldField<Field, scalar>& interfaceBouCoeffs,
    const FieldField<Field, scalar>& interfaceIntCoeffs,
    const lduInterfaceFieldPtrsList& interfaces,
    const dictionary& solverControls
)
:
    lduMatrix::solver
    (
        fieldName,
        matrix,
        interfaceBouCoeffs,
        interfaceIntCoeffs,
        interfaces,
        solverControls
    )
{}


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

Foam::solverPerformance Foam::myPCG::scalarSolve
(
    solveScalarField& psi,
    const solveScalarField& source,
    const direction cmpt
) const
{
    // --- Setup class containing solver performance data
    solverPerformance solverPerf
    (
        lduMatrix::preconditioner::getName(controlDict_) + typeName,
        fieldName_
    );

    label nCells = psi.size();
    
    // get deltaT value defined in the controlDict
    double dT_ = this->mesh().time().deltaTValue(); 
    ...
I don't see a field other object that has a member 'mesh' through which I could access the value.
klausb is offline   Reply With Quote

Reply


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
contact angle yan FLUENT 4 November 6, 2012 05:22
Wall contact angle feijooos OpenFOAM Pre-Processing 4 February 3, 2009 12:52
Wall contact angle feijooos OpenFOAM Pre-Processing 0 January 28, 2009 14:31
Moving contact line (dynamic contact angle) Pulli FLUENT 0 March 1, 2007 13:31
how to code wall contact angle? schou Main CFD Forum 2 May 5, 2003 21:50


All times are GMT -4. The time now is 04:39.