Compiling User Fortran with CFX 14.0 on Win64
2 Attachment(s)
I installed Microsoft Visual Studio 2012 and Intel Visual Fortran Composer XE 2013 on my PC.
I try to compile the TStat_Control.F (No.19 in tutorial file). I have added the enviroment variables as below: include: C:\Program Files (x86)\Intel\Composer XE 2013\compiler; C:\Program Files (x86)\Intel\Composer XE 2013\compiler\include\intel64 lib: C:\Program Files (x86)\Intel\Composer XE 2013\compiler\lib; C:\Program Files (x86)\Intel\Composer XE 2013\compiler\lib\intel64 path: C:\Program Files\ANSYS Inc\v140\CFX\bin; C:\Program Files (x86)\Intel\Composer XE 2013\bin; C:\Program Files (x86)\Intel\Composer XE 2013\bin\intel64; C:\Program Files (x86)\Intel\Composer XE 2013\redist; C:\Program Files (x86)\Intel\Composer XE 2013\redist\intel64; C:\Program Files (x86)\Intel\Composer XE 2013\redist\intel64compiler; C:\Program Files (x86)\Intel\Composer XE 2013\redist\intel64\mkl; C:\Program Files (x86)\Intel\Composer XE 2013\redist\intel64\mpirt; Then I run the "C:\Program Files (x86)\Intel\Composer XE 2013\bin\ifortvars" in command line, it appears: Then I type the following command in the Command Editor dialog box ! system ("cfx5mkext TStat_Control.F") == 0 or die "cfx5mkext failed"; The error message is like this: /*ERROR CCL parser failed with message: Perl Syntax errors detected: cfx5mkext failed at (eval 103) line 1.*/ Can someone help me ? Thanks a lot. |
Quote:
2. Open Command Line (Tools -> Command Line) 3. Inside Command Line execute: call "C:\Program Files (x86)\Intel\Composer XE 2013\bin\ifortvars" Intel64 4. Inside Command Line change directory to that where your source file is located. 5. Execute cfx5mkext <your_source_file_name>.F |
1 Attachment(s)
Quote:
I do it in steps as you told me. A warning message is shown in the pic underlined with red color. Is this OK? |
Quote:
|
Hey guys,
When I want to compile my fortran code in command editor I also receive this message. Seems that you have resolved it before. I am running CFX on a linux machine. p, li { white-space: pre-wrap; } ERROR CCL parser failed with message: Perl Syntax errors detected: cfx5mkext failed at (eval 106) line 1. Any ideas? |
Fortran Compiler error
Hi,
I am trying to simulate Air conditioning simulation tutorial 19.I have installed visual studio 2015 and intel FORTRAN compiler. when i run "C:\Program Files (x86)\Intel\Composer XE 2015\bin\ifortvars.bat" from CFX command editor i get following error ERROR CCL parser failed with message: invalid object type ""C": leading character must be alphabetic or '_' and when i run cfx5mkext TStat_Control from the windows command prompt it again gives some error and i am unable to generate .dll file for my simulation. I have attached error message, please help me to solve this problem http://s26.postimg.org/o1wwrnos5/error_1.jpg http://s26.postimg.org/ra1e4pb1x/error_2.jpg |
Quote:
Working through tutorial 19, I have the same problem. Asking Google and searching through the forum, I've tried a lot of things but still can't compile the example-sorce code TStat_Control.F. I'm working on a win7 64bit machine with ANSYS 15. The Visual Fortran Compiler XE 12.0 is installed. Processing the command ! system ("cfx5mkext TStat_Control.F") == 0 or die "cfx5mkext failed"; in Command Editor gives me the error: ERROR CCL parser failed with message: Perl Syntax errors detected: cfx5mkext failed at (eval 548) line 1. Processing the command call "C:\Program Files (x86)\Intel\ComposerXE-2011\bin\ifortvars" Intel64 in Command Editor gives me the error: ERROR CCL parser failed with message: invalid object type "call "C": contains invalid character '"' Do I have to add any "enviroment variables" like Raijin Thunderkeg did? If yes, where? Do I have to make any changes in cfx5mkext.ccl? Please, can anyone help me? I'm dealing with this problem for days now. :( Best Regards, Emil |
Quote:
|
Quote:
Executing the ifortvars.bat in this window works. But I'm getting still the same error. I think the Environment variables are missing. Where and how do I have to set them? Edit: I've tried to add the Environment variables, therefore I typed into the command line (is this correct???): set include=C:\Program Files (x86)\Intel\ComposerXE-2011\compiler;C:\Program Files (x86)\Intel\ComposerXE-2011\compiler\include\intel64 set lib=C:\Program Files (x86)\Intel\ComposerXE-2011\compiler\lib;C:\Pr...... set path=C:\Prog.............. now the error after trying to compile is : ERROR CCL parser failed with message: Perl Syntax errors detected: cfx5mkext failed at (eval 14) line 5. Thanks for your help! |
Quote:
|
2 Attachment(s)
Quote:
I started CFX-Pre and used command Editor for compiling, as described in the tutorial. Now I've checked your recommended procedure: executing the ifortvars.bat and cfx5mkext TStat_Control.F, both in command line. In the attached Picture you can check the procedure an see the error. http://www.cfd-online.com/Forums/att...1&d=1450186790 EDIT 2: I think I finally got it now!!!!! it works without error, I added Intel64 after the ifortvars.bat command and tried to compile again. In the working Directory the Folder winnt-amd64 was created. The ...dll file is the Thing I Need, correct? Do I Need the other filles ( .manifest .exp .lib .o ) as well? thanks a lot!!! |
Quote:
|
2 Attachment(s)
Quote:
After compiling some example-routines, unfortunately I have an other problem now. First of all, I want so start with a Routine which just gives one argument-value back. Therefore I copied the ucf_template.F. I didn't change anything but the calling name, filename and some comments. The code Looks like this: #include "cfx5ext.h" dllexport(sourcetest) SUBROUTINE SOURCETEST ( & NLOC, NRET, NARG, RET, ARGS, CRESLT, CZ,DZ,IZ,LZ,RZ ) C INTEGER NLOC,NARG,NRET C CHARACTER CRESLT*(*) C REAL ARGS(NLOC,NARG), RET(NLOC,NRET) C INTEGER IZ(*) CHARACTER CZ(*)*(1) DOUBLE PRECISION DZ(*) LOGICAL LZ(*) REAL RZ(*) C C Send any diagnostic messages via master process. CALL MESAGE( 'WRITE','Hello World!' ) C C Initialise RET(1:NLOC*NRET) to zero. CALL SET_A_0( RET, NLOC*NRET ) C C Copy first argument ARGS(1:NLOC,1) to RET(1:NLOC,1). CALL SET_A_B( RET, ARGS, NLOC ) C C Set success flag. CRESLT = 'GOOD' C C================================================= ====================== END If I insert the subroutine like this: http://www.cfd-online.com/Forums/att...1&d=1450353143 gives me the following error (code 2) after starting the solver in workbench, although I didn't use the Routine anywhere in my modell so far. http://www.cfd-online.com/Forums/att...1&d=1450353362 If I delete the Routine, the modell works as it did before. Any Ideas? EDIT: error in out file is: +================================================= ===================+ | ****** PROBLEM REPORT ****** | |--------------------------------------------------------------------| | Subsystem: Input and Output | | Subroutine name: ErrAction | | Severity level: Fatal Error | | Error message number: 001100279 | |--------------------------------------------------------------------| | Message: | | | | Unable to find library winnt-amd64/double/testreibw.dll on path "- | | D:\Benutzer\feld24\grob151125_pending_tasks\dp0_CF X_Solution-1\wi- | | nnt-amd64" | | | | | | | +================================================= ===================+ +================================================= ===================+ | ****** PROBLEM REPORT ****** | |--------------------------------------------------------------------| | Subsystem: Input and Output | | Subroutine name: ErrAction | | Severity level: Fatal Error | | Error message number: 001100279 | |--------------------------------------------------------------------| | Message: | | | | USER ROUTINE: sourcetry could not be loaded. Please check the Lib- | | rary Path, Library Name and Calling Name. For FORTRAN user routin- | | es, the Calling Name should be in lower case. | | | | | | | +================================================= ===================+ +================================================= ===================+ | ****** PROBLEM REPORT ****** | |--------------------------------------------------------------------| | Subsystem: Input and Output | | Subroutine name: ErrAction | | Severity level: Fatal Error | | Error message number: 001100279 | |--------------------------------------------------------------------| | Message: | | | | Stopped in routine UR_REGISTER | | | | | | | | | | | +================================================= ===================+ how can I compile with command line for double precision? Thanks a lot! |
Quote:
|
Quote:
But I've got an other Problem now. In each iteration loop (im doing a steady state simulation) the solver is calling the subroutine many many times. As my routine is only calculating on single scalar value as a function of a temperature wich is a result of the cfx-calculation, it would be enough to call the subroutine once per iteration loop (as the calculated value is always the same). In terms of saving computing time, is there a posibility to call the subroutine only once per iteration loop? The same modell (same mesh) using Expressions (in CFX-Pre) ist about 25% faster than using the subroutine. As my task is to replace the confusing expressions by a subroutine, I cannot go back and use expressions. I've tried to use a junction box routine with location "Start of Coefficient Loop: Called at the start of each iteration loop. For a transient run, this relates to the inner loop.", but this isn't changing anything. Any ideas? :( Thanks a lot!! :) :) :) A part out of the *.out file looks like this: ================================================== ==================== OUTER LOOP ITERATION = 1 CPU SECONDS = 4.289E+02 ---------------------------------------------------------------------- | Equation | Rate | RMS Res | Max Res | Linear Solution | +----------------------+------+---------+---------+------------------+ | Wallscale-Luft | 0.00 | 6.1E-03 | 2.8E-02 | 10.4 4.6E-02 OK| +----------------------+------+---------+---------+------------------+ | Wallscale-Bulk-Oelra | 0.00 | 6.2E-03 | 1.7E-02 | 14.7 4.0E-02 OK| +----------------------+------+---------+---------+------------------+ | U-Mom-Luft | 0.00 | 1.1E-06 | 5.9E-05 | 1.2E+01 F | | V-Mom-Luft | 0.00 | 2.0E-02 | 2.1E-01 | 4.6E-03 OK| | W-Mom-Luft | 0.00 | 2.0E-02 | 2.1E-01 | 4.0E-03 OK| | P-Mass-Luft | 0.00 | 3.4E-11 | 4.1E-10 | 41.5 4.6E+01 F | +----------------------+------+---------+---------+------------------+ | U-Mom-Bulk-Oelraum | 0.00 | 1.2E-06 | 1.1E-05 | 1.6E+01 ok| | V-Mom-Bulk-Oelraum | 0.00 | 1.6E-02 | 1.8E-01 | 1.1E-02 ok| | W-Mom-Bulk-Oelraum | 0.00 | 1.6E-02 | 1.8E-01 | 9.4E-03 OK| | Mass-OelInOelraum-Oe | 0.00 | 8.8E-05 | 7.0E-04 | 5.1E-03 OK| | Mass-LuftInOelraum-O | 0.00 | 3.6E-04 | 4.5E-03 | 23.6 5.5E-03 OK| +----------------------+------+---------+---------+------------------+ Call Subroutine "ReibwaermeModell" Call Subroutine "ReibwaermeModell" Call Subroutine "ReibwaermeModell" Call Subroutine "ReibwaermeModell" Call Subroutine "ReibwaermeModell" Call Subroutine "ReibwaermeModell" Call Subroutine "ReibwaermeModell" Call Subroutine "ReibwaermeModell" Call Subroutine "ReibwaermeModell" Call Subroutine "ReibwaermeModell" Call Subroutine "ReibwaermeModell" Call Subroutine "ReibwaermeModell" | H-Energy-Luft | 0.00 | 3.2E-02 | 5.6E-01 | 8.5E-02 OK| | T-Energy | 0.00 | 1.7E-02 | 4.8E-01 | 8.5E-02 OK| | H-Energy-OelInOelrau | 0.00 | 4.5E-08 | 2.1E-06 | 8.5E-02 OK| | H-Energy-LuftInOelra | 0.00 | 6.0E-08 | 1.2E-06 | 15.5 1.3E+03 ok| +----------------------+------+---------+---------+------------------+ | K-TurbKE-Luft | 0.00 | 3.5E-02 | 1.2E-01 | 5.7 2.1E-03 OK| | O-TurbFreq-Luft | 0.00 | 7.3E-02 | 1.0E+00 | 10.2 6.3E-03 OK| +----------------------+------+---------+---------+------------------+ | K-TurbKE-Bulk-Oelrau | 0.00 | 3.2E-02 | 1.2E-01 | 10.0 1.2E-02 OK| | O-TurbFreq-Bulk-Oelr | 0.00 | 7.1E-02 | 1.0E+00 | 8.4 2.9E-02 OK| +----------------------+------+---------+---------+------------------+ Slave: 2 Call Subroutine "ReibwaermeModell" Slave: 2 Call Subroutine "ReibwaermeModell" Slave: 2 Call Subroutine "ReibwaermeModell" Slave: 2 Call Subroutine "ReibwaermeModell" Slave: 2 Call Subroutine "ReibwaermeModell" Slave: 2 Call Subroutine "ReibwaermeModell" Slave: 2 Call Subroutine "ReibwaermeModell" Slave: 2 Call Subroutine "ReibwaermeModell" Slave: 2 Call Subroutine "ReibwaermeModell" Slave: 3 Call Subroutine "ReibwaermeModell" Slave: 3 Call Subroutine "ReibwaermeModell" Slave: 3 Call Subroutine "ReibwaermeModell" Slave: 3 Call Subroutine "ReibwaermeModell" Slave: 4 Call Subroutine "ReibwaermeModell" Slave: 4 Call Subroutine "ReibwaermeModell" Slave: 4 Call Subroutine "ReibwaermeModell" Slave: 4 Call Subroutine "ReibwaermeModell" Slave: 4 Call Subroutine "ReibwaermeModell" Slave: 4 Call Subroutine "ReibwaermeModell" Slave: 5 Call Subroutine "ReibwaermeModell" Slave: 5 Call Subroutine "ReibwaermeModell" Slave: 5 Call Subroutine "ReibwaermeModell" Slave: 5 Call Subroutine "ReibwaermeModell" Slave: 5 Call Subroutine "ReibwaermeModell" Slave: 5 Call Subroutine "ReibwaermeModell" Slave: 5 Call Subroutine "ReibwaermeModell" Slave: 5 Call Subroutine "ReibwaermeModell" Slave: 5 Call Subroutine "ReibwaermeModell" Slave: 5 Call Subroutine "ReibwaermeModell" Slave: 5 Call Subroutine "ReibwaermeModell" Slave: 5 Call Subroutine "ReibwaermeModell" Slave: 6 Call Subroutine "ReibwaermeModell" Slave: 6 Call Subroutine "ReibwaermeModell" Slave: 6 Call Subroutine "ReibwaermeModell" Slave: 6 Call Subroutine "ReibwaermeModell" Slave: 6 Call Subroutine "ReibwaermeModell" Slave: 6 Call Subroutine "ReibwaermeModell" Slave: 6 Call Subroutine "ReibwaermeModell" Slave: 6 Call Subroutine "ReibwaermeModell" ================================================== ==================== OUTER LOOP ITERATION = 2 CPU SECONDS = 1.826E+03 |
Every Partition of your Simulation is calling the subroutine. To prevent this you can get the parallel information and only let the master node call your subroutine; i.e.:
CALL GET_PARALLEL_INFO('PARMOD',PARTIT,CNAME,CRESLT) IF(PARTIT==1) THEN |
Quote:
Thanks a lot for your answer! where in my code do I have to apply this? My fist test doing it before executional statements gives the following error in the *.out file: ================================================== ==================== OUTER LOOP ITERATION = 1 CPU SECONDS = 3.604E+02 ---------------------------------------------------------------------- | Equation | Rate | RMS Res | Max Res | Linear Solution | +----------------------+------+---------+---------+------------------+ | Wallscale-Luft | 0.00 | 6.1E-03 | 2.8E-02 | 10.4 4.6E-02 OK| +----------------------+------+---------+---------+------------------+ | Wallscale-Bulk-Oelra | 0.00 | 6.2E-03 | 1.7E-02 | 14.7 4.0E-02 OK| +----------------------+------+---------+---------+------------------+ | U-Mom-Luft | 0.00 | 1.1E-06 | 5.9E-05 | 1.2E+01 F | | V-Mom-Luft | 0.00 | 2.0E-02 | 2.1E-01 | 4.6E-03 OK| | W-Mom-Luft | 0.00 | 2.0E-02 | 2.1E-01 | 4.0E-03 OK| | P-Mass-Luft | 0.00 | 3.4E-11 | 4.1E-10 | 41.5 4.6E+01 F | +----------------------+------+---------+---------+------------------+ | U-Mom-Bulk-Oelraum | 0.00 | 1.2E-06 | 1.1E-05 | 1.6E+01 ok| | V-Mom-Bulk-Oelraum | 0.00 | 1.6E-02 | 1.8E-01 | 1.1E-02 ok| | W-Mom-Bulk-Oelraum | 0.00 | 1.6E-02 | 1.8E-01 | 9.4E-03 OK| | Mass-OelInOelraum-Oe | 0.00 | 8.8E-05 | 7.0E-04 | 5.1E-03 OK| | Mass-LuftInOelraum-O | 0.00 | 3.6E-04 | 4.5E-03 | 23.6 5.5E-03 OK| +----------------------+------+---------+---------+------------------+ +--------------------------------------------------------------------+ | ERROR #001100279 has occurred in subroutine ErrAction. | | Message: | | Signal caught: Segmentation violation | | | | | | | | | | | +--------------------------------------------------------------------+ +--------------------------------------------------------------------+ | ERROR #001100279 has occurred in subroutine ErrAction. | | Message: | | Stopped in routine FPX: SIG_HANDLER | | | | | | | | | | | +--------------------------------------------------------------------+ +--------------------------------------------------------------------+ | An error has occurred in cfx5solve: | | | | The ANSYS CFX solver exited with return code 1. No results file | | has been created. | +--------------------------------------------------------------------+ End of solution stage. +--------------------------------------------------------------------+ | The following user files have been saved in the directory | | D:/Benutzer/feld24/20160202/sehrgrob20160121_pending_tasks/dp0_CF- | | X_Solution/Fluid Flow CFX_030: | | | | mon | +--------------------------------------------------------------------+ This run of the ANSYS CFX Solver has finished. |
Do you understand the fundamentals of how ANSYS CFX discretize the equations? If you read the documentation, you will notice that user subroutines are called on demand on group of elements or faces the software creates.
You can tell what group is the subroutine is called for. See USER_CALC_INFO documentation, and add the information returned to your print statements. The above applies to parallel and serial simulations. For parallel simulations, the software should only call the user subroutines on the partitions where the information is required. Bypassing the required values for such call will only corrupt the simulation because those partitions will have incomplete information. Hope the above helps, |
Quote:
I understand, that the solution given by PeMo would prevent the solver from calling the subroutine in most cases, which would probably cause abortion of the run, as the result-value from the subroutine is required. But is there no way to store the result after the first run of the subroutine and use the stored value again always when needed inside current Iteration Loop? |
Jepp, sorry didn't think through and just adapted it from my project. I have two subroutines, the first is evaluating the requested scalar and store it in the Memory Managment System (MMS), and the second (called at the master node) is calling a 1D routine and return a value.
So it depends on your routine but to my understanding it should be possible to let CFX calculate the scalar (via cel), call the subroutine once per iteration and store the return value in the MMS. |
Quote:
My 2 cents, and hope it helps |
Okay, Thanks!
|
I haven't read through your entire code but the fact that your routine is called several times within a single iteration isn't bad necessarily. Even if you run a serial computation some domains and boundaries are split in locales. I've had a similar experience and started outputting the amount of 'successful' actions of my subroutine and noticed it was never the same amount. In other words, as far as I understand, the entire domain is always split some form or another (irrespective of serial/parallel), so you'll always see multiple calls of your subroutine in a single iteration.
|
Quote:
The problem is: In the new model I'm using the subroutine instead of the cfx-pre-expressions (old model). Nothing else has changed. The new model needs more computing time compared with the old model. As my task is, to replace the expressions by a subroutine, i cannot go back and use expressions. Thats why I'm desperately looking for a possibility to save computing time.... |
I'm far from an expert on this stuff. But my gut feeling says that Fortran should be as fast if not faster than CEL for simple equations. Have you considered checking things other than the subroutine, like your source coefficient. I've used a different source option (general momentum) and tweaking that coefficient can significantly speed up your simulation.
|
thanks again for your answers so far!
i think im very close to a solution now my idea is, to find out the actual partition number and calculate the scalar only if Partition number is 1 in each Iteration loop. after having calculated it, i want to save it via Memory Manegement System (MMS) and read it from there, when partition number is different from 1. how can i save a value with MMS and read it from there? i've read chapter 18.6. from the solver modelling guide, but still have no idea how i can save and read values. Ive tried RZ(1)=P ...if Partition number is 1... ... ... P=RZ(1) ...else: Partition number not equal 1... but this didn't work. Thanks for your help!!! :) |
The only experience I have with that is passing data to CFX via a junction box sub routine. I'm guessing you'd have to save this data in a pointer probably. I'm not sure how much work this might be, otherwise you could consider making a multi-body mesh and only apply it on the relevant body. It's the same thing, just much easier to accomplish.
|
Quote:
It shows how to create a memory data area, store the value of interest, and later how to read it from another routine/function. Hope the above helps, |
Thank you for your answer!
I've read through example 18.8.1, I'think it's close to my Problem. My idea is now: First calculate and store my value once in each Iteration Loop, using a Junction Box Routine with Location "Start of Coefficient Loop: Called at the start of each iteration loop. For a transient run, this relates to the inner Loop." And then read it from stack with a CEL Routine, which is called as often as needed. My Problem now is: The junction box Routine is never executed and therefore the value the CEL Routine is reading from stack is allways Zero. Any ideas how i can get my Junction Box Routine working? Thank you! :) |
Did you activate the usage of the Junction Box Routine as outlined in the documentation ?
Quote:
|
All times are GMT -4. The time now is 16:17. |