I have a question about FORTRAN

  • Context: Fortran 
  • Thread starter Thread starter FuriousJ
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary
SUMMARY

This discussion focuses on using modules in FORTRAN, specifically how to create and utilize a global module file named global.f95 across multiple FORTRAN source files. The key takeaway is that to access the contents of global.f95, a USE statement must be included in each subroutine or function that requires the module. This process is straightforward once the correct syntax and structure are understood, contrary to the initial assumption of complexity.

PREREQUISITES
  • Basic understanding of FORTRAN programming language
  • Familiarity with creating and using modules in FORTRAN
  • Knowledge of the USE statement in FORTRAN
  • Experience with Makefiles for compiling FORTRAN code
NEXT STEPS
  • Research how to structure a global module in FORTRAN
  • Learn about the compilation process of multiple FORTRAN files using Makefiles
  • Explore advanced module features in FORTRAN, such as private and public variables
  • Study examples of using the USE statement effectively in various contexts
USEFUL FOR

FORTRAN learners, software developers working with scientific computing, and anyone looking to improve their modular programming skills in FORTRAN.

FuriousJ
Messages
5
Reaction score
0
So I'm starting to learn FORTRAN, and I'm starting to do makefile's and modules.

Now the book I have that I've been learning from tells me all about Modules that I can put at the beginning of a file for use throughout the rest of that file, but seems to be glazing over how I can have a global.f95 module that I can call from other .f95 files. I assume this is more simple to do than the amount of time I've been trying to get it to work would indicate, is this a correct assumption? Or is it a difficult process?
 
Technology news on Phys.org
FuriousJ said:
So I'm starting to learn FORTRAN, and I'm starting to do makefile's and modules.

Now the book I have that I've been learning from tells me all about Modules that I can put at the beginning of a file for use throughout the rest of that file, but seems to be glazing over how I can have a global.f95 module that I can call from other .f95 files. I assume this is more simple to do than the amount of time I've been trying to get it to work would indicate, is this a correct assumption? Or is it a difficult process?

You must include a USE statement for the module
in each subroutine or function that requires use of the module.
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 17 ·
Replies
17
Views
6K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 2 ·
Replies
2
Views
18K