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

Phase Field modeling in OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Like Tree13Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 1, 2007, 12:25
Default I am a relatively new user to
  #1
Member
 
Adam Donaldson
Join Date: Mar 2009
Location: Ottawa, Ontario, Canada
Posts: 37
Rep Power: 17
adona058 is on a distinguished road
I am a relatively new user to the OpenFOAM community, and would appreciate some feedback/direction on a new solver I will be working on in OpenFOAM as part of my PhD.

From the documentation I have seen to date, there does not appear to be an implementation of the Phase Field multiphase flow model in OpenFOAM at this time. I have been reviewing the existing solvers and just about all the documentation I can get my hands on, but I am finding that there is still not a good step-by-step tutorial out there on development of a new solver in OpenFOAM. Below is a brief outline of the application I am trying to develop:

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

Phase Field Model
Most similar to level-set method, but with the order parameter governed by the Cahn-Hilliard equation which uses chemical potential gradients and the minimization of free energy to govern interface movement).

Parameters:
phi - typically representing mole fraction
velocity field
pressure field

Solver Pseudocode:

Step 1: Update phi:

1) Calculate chemical potential field based on the leplacian of phi and an energy of mixing term (linear equation which is a function of phi).
2) Solve the Cahn-Hilliard equation implicitely for the new phi (involves temporal term, convective term, and diffusive term with the leplacian of the chemical potential).

In reality, this step could be solved in one stage, but unfortunately there is a forth order derivative involved for which the documentation has lead me to believe is not supported with OpenFOAM's grid structure (cannot find second neighbor for 5-point descretization). So instead, I plan to calculate the chemical potential, then take the leplacian to get the final results.

Step 2:

Solve the momentum conservation equation, with an additional source term incorporating the momentum forcing from the chemical potential gradients (similar to curvature * surface tension * surface normal vector).

Step 3:

Perform pressure velocity correction

Step 4:

Calculate residuals for phi and velocity, and confirm a divergence free velocity vield.

Step 5:

If all residuals are below the specified tolerance, move to the next timestep. otherwise, go back to step 1, but using the new velocity field.

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


In regards to the questions and feedback:

1) The most obvious, Is there an existing solver in OpenFOAM (or one that you know of that is not in the standard release) that could be easily adapted to meet the needs of this application?

2) Has anyone come across a comprehensive outline describing the addition of a new solver from start to finish (i.e. adding new scalar fields, defining them in the FoamX configuration files so that they can be accessed in FoamX, outlining the function of each #include statement, and describing when each is required. etc.)

3) I am a bit concerned about my intended method for solving the cahn hilliard equation via a calculated chemical potential field (cheat for 4th order derivative). I know that it will use additional resources and could introduce additional numerical instability, but I have not been able to find a viable alternative as of yet... I would appreciate some input on any complications that you might foresee, or any methods which might prove to be better suited.

Thank you in advance for any help provided.
Annier likes this.
adona058 is offline   Reply With Quote

Old   June 1, 2007, 12:32
Default As an additional note, the mod
  #2
Member
 
Adam Donaldson
Join Date: Mar 2009
Location: Ottawa, Ontario, Canada
Posts: 37
Rep Power: 17
adona058 is on a distinguished road
As an additional note, the model will eventually need to include easily edited functions describing such properties as the mixing energy (used in the calculation of the chemical poential), and two-phase properties as a function of phi (density, viscosity, mobility).

There are also a number of constants required which need to be incorporated into the dictionary files for ease of modification.

Thanks.

Adam
adona058 is offline   Reply With Quote

Old   November 30, 2007, 19:34
Default Hi Adam, I have been toying
  #3
New Member
 
C.E.M.
Join Date: Mar 2009
Posts: 16
Rep Power: 17
evan is on a distinguished road
Hi Adam,

I have been toying with modeling a Cahn-Hilliard solution in openfoam as well. I'm not sure that I can be of too much help at this point, but my initial thought is that the biharmonic operator should be fairly stable out of the box, so to speak.

This might be helpful as well:

http://portal.acm.org/citation.cfm?id=1036150

If you get things working at all please do share. I plan to start working with this model soon, so I'll post back here as well if I get anywhere.

Best,
Evan
Annier likes this.
evan is offline   Reply With Quote

Old   January 15, 2008, 19:20
Default Adam, Still haven't had a
  #4
