|
[Sponsors] |
May 19, 2016, 04:35 |
CFX User Fortran caveats
|
#1 |
New Member
HLo
Join Date: Dec 2013
Location: Germany
Posts: 26
Rep Power: 12 |
Hello,
I'd like to share my experience about some issues I came across when I used User Fortran to build a 1D scalar time integration routine. Works well (even in MINGW-gfortran environment), but there are some points to take into account. The behaviour of the program logic and fortran routines is as designed (no bug) and straightforward, but not as obvious to notice at first sight. For the integration or similar tasks one has to store a previous value of the scalar or result, which -as such- can easily be established in fortran, BUT: a) If one wants to use the routine in more than one CEL expression, the stored values are accessed by each call so the integration is done repeatedly !! b) Sometimes the routine is called twice within one time step, I noticed that, when I used a interrupt condition for the solver: 1st call is as expected, 2nd call is at the same timestep for checking the condition ==> integration is done twice Resolution proposal: for a) in routine keep the previous values and/or results in a array, and call it with an additional parameter for the array position, example CEL calls: exp1=integr(1,val,initval,...) exp2=integr(2,val2,....) What might work also is registering the function twice with different name with two separate dlls (simply a copy of master dll) for b) do a check in the routine, whether the call's timestep no. is greater than the previous call's timestep no., which obviously has to be kept in the routine too: if YES calculate, if NO return the stored result. Proposed call to fortran routines: expr1=integr(array-id, expr to do calcs from, initial val of expr, inital result, timestepsize, accumlated timestep no.) Good luck PS: If interested in time integration of a variable, without User Fortran, see: http://www.cfd-online.com/Forums/cfx...tml#post465756 ff. If interested in MINGW-fortran see: http://www.cfd-online.com/Forums/cfx...nnt_amd64.html |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
User fortran: Transiet boundary simulation | Casper_07 | CFX | 3 | May 10, 2016 20:54 |
How to set environmental variables of Intel Fortran +CFX? | Christine MO | CFX | 0 | September 23, 2011 11:11 |
how to write user fortran for turbulence model | waynezw0618 | CFX | 2 | July 10, 2009 01:55 |
CFX arc-modeling, User Fortran, CEL.... | Bloshchitsyn Vladimir | CFX | 0 | October 15, 2007 06:17 |
how to use USER FORTRAN with CFX | cfd_99 | Main CFD Forum | 1 | June 4, 1999 05:42 |