Setting boundary, source, etc. values as non-trivial functions of time.
Sometimes the need arises to switch a quantity such as a boundary or source value on, off or between discrete values at certain times during the course of a transient run. Or, quantities may need to vary in in other, non-trival ways as a function of time. Sometimes, step functions in expression language can perform this function (see solution 567080). Often however, a more flexible solution is required.
The use of 1-D interpolation functions often proves to be the most versatile solution and is the method described here. It is important to note that table interpolation functions are not limited to spatial data. In fact, the example discussed is a function of time, but the table may be a function of any variable, e.g. temperature, concentration, etc. The advantage of interpolation functions is that they can be used in any expression. Functions can be tested prior to running by plotting the function in CFX-Pre.
As an example, suppose that a time dependent inlet velocity is required. The inlet velocity is to vary as a function of time as dictated by the following data pairs:
t = 0 s, u = 0 m/s (start)
t = 10 s, u = 2 m/s (linear increase)
t = 40 s, u = 2 m/s (constant)
t = 50 s, u = 1 m/s (linear decrease)
t = 100 s, u = 1 m/s (end)
A graphical illustration of this function is shown in the plot (function.gif) included in the attached archive file.
The 1-D interpolation functions in CFX are also defined by a set of data pairs. Linear interpolation is used to calculate values between data points. A new interpolation function may be created in CFX-Pre by selecting 'Insert > Expressions, Functions and Variables > User Function'. The file example1.cfx may be opened in CFX-Pre and is a ready defined example using the function described earlier.
As an alternative to setting up the data pairs in CFX-Pre, 1-D table functions may also be set up in CFX command Language (CCL) as shown in the file table_fragment.ccl (also shown below). A CCL fragment such as this may be imported into CFX-Pre or may be included as part of a solver run using the -ccl argument.
Option = Interpolation
Argument Units = [s]
Result Units = [m s^-1]
Option = One Dimensional
Data Pairs = 0.0, 0.0,
Extend Max = Yes
Extend Min = Yes
The 'Extend Min' and 'Extend Max' options control what happens if the argument falls outside the table range. i.e. if 'Extend Min' is enabled and the argument value is below the minimum value in the table, then the table behaves as if the argument has the minimum value. In such a case but without 'Extend Min', the solver would stop with an error.
Note that the data pairs may also be defined in a separate data file. See documentation for more details.