|
[Sponsors] |
April 13, 2015, 07:50 |
time step ramp
|
#1 |
New Member
Jan N. Wieczorek
Join Date: Jul 2014
Posts: 14
Rep Power: 12 |
Hey guys,
I'm trying to implement a ramped time step for a pimpleDYMfoam simulation, because I have a feeling that my solution is very time step sensitive. I successfully built some if-statements in the controlDict file via runtime code-compilation (marking a coded part with #{ #} brackets), but that results in huge jumps in the force output even if the time step is only reduced by its half. My desired way of doing this would be to keep using the runtime code compilation and not building some wild libraries... My code part in the controlDict file looks like this: Code:
#{ const Time& runTime = mesh().time(); // scalar deltaT_start = 0.005; scalar deltaT_end = 0.001; scalar t_end = 1.0; // const_cast<Time&>(runTime).setDeltaT(deltaT_start+(deltaT_end-deltaT_start)*(pow(sin(min(runTime*pi/(2*t_end),pi/2))),2)); const_cast<Time&>(runTime).setDeltaT(deltaT_end*(min(1, 0.1*runTime))); /* if (runTime.value()>=2) { const_cast<Time&>(runTime).setDeltaT(deltaT_end); } if (runTime.value()>=3) { const_cast<Time&>(runTime).setDeltaT(deltaT_end/2); } */ #}; Error output for a pisoFOAM trial case lokk like this: Code:
/home.local/janwi/OpenFOAM/janwi-2.3.x/run/incompressible/pisoFoam/ras/cavity/system/controlDict.functions.changeTimeStep:59:79: note: candidates are: /home.local/janwi/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/label.H:295:1: note: char Foam::min(char, char) /home.local/janwi/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/label.H:295:1: note: no known conversion for argument 2 from ‘Foam::dimensioned<double>’ to ‘char’ /home.local/janwi/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/label.H:296:1: note: short int Foam::min(short int, short int) I think the multiplication of 0.1*runTime is causing this. How can I best solve this issue? |
|
April 13, 2015, 09:53 |
solution:
|
#2 |
New Member
Jan N. Wieczorek
Join Date: Jul 2014
Posts: 14
Rep Power: 12 |
okay, I found the solution myself:
I didn't set the variable for the time step in a proper way. It's working now, even if the results for the time step look a bit weird. Maybe someone has another (better) function to work as a kind of smoothed ramp. I use a squared sine function: Code:
delta_t_start + (delta_t_end - delta_t_start) * (sin^2(min(t*PI/(2* t_end) , PI/2) ) My working code is: Code:
#{ const Time& runTime = mesh().time(); double t = runTime.value(); scalar deltaT_start = 0.005; scalar deltaT_end = 0.001; scalar t_end = 1.0; double pi = M_PI; const_cast<Time&>(runTime).setDeltaT(deltaT_start+(deltaT_end-deltaT_start)*(pow(sin(min(t*pi/(2*t_end),pi/2)),2))); #}; |
|
Tags |
ramp, time step |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
High Courant Number @ icoFoam | Artex85 | OpenFOAM Running, Solving & CFD | 11 | February 16, 2017 14:40 |
Star cd es-ice solver error | ernarasimman | STAR-CD | 2 | September 12, 2014 01:01 |
Rapidly decreasing deltaT for interDyMFoam | chrisb2244 | OpenFOAM Running, Solving & CFD | 3 | July 1, 2014 17:40 |
Full pipe 3D using icoFoam | cyberbrain | OpenFOAM | 4 | March 16, 2011 10:20 |
calculation diverge after continue to run | zhajingjing | OpenFOAM | 0 | April 28, 2010 05:35 |