|
[Sponsors] |
How to stop a simulation with a physical criterion (other than time) ? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 23, 2019, 06:03 |
How to stop a simulation with a physical criterion (other than time) ?
|
#1 |
Member
Mat
Join Date: Jan 2012
Posts: 60
Rep Power: 14 |
Hi foamers,
Everything's in the title. I was wondering if there's a way to stop an openfoam simulation with a physical criterion (e.g. average pressure on a wall exceeding a threshold), using the dictionaries. And then to write the results, at this last time step. Otherwise, I suppose I will have to modify the solver. Thanks, Mat |
|
November 7, 2019, 03:55 |
|
#2 |
New Member
Benedikt Scholz
Join Date: Oct 2019
Posts: 2
Rep Power: 0 |
Hi Mat,
were you able to find a solution to your problem? Thanks, Ben |
|
November 7, 2019, 04:55 |
|
#3 |
Member
Mat
Join Date: Jan 2012
Posts: 60
Rep Power: 14 |
Hello,
No I didn't. For the moment, I am recording some physical values and looking for which time my physical criterion is achieved. Then if I need I start again the simulation at a previous saved time step untill the criterion time I just found. It's a bit anoying and takes a bit of time, but it's okay. Good luck, Mat |
|
November 7, 2019, 05:34 |
|
#4 |
New Member
Benedikt Scholz
Join Date: Oct 2019
Posts: 2
Rep Power: 0 |
Hi,
I think I found a solution. Writing a coded functionObject to the controlDict file can help. Something like this: T__max__sample { enabled true; type coded; functionObjectLibs ("libutilityFunctionObjects.so"); region sample00; redirectType T__max__sample; writeControl timeStep; writeInterval 1; log true; codeExecute #{ const volScalarField& T = mesh().lookupObject<volScalarField>("T"); if ( max(T).value() < 270 ) { bool result=const_cast<Time&>(mesh().time()).writeNow() ; FatalErrorIn("Stopped") << "Bla" << endl << exit(FatalError); } #}; } It terminates the simulation, if the max temperature in the region called "sample00" falls below 270 with a fatal error message (I know not pretty, but functional). Then, it writes the last timeStep. This link helped me a lot: Mixing #codeStream with coded-function-object I hope this will help you. Ben |
|
November 7, 2019, 08:00 |
|
#5 |
Member
Mat
Join Date: Jan 2012
Posts: 60
Rep Power: 14 |
That's grand! Thanks for your time, Ben.
I haven't made it to the step of conded function objetc yet, and I should. Regards, Mat |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[General] Extracting ParaView Data into Python Arrays | Jeffzda | ParaView | 30 | November 6, 2023 22:00 |
Time Step Continuity Errors simpleFoam | Dorian1504 | OpenFOAM Running, Solving & CFD | 1 | October 9, 2022 10:23 |
Unexpected deltaT decrease in pimpleFoam simulation | robyTKD | OpenFOAM Running, Solving & CFD | 9 | June 27, 2014 07:52 |
dynamic Mesh is faster than MRF???? | sharonyue | OpenFOAM Running, Solving & CFD | 14 | August 26, 2013 08:47 |
pisoFoam with k-epsilon turb blows up - Some questions | Heroic | OpenFOAM Running, Solving & CFD | 26 | December 17, 2012 04:34 |