
[Sponsors] 
July 23, 2012, 23:24 
Nonlinear source term like u*(1u)?

#1 
New Member
Chenguang Zhang
Join Date: Jul 2012
Location: Baton Rouge Louisiana
Posts: 10
Rep Power: 4 
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*(1u) 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! 

July 24, 2012, 03:52 

#2 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,592
Rep Power: 24 
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 

July 25, 2012, 22:09 

#3  
New Member
Chenguang Zhang
Join Date: Jul 2012
Location: Baton Rouge Louisiana
Posts: 10
Rep Power: 4 
Quote:
solve(fvm::ddt(T)  fvm::laplacian(DT, T)  fvm::Sp(gamma * (1T), 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*(1T) 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? 

July 26, 2012, 03:48 

#4 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,592
Rep Power: 24 
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 
Problem of SOURCE term gradient in UDS  wind  Fluent UDF and Scheme Programming  5  June 21, 2013 05:39 
GPU Linear Solvers for OpenFOAM  gocarts  OpenFOAM Announcements from Other Sources  35  March 1, 2012 21: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 
UDFs for Scalar Eqn  Fluid/Solid HT  Greg Perkins  FLUENT  0  October 11, 2000 03:43 