How do I stop the prescribed velocity after a certain time?

Hi all,

I would like to halt the prescribed velocity after 50 million years. I attempted to formulate a function using ‘t’ as the variable representing time; however, I am uncertain whether the issue lies with my function or the ‘t’ variable. Thank you in advance.

Best,
Açelya

subsection Boundary velocity model
set Tangential velocity boundary indicators = bottom
set Prescribed velocity boundary indicators = left x: function, right x:function

subsection Function
set Function constants = cm=100.0
set Variable names = x,z,t
set Function expression = if(t<50e6,
(if(x<1650e3 && z<=440.e3, -(0.25)/cm,
if(x<1650e3 && z>=440.e3, 0.5/cm,
if(x>1650e3 && z<=440.e3, (0.25)/cm,
if(x>1650e3 && z>=440.e3, -0.5/cm,0)
)))));
0
end
end

Hi Açelya,

Thanks for posting this to the forum.

My thoughts below on what I think the issue is.

To start, please note the following:

  • I used the “preformatted text” (</> icon symbol) option to preserve the formatting in the prm snippets below.
  • I only included the x-velocity component for the function and added a \ to be consistent with what is required in the ASPECT prm files.
  • I used spaces to align starting and closing brackets (and the corresponding contents) of each conditional statement. I find this practice makes these expressions significantly easier to debug!

Here is the original function expression, updated with the methodology outlined above:

if ( t<50e6, \
     ( if ( x<1650e3 && z<=440.e3, -(0.25)/cm, \
            if ( x<1650e3 && z>=440.e3, 0.5/cm, \
                 if ( x>1650e3 && z<=440.e3, (0.25)/cm, \
                      if ( x>1650e3 && z>=440.e3, -0.5/cm, 0) \
               ) \
          ) \
     ) \
   ); \

At first, glance, my first thought is that this expression should produce a runtime error, as their is no entry for what happens when t>=50e6 at the end.

For example, if you want the x-velocity to be 0 after t>=50e6, then you would add ), 0 \ and the second to last line:

if ( t<50e6, \
     ( if ( x<1650e3 && z<=440.e3, -(0.25)/cm, \
            if ( x<1650e3 && z>=440.e3, 0.5/cm, \
                 if ( x>1650e3 && z<=440.e3, (0.25)/cm, \
                      if ( x>1650e3 && z>=440.e3, -0.5/cm, 0) \
               ) \
          ) \
     ), 0 \
   ); \

Note that I have not tested the above code, so there still may be some errors.

One strategy I use when writing and testing/debugging complex functions is to make other parts of the model very simple (1 nonlinear iteration, constant viscosity, only run two time steps, etc, etc) and a start with a simple function like:

if ( t<50e6, \
     ( if ( x<1650e3 , -(0.25)/cm, -0.5/cm), \
     0 \
   )

and from there then keep adding complexity to the function and testing at each step to ensure the boundary conditions are giving the correct output.

I hope this helps and let us know if you have any further questions.

Cheers,
John

Hi John,

Thank you for your quick reply. Somehow, I missed your response.

As you suggested, I simplified the function and added elements one by one. This helped me identify the problem.

Best,
Açelya