
[Sponsors] 
June 17, 2015, 23:23 
laplacianFoam with source term

#1 
New Member
Join Date: May 2012
Posts: 4
Rep Power: 14 
Hi, I would need a laplacian solver with heat sink/source  which exisiting OpenFOAM solver can be used  rsp. how to implement into the existing Laplacian solver a heat sink/source  thanks!!


June 18, 2015, 09:03 
Hi Herwig

#2 
Member
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 13 
You can use laplacianFoam to solve laplacian equation.
fvm::ddt(T)  fvm::laplacian(DT, T)  sourceterm sourceterm should be defined in createFields. 

June 18, 2015, 14:31 

#3 
New Member
Join Date: May 2012
Posts: 4
Rep Power: 14 
Many thanks! Only one final question: My source term is temperature dependent  i.e. source term is a function of the solution (temperature).


June 19, 2015, 00:31 

#4 
Member
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 13 
If you want to write source term in implicit form you can use fvm::Sp(phi,T) and for explicit you can use fvc::Sp(phi,T). You can find this in programmers guide page no 33.


June 19, 2015, 02:02 

#5 
New Member
Join Date: May 2012
Posts: 4
Rep Power: 14 
Again thanks  unfortunately I'm pretty new to OpenFOAM (but not C++)  therefore hopefully my last request:
The source term is exponentially nonlinear, therfore I assume to have to linearize it  what's here the most efficient way to implement this linearization of a nonlinear source term in an OpenFOAM solver! 

June 19, 2015, 02:10 

#6 
Member
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 13 
Can you post the source term after linearization.


June 19, 2015, 03:10 

#7 
New Member
Join Date: May 2012
Posts: 4
Rep Power: 14 
Hi, I think I have found the solution  a similar question was discussed and solved on Jan. 9th 2015 by Sun in forum: OpenFOAM Programming & Development  titled "goodoldsourcetermnewtransportequation".
All thanks. Last edited by Herwig; June 20, 2015 at 01:50. 

November 12, 2019, 09:14 

#8 
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 6 
Hi Herwig,
I met a similar question to yours. Could you tell me how you deal with the exponential term in your transport equation? Thanks 

November 12, 2019, 16:16 

#9  
New Member
Nathan Neeteson
Join Date: May 2016
Posts: 5
Rep Power: 10 
Quote:
You can linearize a nonlinear source term using a Taylor series expansion: https://www.cfdonline.com/Wiki/Sour..._linearization Just split the source term apart into an implicit and explicit part then you can implement in OF as: fvm::ddt(T)  fvm::laplacian(DT, T)  fvm::Sp(implicitPart,T)  explicitPart Where implicitPart and explicitPart will be functions of your other fields, calculated between iterations. You will have to do the algebra and calculus of calculating the implicit and explicit components of your source term though, following the steps they use in the link above. You might also not even want to bother with linearizing and computing the implicit component. To my knowledge you only want to bother with doing this if the implicit component is going to be contributing to the diagonal dominance of the system (and thus increasing stability). If they would decrease the diagonal dominance you would be better of leaving it fully explicit. 

November 13, 2019, 10:29 

#10  
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 6 
Quote:
Here attached my code. No error but the results do not converge. I don't know what is wrong. (PS: fH is the passive scalar field to be solved and others are all constants) fHEqn.H Quote:


November 13, 2019, 11:56 

#11  
New Member
Nathan Neeteson
Join Date: May 2016
Posts: 5
Rep Power: 10 
Quote:
When it comes to linearizing very nonlinear source terms I have two troubleshooting lines I like to approach first, though. 1. You might have ruined your system's diagonal dominance. Try not linearizing it and treating it fully explicitly and see if that improves performance. 2. Your relaxation parameters might be too large. Try reducing them (by a lot) and see if the problem persists. In my experience when you have a large contribution from a nonlinear source term you are going to take a stability hit no matter if you do it properly, and sometimes the only answer is a very low relaxation parameter (and unfortunately a correspondingly longer solve time). 

November 13, 2019, 19:57 

