Showing results for 
Search instead for 
Do you mean 

Regarding fixed step solver

[ Edited ]


i was trying to simulate a simple model with a fixed step solver but the simulation is stopped and the results given till that point do not make sense.I would like some help with the interpretation of them.

I attached some screenshot to make it easier to understand.

The model consists of two water tanks. The left one is 30cm higher than the right one so i used a pipe submodel to model that height difference. Initial height of left tank(higher tank) is 5 cm and the right tank has an initial height of 30cm. I want to simulate the flow from the higher tank to the lower one due to the height (pressure) difference. The valve (Cq=0.7,Area=79mm2) is always open.


With the variable step solver everything goes fine. (see attached image for reference results)

Now i try a fixed step Euler method: (other methods give more or less same results for same step size)

1) I use 0.001 s default step time (see attached images). Simulation aborts, results not comparable to variable solver.

2) I change to 1e-05 s step time (see image). It does not crash but does not give good results.

3)With 1e-06s, altohugh really slow, gives almost same results as variable solver.

Edit: simulation time 10s


If i change for example the pipe length to 1 m instead of the initial 30cm, 1e-5s fixed step solver and variable step solver give almost same results.


Does it basically mean that with that pipe length (30cm) the step require to achieve comparable results is 1e-06s or smaller? But if i make the pipe longer it is compensated (somehow?, faster changes of variables?) and i can start reducing step size?


What If i would like to use this simple model to try out desktop real time "capabilities". With a step size of 1e-06s the simulation is too slow for real time. I know a desktop is no RT platform but for a really simple model like this I wanted to try it out.


Is there any other way to model the tank height difference? If i remove the valve I am able to use a pipe submodel I-R with 30 cm vertical orientation and default fixed step solver works fine and fast. I am guessing it is the pipe-submodel I am using in this example (HL001 C-R) what is giving the problems. Probably the capacitive part is making trouble with a small pipe length and when I increase it, it starts giving less problems to the simulation.

With the valve between both tanks I am only able to use C-R pipe submodels and other similar ones but not a purely I-R submodel, which doesnt give problems like I said.


What about a variable step solver with Timesync submodel? Would it give some initial acceptable results for RT behaviour?


Thank you in advance!








Re: Regarding fixed step solver

Dear AC1,


It is generally difficult to compare results form fixed and variable step simulations. Fixed step methods are also fixed step orders, which is not generally the case for variable step solvers.

I'm not really surprised by the results you obtained with fixed step simulator.


In the 1st attempt (h=1e-3), you might encounter instabilities.

Fixed step solvers have a very limited stability area, meaning that depending on the dynamics embedded in the model, an acceptable step able to provide stable simulation might be very very small. In you're first attempt, I guess that you might encounter instabilities with the "big" 1e-3 step, leading to high state variable values, and thus a  empty tank at one end of hydraulic line.


In the 2nd attempt, (h=1e-5), you might be at the limit of stability, leading to oscillating or poorly accurate results. In that case simulation will not fail (or at least it could fail later due to slow propagation of instabilities in your system) but results might not be satisfyingly enough.


In the last attempt, I guess h=1e-6s is a viable step, that ensures the stability criterion for the Euler method being preserved with this step. For more explanation about the stability criterion, please refer to the demo fixedstep_stability in Amesim demo section.


To know a valuable step for your fixed time step integration, I would advise using eigenvalue animation tool app embedded in  SIMP00 submodel. This tool allows getting valuable values for a stable fixed step simulation (at least it will indicate the maximum step value able to ensure a stable fixed step simulation). Please refer to Eigenvalue Animation tool help in Amesim help.


Of course if the indicated value is too small for a RT simulation, then you would need to simplify the system in order to remove dynamics that might cause this small step (remember that Euler step and system dynamics  are tightly linked due to constraint of stability area of the used numerical method).


Note that you could easily try different steps for fixed step integration, by sweeping over fixed step values with the same SIMP00 submodel.


 Hope this will help and answers your questions,