- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When I write a subroutine in Intel Fortran 10.1 (through Visual Studio 2008), it saves the file as a .f90 however I need to file type to be .for. However when I go to file - save as - and type filename.for, it seems to green out all the code. This seems to be causing me problems with my code.I have attached both files to this post.Is there a more efficient and reliable way to change my .f90 files to .for? I need the .for file types ofso I can use them withanother programming which reads .for subroutines.
Thank-you very much.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello mechprog,
This is because .for files are fixed format Fortran files, and the first five rows should generally be left blank in fixed format Fortran. The following article has more information about fixed format Fortan -http://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/2011Update/fortran/win/lref_for/source_files/pgbsfixd.htm
Regards, Annalee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why do you need "valid .for code"? .f90 files are just as valid.
Fixed format means :
column 1 to 5 used for statement label
column 6 used for continuation indicator
column 7 to 72 used for program statements
Free format means these restrictions do not apply. Statements are not limited to specific column positions in a source file.
See the help (under Contents -> Language Reference -> Program Structure -> Source Forms
As you are new to programming I would reccommend as a starting point
(a) use free format it is less error prone.
(b) ALWAYS have "implicit none" in your routines.
(c) learn the modern Fortran language style (rather than F77 style) for example you can use whole array operations instead of do-loops
(d) learn about modules, they are another great means of reducing errors.
Hope this helps
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your feedback, as I am currently really stuck with these fortran coding problems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. As Fortran source files (either in fixed on in free form) are simply ordinary text files,
you can use your favourite text editor to create and edit them. Once you are done,
you can either import them into Visual Studio or use the command-line mode to
compile them. This will give you the opportunity to correct syntactical and other
mistakes.
(I find the command-line mode to be very useful for small projects - one or two
source files, say, because Visual Studio, while wonderful for large ones,tends to
be a bit of a burden if you only have a single source file.)
2. You can use free form source code instead. Perhaps you need to read up on this
type of files, but I find free form to be easier to work with myself. There are
plenty of online resources and books on paper to fill you in on these and other
aspect of Fortran 90 and later standards.
Regards,
Arjen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunetly I need to only use .for files (as I understand so far, this is only fixed type). I am not sure why Abaqus can only read this type of code?
I have checked to ensure there are no problems in the configuration between the Intel Fortran compiler and Abaqus and there is no issue. All the checks passed.
I have attached an updated .for file to this post, is the syntax now corrected? Am I still missing something here?
Thanks again for everyone help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
continuation is done using a non-space, non-zero character in the sixth column and you have it
in the seventh (this counting is one aspect of fixed form that makes it cumbersome to use).
Compiling the source (outside the Abaqus environment) will quickly give you the information
on syntax errors and such.
Regards,
Arjen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks again. I am sure I will be posting on here again soon. Apparently I am "green-belt", thank you Sensai Intel :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Arjen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fixed form can at times hide syntax errors and coding errors. i.e. the compiler will not detect/report error due to the programming error looking like valid statements considering what is in/(not in) columns 1:6.
If you prefer to use your favorite editor, I would suggest you write a GREP or other text file filtering program to find lines with TAB's on them and which you then replace the TAB with the appropriate number of spaces.
Then filter to find lines with non-space in column 6. Visually assert that these are proper continuation lines. (and have either a numeric or * character)
Then filter to find lines to find lines with non-space/non-numeric characters in columns 1:5 (these are in error)
Then filter to find lines without spaces as the first5 characters. These should be all numeric. Inspect these lines to assert that they are valid continuation lines.
*** Note
I do not use ABACUS so I do not know what it is looking for in your .FOR files. If it is looking for data/common declarations then you might get by with compiling as .f90, copy/rename appropriate file(s) to .FOR, then process file with ABACUS. If ABACUS is generating the .FOR files then these should be proper F77 .FOR files suitable for use by IVF.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
JMN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regarding Abaqus and fixed/free form. In the file abaqus_v6.env you can find the compiler directives used for compiling Fortran source files to use with Abaqus. The line lookes like this:
compile_fortran=['ifort', '/c','/DABQ_WIN86_64', '/recursive', '/Qauto-scalar', '/QxW', '/nologo', '/Od', '/include:%I']
If you add the compiler directive /free to this line, you can use free form source code with Abaqus, e.g.
compile_fortran=['ifort', '/c','/DABQ_WIN86_64', '/recursive', '/Qauto-scalar','/free', '/QxW', '/nologo', '/Od', '/include:%I']
abaqus_v6.env is found in C:\\SIMULIA\\Abaqus\\6.10-2\\site
I never use the command line for compiling, so I don't know if any of the other directives could be changed to improve performance.
Unfortunately I never found a way to use modules with myFortran source code inAbaqus. Maybe some changes in the compiler directives can make this possible... Does anyone have any experience with this?
j_clausen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is such a useful post for fortran-abaqus users. Thanks for taking the time to post this. I am assuming you need to select either fixed or free format and stick with that?
With regards to the use of modules, do you mean developing functions or subroutines within the primary subroutine? I am not sure about that? I am having enough of a challenging dealing with one subroutine alone :-) I look also forward to input from others on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So a question I have is if anyone outthere have managed to use modules from Abaqus?
Another thing: Do any of the Fortran Experts out there have any general comments on the default compiler directives used in Abaqus (shown in my previous post). Do they look good for the task, or are any of them odd?
Best regards
j_clausen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am no expert on Abaqus, but a workaround (if I understand the interfacing correctly) would be:
module your_modules
... all the code you need in one or more modules
end module your_modules
subroutineentry_from_abaqus( ...)
use your_modules
... thin layer tocall the module procedures
end subroutine entry_from_abaqus
(Adjust for fixed form or use the compile option to treat .for files as free form)
The basic idea is to let Abaqus call a subroutine that lives outside any module which then
calls the routines that do live in modules. That way you get most of the benefits of modules.
Regards,
Arjen

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page