|
[Sponsors] | |||||
|
|
|
#1 |
|
New Member
Tom Chin
Join Date: Jul 2012
Posts: 2
Rep Power: 0 ![]() |
Hello, everyone!
I have a quick question, how to specify nonlinear terms in the solver? For example, I want to solve the KPP equation which reads U_t = D*(U_{xx} + U_{yy}) + gamma * U * (1 - U) (an example in matlab is: http://www.mathworks.com/matlabcentr...tent/pattern.m) In what way should I express the nonlinear term u*(1-u) in the solver, I tried to do this based on the laplacianFoam.C in several ways, but none seemed to work. I was once told openFOAM can only handle linear forms... Any help would be really appreciated! |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Posts: 1,139
Rep Power: 19 ![]() |
Hi Tom,
It is true that OpenFoam solves the linearised equation, so you have to linearise the equation, e.g. u^(n+1) * (1 - u^n), which makes it possible to formulate a linear set of equations in u^(n+1). Specifically, merely add the [CODE] fvm::Sp( gamma * U, U) // Only the source term! [CODE] in your equation, which then automatically makes it into the linearised form. My feel is that you will gain a lot more stability compared to the Matlab script, which seems to be explicit. BTW: Thanks for the link, it really do create some beautiful patterns and sometimes transient and psychedelic Kind regards, Niels |
|
|
|
|
|
|
|
|
#3 | |
|
New Member
Tom Chin
Join Date: Jul 2012
Posts: 2
Rep Power: 0 ![]() |
Quote:
solve(fvm::ddt(T) - fvm::laplacian(DT, T) - fvm::Sp(gamma * (1-T), T)); the result doesn't appear right compared with the matlab script in the link: the T become T = 1 throughout the domain (except the boundary which is actually irrelevant) in my result. I don't think openfoam will automatically consider gamma*(1-T) or T as from the previous time step. Were you suggesting I use both T^(n+1) and T^(n) in the equation, then how should I write it? I know there is something like T.oldTime(), should that be used? |
||
|
|
|
||
|
|
|
#4 |
|
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Posts: 1,139
Rep Power: 19 ![]() |
Hi
First of all, if you consider carefully the matlab script, then you will find that the boundary values are neglected in the computation of gradients, etc, which you cannot avoid in OpenFoam besides using either zeroGradient (but still considered) or using periodic domains (cyclic). With respect to the equation you are solving the form: Code:
fvm::ddt(T) - fvm::laplacian(DT, T) - fvm::Sp(gamma * (1 - T), T) Code:
gamma^n * (1 - T^n) * T^(n+1) I hope this clarified things a bit. / Niels |
|
|
|
|
|
![]() |
| Tags |
| nonlinear |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| GPU Linear Solvers for OpenFOAM | gocarts | OpenFOAM Announcements from Other Sources | 35 | March 1, 2012 20:41 |
| UDF source term | jerome_ | FLUENT | 2 | July 11, 2011 11:55 |
| How to write source term into scalar Fiel | JimKnopf | OpenFOAM Programming & Development | 0 | March 23, 2011 06:59 |
| Problem of SOURCE term gradient in UDS | wind | Fluent UDF and Scheme Programming | 4 | March 11, 2010 07:50 |
| UDFs for Scalar Eqn - Fluid/Solid HT | Greg Perkins | FLUENT | 0 | October 11, 2000 03:43 |