Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial CI #13

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
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
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # .github/workflows
schedule:
interval: "monthly"
target-branch: "main"
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
name: Build and test
runs-on: ubuntu-22.04
strategy:
matrix:
compiler: [gfortran-10, gfortran-11, gfortran-12]
# TODO: Intel
defaults:
run:
shell: bash -l {0}
env:
BUILD_DIR: build

steps:
- uses: actions/checkout@v3

- name: Build
run: |
cmake -B $BUILD_DIR
cmake --build $BUILD_DIR
env:
FC: ${{ matrix.compiler }}

# TODO: ctest --test-dir $BUILD_DIR
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint

on:
push:
pull_request:
workflow_dispatch:

jobs:
lint:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: pre-commit/[email protected]
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.4.0"
hooks:
- id: trailing-whitespace
args: ['--markdown-linebreak-ext=md,markdown']
- id: end-of-file-fixer
- id: check-yaml

- repo: https://github.com/zmoon/findent-pre-commit
rev: "65627b8"
hooks:
# NOTE: doesn't work on Windows currently
- id: findent-pypi
args: ['-i3']

- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
args: ['--in-place', '--line-width=100']
- id: cmake-lint
args: ['--line-width=100']
67 changes: 67 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
cmake_minimum_required(VERSION 3.5)

project(
CATChem
VERSION 0.1.0
LANGUAGES Fortran)

# If GNU compiler and Debug build type, add extra debug flags
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
message(STATUS "CMAKE_Fortran_COMPILER: ${CMAKE_Fortran_COMPILER}")
message(STATUS "CMAKE_Fortran_COMPILER_ID: ${CMAKE_Fortran_COMPILER_ID}")
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU|G95" AND CMAKE_BUILD_TYPE MATCHES "Debug")
add_compile_options(
-g
-Wall
-Wextra
-Og
-pedantic
-fcheck=all
-ffpe-trap=invalid,zero,overflow
-fbacktrace
-fmax-errors=1)
endif()

set(_param_src
parameters/catchem_config.F90
parameters/catchem_constants.F90
parameters/ddep_data_mod.F90
parameters/dust_data_mod.F90
parameters/opt_data_mod.F90
parameters/plume_data_mod.F90
parameters/seas_data_mod.F90)
add_library(CATChem_params STATIC ${_param_src})

set(_scheme_src
src/aero_soa_vbs_data_mod.F90
src/dep_vertmx_mod.F90
src/drydep_gocart_mod.F90
src/drydep_wesely_mod.F90
src/dust_afwa_mod.F90
src/dust_fengsha_mod.F90
src/gocart_aerosols_mod.F90
src/gocart_chem_mod.F90
src/gocart_diag_mod.F90
src/gocart_dmsemis_mod.F90
src/gocart_dust_default_mod.F90
src/gocart_dust_simple_mod.F90
src/gocart_seas_default_mod.F90
src/gocart_seas_ngac_mod.F90
src/gocart_seas_simple_mod.F90
src/gocart_settling_mod.F90
src/opt_aer_mod.F90
src/opt_aer_out_mod.F90
src/opt_aer_ra_mod.F90
src/opt_averaging_mod.F90
src/opt_driver_mod.F90
src/opt_gocart_mod.F90
src/opt_mod.F90
src/plume_rise_mod.F90
src/plume_scalar_mod.F90
src/plume_zero_mod.F90
src/vash_settling_mod.F90)
add_library(CATChem_schemes STATIC ${_scheme_src})
target_link_libraries(CATChem_schemes PUBLIC CATChem_params)
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Configurable ATmospheric Chemistry
# Configurable ATmospheric Chemistry

This is the repository for the Configurable ATmospheric Chemistry modelling component.

2 changes: 1 addition & 1 deletion docs/_static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

.wy-nav-top {
background-color: #ffffff;
}
}
37 changes: 32 additions & 5 deletions docs/develop/developers_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ when cloning the repository.
.. _dev-install-instructions:

How to incorporate updates to CATChem
--------------------------------------------
-------------------------------------

In order to contribute code to CATChem, you will need to fork the
repository, make changes on your fork, and submit a pull request with your
changes.
changes.

(a) Fork the GitHub repository to your own GitHub account
using the "Fork" button near the top right:
Expand Down Expand Up @@ -53,11 +53,11 @@ changes.
(d) Make changes to your fork.

(e) Submit a pull request back to the main CATChem repository with your
changes.
changes.

(f) Select two code reviewers (see list under development team section).

(g) Once those two reviewers approve the code, it can be merged into the develop branch.
(g) Once those two reviewers approve the code, it can be merged into the develop branch.

.. _clone-notes:
.. [#clone] Note that in order to do an SSH clone,
Expand All @@ -75,3 +75,30 @@ changes.

$ git clone https://github.com/ufs-community/CATChem.git


pre-commit setup
----------------

We use the `pre-commit <https://pre-commit.com/>`__ tool to run automated checks.
After `installing pre-commit <https://pre-commit.com/#install>`__,
e.g. with ``pipx`` or ``conda``,
run ``pre-commit install`` in the repository to set up the hooks.


Build and test
--------------

To build, first configure::

cmake -B build

then build::

cmake --build build

To specify a compiler, you can in the configuration step
use the ``FC`` shell/environment variable
or the ``CMAKE_Fortran_COMPILER`` CMake variable::

cmake -B build -DCMAKE_Fortran_COMPILER=/usr/bin/gfortran-12
FC=/usr/bin/gfortran-12 cmake -B build
27 changes: 12 additions & 15 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
CATChem
==============

**CATChem** (Configurable ATmospheric Chemistry) is a modelling
component that includes all chemical and aerosol processes needed to perform
atmospheric chemistry and composition simulations within a model through a
flexible, easy to modify, and well-documented infrastructure. CATChem will
include the following processes: chemical kinetics, aerosols, photolysis,
wet deposition, dry deposition, connections to emissions, and connection to
physics schemes. The first use of CATChem will be connecting it to NOAA's
Unified Forecasting System (https://ufscommunity.org/) to create UFS-Chem. CATChem and UFS-Chem are
**CATChem** (Configurable ATmospheric Chemistry) is a modelling
component that includes all chemical and aerosol processes needed to perform
atmospheric chemistry and composition simulations within a model through a
flexible, easy to modify, and well-documented infrastructure. CATChem will
include the following processes: chemical kinetics, aerosols, photolysis,
wet deposition, dry deposition, connections to emissions, and connection to
physics schemes. The first use of CATChem will be connecting it to NOAA's
Unified Forecasting System (https://ufscommunity.org/) to create UFS-Chem. CATChem and UFS-Chem are
currently under development and more information will be provided soon.


.. warning::
CATChem is currently under development. The code is public to
encourage collaboration amongst the community. Do not publish results using
CATChem is currently under development. The code is public to
encourage collaboration amongst the community. Do not publish results using
CATChem without consulting the development team.

.. toctree::
:maxdepth: 1
:caption: Contribute

develop/development_team
develop/developers_guide



Loading