|
[Sponsors] |
July 24, 2016, 11:49 |
Stoping criterion
|
#1 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Hi All,
I want to stop my simulation when C < tolerance_Value or C < 0 at any grid point. I don't know, how to write the condition in while loop? I need your help, code is given below. Code:
while (????) { Info<< "Time = " << runTime.timeName() << nl << endl; forAll(CX, cellI) { CX[cellI] = alpha.value()*C[cellI]*C[cellI]; } solve(fvm::ddt(C) == fvm::laplacian(DT, C) - k*CX*C); runTime.write(); } Last edited by cute; July 24, 2016 at 20:00. |
|
July 25, 2016, 11:35 |
|
#2 |
Senior Member
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18 |
You can use panicDump during the run rather than putting it in the solver.
|
|
July 25, 2016, 15:10 |
|
#3 | |
Member
Jerry
Join Date: Oct 2013
Location: Salt Lake City, UT, USA
Posts: 52
Rep Power: 12 |
Hi cute,
You can simply add a line that gives the maximum of C, and then determine based on this maximum value. Quote:
|
||
July 25, 2016, 20:30 |
|
#4 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Thanks for the input.
I defined C as volScalarField, is my Type equals volScalarField? dimensioned<volScalarField> maxC = max(C); But all the values in C are floating point numbers, I am confused what to write? |
|
July 25, 2016, 20:34 |
|
#5 | |
Member
Jerry
Join Date: Oct 2013
Location: Salt Lake City, UT, USA
Posts: 52
Rep Power: 12 |
What I mean is Type of variable in field C, not the Type of field C itself. In this case, you should use
Quote:
|
||
July 25, 2016, 20:35 |
|
#6 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Thanks for a quick response.
|
|
July 31, 2016, 12:26 |
|
#7 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
I am using the following code as suggested, but I am getting error:
CODE: Code:
dimensioned<scalar> maxC = max(C); dimensioned<scalar> minC = min(C); while (maxC > 1E-6 && minC > 0.0) { -------------------- } Code:
error: no match for ‘operator>’ (operand types are ‘Foam::dimensioned<double>’ and ‘double’) while (maxC > 1E-6 && minC > 0.0) |
|
July 31, 2016, 12:52 |
|
#8 | |
Member
Jerry
Join Date: Oct 2013
Location: Salt Lake City, UT, USA
Posts: 52
Rep Power: 12 |
Quote:
You can try to get the value out from the dimensionedType variable by: while (maxC.value() > 1E-6 && minC.value() > 0.0) |
||
July 31, 2016, 14:27 |
|
#9 |
Member
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10 |
Thanks, it works.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problem with Min/max rho | tH3f0rC3 | OpenFOAM | 8 | July 31, 2019 09:48 |
Is convergence criterion (residual value) related with grid size? | rdeepakkumar | FLUENT | 2 | November 9, 2014 01:19 |
Asymptotic stopping criterion is not working | rob50904 | STAR-CCM+ | 2 | January 28, 2013 08:25 |
question to courant criterion | tH3f0rC3 | OpenFOAM | 6 | May 16, 2011 04:32 |
convergence criterion | Dominique | FLUENT | 5 | November 24, 2006 02:36 |