CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   user fortran (

Fred May 11, 2005 11:17

user fortran
Hello everybody, Is it possible to use more than one fortran program in single analysis?If it can be done then how to compile and link it?.Can anyone please help me?

Regards Fred

RK May 11, 2005 19:17

Re: user fortran

Does putting all the necessary fortran files into one *.f file not work? For example, if you had USRSRC, USRBCS the you could put these files into a file called m01.f (one after each other) then run using

runsolve4 m01.fc -g m01.geo -f m01.f

(the above assumes CFX 4, and the command file (*.fc) and the geometry file (*.geo) is given a name; in this case m01.

Hope it helps and works.


Fred May 12, 2005 01:40

Re: user fortran
Hello RK, Thanks for ur suggestion. In my problem,i need 2 return variables from the program, but in cfx5.7 help it is given that only one variable can be returned in one program.So,i wonder is it possible to use 2 programs so i will have 2 return variables to use it in my analysis.

Thanking you once again Regards Fred

RK May 12, 2005 04:05

Re: user fortran
Hi Fred,

Sorry misunderstood your question...I may only be a handful of people who still uses CFX 4 (esp in this forum). I have not used CFX 5 in any shape or form, but if you can give more details about your needs then may be I can try to see if there is analogy between the programs...

(1) What USR fortran are using?

(2) What variables would you like it to retrun?

It is likley that I may not be able to assist in this matter...but I will try...


berny May 12, 2005 07:26

Re: user fortran
Of course you can link more than one on user-subroutine to cfx5. Simply give more than one routine the cfx5mkext.

Fred May 12, 2005 11:24

Re: user fortran
Hi RK&Berny, Thanks RK&berny. I have to add source terms through general momentum source option in subdomain form by user fortran.So the variable that i will be returning is a source value(N /m^3)>if i want to add source terms in x and y directions then i require 2 variables to be returned.

Berny if u dont mind can u list out the steps to link 2 user routines.I have tried the following way and not successfull: I have used 2 user routines and 2 user functions and while compiling i have typed the following command in the command editor. ! system ("cfx5mkext one.F two.F"); one and two are the two user fortan programs,in this only one of the program is getting compiled. I think this is not the correct way of linking 2 programs.How to do this?

Thank you Regards Fred

Robin May 12, 2005 12:03

Re: user fortran
Hi Fred,

You can combine multiple subroutines into a single fortran file, or alternatively run cfx5mkext twice, once for each routine. 'cfx5mkext' simply creates a shared library, it does not relink the code. The shared libraries are linked in at runtime, so you can have as many as you like.

Regards, Robin

Fred May 13, 2005 11:51

Re: user fortran
Hi berny and robin, Thanks for ur suggestion. Now i could link 2 user routines to the solver.

Regards Fred

All times are GMT -4. The time now is 14:03.