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

Non-linear 4rth order Diffusion

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 2 Post By physicosm
  • 1 Post By physicosm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 21, 2019, 09:34
Default Non-linear 4rth order Diffusion
  #1
New Member
 
Thomas N.
Join Date: Nov 2018
Posts: 11
Rep Power: 7
physicosm is on a distinguished road
Dear OpenFoamers,Foamers and HopeFoamers,


I am struggling lately with the problem of how to solve a non linear 4rth order diffusion equation(see below). Of course, it can be solved full explicitly but on this way someone has to use small time-steps. One idea is to split this equation into two 2nd order equations by defining the brackets as the chemical potential. When someone does this, it will come up with the problem of OpenFOAM and general most of the softwares/toolkits can't solve equations for two variables simultaneously. With OpenFOAM words: FATAL ERROR incompatible fields. Nevertheless, I have attached a picture that I was thinking on this way maybe I could solve my problem but it doesn't work. The idea was to calculate first explicit the chemical potential in order to find the correct values of C and then, to calculate implicity the chemical potential with the new correct values of C that have been calculated in the previous step. After this, you solve the diffusion equation. This idea doesn't work. Therefore, I would like to ask if someone has any idea of how to deal with this problem. Last, of course the ideal case would be to define an implicity laplacian^2 with an implicit scheme but I guess this over my programming skills. Thanks in advance!


Thomas


Attached Images
File Type: png bam.png (53.5 KB, 41 views)
akabat and Krapf like this.
physicosm is offline   Reply With Quote

Old   February 22, 2019, 07:01
Default
  #2
Senior Member
 
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 13
massive_turbulence is on a distinguished road
Quote:
Originally Posted by physicosm View Post
Dear OpenFoamers,Foamers and HopeFoamers,


" can't solve equations for two variables simultaneously. With OpenFOAM words: FATAL ERROR incompatible fields. "

I'd love to help you with this Thomas but this is a daunting problem, something on the level of a thesis. The best I can do is this link.

Incompatible fields for operation

Is there some way to end up with just one variable and one matrix? What are the variables by the way in your equation?
massive_turbulence is offline   Reply With Quote

Old   February 22, 2019, 07:26
Default
  #3
New Member
 
Thomas N.
Join Date: Nov 2018
Posts: 11
Rep Power: 7
physicosm is on a distinguished road
Quote:
Originally Posted by massive_turbulence View Post
I'd love to help you with this Thomas but this is a daunting problem, something on the level of a thesis. The best I can do is this link.

Incompatible fields for operation

Is there some way to end up with just one variable and one matrix? What are the variables by the way in your equation?

Dear Andrew,


first of all, thanks for your answer and you are right this one kind of thesis range problem. Regarding to the link that you have attached: I have seen it and in this case, it used chain rule and you treat the half of the term explicitly. In my case, when someone introduces different methods to solve the Cahn-Hilliard in order to increase the time-step, it turns out that someone has to treat the laplacian^2 term implicitly. Therefore, the idea of splitting the 4rth order equation into two 2nd order equations holds and you can define implicitly the laplacians. By the way, this is a common approach in all of the phase field softwares (FiPy, Moose, PRISMS PF, ... ). However, OpenFOAM can't solve for two variables in the same time.

Regarding to your second question, the two variables are the order parameter C and the chemical potential chemPot in the code respectively. So, there boundary conditions for each field separately.


Thomas
physicosm is offline   Reply With Quote

Old   February 22, 2019, 16:10
Default
  #4
Senior Member
 
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 13
massive_turbulence is on a distinguished road
Quote:
Originally Posted by physicosm View Post
Dear Andrew,


first of all, thanks for your answer and you are right this one kind of thesis range problem. Regarding to the link that you have attached: I have seen it and in this case, it used chain rule and you treat the half of the term explicitly. In my case, when someone introduces different methods to solve the Cahn-Hilliard in order to increase the time-step, it turns out that someone has to treat the laplacian^2 term implicitly. Therefore, the idea of splitting the 4rth order equation into two 2nd order equations holds and you can define implicitly the laplacians. By the way, this is a common approach in all of the phase field softwares (FiPy, Moose, PRISMS PF, ... ). However, OpenFOAM can't solve for two variables in the same time.

