Fortran Courses

ASTG currently offers courses on the use of Fortran for scientific computing. The courses cover introductory as well as advanced topics in Fortran, and are available to anyone in the NASA community. A description of the courses are provided below, as well as links to register for the courses.

Fortran Courses

Introduction to Fortran

  • Dates: April 10 & April 12, 2024 (08:30 to 15:30 US EST)
  • SATERN Course ID: 136288
  • SATERN Registration Link: GSFC-ITF

Description

Fortran is a computer programming language that is extensively used in numerical and scientific computing. It has a strong user base with scientific programmers, and is used to develop weather forecasting and financial trading models as well as engineering simulations. Fortran programs can be highly optimized to run on high performance computers, and in general the language is suited to producing code where performance is important.

Fortran is a compiled language, that is, you must perform a special step called compilation that translates your written code into machine code before you are able to run it on a computer. This is where Fortran differs with interpreted languages such as Python and R which run the code through an interpreter that in turn executes the instructions directly, but at some performance cost.

In this two-day course, we will introduce the main concepts of the Fortran programming language. We will learn how to write simple Fortran programs and will design and write a complex application. Throughout this hands-on class, we will solve several exercises to reinforce what is presented.

Target Audience

This course will be useful for scientists and engineers who want to start programming in Fortran or transition from Fortran 77 to Fortran 90.

Prerequisites

Familiarity with computer programming, and if possible any compiled language. You will be asked to provide your gmail userid in order to be granted access to the NASA Center for Climate Simulation (NCCS) Science Data Managed Cloud Environment (SMCE).

Expected Outcomes

After this workshop, participants will be able to:

  • Understand
    • Fortran data types
    • How to perform arithmetic operations
    • How to write conditional statements, loops
    • How to write subroutines, functions and modules
    • How to manipulate data array
    • The different components of a Fortran programs
  • Write a Fortran application (including functions/subroutines) from scratch
  • Read/Write files
  • Compile and run the application.
  • Understand how to write a Makefile file needed to compile a Fortran application.

Jupyter Notebook

You might find it useful to learn little more about Jupyter notebook: Open In Colab

Teaching Tool and Platform

All the materials are written in Jupyter notebook files to facilitate accessibility, readability and maintainability. Whenever necessary, we may write and execute simple Fortran programs directly from Jupyter notebook cells. Most the time we will use the command line to write, compile and execute Fortran programs.

The teaching platform will be the NASA Center for Climate Simulation (NCCS) Science Data Managed Cloud Environment (SMCE). It is a cloud based system that is accessible through a browser. You can log in to the SMCE through the user portal.

It is assumed that you have already provided your gmail userid. You will use your gmail credential to automatically access the system. It is recommended that you first use a browser to access your gmail account and then click on the link above.

Git

Familiarity with basic Git is recommended. Please check the following tutorials:

Topics

The following topics will be covered:

Day 1:

Introduction
  • History of Fortran
  • Compilers
  • First Fortran Program
  • Fortran Program Structure
Variables and Data Types
  • Variable Naming Convention and Declaration
  • Integer Data Type
  • Real Data Type
  • Logical Data Type
  • Character Data Type
  • Complex Data Type
Conditionals and Loops
  • If-Else
  • Select Case
  • Do Loops
  • While Loops
  • Loops: Exit and Cycle
Array Concepts
  • Declaring and Initializing Arrays
  • Array Constructors
  • Array Slicing
  • Where Structure

Day 2

Subroutines and Functions
  • User Defined Subroutines
  • Keyword Calls and Optional Arguments
  • User Defined Functions
  • Intrinsic FunctionA
Modules and Interfaces
  • Module Procedures
  • Public and Private Accessibility
  • Explicit Interfaces
File I/O
  • Internal File IO
  • Formatted IO
  • Non-Advancing IO
  • Namelist
Derived Types and Pointers
  • Derived Types
    • Declaration
    • Defining values
    • Component Selection
    • Nesting Derived Types
    • Use in modules
  • Pointers
    • Tartget and Association
    • Array Pointers
    • Linked List

Useful Resources

Instructors

This class was prepared and will be presented by:

Modern Fortran

  • Dates: April 26, 2024 (08:30 to 15:30 US EST)
  • SATERN Course ID: 136280
  • SATERN Registration Link: GSFC-600-MFOI

Description

Fortran, despite its very long history, is still one of the most widely used programming languages in scientific computing. It is well-suited for numerical computing because of its performance, simple syntax and inherent treatment of standard mathematical objects, especially multi-dimensional arrays. It is heavily used in numerical and high performance computing, especially in climate research, numerical weather prediction, finite element analysis, trajectory optimization and computational science. This course introduces some of the Fortran 2003 features, expecially the enhanced object-oriented capabilities. We will cover for instance, type-bound procedures, type extensions and inheritance, polymorphism and dynamic type allocation. We hope that participants will use these features to modernize their Fortran applications.

