Expand/compress region

Dear all,

Is it possible change the radius parameter of spherical region during the simulation run?


Yes. Please see the documentation of the region command.

I have used the following command change the radius:

variable radius equal ramp(15.0,8.0)
region Sphere sphere 0.0 0.0 0.0 v_radius

This results in error:
ERROR: Variable radius: Cannot use ramp in variable formula between runs (src/src/variable.cpp:3559)

You can easily work around this restriction by implement the ramp explicitly.

variable rstart index 15.0
variable rend index 8.0
variable nsteps index 1000
variable sstart equal $(step)
variable radius equal v_rstart+(v_rend-v_rstart)*((step-v_sstart)/v_nsteps)
region Sphere sphere 0.0 0.0 0.0 v_radius

run ${nsteps}

Thank you, axel.

I tried your code but I am still getting the following error: ERROR on proc 0: Variable evaluation in region gave bad value (src/src/region_sphere.cpp:212)

That example assumes that your initial step is 0. I’ve updated it to be more generic.

Ok. I got it. Thank you, axel.

Always keep in mind that examples are just that: an example. The intent is to show the principle but not necessarily a complete solution for all cases. Making the assumption of the initial step being 0 is a significant restriction and hence I updated the example, but on the other hand, it should have been straightforward for you to debug and fix this on your own.
Also, based on this, you can do non-linear ramps and lots of other things with additional modifications.