How can I obtain the time derivative of a variable?

This can be achieved with a user CEL routine as described below.


In some transient simulations, it can be useful to have access to time
derivative of variables. At time of writing, the current release (CFX-10.0)
does not provide a method of obtaining time derivatives of variables for use in
CEL expressions. This may become available as a standard feature of CEL in a
future release of the code, but until this functionality is available, user
Fortran provides a route to obtain time derivatives. Prospective users of this
code should first check whether time derivatives of variables are available in
CEL as a standard feature.


User Fortran routines USR_VEL_TDERIV and USR_PRES_TDERIV are wrapper routines
for the utility routine USER_GETVAR, which returns a pointer to the time
derivative field required. The variable name is hard-coded in these wrapper
routines. The user CEL function takes on argument which specifies the required
variable component for vector variables. For scalar variables, this argument
has no effect.


The example is of transient flow through a cube. All components of the velocity
time derivative are calculated as a vector additional variable. The pressure
time derivative is calculated as a scalar additional variable. Maximum values
are monitored and the variable fields are output to a transient results file.

To run the example:

- Create a user Fortran shared library from both user Fortran routines:

cfx5mkext -name test usr_pres_tderiv.F usr_vel_tderiv.F

- Edit the file test1.ccl such that the shared library path is correct:

- Write the command language (test1.ccl) into the definition file:

cfx5cmds -def test1.def -text test1.ccl -write

- Run the solver:

cfx5solve -def test1.def


The CEL functions (e.g. getutderiv(1) and getptderiv(1) in the example) can be
used in a CEL expression wherever the timederivative of velocity or pressure
are required. If time derivatives of other variables are required, it will be
necessary to write further wrapper routines and associated CEL functions for
these variables.

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