CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CFX (http://www.cfd-online.com/Forums/cfx/)
-   -   Loading expressions into fortran routine (http://www.cfd-online.com/Forums/cfx/25307-loading-expressions-into-fortran-routine.html)

ats February 26, 2008 05:47

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

opaque February 26, 2008 10:20

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


ats February 26, 2008 10:29

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

ats February 26, 2008 10:54

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

opaque February 26, 2008 12:01

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


Anders February 26, 2008 20:08

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

- ats

ats February 27, 2008 05:35

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 03:11.