Target Audience

This course will be useful for scientists and engineers who are familiar with Fortran and want to learn Fortran’s object oriented programming features and interface their Fortran programs with C.

Prerequisites

Familiarity with Fortran 77/90/95a. You will be asked to provide your gmail userid in order to be granted access to the NASA Center for Climate Simulation (NCCS) Science Managed Cloud Environment (SMCE).

Expected Outcomes

After this course, participants will be able to:

  • Use derived types and generic procedures.
  • Add object-oriented-like features to an application
  • Write a Fortran application using object-oriented programming techniques.
  • Interoperate Fortran with C.
  • Use Makefiles to manage Fortran-based applications

Jupyter Notebook

You might find it useful to learn little more about Jupyter notebook: Open In Colab

Teaching Tool and Platform

All the materials are written in Jupyter notebook files to facilitate accessibility, readability and maintainability. Whenever necessary, we may write and execute simple Fortran programs directly from Jupyter notebook cells. Most the time, we will use command line to write, compile and execute Fortran programs.

The teaching platform will be the NCSS SMCE. It is a cloud based system that is accessible through a browser. You can log in to the SMCE through the user portal.

It is assumed that you have already provided your gmail userid. You will use your gmail credential to automatically access the system. It is recommended that you first use a browser to access your gmail account and then click on the link above.

Git

It might be useful to learn how to do version control with Git. Git is the industry standard. Please check the following tutorials:


Topics

As time permits, we will cover The following topics:

General enhancements
  • Data enhancements
  • ISO_FORTRAN_ENV module
  • Allocate statement and new allocation features
  • Parameterized derived types
Introduction to OOP
  • Data Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism
Inheritance
  • Variables as Objects
    • Type Bound Procedures
  • Type Extension and Inheritance
    • Extends Attribute
    • Abstract Types
    • Abstract Interfaces
Polymorphism
  • Procedure Polymorphism
  • Data Polymorphism
I/O Enhancements
  • Stream I/O
  • Asynchronous I/O
Miscellaneous Items
  • Access to Computing Environment
  • IEEE modules
Interoperability with C
  • ISO_C_BINDING
  • Intrinsic Types
  • Interoperable Procedures
  • Interoperable Data

Useful Resources

Instructors

This class was prepared and will be presented by:

Modern Fortran - Interoperability

Modern Fortran Workshop: Enhancing Scientific Computing with Interoperability

  • Dates: March 26 & 28, 2025 (09:30 to 15:30 US EST)
  • SATERN Registration Link: GSFC-600-MFWI

Description

Fortran remains a cornerstone language in scientific computing, valued for its exceptional performance, simple syntax, and native support for mathematical constructs like multi-dimensional arrays. It is widely used in fields such as climate research, numerical weather prediction, finite element analysis, trajectory optimization, and computational science. This workshop introduces key features of modern Fortran, with a special emphasis on its interoperability with other programming languages, including C, C++, and Python. Participants will explore techniques to seamlessly integrate Fortran code into multi-language projects, leveraging its numerical efficiency while utilizing the broader ecosystems of these languages.

Topics will include:

  • Interfacing Fortran with C/C++ using standardized ISO C bindings.
  • Integrating Fortran with Python using tools like f2py and custom bindings.
  • Best practices for mixed-language development and performance optimization.

We will also touch on modern Fortran concepts such as type-bound procedures, polymorphism, and dynamic type allocation to help participants refine existing applications and build efficient, interoperable solutions.

Target Audience

This workshop is ideal for scientists, engineers and code developers looking to modernize their Fortran workflows and integrate them into diverse software environments.

Prerequisites

Familiarity with Fortran 77/90/95a. You will be asked to provide your gmail userid in order to be granted access to the NASA Center for Climate Simulation (NCCS) Science Managed Cloud Environment (SMCE).

Jupyter Notebook

You might find it useful to learn little more about Jupyter notebook: Open In Colab

Teaching Tool and Platform

All the materials are written in Jupyter notebook files to facilitate accessibility, readability and maintainability. Whenever necessary, we may write and execute simple Fortran programs directly from Jupyter notebook cells. Most the time, we will use command line to write, compile and execute Fortran programs.

The teaching platform will be the NCSS SMCE. It is a cloud based system that is accessible through a browser. You can log in to the SMCE through the user portal.

It is assumed that you have already provided your gmail userid. You will use your gmail credential to automatically access the system. It is recommended that you first use a browser to access your gmail account and then click on the link above.

Git

It might be useful to learn how to do version control with Git. Git is the industry standard. Please check the following tutorials:


Useful Resources

Instructors

This class was prepared and will be presented by: