Sometimes when using CFX 10.0 solver, the need arises to switch a quantity such as a boundary or source value on and off thoroughout the course of a run, or between a number of discrete values. A typical example is where the heat generation in a device has different values due to different modes of operation. Although this problem can be solved by carrying out a series of runs and manually changing the desired value at the start of each run, the process can be automated with some creative use of CFX Expression Language (CEL).




The CEL step function is very useful for this type of problem. Two examples are given below. For each example, a set of files is available for download. Both examples set the inlet velocity, but it is trivial to apply these methods to any quantity which may be set using CEL (e.g. heat source, resistance, etc.).


EXAMPLE 1 (SWITCH INLET VELOCITY ALTERNATELY BETWEEN TWO DISCRETE VALUES)

This example which switches the inlet velocity between values of 1.5 and 3.0 m/s as follows:

*time range* *velocity*
0 to 8 3.0
8 to 16 1.5
16 to 24 3.0
24 to 32 1.5
32 to 40 3.0
40 to 48 1.5

The following expressions are used:

tinv = 1.0 [s^-1]

switch1 = min(1.0, step(tinv*(t- 0.0[s]))*step(tinv*( 8.0[s]-t)) + step(tinv*(t-16.0[s]))*step(tinv*(24.0[s]-t))
+ step(tinv*(t-32.0[s]))*step(tinv*(40.0[s]-t)))

The expression is built up from a number of step functions (e.g. step(tinv*( 8.0[s]-t)) would return 1 if the t was less than 8 seconds and zero if greater than 8 seconds). The value tinv is necessary because the argument of step function must be dimensionless. Since the output of the step function is bounded between 0 and 1, the expression is constructed in boolean fashion (where * behaves like AND, + behaves like OR). The min function is used to guard against overlapping time ranges. The value of switch1 will be 1 for the time ranges 0s-8s, 16s-24s and 32s-40s.

The inlet velocity can then be set as follows:

invel = 1.5 [m s^-1] + switch1 * 1.5 [m s^-1]


EXAMPLE 2 (SWITCH INLET VELOCITY BETWEEN AN ARBITRARY NUMBER OF DISCRETE VALUES

In this example, the inlet velocity is again a function of time, but an arbitrary set of velocity values is used as shown:

*time range* *velocity*
0 to 8 10.0
8 to 16 2.0
16 to 48 0.0
48 to 64 8.0
64 to 88 3.0
40 to 48 0.0

This case can be tackled by considering each velocity value as a contribution, which is only active over its associated time range. Only the time ranges with non-zero velocity values need to be included. Once again, the expression is built up from step functions. This time there is no means to guard against overlapping time ranges, so the time ranges must not overlap!

invel = step(tinv*(t-0.0[s]))*step(tinv*(8.0[s]-t)) * 10.0[m s^-1]
+ step(tinv*(t-8.0[s]))*step(tinv*(16.0[s]-t)) * 2.0[m s^-1]
+ step(tinv*(t-48.0[s]))*step(tinv*(64.0[s]-t)) * 8.0[m s^-1]
+ step(tinv*(t-64.0[s]))*step(tinv*(88.0[s]-t)) * 3.0[m s^-1]


MORE COMPLEX CASES

Although a great deal can be achieved with CEL, a few will be beyond its scope. Such cases can still be dealt with by implementing the required function in user Fortran.





Show Form
No comments yet. Be the first to add a comment!