|
[Sponsors] |
April 21, 2015, 04:00 |
Change accumulated time step
|
#1 |
New Member
Join Date: Apr 2015
Posts: 16
Rep Power: 11 |
Hi,
In a junction box called at the end of each coefficient loop, i have to change the accumulated time step when i reach 50 iterations : IF (ATSTEP.EQ.10) THEN CALL MESAGE('WRITE','ATTENTION') CALL PSHDIR ('/FLOW/SOLUTION', 'STOP', CRESLT) CALL POKEI ('ATSTEP', IONE, 100, 'STOP', CRESLT, IZ) CALL POPDIR ('STOP', CRESLT) END IF At the 101 iteration, i have an error message : Error detected by routine PSHDRH CDRNAM = /FLOW/MESH/TSTEP100 /LAST CRESLT = NONE Do you know why ? Thanks |
|
April 21, 2015, 07:54 |
|
#2 |
Senior Member
Join Date: Jun 2009
Posts: 1,869
Rep Power: 33 |
The accumulated time step is an internal feature of the software, and overriding w/o updating any related variables and/or data structures is ill-advised.
What are you trying to achieve by faking the accumulated timestep instead of ? |
|
April 21, 2015, 08:35 |
|
#3 |
New Member
Join Date: Apr 2015
Posts: 16
Rep Power: 11 |
Thanks for your answer.
I agree, in fact i don't know to solve my problem. - I have a Mass Flow Rate of 0.5 [kg/s] in my input section. - I wrote a junction box which stops the calculation when I reach a convergence criterion. The problem is : I want to change the Mass Flow Rate to 0.3 [kg/s] when the convergence criterion is reached. In the expression of the mass flow rate i wrote a USER CEL Function but in this function, I can't read the convergence criterion of my junction box. I have an error of type : Error detected by routine PSHDIR. |
|
April 21, 2015, 08:48 |
|
#4 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,848
Rep Power: 144 |
So why not do a simulation at 0.5 kg/s and let it reach the convergence criteria. Then a second simulation uses the first as an initial condition but with 0.3 kg/s mass flow rate.
This can be automated with a shell/batch file or in workbench. No fortran or user CEL is required. And why do you need to use a junction box routine to find convergence? Are the built in convergence tests inadequate? Can't you just set the maximum number of iterations in the CFX-Pre GUI? |
|
April 21, 2015, 10:34 |
|
#5 |
New Member
Join Date: Apr 2015
Posts: 16
Rep Power: 11 |
Thanks for your reply. No because the goal of my work is to have in the same graph the different steps. I use this convergence criteria :
CONV=(MAXU-MINU)*2.0/(MAXU+MINU)*100.0 Where MAXU et MINU are the max and the min of my user point on the previous 40 iterations. |
|
April 21, 2015, 10:49 |
|
#6 |
Senior Member
Join Date: Jun 2009
Posts: 1,869
Rep Power: 33 |
Not sure why you would like to measure convergence in such manner.
Regardless of whatever formula you want to use, you must be very careful the standard convergence criteria are fairly satisfied. A global quantity, or local such a monitor point may falsely converge (region of small changes during convergence), and you will obtain the wrong overall results. |
|
April 21, 2015, 11:17 |
|
#7 |
New Member
Join Date: Apr 2015
Posts: 16
Rep Power: 11 |
Ok I can change the criteria but it doesn't solve my problem...
Maybe I can write the criteria with CEL expressions but is it possible to access to the value of U of the previous time step ? |
|
April 21, 2015, 12:38 |
|
#8 |
Senior Member
Join Date: Jun 2009
Posts: 1,869
Rep Power: 33 |
Accessing the previous timestep value is not trivial. Such topic has been discussed in the past, and you can search through the forum for the latest description.
As an advice, you should not compare values between iterations to determine convergence regardless of the metric used. How do you remove the influence of under-relaxation out of the behavior between two consecutive iterations ? That is, if you set a criteria and a threshold to be satisfied, I could under-relax the solution to 0.1 (for example), and the solution may stop earlier than expected. Similarly, someone could inadvertently reduce the physical timescale and the software stop earlier than it should. Your new convergence criteria must be independent of chosen under-relaxation factor, physical timescale, or timestep so you can be sure the solution is unique given the threshold chosen. If you need the solutions for different mass flows on the same plot, I would follow Glenn's suggestions of running separate runs, export the plots and stitch them in Excel or the spreadsheet of your choice. |
|
April 22, 2015, 07:33 |
|
#9 |
New Member
Join Date: Apr 2015
Posts: 16
Rep Power: 11 |
Thanks Opale for your reply, I will work on that.
I have just another question : is it possible in a User CEL Function to retain a variable ? Ex : - iteration N, X = expression - iteration N+1, Y = X² with X the value at the iteration N Thanks |
|
Tags |
accumulated time step, atstep, junction box, pshdrh, user fortran |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
simpleFoam error - "Floating point exception" | mbcx4jc2 | OpenFOAM Running, Solving & CFD | 12 | August 4, 2015 03:20 |
Help for the small implementation in turbulence model | shipman | OpenFOAM Programming & Development | 25 | March 19, 2014 11:08 |
Unstabil Simulation with chtMultiRegionFoam | mbay101 | OpenFOAM Running, Solving & CFD | 13 | December 28, 2013 14:12 |
mixerVesselAMI2D's mass is not balancing | sharonyue | OpenFOAM Running, Solving & CFD | 6 | June 10, 2013 10:34 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 19:07 |