#12 
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 6 
I attach the terminal here. Thanks again for your patience.
Code:
Create time Create mesh for time = 0 SIMPLE: Convergence criteria found T: tolerance 0.01 fe: tolerance 0.001 fH: tolerance 0.001 Reading field T Reading field fe and fH Reading transportProperties Reading diffusivity sigma_e Reading diffusivity sigma_H Reading i0_ORR Reading b_ORR Reading diffusivity DT No finite volume options present Calculating temperature distribution Time = 0.1 DICPCG: Solving for T, Initial residual = 1, Final residual = 2.73819e16, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1, Final residual = 4.3179e15, No Iterations 1 GAMG: Solving for fH, Initial residual = 1, Final residual = 2.86228e16, No Iterations 3 ExecutionTime = 0.02 s ClockTime = 0 s Time = 0.2 DICPCG: Solving for T, Initial residual = 0.0490254, Final residual = 6.96212e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.172278, Final residual = 5.53285e18, No Iterations 3 ExecutionTime = 0.02 s ClockTime = 0 s Time = 0.3 DICPCG: Solving for T, Initial residual = 0.0245904, Final residual = 9.52287e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.999881, Final residual = 3.71098e16, No Iterations 3 ExecutionTime = 0.02 s ClockTime = 0 s Time = 0.4 DICPCG: Solving for T, Initial residual = 0.0185054, Final residual = 6.70175e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.169595, Final residual = 6.49193e18, No Iterations 3 ExecutionTime = 0.02 s ClockTime = 0 s Time = 0.5 DICPCG: Solving for T, Initial residual = 0.0156083, Final residual = 5.44869e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.81591e16, No Iterations 3 ExecutionTime = 0.03 s ClockTime = 0 s Time = 0.6 DICPCG: Solving for T, Initial residual = 0.013873, Final residual = 4.96861e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.169414, Final residual = 7.46474e18, No Iterations 3 ExecutionTime = 0.03 s ClockTime = 0 s Time = 0.7 DICPCG: Solving for T, Initial residual = 0.0127085, Final residual = 4.48262e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.9506e16, No Iterations 3 ExecutionTime = 0.03 s ClockTime = 0 s Time = 0.8 DICPCG: Solving for T, Initial residual = 0.011873, Final residual = 4.67445e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.169401, Final residual = 5.87521e18, No Iterations 3 ExecutionTime = 0.03 s ClockTime = 0 s Time = 0.9 DICPCG: Solving for T, Initial residual = 0.0112473, Final residual = 5.02791e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.62415e16, No Iterations 3 ExecutionTime = 0.03 s ClockTime = 0 s Time = 1 DICPCG: Solving for T, Initial residual = 0.0107639, Final residual = 3.42222e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.69655e18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.1 DICPCG: Solving for T, Initial residual = 0.0103833, Final residual = 4.70209e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.69406e16, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.2 DICPCG: Solving for T, Initial residual = 0.0100792, Final residual = 3.49728e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 5.05491e18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.3 DICPCG: Solving for T, Initial residual = 0.00983153, Final residual = 3.40826e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.27136e16, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.4 DICPCG: Solving for T, Initial residual = 0.00962984, Final residual = 2.61469e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.40106e18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.5 DICPCG: Solving for T, Initial residual = 0.00946446, Final residual = 3.84095e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.39964e16, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.6 DICPCG: Solving for T, Initial residual = 0.00932815, Final residual = 3.08647e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 7.49853e18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.7 DICPCG: Solving for T, Initial residual = 0.00921476, Final residual = 2.86801e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.36757e16, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.8 DICPCG: Solving for T, Initial residual = 0.00912052, Final residual = 2.87526e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 7.136e18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.9 DICPCG: Solving for T, Initial residual = 0.00904175, Final residual = 3.06217e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.04685e16, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 2 DICPCG: Solving for T, Initial residual = 0.0089761, Final residual = 2.99441e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.47845e18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 2.1 DICPCG: Solving for T, Initial residual = 0.00892131, Final residual = 3.6829e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.85442e16, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 2.2 DICPCG: Solving for T, Initial residual = 0.00887553, Final residual = 3.08283e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.35172e18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 2.3 DICPCG: Solving for T, Initial residual = 0.00883725, Final residual = 3.06674e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.59208e16, No Iterations 3 ExecutionTime = 0.05 s ClockTime = 0 s Time = 2.4 DICPCG: Solving for T, Initial residual = 0.00880523, Final residual = 3.3475e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 5.90286e18, No Iterations 3 ExecutionTime = 0.05 s ClockTime = 0 s Time = 2.5 DICPCG: Solving for T, Initial residual = 0.00877842, Final residual = 2.72073e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.69406e16, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 2.6 DICPCG: Solving for T, Initial residual = 0.00875596, Final residual = 2.42656e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.31318e18, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 2.7 DICPCG: Solving for T, Initial residual = 0.00873716, Final residual = 3.6027e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.111e16, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 2.8 DICPCG: Solving for T, Initial residual = 0.0087214, Final residual = 3.17568e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.60425e18, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 2.9 DICPCG: Solving for T, Initial residual = 0.00870819, Final residual = 3.3563e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.17514e16, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3 DICPCG: Solving for T, Initial residual = 0.00869712, Final residual = 2.86403e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 4.66778e18, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.1 DICPCG: Solving for T, Initial residual = 0.00868784, Final residual = 2.87368e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.39964e16, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.2 DICPCG: Solving for T, Initial residual = 0.00868007, Final residual = 3.87548e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 5.0556e18, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.3 DICPCG: Solving for T, Initial residual = 0.00867355, Final residual = 3.06677e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.78451e16, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.4 DICPCG: Solving for T, Initial residual = 0.00866808, Final residual = 3.25277e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 7.28601e18, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.5 DICPCG: Solving for T, Initial residual = 0.0086635, Final residual = 3.34311e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.95064e16, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.6 DICPCG: Solving for T, Initial residual = 0.00865965, Final residual = 3.16634e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.68364e18, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.7 DICPCG: Solving for T, Initial residual = 0.00865643, Final residual = 3.6563e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.52793e16, No Iterations 3 ExecutionTime = 0.07 s ClockTime = 0 s Time = 3.8 DICPCG: Solving for T, Initial residual = 0.00865373, Final residual = 2.85281e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.62523e18, No Iterations 3 ExecutionTime = 0.07 s ClockTime = 0 s Time = 3.9 DICPCG: Solving for T, Initial residual = 0.00865146, Final residual = 3.33705e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.65622e16, No Iterations 3 ExecutionTime = 0.07 s ClockTime = 0 s Time = 4 DICPCG: Solving for T, Initial residual = 0.00864956, Final residual = 3.03165e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 7.18896e18, No Iterations 3 ExecutionTime = 0.07 s ClockTime = 0 s Time = 4.1 DICPCG: Solving for T, Initial residual = 0.00864797, Final residual = 2.61805e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.98271e16, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.2 DICPCG: Solving for T, Initial residual = 0.00864663, Final residual = 2.55266e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.31699e18, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.3 DICPCG: Solving for T, Initial residual = 0.00864551, Final residual = 3.41296e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.66199e16, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.4 DICPCG: Solving for T, Initial residual = 0.00864457, Final residual = 3.38449e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 7.11275e18, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.5 DICPCG: Solving for T, Initial residual = 0.00864378, Final residual = 4.19861e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.49586e16, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.6 DICPCG: Solving for T, Initial residual = 0.00864312, Final residual = 2.7839e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.06066e18, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.7 DICPCG: Solving for T, Initial residual = 0.00864257, Final residual = 2.48456e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.88073e16, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.8 DICPCG: Solving for T, Initial residual = 0.0086421, Final residual = 2.88026e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.69475e18, No Iterations 3 ExecutionTime = 0.09 s ClockTime = 0 s Time = 4.9 DICPCG: Solving for T, Initial residual = 0.00864171, Final residual = 3.28074e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.98271e16, No Iterations 3 ExecutionTime = 0.09 s ClockTime = 0 s Time = 5 DICPCG: Solving for T, Initial residual = 0.00864139, Final residual = 3.60354e17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e10, Final residual = 1.25886e10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.94457e18, No Iterations 3 ExecutionTime = 0.09 s ClockTime = 0 s .......... 

