CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

Loading expressions into fortran routine

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 26, 2008, 05:47
Default Loading expressions into fortran routine
  #1
ats
Guest
 
Posts: n/a
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
  Reply With Quote

Old   February 26, 2008, 10:20
Default Re: Loading expressions into fortran routine
  #2
opaque
Guest
 
Posts: n/a
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

  Reply With Quote

Old   February 26, 2008, 10:29
Default Re: Loading expressions into fortran routine
  #3
ats
Guest
 
Posts: n/a
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
  Reply With Quote

Old   February 26, 2008, 10:54
Default Re: Loading expressions into fortran routine
  #4
ats
Guest
 
Posts: n/a
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
  Reply With Quote

Old   February 26, 2008, 12:01
Default Re: Loading expressions into fortran routine
  #5
opaque
Guest
 
Posts: n/a
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

  Reply With Quote

Old   February 26, 2008, 20:08
Default Re: Loading expressions into fortran routine
  #6
Anders
Guest
 
Posts: n/a
Ok thank you, I will try that

- ats
  Reply With Quote

Old   February 27, 2008, 05:35
Default Re: Loading expressions into fortran routine
  #7
ats
Guest
 
Posts: n/a
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.
  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CFX11 + Fortran compiler ? Mohan CFX 20 March 30, 2011 19:56
user routine, user funcion, or fortran compile effect on the memroy? princeps11 CFX 1 May 13, 2009 19:37
user subroutine error CFDUSER CFX 2 December 9, 2006 07:31
user defined function cfduser CFX 0 April 29, 2006 11:58
FORTRAN Routine - variable passing Malcolm CFX 1 August 11, 2005 19:51


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