yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #09767
[Question #250783]: some questions about 'O.dt' and 'PyRunner'
New question #250783 on Yade:
https://answers.launchpad.net/yade/+question/250783
Dear Prof. Chareyre:
Thanks for helping me last time and today my questions are about some small details of manual controlling of my simulation.
(1). The first question is about the ‘O.dt’ of my simulation. In the past, I always followed the Yade’s default requirement and used the ‘PWaveTimeStep()’ command to set the ‘dt’ in my simulation for ensuring that the process of simulation is stable. But now some reasons make me need to change this way and then use a special ‘dt ’ in simulation. Of course, this special ‘dt ’ is smaller than ‘PWaveTimeStep’. The python codes just for this purpose are as follows:
#############################################################################
O.dt = special ‘dt ’
O.usesTimeStepper = False
O.run(totalsteps, True)
#############################################################################
But after the simulation finished, the interface told me I was wrong, because the simulation still used ‘timestepper’ and ‘delta-t’ failed to get ‘fixed’. There may be something wrong or be lack of some details in my codes. Please tell me these.
(2). The second question is about using ‘PyRunner’ to output some important simulation data for post process. The general use of ‘PyRunner’ in ‘O.engines’is just like that
####################################################################################
output_unit_step = constant int
...
PyRunner(command='postprocess()', iterPeriod = output_unit_step)
####################################################################################
Now, I expect that ‘output_unit_step’ can be changed by stages in whole process of simulation and the key factor of determining these different stages is the ‘O.iter’. So the codes above can be modified as:
####################################################################################
if O.iter <= certain stage range 1 :
output_unit_steps = constant int 1
elif certain stage range 1 < O.iter <= certain stage range 2:
output_unit_steps = constant int 2
.....
PyRunner(command='postprocess()', iterPeriod = output_unit_step)
####################################################################################
I hoped ‘iterPeriod’ in ‘PyRunner’ can be updated in accordance with the variable ‘output_unit_steps’ but failed. The invariable ‘iterPeriod’ is always equal to ‘constant int 1’. This is because at the beginning of simulation, ‘O.iter = 0’ and the ‘if’ condition is ‘True’. ‘output_unit_steps’ is assigned by ‘constant int 1’ and may not be changed any more in the whole process. I wish there are some other codes can replace my codes above to achieve my purpose. Please tell me these.
Seeking your help!.
--
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.