November 14, 2019, 09:10 

#13  
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 6 
Quote:
I changed my relaxation factor to 0.5 and it seemed to converge!!! Thanks so much for the tip. 

November 14, 2019, 11:30 

#14  
New Member
Nathan Neeteson
Join Date: May 2016
Posts: 5
Rep Power: 10 
Quote:
I don't have any experience with laplacianFoam, do you know what the relaxation parameters even do in that solver? From looking at your log file it seems like there is only one iteration per time step so where is the relaxation happening? If you use relaxation between time steps but only solve the equations once (as opposed to iteratively, until you converge on a proper result for the next time step) are you properly modelling the time evolution of the system? Or do you just care about the final state and are not interested in the evolution from initial conditions? For a system where you have a highly nonlinear source term and you care about the time evolution I would think you would either iteratively solve the equations, with relaxation and while updating the source term between iterations, at each time step, or not use relaxation and decrease the time step instead to improve stability. 

November 18, 2019, 07:56 

#15  
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 6 
Quote:
Thanks for the explanation. Sorry I was not checking the forum before. Yes, you are right, the log file I showed to you was not relaxing because I noted the relaxation code. Later I denoted the code and added 0.5, it seemed to work well. To answer your question: what I care about now is only the final state. Another question: do you have any idea about how to solve the coupled equations? My equations are actually like this: Quote:


