Posted Thu, 03 Nov 2016 23:45:56 GMT by hidromatrix
Dear all,

I'm making a plugin where I need to figure out the time step length at the PreTimeStep callback, for a model using the automate time stepping.

The problem that I'm having is that the time step length is modified on the OnTimeStepConstraint callback, by which time the time step has already been simulated.

There for when I use IfmGetCurrentTimeIncrement during the PreTimeStep callback, it gives me the time increment from the previous time step.

In other words, I'm having problem to figure out the time step length before it happens.

Is that a way around that?

Regards,

Eduardo
Posted Thu, 03 Nov 2016 23:47:39 GMT by hidromatrix
Dear all,

I'm making a plugin where I need to figure out the time step length at the PreTimeStep callback, for a model using the automate time stepping.

The problem that I'm having is that the time step length is modified on the OnTimeStepConstraint callback, by which time the time step has already been simulated.

Therefore when I use IfmGetCurrentTimeIncrement during the PreTimeStep callback, it gives me the time increment from the previous time step.

In other words, I'm having problem to figure out the time step length before it happens.

Is that a way around that?

Regards,

Eduardo
Posted Mon, 07 Nov 2016 15:22:53 GMT by Denim Umeshkumar Anajwala
Hi Eduardo,

The actual time step length can only be determined in the OnTimeStepConstraint callback, which might be called several times in a time step. FEFLOW itself cannot know what the final length of a time step will be before it is calculated as - using the predictor-corrector scheme - the simulation may be carried out several times with different time step sizes before actually accepting the result. PreTimeStep will only be called once, so it will not be useful for you. OnTimeStepConstraint, however, is called before the time step is actually simulated, so this should be where you actually put your code. Keep in mind, though, that it may be called several times before FEFLOW proceeds to the next step.

Cheers,
Peter

PS: Merged your two topics.
Posted Thu, 10 Nov 2016 07:29:37 GMT by hidromatrix
Hi Peter,

Thanks for your reply it was very helpful.
One thing that I noticed is that if I use IfmGetResultsFlowHeadValue in the beginning of the OnTimeStepConstraint callback, it gives me a different value from using the same function during the PreTimeStep callback, which made me think that the time step was simulated before OnTimeStepConstraint, and the dtProposed value would be used in the following time step.

Could you expand a bit on that?

Regards,

Eduardo
Posted Thu, 10 Nov 2016 15:14:43 GMT by Denim Umeshkumar Anajwala
Hi Eduardo,

I think the reason is the following (without testing or looking at the actual FEFLOW code):
OnTimeStepConstraint is called whenever a new time step length is determined. With the predictor-corrector scheme, it may happen that a step is calculated, but the result rejected due to a too large deviation from the previous one. In this case, a new time step length will be set, and OnTimeStepConstraint will be called again. I assume that at this time, the values you get via IfmGetResultsFlowHeadValue are the results of the previous rejected step.

Cheers,
Peter

You must be signed in to post in this forum.