How can I obtain a solution variable at a previous time step for use in a CEL expression?


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


INTRODUCTION

At time of writing, (current release is CFX-10.0) CEL expressions only allow variables to be used at the current time level. In some transient simulations, it can be useful to have access to variables at the previous time level. This is planned as a standard feature of CEL in a future release of the code, but until available, this Fortran utility provides this capability. Prospective users of this utility should first check whether previous time level values are available in CEL as standard.


DETAILS

The main routine is USR_PHI_OLD, which is a generic routine to obtain any variable at the previous time step.

The variable name should be hard-coded in the calling routine rather than in USR_PHI_OLD. Note that if the mesh locale requested by the solver is not supported, this routine will terminate with CRESLT=NONE. In some cases this will cause the solver to fail. Currently, the only locale supported is zone vertices. Further locales can be coded for if required.

For vector variables, the vector name should be used when calling this routine from its wrapper. The CEL function to which this routine is linked should have one argument specifying the required variable component. For scalar variables the value of this argument is indeterminate.


EXAMPLE

The attached zip archive file contains an example of transient flow through a cube. The u and v components of velocity are monitored at both the current and previous time level, using monitor points which show the average values. The supplied image (mon_plot.png) shows all four of the monitored values plotted over a short run. As expected, the values at the previous time level lag those at the current time level.

A wrapper routine USR_VEL_OLD has been defined to call USR_PHI_OLD. This is associated with the CEL function 'velold',whose single argument is used to specify the required vector component.

To run the example:

- Create the user Fortran shared library:

cfx5mkext -name test usr_vel_old.F usr_phi_old.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


GENERAL USAGE

The additional variables in the example are only necessary for use with the monitor points. The CEL function(e.g. velold(1) in the example) can be used in a CEL expression wherever a variable is required at the previous time step. If other variables are required, it will be necessary to write further wrapper routines and associated CEL functions for these.





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