New Member
 
C.E.M.
Join Date: Mar 2009
Posts: 16
Rep Power: 17
evan is on a distinguished road
Adam,

Still haven't had a chance to work too much on this, but thought I'd pass along a neat opensource C code that might come in handy:

http://gururajan.mp.googlepages.com/phase-field

thanks to Mogadalai Pandurangan Gururajan.

Evan
Annier likes this.
evan is offline   Reply With Quote

Old   July 15, 2009, 07:39
Default
  #5
bhh
Member
 
Bjorn H. Hjertager
Join Date: Mar 2009
Posts: 72
Rep Power: 17
bhh is on a distinguished road
Hi,

Has anybody got a OF solver for the Cahn-Hilliard equation?

regards
Bjorn
bhh is offline   Reply With Quote

Old   December 7, 2009, 10:41
Default Phase-Field solver built?
  #6
Senior Member
 
Claus Meister
Join Date: Aug 2009
Location: Wiesbaden, Germany
Posts: 241
Rep Power: 17
idrama is on a distinguished road
Hello adona058!

I have just read you post which was posted in March, well, a half year ago. I just want to inform myself if you had any succeed to build a phase field solver for openfoam?

cheers,

Claus
idrama is offline   Reply With Quote

Old   February 16, 2011, 12:26
Default
  #7
Member
 
Duong A. Hoang
Join Date: Apr 2009
Location: Delft, Netherlands
Posts: 93
Rep Power: 17
duongquaphim is on a distinguished road
Send a message via Yahoo to duongquaphim
Hi all,

I am also considering Phase-filed method for my case. I just wonder if anyone is successful in implementing that method in OF?

Cheers,

Duong
duongquaphim is offline   Reply With Quote

Old   August 7, 2012, 04:38
Default
  #8
New Member
 
Xuan Cai
Join Date: Mar 2011
Location: Karlsruhe, Germany
Posts: 9
Rep Power: 15
cfd_explorer is on a distinguished road
I am also very interested on whether anyone has already implemented that in openfoam?
cfd_explorer is offline   Reply With Quote

Old   January 23, 2013, 10:56
Default
  #9
Member
 
Join Date: Aug 2012
Posts: 33
Rep Power: 13
gigilentini8 is on a distinguished road
no news about a phase-field formulation in OF?
gigilentini8 is offline   Reply With Quote

Old   July 24, 2014, 15:53
Default
  #10
Member
 
Sebastian W.
Join Date: Nov 2012
Location: Saxony, Germany
Posts: 43
Rep Power: 13
nero235 is on a distinguished road
Send a message via ICQ to nero235
Hi,

I am pretty far on implementing the Cahn-Hilliard model into the two-phase solver interFoam. The new solver compiles and it also runs. However I have to fix some problem with the alpha limiter. The problem is the 4th order diffusion term most certainly. When this is fixed I am going to validate the solver and share it with the public. If you guys are still interested just let me know.

Regards, Sebastian.
Annier, winsway and Sulis like this.
nero235 is offline   Reply With Quote

Old   August 3, 2014, 13:59
Default
  #11
Member
 
Hrushi
Join Date: Jan 2013
Posts: 58
Rep Power: 13
hrushi.397 is on a distinguished road
Hi Sebastian,

How far are you in two phase solver? I am working on same but do not know how to implement 4th order derivative. Could you please share some details?

Regards,

Hrushi
Annier likes this.
hrushi.397 is offline   Reply With Quote

Old   August 4, 2014, 03:02
Default
  #12
Member
 
Sebastian W.
Join Date: Nov 2012
Location: Saxony, Germany
Posts: 43
Rep Power: 13
nero235 is on a distinguished road
Send a message via ICQ to nero235
Quote:
Originally Posted by hrushi.397 View Post
Hi Sebastian,

How far are you in two phase solver? I am working on same but do not know how to implement 4th order derivative. Could you please share some details?

Regards,

Hrushi
Hey Hrushi,

I've got the same problem. Leaving this 4th order diffusion term out of the equation works and the results seem realistic. However I want to implement the whole equation so I am still working on it. I've build my solver upon the interFoam code and I used the equation from fipy documentaion:

http://www.ctcms.nist.gov/fipy/examp...2DCoupled.html

