Exec Intervals for solver activation

Numerical methods and mathematical models of Elmer
Post Reply
suecook
Posts: 5
Joined: 11 Dec 2012, 14:51
Antispam: Yes

Exec Intervals for solver activation

Post by suecook »

Hello,

I've been trying to use Exec Intervals to switch off a solver for the first timestep in a simulation.

In the Simulation section I use:
Timestep Intervals(2) = 1 2
Timestep Sizes(2) = 0.005 0.005

And then in the Solver:
Exec Solver = "After TimeStep"
Exec Intervals (2) = 100 1

But the solver still runs on all timesteps.

If I try "Exec Intervals (2) = 1 100" then the solver runs as I expected for only the first timestep, then switches off for the rest of the simulation.

If I try using "Exec Intervals (2) = 0 1" then I get an error message: "18453 Floating point exceptionElmerSolver"

I'm now a bit confused about how Exec Intervals works. Does anyone have any ideas of what input I should be using?

Thanks,

Sue
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Exec Intervals for solver activation

Post by mzenker »

Hi,

I found the question interesting and had a short look into the source code. In MainUtils.src, there is the following section:

Code: Select all

     ExecIntervals => ListGetIntegerArray( Params,'Exec Intervals', Found )
     IF( .NOT. Found ) THEN
       ExecIntervals =>  ListGetIntegerArray( Params,'Exec Interval', Found )
     END IF
     IF ( Found ) THEN
       TimeVar => VariableGet( Model % Variables, 'Timestep Interval' )
       timei = NINT(Timevar % Values(1))

       TimeVar => VariableGet( Model % Variables, 'Timestep' )
       timestep = NINT(TimeVar % Values(1))

       IF( MOD( timestep-1, ExecIntervals(timei)) /= 0 ) RETURN
     END IF
So a zero value for Exec Intervals leads to an error because of the MOD.
And if I understand correctly, the solver is always executed at the first timestep. Why this has been implemented that way, I don't know...

HTH,

Matthias
raback
Site Admin
Posts: 4828
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Exec Intervals for solver activation

Post by raback »

Hi

There is clearly room for improvement.

First of all, the case "0" should be treated separately as it is now for "Output Intervals".

Also there could be "Exec Intervals Offset" so that one could choose the first active step. Currently it is zero. This would enable also various staggered schemes.

I tentatively implemented that but unfortunately the svn is under migration so I cannot commit it just now. I hope sf.net will get Elmer code there soon...

If you compile yourself you could add something like:

Code: Select all

      
IF( ExecIntervals(timei) == 0 ) RETURN
-Peter
suecook
Posts: 5
Joined: 11 Dec 2012, 14:51
Antispam: Yes

Re: Exec Intervals for solver activation

Post by suecook »

Hi Peter,

I made the change you suggested to MainUtils.src and now it's working exactly as I'd hoped.

Thank you for your help!

Sue
Post Reply