Topics relate to Fluent, CFX, Turbogrid and more

A tip for CFX USER Fortran

    • Min Zhang

      In the past two days, I performed a CFX simulation which called a fortran code to calculate an algebraic addition variable and a momentum source term simultaneously. 

      User Function: mom source(args)

      If the Additional Variable (mom_add) is not set on the Fluid Models tab (just the momentum source is defined), the solver can finish normally. However, when mom_add is specified using the User Function mom source(args), an "solver-impi.exe" error is reported by CFX-Solver at the end of the run and no .res file is saved. 

      A similar problem is mentioned in CFD Online website, while it was unfortunately not solved.


      This situation occurs only if the addition variable is activated. So it is not caused by parallel setup (Intel MPI). 

      As I know relatively little about Fortran, I just thought this error is due to the USER_GETVAR routine which is applied to calculate velocity gradient tensor. Then i reviewed "USER CEL Example 2" in CFX Manual and embedded that into my own simulation. The type of phi2 (declared using transport equation in the Example) is changed to an algebraic variable, and phi2 is calculated using the same 'AdVarSource.F' code (offered in examplesUserFortran).

      phi2 can be calculated and no error occurs.

      This puzzled me, so i checked my own code and deleted some unnecessary local variables. Finally and fortunately, the solver ran well and finished normally. Therefore, if the simulation is complex and large, trying to define variables in Fortran codes as little as possible.

      PS: some spelling errors cannot be recognized when compile the code using cfx5mkext script in the command line, and the solver just stop without offering enough information. So, just be careful.

      I spent two days to solve this problem and hope this information can be helpful for others.


    • Jimmyhan

      Your suggestion really helps. by the way, it is very important in my mass transfer simulation when I set source.

Viewing 1 reply thread
  • The topic ‘A tip for CFX USER Fortran’ is closed to new replies.