|
[Sponsors] |
December 19, 2017, 14:09 |
Solving eqation and poor convergence problem
|
#1 |
Member
behzad Ghasemi
Join Date: Sep 2013
Location: Iran
Posts: 56
Rep Power: 12 |
Hi dear foamers,
I want to solve magnetic potential equation. I defined this equation like this: Code:
fvScalarMatrix ksiEqn ( fvm::laplacian(interfacePsi.muM() ,ksi) ); ksiEqn.solve(); Code:
inlet { type zeroGradient; } outlet { type zeroGradient; } up { type fixedGradient; gradient uniform -1234; } down { type fixedGradient; gradient uniform 1234; } frontAndBack { type empty; } Code:
ksi { solver smoothSolver; smoother DICGaussSeidel; //DIC-FDIC-GAMG-diagonal-none tolerance 1e-6; relTol 0; } The log file is attached. Any suggestion is appreciated. Thanks in advance, Behzad |
|
December 20, 2017, 03:43 |
Solved
|
#2 |
Member
behzad Ghasemi
Join Date: Sep 2013
Location: Iran
Posts: 56
Rep Power: 12 |
Hi,
I solved this problem by adding equation in a simple loop. If there is a better solution I'm very glad to know. Regards, Behzad |
|
December 22, 2017, 12:25 |
|
#3 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21 |
What kind of loop did you add? Could you please post the peace of code which solved your problem.
|
|
December 22, 2017, 15:09 |
|
#4 | |
Member
behzad Ghasemi
Join Date: Sep 2013
Location: Iran
Posts: 56
Rep Power: 12 |
Quote:
1- In your solver *.C file include "simpleControl.H". 2- Then create an object from simpleControl class like this: Code:
simpleControl simple(mesh); Code:
while (simple.correctNonOrthogonal()) { yourEqn.solve(); } Code:
SIMPLE { nNonOrthogonalCorrectors 1; //or whatever number of correctors you set } |
||
January 6, 2018, 15:39 |
|
#5 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21 |
You are right. There should be 2 loops. The outer one to advance over time and the inner one to deal with mesh nonorthogonality which strongly affects laplacian discretisation. For the nonorthogolal correction loop to work don't forget to specify in fvSchemes dictionary:
Code:
gradSchemes { default Gauss linear; } laplacianSchemes { default Gauss linear corrected; } |
|
January 6, 2018, 15:56 |
|
#6 | |
Member
behzad Ghasemi
Join Date: Sep 2013
Location: Iran
Posts: 56
Rep Power: 12 |
Quote:
Rgards, Behzad |
||
|
|