- **CFX**
(*https://www.cfd-online.com/Forums/cfx/*)

- - **Loading expressions into fortran routine
**
(*https://www.cfd-online.com/Forums/cfx/25307-loading-expressions-into-fortran-routine.html*)

Loading expressions into fortran routine
Hi,
Is there a way for me to load expressions defined in CFX-Pre into my fortran routine for use in a transient run. eg. if I have an expression FX = force_x()@Structure - can this be accessed in my fotran routine? (I know there are other ways to achieve the resulting force on a boundary, but the question here is how to load an expression into my fortran routine). - ats |

Re: Loading expressions into fortran routine
Dear ats,
That cannot be done directly. There several alternatives Alternative 1: done by using USER_GET_GVAR. Please take a look at the documentation. For an example, CALL USER_GET_GVAR (' ','Structure','force_x', & CRESLT,REXPRESSION, & CZ,DZ,IZ,LZ,RZ) CALL USER_PRINT_REAL('area_x()@Inlet',REXPRESSION) Alternative 2: Create an Additional Variable, set it as an Algebraic Equation, and make it equal to force_x()@Structure. Then, pass it as argument list to your USER CEL function (fortran routine). Hope this helps, Opaque |

Re: Loading expressions into fortran routine
Thank you for the reply.
Alternative 1 is not a possibility, simply because in this case I need area integrated values that aren't integrated over the entire boundary. Alternative 2 could work I suppose, but will it not take an entire column in ARGS of size (NLOC,1) ? - ats |

Re: Loading expressions into fortran routine
I tried creating an additional variable:
FX: Variable type - Specific Units - [N] Tensor Type - Scalar and in Domain/Fluid Models I set it to "Algebraic Equation" with the expression "force_x()@Structure". When I use this as argument for my CEL function I get the following msg in the .out file: ERROR #001100279 has occurred in subroutine ErrAction. Message: The fluid/solid qualifier for the additional variable FX cannot be determined. Please ensure that the name is prefixed with the fluid or solid name. Any pointers? - ats |

Re: Loading expressions into fortran routine
Dear ats,
I think the message is very clear. The solver is expecting (not sure why) that you prefix the variable FX by the fluid/solid using it. Try doing so, as in MyFluid.force_x()@Structure, where MyFluid is the name of the fluid you are using. Also, the single value will use a full array (1:NLOC) since the mechanism to transfer data does not differentiate a single value from a multivalue arg list. It only knows is a variable. Opaque |

Re: Loading expressions into fortran routine
Ok thank you, I will try that
- ats |

Re: Loading expressions into fortran routine
I have tried changing my additional variable to 'Air at 25 C.force_x()@Structure', which does not cause for any warnings in PRE. However when I run the solver, I get the following two errors:
ERROR #001100279 has occurred in subroutine ErrAction Message: An error: Illegal Vector Component for callback function force_x()@Structure Details of error:- ---------------- Error detected by routine MAKDAT CDANAM = LVAR CDTYPE = INTR ISIZE = 90 CRESLT = OLD Current Directory : /FLOW/ALGORITHM/ZN1/SYSTEM/VARIABLES I really am desperate to figure this out, as it is halting all progress. |

All times are GMT -4. The time now is 02:11. |