I introduced a second equation for Psi for the diffusion term in the alpha1 equation which is solved at first. However the 4th order diffusion term gives me weird alphas maybe because of the explicit calculation of Psi. I am pretty much stuck at this point. I can upload the solver if you're interested.

Which equations are you using and how far are you?

Regards, Sebastian.
Annier likes this.
nero235 is offline   Reply With Quote

Old   August 4, 2014, 07:41
Default
  #13
Member
 
Hrushi
Join Date: Jan 2013
Posts: 58
Rep Power: 13
hrushi.397 is on a distinguished road
Do you get non physical values of alpha1? Because that is where I am stuck too. I am solving the diffusion equation and not the Navier-Stokes couple.

BTW, the Psi term does not look physical with second order derivative of free energy. Is there a documentation for this term?

Regards, Hrushi
Annier likes this.
hrushi.397 is offline   Reply With Quote

Old   August 4, 2014, 07:55
Default
  #14
Member
 
Sebastian W.
Join Date: Nov 2012
Location: Saxony, Germany
Posts: 43
Rep Power: 13
nero235 is on a distinguished road
Send a message via ICQ to nero235
Quote:
Originally Posted by hrushi.397 View Post
Do you get non physical values of alpha1? Because that is where I am stuck too. I am solving the diffusion equation and not the Navier-Stokes couple.

BTW, the Psi term does not look physical with second order derivative of free energy. Is there a documentation for this term?

Regards, Hrushi
After initializing with a maximum alpha1 of 0.55 it decreases to 0.5 during the first time steps, which is unrealistic but not unphysical. Maybe its just the diagonal solver of the explicit term, idk. I also didn't modify the equation for momentum conservation. Do you know if its necessary to add (mu*nabla alpha)?

I think the second order derivative of the free energy is correct because you have to write f'(phi) in canonical form. Thats how you end up with the equation for Psi. Also this equation works in my code without the energy gradient term.

Regards, Sebastian.
Annier likes this.
nero235 is offline   Reply With Quote

Old   December 20, 2014, 06:38
Default
  #15
Member
 
Anil Kunwar
Join Date: Jun 2013
Posts: 64
Rep Power: 11
Annier is an unknown quantity at this point
Hi Sebastian,
I am interested in Phase Field Modeling in OpenFOAM. Can you upload your solver so that we can learn from it?
I am a beginner and what i have learnt upto now is:
-interFoam is based on VOF whereas the phase field modeling needs to be created by replacing that VOF technique with Cahn-Hilliard equation.
Thanking you in advance.

Yours
Anil Kunwar

Last edited by Annier; December 22, 2014 at 03:58.
Annier is offline   Reply With Quote

Old   December 22, 2014, 08:11
Default
  #16
Member
 
Sebastian W.
Join Date: Nov 2012
Location: Saxony, Germany
Posts: 43
Rep Power: 13
nero235 is on a distinguished road
Send a message via ICQ to nero235
Quote:
Originally Posted by Annier View Post
Hi Sebastian,
I am interested in Phase Field Modeling in OpenFOAM. Can you upload your solver so that we can learn from it?
I am a beginner and what i have learnt upto now is:
-interFoam is based on VOF whereas the phase field modeling needs to be created by replacing that VOF technique with Cahn-Hilliard equation.
Thanking you in advance.

Yours
Anil Kunwar

Hello Anil,

the VOF or EULER methods have a different background. These methods differ in the treatment of the whole multiphase system. The VOF method uses an additional equation (alpha = phase fraction) apart from 1 set of navier stokes equations for all phases to distinguish between multiple phases whereas the EULER method uses 3N navier stokes equations for N phases. However neither can be used to simulate phase separation because the diffusion mechanisms in the navier stokes and alpha eqn are missing.

The Cahn Hilliard model doesn't replace the alpha eqn of the VOF model. It just adds a diffusion term to the alpha eqn and replaces the CSF (continuum surface force) model in the navier stokes eqn, since diffusion is a primary transport mechanism during the phase separation.

Are you familiar with OF programming? I am asking because I am not done with that solver. I would like to release a version which works

Kind regards, Sebastian
Annier likes this.

Last edited by nero235; December 22, 2014 at 09:37. Reason: forgot a 3
nero235 is offline   Reply With Quote

Old   December 22, 2014, 09:18
Default
  #17
Member
 
