PATMO User Guide
The guide describes PATMO as a modular 1-D atmospheric model and provides the Ubuntu installation workflow used here.
PROFILE NODE
From GitHub download to compiling and running the modern sulfur cycle case.
Student Handout
Lecture 5 explained how wet deposition is written in the modern sulfur cycle.
This lecture is the first full server-side operation class:
log in to an Ubuntu server, download PATMO from GitHub, prepare the
modern_sulfur_cycle input files, compile the model in build, and run ./test.
The goal is not to change the science yet. The goal is to make every student able to reach a successful baseline run.
PATMO User Guide
The guide describes PATMO as a modular 1-D atmospheric model and provides the Ubuntu installation workflow used here.
Install PATMO
The installation page lists the Ubuntu tools used in this lecture: compilers, Git, Python, and scientific Python libraries.
GitHub Repository
The class starts by cloning the official PATMO repository from GitHub.
Use an Ubuntu server or an Ubuntu terminal through WSL. The user guide targets Ubuntu 20.04 or newer. Students need internet access, permission to install packages, and a working shell.
ssh username@server_address
mkdir -p ~/patmo_course
cd ~/patmo_course
| Tool | Why it is needed |
|---|---|
git |
Download the PATMO source code from GitHub. |
gfortran, gcc, g++, make |
Compile the Fortran source files and build the test executable. |
python3 and Python libraries |
Run the PATMO preprocessor and convert spreadsheet-style input files into model input files. |
Install the basic compilers, Git, Make, and Python packages before cloning PATMO. On a teaching server, this step may already be done by the instructor.
sudo apt update
sudo apt install -y git make gfortran gcc g++ \
python3 python3-pip \
python3-numpy python3-scipy python3-matplotlib \
python3-pandas python3-openpyxl
Check that the important commands are visible to the shell:
git --version
gfortran --version
python3 --version
python3 -c "import numpy, scipy, matplotlib, pandas, openpyxl; print('Python libraries OK')"
Clone the repository and enter the PATMO root directory.
In the examples below, the root directory is called PATMO.
git clone https://github.com/SophiaAtmo/PATMO.git
cd PATMO
pwd
ls
Where You Should Be
The commands below assume that the terminal is in the PATMO root directory,
the same level that contains patmo, compile.sh, build, src_f90, and tests.
The prepared case is stored in tests/modern_sulfur_cycle.
Before running anything, students should inspect the files and connect them to previous lectures.
ls tests/modern_sulfur_cycle
| File | Role in this run |
|---|---|
reaction_network.xlsx |
Editable reaction-network spreadsheet. |
reaction_network.ntw |
PATMO-readable reaction network generated from the spreadsheet. |
settings.xlsx |
Editable model settings used to create options.opt. |
profile.xlsx and profile.dat |
Atmospheric vertical profile used to initialize the model column. |
solar_flux.xlsx and solar_flux.txt |
Solar flux input for photochemistry. |
test.f90 |
The Fortran driver program compiled into the final test executable. |
Rainout-*.txt and sulfur deposition files |
Wet deposition, aerosol, and related sulfur-cycle input data used by test.f90. |
In this lecture, compile input files means converting the editable classroom files into the files PATMO actually reads,
then asking the PATMO preprocessor to prepare the build directory for this test case.
Copy the modern sulfur compile script to the PATMO root directory and run it there:
cp tests/modern_sulfur_cycle/compile_modern_sulfur_cycle.sh .
chmod +x ./compile_modern_sulfur_cycle.sh
./compile_modern_sulfur_cycle.sh
When the script asks for the folder name under tests, type:
modern_sulfur_cycle
The script converts reaction_network.xlsx to reaction_network.ntw,
converts settings.xlsx to options.opt, prepares profile and solar-flux input files,
creates copylist.pcp, validates output settings in test.f90, and runs:
python3 patmo -test="modern_sulfur_cycle"
Do Not Skip This Step
Running make before the PATMO preprocessor has prepared build usually means the build folder is using old files,
missing files, or a different test case.
After the input/preprocessor step finishes, enter the build folder, compile the executable, and run it.
cd build
make clean
make
./test
make
Compiles PATMO source files and the selected test.f90 driver into an executable named test.
./test
Runs the modern sulfur cycle case. Students should watch the terminal for progress, mass information, and any error message.
Successful Baseline
A successful class run means the executable is created, ./test starts, and the model reaches the end of the run without a crash.
Scientific interpretation comes after this operational baseline is stable.
| Problem | Likely fix |
|---|---|
Permission denied when running the script |
Run chmod +x ./compile_modern_sulfur_cycle.sh. |
Folder not found: ./tests/... |
Run the script from the PATMO root directory and enter modern_sulfur_cycle exactly. |
ModuleNotFoundError for Python packages |
Install python3-pandas and python3-openpyxl, or use the Python setup recommended by the server administrator. |
gfortran: command not found |
Install gfortran with sudo apt install -y gfortran. |
./test: No such file or directory |
Make sure make finished successfully inside build. |