Regarding to your second question, the two variables are the order parameter C and the chemical potential chemPot in the code respectively. So, there boundary conditions for each field separately.


Thomas
One of the things I've noticed about semi-implicit methods in openfoam is that there are some calculations with matrices such as the velocity matrix

volScalarField rUA = 1.0/UEqn().A();

in order to use it for the pressure equation e.g.
Code:
 fvScalarMatrix pEqn
 (
    fvm::laplacian(rUA, p) == fvc::div(phi)
 );
 pEqn.setReference(pRefCell, pRefValue);
 pEqn.solve();
Wouldn't your code need something like this similarly (not in terms of the actual variables but in terms of the methodology), if not why not? I know that this sounds like a hack but I'm very new to PISO and SIMPLE.
massive_turbulence is offline   Reply With Quote

Old   February 25, 2019, 10:11
Default
  #5
New Member
 
Thomas N.
Join Date: Nov 2018
Posts: 11
Rep Power: 7
physicosm is on a distinguished road
Dear Andrew,


Unfortunately, it can't. For more details regarding to the PISO loop I am encouraging you to check the wonderful summary of interFoam solver. Download the pdf file from the section 1.2 Useful links.



https://openfoamwiki.net/index.php/InterFoam




Thomas
physicosm is offline   Reply With Quote

Old   February 25, 2019, 17:14
Default
  #6
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,278
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by physicosm View Post
Dear Andrew,


Unfortunately, it can't. For more details regarding to the PISO loop I am encouraging you to check the wonderful summary of interFoam solver. Download the pdf file from the section 1.2 Useful links.


https://openfoamwiki.net/index.php/InterFoam


Thomas

I think if you are open to using other solvers then you can (possibly) do with Wildkatze solver using user coding where you supply the descretization and solver solves the linear system for you (also does other tasks like creating variables, and providing them for post processing etc).
arjun is offline   Reply With Quote

Old   March 1, 2019, 10:49
Default Progress...
  #7
New Member
 
Thomas N.
Join Date: Nov 2018
Posts: 11
Rep Power: 7
physicosm is on a distinguished road
If anyone is still interested on the above issue, there was a little bit of progress. What is more, I am treating the 4th order non linear Cahn-Hilliard equation by splitting into two 2nd order equations. So, the equations are coupled and on this way have to be solved both of them for every time step. The solution to this, it can be given by using the block coupled matrix of foam-extend 4.0. Moreover, I have found on an OpenFOAM workshop 2015 that Holger Marschall is doing this in order to solve the system of coupled equations (He said that it will be released in foam-extend but I haven't found something). Unfortunately, I couldn't find more details of how he is doing it and so, I decided to try to implement it on my own. Therefore, I have attached 2 files, one for the details of the Cahn-Hilliard equation and one of how this implementation could be done. Unfortunately, the way that I have implemented the solver, it doesn't work. It would be nice if you have any ideas or if you know a different way to handle these equations.


Thomas
Attached Images
File Type: png scheme.png (63.6 KB, 41 views)
Attached Files
File Type: pdf scheme.pdf (51.6 KB, 27 views)
azad_786 likes this.
physicosm is offline   Reply With Quote

Old   August 10, 2020, 05:40
Default Non-linear 4rth order Diffusion
  #8
New Member
 
Azad
Join Date: Nov 2019
Posts: 6
Rep Power: 6
azad_786 is on a distinguished road
Hello Foamers,
Have you been able to solve the 4th order Diffusion equation using OpenFOAM.
Please help me with the same.
Thanks
azad_786 is offline   Reply With Quote

Reply

Tags
c++, cahn hilliard, diffusion, non linear, openfoam

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
First Order to Higher Order Blending Factor NormalVector FLUENT 4 November 13, 2023 07:06
Oscillating behaviour when mesh gets too small james91 OpenFOAM Running, Solving & CFD 0 January 9, 2014 05:04
Problems solving T Equation in separated flow using a second Order Closure Model pascool OpenFOAM Programming & Development 1 November 19, 2012 10:29
2nd order boundary conditions for 2nd order discretization? quarkz Main CFD Forum 30 December 26, 2011 07:12
Numerical diffusion error Z.Zeng Main CFD Forum 8 October 22, 1999 09:06


All times are GMT -4. The time now is 14:47.