|
[Sponsors] |
June 18, 2015, 00: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, 10: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, 15: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, 01: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, 03: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 non-linear, therfore I assume to have to linearize it - what's here the most efficient way to implement this linearization of a non-linear source term in an OpenFOAM solver! |
|
June 19, 2015, 03: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, 04: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 "good-old-source-term-new-transport-equation".
All thanks. Last edited by Herwig; June 20, 2015 at 02:50. |
|
November 12, 2019, 10:14 |
|
#8 |
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 7 |
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, 17:16 |
|
#9 | |
New Member
Nathan Neeteson
Join Date: May 2016
Posts: 5
Rep Power: 10 |
Quote:
You can linearize a non-linear source term using a Taylor series expansion: https://www.cfd-online.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, 11:29 |
|
#10 | ||
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 7 |
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, 12:56 |
|
#11 | |
New Member
Nathan Neeteson
Join Date: May 2016
Posts: 5
Rep Power: 10 |
Quote:
When it comes to linearizing very non-linear 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 non-linear 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, 20:57 |
|
#12 |
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 7 |
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.73819e-16, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1, Final residual = 4.3179e-15, No Iterations 1 GAMG: Solving for fH, Initial residual = 1, Final residual = 2.86228e-16, No Iterations 3 ExecutionTime = 0.02 s ClockTime = 0 s Time = 0.2 DICPCG: Solving for T, Initial residual = 0.0490254, Final residual = 6.96212e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.172278, Final residual = 5.53285e-18, No Iterations 3 ExecutionTime = 0.02 s ClockTime = 0 s Time = 0.3 DICPCG: Solving for T, Initial residual = 0.0245904, Final residual = 9.52287e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.999881, Final residual = 3.71098e-16, No Iterations 3 ExecutionTime = 0.02 s ClockTime = 0 s Time = 0.4 DICPCG: Solving for T, Initial residual = 0.0185054, Final residual = 6.70175e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.169595, Final residual = 6.49193e-18, No Iterations 3 ExecutionTime = 0.02 s ClockTime = 0 s Time = 0.5 DICPCG: Solving for T, Initial residual = 0.0156083, Final residual = 5.44869e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.81591e-16, No Iterations 3 ExecutionTime = 0.03 s ClockTime = 0 s Time = 0.6 DICPCG: Solving for T, Initial residual = 0.013873, Final residual = 4.96861e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.169414, Final residual = 7.46474e-18, No Iterations 3 ExecutionTime = 0.03 s ClockTime = 0 s Time = 0.7 DICPCG: Solving for T, Initial residual = 0.0127085, Final residual = 4.48262e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.9506e-16, No Iterations 3 ExecutionTime = 0.03 s ClockTime = 0 s Time = 0.8 DICPCG: Solving for T, Initial residual = 0.011873, Final residual = 4.67445e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.169401, Final residual = 5.87521e-18, No Iterations 3 ExecutionTime = 0.03 s ClockTime = 0 s Time = 0.9 DICPCG: Solving for T, Initial residual = 0.0112473, Final residual = 5.02791e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.62415e-16, No Iterations 3 ExecutionTime = 0.03 s ClockTime = 0 s Time = 1 DICPCG: Solving for T, Initial residual = 0.0107639, Final residual = 3.42222e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.69655e-18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.1 DICPCG: Solving for T, Initial residual = 0.0103833, Final residual = 4.70209e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.69406e-16, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.2 DICPCG: Solving for T, Initial residual = 0.0100792, Final residual = 3.49728e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 5.05491e-18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.3 DICPCG: Solving for T, Initial residual = 0.00983153, Final residual = 3.40826e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.27136e-16, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.4 DICPCG: Solving for T, Initial residual = 0.00962984, Final residual = 2.61469e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.40106e-18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.5 DICPCG: Solving for T, Initial residual = 0.00946446, Final residual = 3.84095e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.39964e-16, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.6 DICPCG: Solving for T, Initial residual = 0.00932815, Final residual = 3.08647e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 7.49853e-18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.7 DICPCG: Solving for T, Initial residual = 0.00921476, Final residual = 2.86801e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.36757e-16, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.8 DICPCG: Solving for T, Initial residual = 0.00912052, Final residual = 2.87526e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 7.136e-18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 1.9 DICPCG: Solving for T, Initial residual = 0.00904175, Final residual = 3.06217e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.04685e-16, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 2 DICPCG: Solving for T, Initial residual = 0.0089761, Final residual = 2.99441e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.47845e-18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 2.1 DICPCG: Solving for T, Initial residual = 0.00892131, Final residual = 3.6829e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.85442e-16, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 2.2 DICPCG: Solving for T, Initial residual = 0.00887553, Final residual = 3.08283e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.35172e-18, No Iterations 3 ExecutionTime = 0.04 s ClockTime = 0 s Time = 2.3 DICPCG: Solving for T, Initial residual = 0.00883725, Final residual = 3.06674e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.59208e-16, No Iterations 3 ExecutionTime = 0.05 s ClockTime = 0 s Time = 2.4 DICPCG: Solving for T, Initial residual = 0.00880523, Final residual = 3.3475e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 5.90286e-18, No Iterations 3 ExecutionTime = 0.05 s ClockTime = 0 s Time = 2.5 DICPCG: Solving for T, Initial residual = 0.00877842, Final residual = 2.72073e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.69406e-16, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 2.6 DICPCG: Solving for T, Initial residual = 0.00875596, Final residual = 2.42656e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.31318e-18, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 2.7 DICPCG: Solving for T, Initial residual = 0.00873716, Final residual = 3.6027e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.111e-16, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 2.8 DICPCG: Solving for T, Initial residual = 0.0087214, Final residual = 3.17568e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.60425e-18, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 2.9 DICPCG: Solving for T, Initial residual = 0.00870819, Final residual = 3.3563e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.17514e-16, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3 DICPCG: Solving for T, Initial residual = 0.00869712, Final residual = 2.86403e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 4.66778e-18, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.1 DICPCG: Solving for T, Initial residual = 0.00868784, Final residual = 2.87368e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.39964e-16, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.2 DICPCG: Solving for T, Initial residual = 0.00868007, Final residual = 3.87548e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 5.0556e-18, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.3 DICPCG: Solving for T, Initial residual = 0.00867355, Final residual = 3.06677e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.78451e-16, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.4 DICPCG: Solving for T, Initial residual = 0.00866808, Final residual = 3.25277e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 7.28601e-18, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.5 DICPCG: Solving for T, Initial residual = 0.0086635, Final residual = 3.34311e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.95064e-16, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.6 DICPCG: Solving for T, Initial residual = 0.00865965, Final residual = 3.16634e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.68364e-18, No Iterations 3 ExecutionTime = 0.06 s ClockTime = 0 s Time = 3.7 DICPCG: Solving for T, Initial residual = 0.00865643, Final residual = 3.6563e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.52793e-16, No Iterations 3 ExecutionTime = 0.07 s ClockTime = 0 s Time = 3.8 DICPCG: Solving for T, Initial residual = 0.00865373, Final residual = 2.85281e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.62523e-18, No Iterations 3 ExecutionTime = 0.07 s ClockTime = 0 s Time = 3.9 DICPCG: Solving for T, Initial residual = 0.00865146, Final residual = 3.33705e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.65622e-16, No Iterations 3 ExecutionTime = 0.07 s ClockTime = 0 s Time = 4 DICPCG: Solving for T, Initial residual = 0.00864956, Final residual = 3.03165e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 7.18896e-18, No Iterations 3 ExecutionTime = 0.07 s ClockTime = 0 s Time = 4.1 DICPCG: Solving for T, Initial residual = 0.00864797, Final residual = 2.61805e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.98271e-16, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.2 DICPCG: Solving for T, Initial residual = 0.00864663, Final residual = 2.55266e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.31699e-18, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.3 DICPCG: Solving for T, Initial residual = 0.00864551, Final residual = 3.41296e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.66199e-16, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.4 DICPCG: Solving for T, Initial residual = 0.00864457, Final residual = 3.38449e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 7.11275e-18, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.5 DICPCG: Solving for T, Initial residual = 0.00864378, Final residual = 4.19861e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.49586e-16, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.6 DICPCG: Solving for T, Initial residual = 0.00864312, Final residual = 2.7839e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.06066e-18, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.7 DICPCG: Solving for T, Initial residual = 0.00864257, Final residual = 2.48456e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 3.88073e-16, No Iterations 3 ExecutionTime = 0.08 s ClockTime = 0 s Time = 4.8 DICPCG: Solving for T, Initial residual = 0.0086421, Final residual = 2.88026e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.69475e-18, No Iterations 3 ExecutionTime = 0.09 s ClockTime = 0 s Time = 4.9 DICPCG: Solving for T, Initial residual = 0.00864171, Final residual = 3.28074e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.99988, Final residual = 2.98271e-16, No Iterations 3 ExecutionTime = 0.09 s ClockTime = 0 s Time = 5 DICPCG: Solving for T, Initial residual = 0.00864139, Final residual = 3.60354e-17, No Iterations 1 DICPCG: Solving for fe, Initial residual = 1.25886e-10, Final residual = 1.25886e-10, No Iterations 0 GAMG: Solving for fH, Initial residual = 0.1694, Final residual = 6.94457e-18, No Iterations 3 ExecutionTime = 0.09 s ClockTime = 0 s .......... |
|
November 14, 2019, 10:10 |
|
#13 | |
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 7 |
Quote:
I changed my relaxation factor to 0.5 and it seemed to converge!!! Thanks so much for the tip. |
||
November 14, 2019, 12: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 non-linear 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, 08:56 |
|
#15 | ||
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 7 |
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, 13: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, multi-equation 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 one-equation linearization problem and do it once each for X and Y. Let me know if you have further questions. |
||
November 19, 2019, 13:12 |
|
#17 | ||
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 7 |
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, 14: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)) { ... } |
||
|
|
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 04:09 |
GPU Linear Solvers for OpenFOAM | gocarts | OpenFOAM Announcements from Other Sources | 37 | August 17, 2022 15:22 |
[swak4Foam] Swak4FOAM 0.2.3 / OF2.2.x installation error | FerdiFuchs | OpenFOAM Community Contributions | 27 | April 16, 2014 16:14 |
[swak4Foam] build problem swak4Foam OF 2.2.0 | mcathela | OpenFOAM Community Contributions | 14 | April 23, 2013 14:59 |
UDFs for Scalar Eqn - Fluid/Solid HT | Greg Perkins | FLUENT | 0 | October 11, 2000 04:43 |