November 18, 2019, 12:28 

#16  
New Member
Nathan Neeteson
Join Date: May 2016
Posts: 5
Rep Power: 10 
Quote:
You can solve the coupled equation system by just solving each of those equations one after another, updating the source terms between iterations, until convergence. Linearize the source term in each equation with respect to the field being solved for in each equation and treat the other field as "frozen" during the solve. So in equation 1 just pretend that Y is some constant field and in equation 2 pretend like X is some constant field. Take a look at simpleFoam or any of the more complicated, multiequation system solvers to see how they organize the code, for example when solving for velocities and pressures, or velocities, pressures, and temperatures. It should not be difficult to modify your existing code to do this, you just take what you did to solve the oneequation linearization problem and do it once each for X and Y. Let me know if you have further questions. 

November 19, 2019, 12:12 

#17  
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 6 
Quote:
Thank you for explaining. I looked up simpleFoam and found it quite hard to understand. What I learned: (not sure if it is right) simpleFoam predicts velocity U and solves pressure p (by freezing U), and then updates U with p: U = HbyA  rAtU()*fvc::grad(p); This is feasible because U can be expressed explicitly by p. The iteration converges when the updated U is equal to U solved from the momentum predictor. However, I suppose my case should be easier than simpleFoam since I have done the linearization of both equations. What should I do is implement a criterion for convergence, like: Quote:
Please let me know if I understand wrongly. Again, thank you for your patience. Lan 

November 19, 2019, 13:47 

#18  
New Member
Nathan Neeteson
Join Date: May 2016
Posts: 5
Rep Power: 10 
Quote:
I am pretty sure that: Code:
while (simple.loop(runTime)) { ... } 

Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Source Term due to evaporation in energy transport equation  styleworker  OpenFOAM Programming & Development  3  September 7, 2022 03:09 
GPU Linear Solvers for OpenFOAM  gocarts  OpenFOAM Announcements from Other Sources  37  August 17, 2022 14:22 
[swak4Foam] Swak4FOAM 0.2.3 / OF2.2.x installation error  FerdiFuchs  OpenFOAM Community Contributions  27  April 16, 2014 15:14 
[swak4Foam] build problem swak4Foam OF 2.2.0  mcathela  OpenFOAM Community Contributions  14  April 23, 2013 13:59 
UDFs for Scalar Eqn  Fluid/Solid HT  Greg Perkins  FLUENT  0  October 11, 2000 03:43 