unitialized time step size

General discussion about Elmer
Post Reply
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

unitialized time step size

Post by spacedout »

If I set

Timestep Size = Variable deltaT
Real MATC "tx(0)"

in the Simulation section of the .sif, ElmerSolver immediately gives a segmentation fault. A printout of dt from the first solver called (say MySolver) shows that dt is 0, where dt is a parameter in SUBROUTINE MySolver( Model,Solver,dt,TransientSimulation )

So it looks likes it is impossible to initialize the timestep size to a positive value from variable deltaT since ElmerSolver seems to read this variable before we have a chance to assign a value to it. Kind of a chicken or the egg comes first problem.

Have a nice weekend everybody
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

Re: unitialized time step size

Post by spacedout »

Correction: The error is not segmentation fault but

ERROR:: ExecSimulation: Timestep smaller than epsilon: 0.000E+00
STOP 1

Sorry about that. But the problem remains the same and could be solved by replacing Real MATC "tx(0)" with for example

Real MATC "tx(0)+1"

in which case the printed dt would be 1 but that would entail subtracting 1 from the function that computes deltaT in the fortran code. So that is a potential solution but it is not very elegant. Any thoughts on the matter?
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: unitialized time step size

Post by raback »

Hi

Why can you not initialize the "deltaT" in "initial condition" section?

Sometimes the timestep size may be difficult to set if it depends on the time itself. So if we have a function

dt_i=f(t_i)=f(t_{i-1}+dt_i)

Usually this would be rather smooth function and solvable with fixed point iteration. For this purpose there is a keyword in the simulation section that allows this kind of iteration, set

Code: Select all

Timestep Size Iterations = Integer 10
and the function can be dependent on time.

-Peter
spacedout
Posts: 177
Joined: 30 Mar 2020, 23:27
Antispam: Yes

Re: unitialized time step size

Post by spacedout »

I thought initial and boundary conditions were meant to be used for field variables only. Following your suggestion, I initialized deltaT in the initial condition section and the code now works just fine.
Great thanks,
Marc
Post Reply