The RAMP Function

Top  Previous  Next

The RAMP function is a modification of the URAMP function, intended to make the usage more nearly like an IF..THEN statement.

 

It has been introduced to provide an alternative to discontinuous functions like USTEP and the discontinuous IF..THEN construct.  Discontinuous switching can cause serious difficulties, especially in time dependent problems, and is strongly discouraged. 

 

FlexPDE is an adaptive system.  Its procedures are based on the assumption that by making timesteps and/or cell sizes smaller, a scale can be found at which the behavior of the solution is representable by polynomials.  Discontinuities do not satisfy this assumption.  A discontinuity is a discontinuity, no matter how close you look.  Instantaneous turn-on or turn-off introduces high-frequency spatial or temporal components into the solution, including those which are far beyond the physical limits of real systems to respond.  This makes the computation slow and possibly physically meaningless.

 

The RAMP function generates a smooth transition from one value to another, with a specified transition width.  It can be thought of as a "fuzzy IF", and has a usage very similar to an IF.. THEN, but without the harsh switching characteristics.

 

The form is:

 

value = RAMP(expression, left_value, right_value, width)

 

This expression is logically equivalent to

 

value = IF expression < 0 THEN left_value ELSE right_value

 

except that the transition will be linear over width.

 

See the SWAGE function for a similar function with both smooth value and derivative.

 

Example:

see "Samples | Misc | Swagetest.pde" for a picture of the SWAGE and RAMP transitions and their derivatives.