Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.gitattributes text eol=lf
.gitignore text eol=lf
Makefile text eol=lf
*.yml text eol=lf
LICENSE text eol=lf
*.ipynb text eol=lf
*.txt text eol=lf
*.py text eol=lf
*.sh text eol=lf
*.c text eol=lf
*.cpp text eol=lf
*.f text eol=lf
*.f90 text eol=lf
*.for text eol=lf
*.md text eol=lf
*.rst text eol=lf
*.csv text eol=lf
*.m text eol=lf
*.grc text eol=lf
*.pas text eol=lf
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.out
fort.12
driver
*.a
*.o
*.exe
*.mod
*.so
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
Makefile
build/
*.egg-info/
basic
__pycache__/

55 changes: 55 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
language: generic

os:
- linux
- osx

dist: trusty
group: edge

env: TRAVIS_PYTHON_VERSION=3.6 FC=gfortran

notifications:
email: false

git:
depth: 3

addons:
apt:
packages:
- gfortran

before_install:
- if [[ $TRAVIS_OS_NAME == osx ]]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
brew update;
brew install gcc;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi

- bash miniconda.sh -b -p $HOME/miniconda
- export PATH=$HOME/miniconda/bin:$PATH
- hash -r

- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda create -n test python=$TRAVIS_PYTHON_VERSION
- source activate test
- pip -q install coveralls

install:
- python setup.py develop

script:
# test fortran-only "basic" program
- cd build
- cmake ..
- make
- cd ..
# separately (previous 4 lines not needed) test python access to Glow
- coverage run tests/test.py -v

after_success: coveralls

45 changes: 45 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
cmake_minimum_required (VERSION 2.8.12)
project(glow Fortran)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ..)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ..)

add_compile_options(-O3 -g)

if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
add_compile_options(-debug full -traceback -fpe-all=0 -check all)
else()
add_compile_options(-mtune=native -Warray-bounds -fexceptions -fbacktrace)
endif()
# --------- GLOW library -------------------
add_library(glow cglow.f90 glow.f90 bands.f90 conduct.f90 egrid.f90 ephoto.f90 etrans.f90 exsect.f fieldm.f gchem.f90 geomag.f90 maxt.f90 mzgrid.f90 qback.f90 rcolum.f90 rout.f90 snoem.f90 snoemint.f90 solzen.f90 ssflux.f90 iri90.f nrlmsise00.f)
#------------- basic example ------------
add_executable(basic glowbasic.f90)
target_link_libraries(basic glow)
#include_directories(../build) # for .mod
#---------- NetCDF (optional) ------------
find_package(netCDF)
if(netCDF_DIR)
include_directories(${netCDF_INCLUDE_DIR})

add_library(ionetcdf readtgcm.f90 output.f90 )
target_link_libraries(ionetcdf netcdff glow) # yes double "ff"
else()
message(WARNING "NetCDF failed to be included " ${netCDF_INCLUDE_DIR})
endif()
#---------- MPI (optional) -------------
find_package(MPI)
if(MPI_Fortran_COMPILER)
# wrapper compiler mpif90
#set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER})

add_definitions(${MPI_Fortran_COMPILE_FLAGS})
include_directories(${MPI_Fortran_INCLUDE_PATH})
add_compile_options(-pthread)

add_executable(driver glowdriver.f90 tzgrid.f90)
target_link_libraries(driver glow ionetcdf ${MPI_Fortran_LIBRARIES})
else()
message(WARNING "MPI failed to be included " ${MPI_Fortran_LIBRARIES})
endif()

2 changes: 1 addition & 1 deletion Makefile.glowbasic
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
FC = ifort
#FC = ifort

FFLAGS = -O3
#FFLAGS = -g $(DBGFLAGS)
Expand Down
8 changes: 4 additions & 4 deletions Makefile.glowdriver
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
FC = mpif90

FFLAGS = -fc=ifort -O3 -I $(INC_NETCDF)
FFLAGS = -O3 -I $(INC_NETCDF)
#FFLAGS = -fc=ifort -g $(DBGFLAGS) -I $(INC_NETCDF)