Anil Kunwar
Join Date: Jun 2013
Posts: 64
Rep Power: 11
Annier is an unknown quantity at this point
Hi Sebastian,
Quote:
Originally Posted by nero235 View Post
The Cahn Hilliard model doesn't replace the alpha eqn of the VOF model. It just adds a diffusion term to the alpha eqn and replaces the CSF (continuum surface force) model in the navier stokes eqn, since diffusion is a primary transport mechanism during the phase separation.
Thank you for making me understand about the phase-field implementation.

I can read OpenFOAM codes and understand the things; that is i can do part of a big code. Also, i have used FiPy in my simulation works. I can understand the Cahn-Hilliard equation solved in FiPy way.
The only thing that i am not ready with OpenFOAM programming is I have not built a complete code with myself alone. If you need my input, I am ready to work with you as per your suggestions and assist you for the completion of your work.

You can write to me at :
anilkunwar318@yahoo.com

Yours
Anil Kunwar
Annier is offline   Reply With Quote

Old   December 23, 2014, 10:12
Default
  #18
Member
 
Join Date: Aug 2012
Posts: 33
Rep Power: 13
gigilentini8 is on a distinguished road
Just to avoid confusion:

- why are we talking about Eulerian multiphase models here (meaning by this, models that are based on some sort of volume/ensemble averaging)? I think they have nothing to do with diffuse interphase models

- I think C-H eq DO replace the alpha eqn of the VOF even if it is based on a totally different formalism and theory. Especially if the diffuse interphase model is used only as a interphase tracking scheme, without caring about the thermodynamical interpretation and phase separation, I don't see any problem with that (but I also don't see any major advantages in this case). However in the C-H/N-S system, also the N-S equations should be modified accordingly with a new stress term

in principle however it's not wrong the idea of modifying the alpha eqn, but, as it is written in this post somewhere before, I think the main problem will be the fourth order derivative appearing in the equation

Quote:
Originally Posted by nero235 View Post
Hello Anil,

the VOF or EULER methods have a different background. These methods differ in the treatment of the whole multiphase system. The VOF method uses an additional equation (alpha = phase fraction) apart from 1 set of navier stokes equations for all phases to distinguish between multiple phases whereas the EULER method uses 3N navier stokes equations for N phases. However neither can be used to simulate phase separation because the diffusion mechanisms in the navier stokes and alpha eqn are missing.

The Cahn Hilliard model doesn't replace the alpha eqn of the VOF model. It just adds a diffusion term to the alpha eqn and replaces the CSF (continuum surface force) model in the navier stokes eqn, since diffusion is a primary transport mechanism during the phase separation.

Are you familiar with OF programming? I am asking because I am not done with that solver. I would like to release a version which works

Kind regards, Sebastian
gigilentini8 is offline   Reply With Quote

Old   December 23, 2014, 10:33
Default
  #19
Member
 
Anil Kunwar
Join Date: Jun 2013
Posts: 64
Rep Power: 11
Annier is an unknown quantity at this point
Hi gigilentini8,
If i have to simulate a heterogeneous system, bubble in liquid tin : can i use this C-H equation to develop an OpenFOAM solver for both purposes:
-diffuse interface modeling
-thermodynamic evaluation

Actually, i like to simulate how the bubbles merge in stagnant liquid? Have you written any openFOAM codes regarding phase field models?

Yours
Anil Kunwar
Annier is offline   Reply With Quote

Old   December 23, 2014, 10:39
Default
  #20
Member
 
Sebastian W.
Join Date: Nov 2012
Location: Saxony, Germany
Posts: 43
Rep Power: 13
nero235 is on a distinguished road
Send a message via ICQ to nero235
Anil,

you don't need the C-H model for your purpose. The normal VOF model can simulate the agglomeration of the bubbles also.

Regards
nero235 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
problem in Phase Field method qunwuhe@hotmail.com Main CFD Forum 6 February 16, 2011 12:20
phase field or Cahn-Hilliard method dusky.he Main CFD Forum 3 February 2, 2006 16:43
about phase-field or second gradient theory Dusky.He Main CFD Forum 9 December 17, 2005 00:42
Differences between VOF and phase field 2L Main CFD Forum 2 July 4, 2004 13:30
simulating a two-phase flow with an external field Yi Main CFD Forum 7 August 9, 2000 11:12


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