|
[Sponsors] |
Eek! nOuterCorrectors eating energy from heatSource? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 10, 2018, 18:45 |
Eek! nOuterCorrectors eating energy from heatSource?
|
#1 |
Member
Anonymouse
Join Date: Dec 2015
Posts: 98
Rep Power: 10 |
I'm running a rhoPimpleFoam simulation of an (evolved) mesh involving spark gaps firing in specific patterns. The energy is added to the simulation in codeAddSup in scalarCodedSourceCoeffs in a heatSource in fvOptions. All well and good. But something weird happens when I change nOuterCorrectors.
Here's the results for nOuterCorrectors == 2: https://www.youtube.com/watch?v=ZCHv...ature=youtu.be Here's the results for nOuterCorrectors == 8: https://www.youtube.com/watch?v=FoRf...ature=youtu.be It's eating all of my energy input from my heatSource! I've checked with printouts from the codeAddSup and it's still adding the energy to the cells... it's just disappearing from the simulation! Any clue what could be going on? Some general info about my case: nCorrectors: 1 nNonOrthogonalCorrectors: 0 transonic: yes maxCo: 1 Turbulence: RAS / LaunderSharmaKE I started messing with nOuterCorrectors when I started trying to up the courant number. As the models are to be evolved in a genetic algorithm, I obviously need the cases to run as quickly as possible (and unfortunately, due to the transient nature of the sparks, I have to use a transient simulation). Advice on how to get as high of a courant number without it crashing out is, of course, quite welcome - I don't need precision, just a reasonable approximation. But in the process of trying to up the courant number I ran into this nOuterCorrectors issue, and so for now I'm forgetting about upping the courant number and trying to wrap my head around what's going on here. I do notice something curious. Note that the lines beginning with "****" and "----" are debugging statements in my codeAddSup: Code:
PIMPLE: iteration 1 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 DILUPBiCGStab: Solving for Ux, Initial residual = 0.15932592095457531745, Final residual = 1.1548576351923050908e-05, No Iterations 1 DILUPBiCGStab: Solving for Uy, Initial residual = 0.037127561281924695291, Final residual = 2.9791603271809994777e-06, No Iterations 1 DILUPBiCGStab: Solving for Uz, Initial residual = 0.37214223517900157923, Final residual = 4.67629236169307904e-07, No Iterations 1 DILUPBiCGStab: Solving for e, Initial residual = 0.16809447344164404892, Final residual = 1.3246400427386530665e-05, No Iterations 1 GAMG: Solving for p, Initial residual = 0.16418462618748358439, Final residual = 1.6645280804302222903e-10, No Iterations 2 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 7.6742864544555995127e-14, global = 4.1324041375401492154e-14, cumulative = 6.5988075225086239377e-11 PIMPLE: iteration 2 DILUPBiCGStab: Solving for Ux, Initial residual = 0.0014448643807351863478, Final residual = 8.1669328637574418402e-08, No Iterations 1 DILUPBiCGStab: Solving for Uy, Initial residual = 0.00027546989643842948381, Final residual = 2.5471593662362301991e-08, No Iterations 1 DILUPBiCGStab: Solving for Uz, Initial residual = 0.0011725874700291632688, Final residual = 3.43998872314807975e-09, No Iterations 1 **** 0.029542883977424907321, 0.57939046460174492559: -231328.87744016532088: 231328.87744016532088: 231328.87744016532088, 1 ---- 0.029542883977424907321, 0.57939046460174492559: 1: 2.6400000000000001346e-06, 0.12298966836295191496, -0.00019899783528436345128 / 0.00035338220963484161643 **** 1.4454774530462930629e-09, 0.45167385015223665556: -6971.0485656573118831: 6971.0485656573118831: 6971.0485656573118831, 1 ---- 1.4454774530462930629e-09, 0.45167385015223665556: 1: 2.6400000000000001346e-06, 0.79567036862702411604, -0.0049310756848542462716 / 0.00093577083064323631628 **** 0.10387054382167526523, 0.80822519910258905362: -63157.279128186026355: 63157.279128186026355: 63157.279128186026355, 1 ---- 0.10387054382167526523, 0.80822519910258905362: 1: 2.6400000000000001346e-06, 0.52570315048303750682, -0.00029215070043198435815 / 5.3379389691171304829e-05 ---- 0.0020286084081171046681, 0.87663340936826095184: 0: 2.6400000000000001346e-06, 0.35548424768006886554, -0.00039742416601329453706 / -3.8839031163536092209e-06 DILUPBiCGStab: Solving for e, Initial residual = 0.016633910190306896992, Final residual = 7.0333565916009248229e-07, No Iterations 1 GAMG: Solving for p, Initial residual = 0.00581019704090993995, Final residual = 2.1653426872621771768e-07, No Iterations 1 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 1.8046236487480513319e-10, global = 5.5905235824988312242e-11, cumulative = 1.2189331105007455162e-10 PIMPLE: iteration 3 DILUPBiCGStab: Solving for Ux, Initial residual = 6.9185422926261512478e-05, Final residual = 3.9417584805672499565e-09, No Iterations 1 DILUPBiCGStab: Solving for Uy, Initial residual = 1.7397410679419544693e-05, Final residual = 9.7452266864967517617e-10, No Iterations 1 DILUPBiCGStab: Solving for Uz, Initial residual = 0.0010964142781748811156, Final residual = 4.184495695933905655e-09, No Iterations 1 DILUPBiCGStab: Solving for e, Initial residual = 0.016793934999454012552, Final residual = 8.4546027323164682118e-08, No Iterations 1 GAMG: Solving for p, Initial residual = 0.0041564748641993113504, Final residual = 8.0932871389897639411e-08, No Iterations 1 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 5.7545486820407337315e-11, global = 4.933207048457593362e-11, cumulative = 1.712253815346504917e-10 PIMPLE: iteration 4 DILUPBiCGStab: Solving for Ux, Initial residual = 3.0098475292996436489e-05, Final residual = 7.4237688725730853256e-10, No Iterations 1 DILUPBiCGStab: Solving for Uy, Initial residual = 8.7667969774453377482e-06, Final residual = 2.2084608084162864429e-10, No Iterations 1 DILUPBiCGStab: Solving for Uz, Initial residual = 0.0010375809055311849445, Final residual = 3.8564189527667151277e-09, No Iterations 1 DILUPBiCGStab: Solving for e, Initial residual = 0.00013987384740133046923, Final residual = 1.784772774312934773e-09, No Iterations 1 GAMG: Solving for p, Initial residual = 4.3711669458214045462e-05, Final residual = 6.3508616335680282179e-10, No Iterations 1 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 4.992653057942766643e-13, global = 3.5398087697986237241e-13, cumulative = 1.7157936241163035069e-10 PIMPLE: iteration 5 DILUPBiCGStab: Solving for Ux, Initial residual = 8.9172137104080305001e-07, Final residual = 8.9172137104080305001e-07, No Iterations 0 DILUPBiCGStab: Solving for Uy, Initial residual = 6.4001241803146574679e-07, Final residual = 6.4001241803146574679e-07, No Iterations 0 DILUPBiCGStab: Solving for Uz, Initial residual = 0.0010879057755952480872, Final residual = 4.0691783309642113622e-09, No Iterations 1 DILUPBiCGStab: Solving for e, Initial residual = 1.3918370498400953989e-05, Final residual = 1.3171378077423801706e-10, No Iterations 1 GAMG: Solving for p, Initial residual = 4.5629369578008409459e-06, Final residual = 5.5317464934446860273e-11, No Iterations 1 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 4.3675931617769713726e-14, global = -2.0627912377480958794e-14, cumulative = 1.7155873449925287794e-10 PIMPLE: iteration 6 DILUPBiCGStab: Solving for Ux, Initial residual = 6.50065314057371466e-08, Final residual = 6.50065314057371466e-08, No Iterations 0 DILUPBiCGStab: Solving for Uy, Initial residual = 1.2884770698931408974e-08, Final residual = 1.2884770698931408974e-08, No Iterations 0 DILUPBiCGStab: Solving for Uz, Initial residual = 0.0010321735805182002954, Final residual = 3.9624429012951149402e-09, No Iterations 1 DILUPBiCGStab: Solving for e, Initial residual = 7.9173245861778451799e-07, Final residual = 7.9173245861778451799e-07, No Iterations 0 GAMG: Solving for p, Initial residual = 4.6723900156853273234e-08, Final residual = 4.6723900156853273234e-08, No Iterations 0 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 3.6736732998395064462e-11, global = -2.0631511162535782774e-14, cumulative = 1.7153810298809033756e-10 PIMPLE: iteration 7 DILUPBiCGStab: Solving for Ux, Initial residual = 2.6229616260430618369e-09, Final residual = 2.6229616260430618369e-09, No Iterations 0 DILUPBiCGStab: Solving for Uy, Initial residual = 2.2366059462807110856e-07, Final residual = 2.2366059462807110856e-07, No Iterations 0 DILUPBiCGStab: Solving for Uz, Initial residual = 3.113827036408037766e-06, Final residual = 4.1981355644990774214e-11, No Iterations 1 DILUPBiCGStab: Solving for e, Initial residual = 7.6606409886354104506e-07, Final residual = 7.6606409886354104506e-07, No Iterations 0 GAMG: Solving for p, Initial residual = 4.6881062470010722192e-08, Final residual = 4.6881062470010722192e-08, No Iterations 0 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 3.6846913096204086676e-11, global = -2.0631730260216672126e-14, cumulative = 1.7149684220513182386e-10 DILUPBiCGStab: Solving for epsilon, Initial residual = 0.99360336695874584834, Final residual = 1.1888773190773920551e-07, No Iterations 1 DILUPBiCGStab: Solving for k, Initial residual = 0.73133648040774557053, Final residual = 3.5347136829280503655e-07, No Iterations 1 ExecutionTime = 0.33000000000000001554 s ClockTime = 0 s writeObjects rhofunc write: automatically written object rho forces upwardForce write: Sum of forces Total : (-53.832371111223288551 490.31955076991397391 1.3425905756708779663e-15) Pressure : (-53.832405571916339682 489.96801167026700341 1.3425899812552512436e-15) Viscous : (3.4460693050318596435e-05 0.3515390996469474616 5.94415626670074e-22) Sum of moments Total : (-24.515977538495661747 -2.6916185555611953362 141.93049425004139152) Pressure : (-24.498400583513316064 -2.6916202785958480703 141.86190852845609811) Viscous : (-0.017576954982347365447 1.7230346525158682425e-06 0.068585721585288861313) Courant Number mean: 0.0042792624626332544449 max: 0.042179241961921243309 deltaT = 1.7279999999999998032e-06 Time = 4.3679999999999995143485503890091e-06 Thoughts? ED: One more run, with nOuterCorrectors == 1, nCorrectors == 2: https://www.youtube.com/watch?v=CCKa...ature=youtu.be |
|
October 11, 2018, 02:19 |
|
#2 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi,
thanks for your thread. Indeed interesting. However, to check it more carefully, details are missing.
Generally, using the PIMPLE algorithm will allow you to increase the time-step. However, you should use it correctly. Thus, using relaxation factors appropriatly and the residual control. Further hints: - nice coarse mesh; maybe a bit to coarse? In the gaps, one/two cells more would be good? Sure, its always a matter of accuracy vs speed - You don´t use residual control to leave the outer loops - Adding minIter to the solvers (to ensure that you make at least 1 iteration; this helps sometimes) A remark to your output.
Thanks in advance, Tobi
__________________
Keep foaming, Tobias Holzmann |
|
October 11, 2018, 05:37 |
|
#3 | ||||||||
Member
Anonymouse
Join Date: Dec 2015
Posts: 98
Rep Power: 10 |
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Will look into these this evening; they weren't in the naca airfoil example that I based my code off of. Quote:
|
|||||||||
October 12, 2018, 00:45 |
|
#4 | |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Quote:
__________________
Keep foaming, Tobias Holzmann |
||
October 12, 2018, 21:58 |
|
#5 | |
Member
Anonymouse
Join Date: Dec 2015
Posts: 98
Rep Power: 10 |
Quote:
*** I had to break the test case up into two tarballs and rename them to text files to be able to upload them to the forum. |
||
October 13, 2018, 04:53 |
|
#6 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi,
I checked the case and it works fine with my personal coded stuff (copy&paste from the header). However, you code does not run at all. Code:
PIMPLE: Iteration 1 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 DILUPBiCGStab: Solving for Ux, Initial residual = 0.082583517869215028462, Final residual = 1.5132790637562652651e-05, No Iterations 1 DILUPBiCGStab: Solving for Uy, Initial residual = 0.01806460985322959692, Final residual = 3.4815363492091973089e-06, No Iterations 1 DILUPBiCGStab: Solving for Uz, Initial residual = 0.15472716674413361515, Final residual = 3.944648390305966073e-07, No Iterations 1 foo foo **codeSetValue** DILUPBiCGStab: Solving for e, Initial residual = 0.057465267730118500811, Final residual = 9.8625283234867808907e-06, No Iterations 1 **codeCorrect** GAMG: Solving for p, Initial residual = 0.070229304922914195797, Final residual = 5.6339922050230987653e-06, No Iterations 1 GAMG: Solving for p, Initial residual = 2.5018139949821598437e-05, Final residual = 3.4172573712020873153e-09, No Iterations 1 GAMG: Solving for p, Initial residual = 1.7517222467274839476e-08, Final residual = 1.7517222467274839476e-08, No Iterations 0 GAMG: Solving for p, Initial residual = 1.7517222467274839476e-08, Final residual = 1.7517222467274839476e-08, No Iterations 0 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 3.6022471099480605211e-11, global = 3.7524435657106932169e-12, cumulative = 3.2242318826135843071e-10 GAMG: Solving for p, Initial residual = 0.00013029157741722673385, Final residual = 1.2092405239817128058e-08, No Iterations 1 GAMG: Solving for p, Initial residual = 6.5520140909152026198e-08, Final residual = 6.5520140909152026198e-08, No Iterations 0 GAMG: Solving for p, Initial residual = 6.5520140909152026198e-08, Final residual = 6.5520140909152026198e-08, No Iterations 0 GAMG: Solving for p, Initial residual = 6.5520140909152026198e-08, Final residual = 6.5520140909152026198e-08, No Iterations 0 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 1.3474441380642783955e-10, global = -1.6427329318844997987e-11, cumulative = 3.0599585894251342626e-10 GAMG: Solving for p, Initial residual = 3.1350376330926383887e-06, Final residual = 1.6631648704174867973e-10, No Iterations 1 GAMG: Solving for p, Initial residual = 1.3556522770063032791e-09, Final residual = 1.3556522770063032791e-09, No Iterations 0 GAMG: Solving for p, Initial residual = 1.3556522770063032791e-09, Final residual = 1.3556522770063032791e-09, No Iterations 0 GAMG: Solving for p, Initial residual = 1.3556522770063032791e-09, Final residual = 1.3556522770063032791e-09, No Iterations 0 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 2.7881030599957615413e-12, global = 6.729567339240278097e-14, cumulative = 3.0606315461590583613e-10 PIMPLE: Iteration 2 DILUPBiCGStab: Solving for Ux, Initial residual = 0.00071627931036244603391, Final residual = 8.5075321114874858666e-08, No Iterations 1 DILUPBiCGStab: Solving for Uy, Initial residual = 0.00017202752667494502787, Final residual = 3.7812687757696778027e-08, No Iterations 1 DILUPBiCGStab: Solving for Uz, Initial residual = 0.00089013857895736355798, Final residual = 6.6777722140240487123e-09, No Iterations 1 foo foo **codeSetValue** DILUPBiCGStab: Solving for e, Initial residual = 0.0058962971408500833292, Final residual = 4.6172709650005078661e-11, No Iterations 1 **codeCorrect** GAMG: Solving for p, Initial residual = 0.0025524815179021097603, Final residual = 3.5810777808251610507e-07, No Iterations 1 GAMG: Solving for p, Initial residual = 1.5283633308277009206e-06, Final residual = 3.1165272939292720171e-10, No Iterations 1 GAMG: Solving for p, Initial residual = 1.335373767225192395e-09, Final residual = 1.335373767225192395e-09, No Iterations 0 GAMG: Solving for p, Initial residual = 1.335373767225192395e-09, Final residual = 1.335373767225192395e-09, No Iterations 0 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 2.6269237780954993169e-12, global = -4.2979288288287500323e-13, cumulative = 3.0563336173302298304e-10 GAMG: Solving for p, Initial residual = 2.622344119518172666e-05, Final residual = 2.0645692070624235978e-09, No Iterations 1 GAMG: Solving for p, Initial residual = 1.0746551136261335936e-08, Final residual = 1.0746551136261335936e-08, No Iterations 0 GAMG: Solving for p, Initial residual = 1.0746551136261335936e-08, Final residual = 1.0746551136261335936e-08, No Iterations 0 GAMG: Solving for p, Initial residual = 1.0746551136261335936e-08, Final residual = 1.0746551136261335936e-08, No Iterations 0 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 2.1136460893127259922e-11, global = 6.3236495238322293335e-13, cumulative = 3.0626572668540619254e-10 GAMG: Solving for p, Initial residual = 6.5640352584576753641e-07, Final residual = 6.5640352584576753641e-07, No Iterations 0 GAMG: Solving for p, Initial residual = 6.5640352584576753641e-07, Final residual = 6.5640352584576753641e-07, No Iterations 0 GAMG: Solving for p, Initial residual = 6.5640352584576753641e-07, Final residual = 6.5640352584576753641e-07, No Iterations 0 GAMG: Solving for p, Initial residual = 6.5640352584576753641e-07, Final residual = 6.5640352584576753641e-07, No Iterations 0 diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0 time step continuity errors : sum local = 1.2910163692305130795e-09, global = 6.3236606951079251525e-13, cumulative = 3.0689809275491698183e-10 Code:
code #{ this->refValue() = vector(1, 0, 0) *min(10, 0.1*this->db().time().value()); this->refGrad() = Zero; this->valueFraction() = 1.0; #}; // codeInclude //#{ // #include "fvCFD.H" //#}; // codeOptions //#{ // -I$(LIB_SRC)/finiteVolume/lnInclude //#}; Code:
if (cell == -1) continue; Code:
if (afl[i] * afl_percent > 0) Pout << "**** " << x[i] << ", " << y[i] << ": " << hSource[cell] << ": " << (afl[i] * afl_percent) << ": " << afl[i] << ", " << afl_percent << endl; Pout << "---- " << x[i] << ", " << y[i] << ": " << afl_percent << ": " << cur_time2 << ", " << raw_cycle_number << ", " << spark_start << " / " << spark_end << endl
__________________
Keep foaming, Tobias Holzmann |
|
October 13, 2018, 08:18 |
|
#7 | |||||
Member
Anonymouse
Join Date: Dec 2015
Posts: 98
Rep Power: 10 |
Quote:
If my code does not work on your version of OpenFOAM, feel free to substitute any code that does work for you. The key issue is that energy added in codeAddSup disappears when the number of outer correctors increases. Quote:
Quote:
2) My code works just fine here. The code in codeInclude runs a single time at the top of the dynamic-compiled code 3) The code you presented from codedMixedBC does not run over here (I just tested it). Putting code in a section called "code" does not cause it to get inserted into the dynamic compiled code. Quote:
Why would there be sparks that aren't in the mesh? Simple: when you run rhoPimpleFoam decomposed through mpirun, not all decomposed cases have all cells. So we have to have this check. The code exists of course regardless of whether you run it decomposed or not (the problem with nOuterCorrectors occurs in both decomposed and non-decomposed cases) Quote:
|
||||||
October 14, 2018, 05:53 |
|
#8 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi Karen,
the codedMixedBoundary I mentioned is indeed not in your case but the boundary works with the same functionality as the coded one within the fvOption. I was wrong about the continue stuff. After a quick look into the funcionality at cplusplus.com, it was clear. For any reason, I related the continue keyword to the if-condition rather than to the for-loop. However, your code works on my machine now and the source term is executed in each pimple loop. The results for PISO, PIMPLE (corr=3) and PIMPLE (corr=6) looks almost identical. Regarding the execution of the code, everything works fine. I guess that is the main point. See here: https://Holzmann-cfd.de/forums/compare.ogv I am using the latest DEV version of the Foundation toolbox. Good luck.
__________________
Keep foaming, Tobias Holzmann |
|
October 14, 2018, 09:29 |
|
#9 | |
Member
Anonymouse
Join Date: Dec 2015
Posts: 98
Rep Power: 10 |
Quote:
All of the versions you show in your video are wrong; none of them show the energy input from the sparks in the upper compartment of the model on the left, which you can see in my first video. I'm starting to think that i may have no option but to stick with nOuterCorrectors == 1 and just use a high value for nCorrectors and nNonOrthogonalCorrectors to compensate. |
||
October 14, 2018, 11:47 |
|
#10 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
As we are talking about PISO and PIMPLE corr corresponds to nOuterCorrectors, everything else would not make any sense.
By the way, I cannot give any feedback about the result based on the fact that I did not investigate into your problem too much. In addition, I was not going through your code in detail. After you mention, that everything I did is wrong, I will stop wasting my time to support here.
__________________
Keep foaming, Tobias Holzmann |
|
October 14, 2018, 16:55 |
|
#11 | |
Member
Anonymouse
Join Date: Dec 2015
Posts: 98
Rep Power: 10 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
energy in sonicFoam | joern | OpenFOAM Running, Solving & CFD | 1 | September 24, 2019 00:15 |
Energy balance in conjugative/ porous simulation; Domain Energy is greater than Input | Vishnu_bharathi | CFX | 2 | June 27, 2018 10:08 |
ATTENTION! Reliability problems in CFX 5.7 | Joseph | CFX | 14 | April 20, 2010 15:45 |
Energy dissipation and Drag coefficient | Freeman | Main CFD Forum | 10 | January 27, 2006 07:42 |
Why FVM for high-Re flows? | Zhong Lei | Main CFD Forum | 23 | May 14, 1999 13:22 |