Solvers active at alternating timesteps?

Numerical methods and mathematical models of Elmer
Post Reply
MTrevers
Posts: 10
Joined: 16 Nov 2015, 20:19
Antispam: Yes

Solvers active at alternating timesteps?

Post by MTrevers »

I'm trying to condition some solvers to be active only on odd or even timesteps

From this thread, I came across the concept of an Exec Condition:
viewtopic.php?f=15&t=3115

Assuming this works like other conditions (i/e positive = on, negative = off), I expected the following to work to condition a solver to be active only on odd timesteps:

Code: Select all

  Exec Condition = Variable Time
    Real MATC "tx%2.0 - 0.5"
To test this I've added this condition to all of my solvers which are active at every timestep. I expect to see my simulation evolving at half the rate of the same case without any conditions, however I see no difference.

Am I missing something here?
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Solvers active at alternating timesteps?

Post by mzenker »

Hi,

are you sure that your MATC expression does what you think it does? According to the MATC manual, there is no modulo function and no "%" operator. You could try to use fprintf() to print the computed value, see manual for more information.

HTH,

Matthias
MTrevers
Posts: 10
Joined: 16 Nov 2015, 20:19
Antispam: Yes

Re: Solvers active at alternating timesteps?

Post by MTrevers »

Good point, I had just assumed that MATC handled maths like c.

I've built a very simple user defined function. Problem solved! Thanks!
Post Reply