DBGFLAGS = -debug full -traceback
Expand All @@ -17,17 +17,17 @@ DBGFLAGS += -fpe-all=0 # this traps all floating point exceptions
#
# Sources (in order of dependency):
#
SOURCES = cglow.f90 readtgcm.f90 output.f90 glowdriver.f90 glow.f90 bands.f90 conduct.f90 egrid.f90 ephoto.f90 etrans.f90 exsect.f fieldm.f gchem.f90 geomag.f90 maxt.f90 mzgrid.f90, qback.f90 rcolum.f90 rout.f90 snoem.f90 snoemint.f90 solzen.f90 ssflux.f90 tzgrid.f90, iri90.f nrlmsise00.f
SOURCES = cglow.f90 mpicdf/readtgcm.f90 mpicdf/output.f90 mpicdf/glowdriver.f90 glow.f90 bands.f90 conduct.f90 egrid.f90 ephoto.f90 etrans.f90 exsect.f fieldm.f gchem.f90 geomag.f90 maxt.f90 mzgrid.f90, qback.f90 rcolum.f90 rout.f90 snoem.f90 snoemint.f90 solzen.f90 ssflux.f90 mpicdf/tzgrid.f90, iri90.f nrlmsise00.f

OBJS := $(addsuffix .o, $(basename $(SOURCES)))
EXEC = glow.exe

$(EXEC): $(OBJS)
$(FC) -o -fc=ifort $@ $(OBJS) $(LIBS) $(LDFLAGS)
$(FC) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)

LIB_NETCDF = /home/tgcm/intel/netcdf-4.1.1/lib
INC_NETCDF = /home/tgcm/intel/netcdf-4.1.1/include
LIBS = -L /usr/lib64 -lcurl -L$(LIB_NETCDF) -lnetcdf
LIBS = -L /usr/lib64 -lcurl -L$(LIB_NETCDF) -lnetcdff

clean:
rm -f *.o *.mod $(EXEC)
Expand Down
92 changes: 86 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,90 @@
[![Build Status](https://travis-ci.org/scivision/GLOW.svg?branch=master)](https://travis-ci.org/scivision/GLOW)

# GLOW
The GLobal airglOW Model

This directory contains:
Fortran-90 source code files,
Makefiles,
Example input and output files,
Example job script,
Subdirectory data/ contains input data files,
Subdirectory data/iri90 contains IRI input data files

* Modern Fortran source code files,
* Makefile
* CMakeLists.txt
* Example input and output files
* Example job script
* `data/` contains input data files,
* `data/iri90/` contains IRI input data files
* [Release Notes](ReleaseNotes.rst)


## Python install
This command automatically compiles the Fortran code to access from Python on any platform.

python setup.py develop

You can then run the self-tests with

python tests/test.py -v

## Fortran-only mode
While many users use the Python interface to Glow, users on HPCC may want to use MPI directly in Fortran using the Makefiles or CMake. Here's how to compile the ``basic`` example with CMake.

cd build
cmake ..
make
cd ..

This creates:


executable | description
------------|--------------
basic | basic GLOW
driver | MPI/NetCDF GLOW

### Fortran examples
With regard to precision, at first try I occasionally see the least digit of precision in the text output files differ.
This can be related to Stan using Intel Fortran compiler and I'm using Gfortran.
E.g. I get 4.34e-9 and Stan got 4.33e-9.

I also get the message::

Note: The following floating-point exceptions are signalling: IEEE_UNDERFLOW_FLAG IEEE_DENORMAL

Which is a warning sign that different compilers and platforms may yield different results of unpredictable variance.



#### Aurora example (night)
Compare your results vs. Stan's results with `meld`:

./basic < in.basic.aur > aur.basic.out

meld out.basic.aur aur.basic.out


#### Aurora Example (night)

./basic < in.basic.day > day.basic.out

meld out.basic.day day.basic.out

### MPI Prereq
Allows parallel execution of GLOW Fortran code for HPCC.

sudo apt install libopenmpi-dev

### NetCDF prereq
allows reading/writing data in NetCDF (optional).
You need both of these.

sudo apt install libnetcdf-dev libnetcdff-dev

### Select Fortran compiler
Simply use the variable `FC`. Example

cd build/
rm -r *

FC=ifort cmake ..
make

NOTE: Using the Intel compiler requires that you have [built NetCDF using Intel Fortran](https://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-netcdf-with-the-intel-compilers/)--this is an issue ANYTIME you use the Intel Compiler and NetCDF.
Loading