Coupling a fortran file with CFX
Dear friends
I have time dependent first order differntial equation, solved by runge kutta method in a fortran file. The out put of the calculation is power for a heated pipe. Now how i can compile or execute the fortran file with the simulated pipe in cfx for a transient case? I do not have any experience for this type of coupling. Thanks |
If the fortran calculation is not coupled to the CFD it is very easy - just put the output into a 1D interpolation function.
If the fortran is coupled to the CFD you will need to put the fortran (or a link to it) in a user fortran routine. |
Regarding to problem physics, it is impossible to run fortran and cfx in decoupled format (the fortran file needs some parameters of fluid domain like density and velicity during run. The code gives feedbacks from fluid domain and then calculates power for cfx). Now how i can couple my code with cfx. Please explain the procedure step by step.
|
My last post described what is required for a coupled fortran routine. There are some examples of how to do this in the CFX documentation. I do not have time to write a step by step guide, especially as one already exists.
|
Thanks a lot for answer. How i can have this document ?Please if possible send it for me.
|
Quote:
|
1. You read carefully the part 18.2.1 in CFX of Help CFX. You will know the location to get your Junction Box Routine or User Function.
2. Write Junction Box Routine or User Function to caculate coupling 3. Note that, you have to compile your Junction Box Routine or User Function by "cfx5mkext -64bit name's Junction Box Routine or User Function" 4. Read examples of part 18.8 in CFX of Help CFX |
Thank you for your answers so far!
I have a very similar problem. I have read chapter 18: User Fortran, but I still have no idea how to compile the code. Do I need just a standard Fortran 77 compiler here? As a simple example, I wanted to test this user routine: #include "cfx5ext.h" dllexport(test) SUBROUTINE TEST (NLOC,NRET,NARG,RET,ARGS,CRESLT,CZ,DZ,IZ,LZ,RZ) C INTEGER NLOC,NARG,NRET CHARACTER CRESLT*(*) REAL ARGS(NLOC,NARG), RET(NLOC,NRET) C INTEGER IZ(*) CHARACTER CZ(*)*(1) DOUBLE PRECISION DZ(*) LOGICAL LZ(*) REAL RZ(*) C RET = 2000*ARGS(1,1) END Using a Fortran 77 or Fortran 90 compiler produces errors. What do I have to do? Thanks a lot! |
RET is an array of size NLOC x NRET; therefore, should you not fill in NLOC x NRET entries instead of
RET = 2000 * ARGS(1,1) For example, DO IRET = 1,NRET DO ILOC = 1, NLOC RET(ILOC,IRET) = 2000 * ARGS(1,1) ENDDO ENDDO Also, you did not say what error has been detected by the compiler.. |
1 Attachment(s)
Thank you for your help!
I've tried #include "cfx5ext.h" dllexport(reibmodell) SUBROUTINE REIBMODELL (NLOC,NRET,NARG,RET,ARGS,CRESLT,CZ,DZ,IZ,LZ,RZ) C INTEGER NLOC,NARG,NRET CHARACTER CRESLT*(*) REAL ARGS(NLOC,NARG), RET(NLOC,NRET) C INTEGER IZ(*) CHARACTER CZ(*)*(1) DOUBLE PRECISION DZ(*) LOGICAL LZ(*) REAL RZ(*) C DO IRET = 1,NRET DO ILOC = 1, NLOC RET(ILOC,IRET) = 2000 * ARGS(1,1) ENDDO ENDDO END Thanks a lot! :) |
It would be good to see your compilation line.
It seems the preprocessing directive # are not being used, that is the compile line did not include cpp, or fpp support. |
I think so, too.
Does #include "cfx5ext.h" only work, when Ansys CFX is installed on the system? Because on this machine I don't have Ansys. On the computer, on which I can use Ansys I can compile only Fortran 90 code. On the attached image you can see the complete Force 3.0 screen with source code, errors.... Thank you!! |
Think I finally got it, thanks!
|
All times are GMT -4. The time now is 19:36. |