- C++ 93%
- Python 4.8%
- Nix 0.6%
- C 0.6%
- Just 0.4%
- Other 0.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Qt5 in nixpkgs keeps the platform plugins (libqcocoa.dylib) in the bin output, and nothing pointed Qt at them. The dev shell now exports QT_PLUGIN_PATH and QT_QPA_PLATFORM_PLUGIN_PATH, and just gui-run starts the app binary directly instead of using open, so the process inherits the shell environment and finds the cocoa plugin (open goes through launchd, which does not inherit it). |
||
| cli | ||
| python | ||
| .gitignore | ||
| CHANGES.md | ||
| CMakeLists.txt | ||
| COPYING | ||
| defaultinput.cpp | ||
| defaults.cpp | ||
| defaults.h | ||
| flake.lock | ||
| flake.nix | ||
| justfile | ||
| landsoil.cpp | ||
| landsoil.h | ||
| main.cpp | ||
| mainwindow.cpp | ||
| mainwindow.h | ||
| mainwindow.ui | ||
| mlmodel_main.pro | ||
| model.cpp | ||
| model.h | ||
| modelchem.cpp | ||
| modelchem.h | ||
| modelchemtypes.h | ||
| modelinput.cpp | ||
| modelinput.h | ||
| modeloutput.cpp | ||
| modeloutput.h | ||
| modelrun.cpp | ||
| modelrun.h | ||
| plotwindow.cpp | ||
| plotwindow.h | ||
| plotwindow.ui | ||
| README.md | ||
| subplot.cpp | ||
| subplot.h | ||
| subplot.ui | ||
| switches.cpp | ||
| todolist.txt | ||
CLASS model
CLASS: Chemistry Land-surface Atmosphere Soil Slab model
This repository is a fork. It is based on classmodel/modelgui and adds a headless command line interface and a Python interface on top of the original graphical application. See CHANGES.md for the detailed list of changes and cli/README.md for the command line documentation.
Book
CLASS is part of a book (soon to be) published at Cambridge University Press: "Atmospheric boundary layer: Integrating chemistry and land interactions" by Jordi Vila-Guerau de Arellano, Chiel C. van Heerwaarden, Bart J.H. van Stratum and Kees van den Dries.
Obtaining the CLASS software
CLASS can be downloaded as precompiled binaries for Windows and OS X.
For information on compiling CLASS on Linux / OS X, see the notes below.
Note for OS X users
On recent versions of OS X, opening CLASS for the first time will result in a warning: "CLASS can’t be opened because it is from an unidentified developer". To circumvent this problem, right click the application and select "open" and again "open" in the dialog instead of double clicking the application. This step is only needed once.
Alternatively, remove the quarantine attribute from the command line:
xattr -dr com.apple.quarantine /path/to/CLASS.app
For the locally built app this happens automatically with just gui-run (or manually with just macos-unquarantine).
Bugs
Bugs can be reported at https://github.com/classmodel/modelgui/issues?state=open
In order to reproduce and fix the bug, we will most likely need:
- Information on the operating system you are using (Windows or OS X version, Linux distribution)
- The git-hash, shown in the 'about CLASS' window (e.g. git-hash: v1.0_beta2-6-g49b7603)
- A description of the exact steps needed to reproduce the problem.
Compiling CLASS
The source code of CLASS can be downloaded manually from GitHub or (preferably) using GIT:
git clone https://github.com/classmodel/modelgui.git
Both methods will always provide you the most recent (stable) version of CLASS. There are two ways of compiling CLASS: using QtCreator or using the command line.
QtCreator
After installing QtCreator, open the CLASS project file (mlmodel_main.pro) in QtCreator and select "build" > "run". This should compile and start CLASS.
Command line
Without QtCreator installed, some additional packages are needed, e.g.
- Ubuntu (20.04 LTS) or Mint (21): g++ qt5-qmake qtbase5-dev
After installing the required packages, calling:
qmake
make
from the source directory of CLASS should compile the model.
In order to build the code on OS X without creating an Xcode project, call:
qmake -spec macx-g++
make
Headless command line interface
The physics core (model.cpp, modelinput.cpp, modeloutput.cpp,
modelchem.cpp) has no Qt dependencies. A headless class-cli and a Python
package are provided for running experiments from a TOML configuration:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
./build/class-cli --config python/examples/standard_case.toml --out runs --name standard
./build/class-cli --help
./build/class-cli --dump-config - # all settings, defaults and names
Full option and configuration reference: cli/README.md. A commented boilerplate with all settings is cli/config.example.toml. Python interface: python/README.md.
Nix development shell
flake.nix provides every dependency (cmake, ninja, uv, just, Python and Qt5
for the GUI):
nix develop # interactive shell
nix develop --command just test
nix build # builds ./result/bin/class-cli (runs ctest)
A justfile with the common tasks is included:
just --list # all recipes
just build # configure + build class-cli
just test # ctest + python tests
just run case.toml mycase # run the model
just gui # build the Qt GUI with qmake
just gui-run # run the Qt GUI (clears macOS quarantine)
just plot # Python example figure
The dev shell exports QT_PLUGIN_PATH (Qt5 keeps its plugins in the bin
output), and just gui-run starts the binary directly instead of using
open, so the app inherits that environment and finds the cocoa platform
plugin.