Skip to content

Commit

Permalink
Format codebase (#337)
Browse files Browse the repository at this point in the history
Automated formatting for non-Fortran code
  • Loading branch information
RobertPincus authored Jan 14, 2025
2 parents e7bf3e2 + 71520f8 commit 0d5be57
Show file tree
Hide file tree
Showing 64 changed files with 1,252 additions and 1,127 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
gfortran-version: [12, 13, 14]
gfortran-from: [system, conda]
fpmodel: [DP, SP]
exclude:
exclude:
- os: ubuntu-24.04
gfortran-from: conda
- os: macos-13
Expand All @@ -38,7 +38,7 @@ jobs:
gfortran-version: 14
gfortran-from: conda
- os: windows-2022
include:
include:
- os: ubuntu-24.04
gfortran-version: 13
gfortran-from: conda
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
#
lumi-init:
if: |
false &&
false &&
github.repository_owner == 'earth-system-radiation' &&
( github.event_name != 'pull_request' ||
( github.event.pull_request.head.repo.owner.login == github.repository_owner &&
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/module_switcher
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,3 @@ switch_for_module ()
eval "$sfm_cmd"
done
}

12 changes: 6 additions & 6 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ authors:
given-names: Robert
orcid: "https://orcid.org/0000-0002-0016-3470"
- family-names: Iacono
given-names: Michael J.
given-names: Michael J.
orcid: "https://orcid.org/0000-0002-9578-0649"
- family-names: Alexeev
given-names: Dmitry
given-names: Dmitry
orcid: "https://orcid.org/0000-0002-6425-2181"
- family-names: Adamidis
given-names: Panos
Expand All @@ -19,12 +19,12 @@ authors:
given-names: Matthew
orcid: "https://orcid.org/0000-0003-4764-3348"
- family-names: Pfister
given-names: Erik
given-names: Erik
orcid: "http://orcid.org/0009-0002-2688-138X"
- family-names: Polonsky
given-names: Igor N.
- family-names: Romero
given-names: Nicols A.
given-names: Nicols A.
- family-names: Kosukhin
given-names: Sergey S.
- family-names: Wehe
Expand All @@ -35,7 +35,7 @@ license: BSD-3-Clause
date-released: "2023-11-27"
version: 1.7

abstract: "RTE+RRTMGP is a set of codes for computing radiative fluxes in planetary atmospheres.
abstract: "RTE+RRTMGP is a set of codes for computing radiative fluxes in planetary atmospheres.
RRTMGP uses a k-distribution to provide an optical description (absorption and possibly Rayleigh optical depth) of the gaseous atmosphere, along with the relevant source functions, on a pre-determined spectral grid given temperatures, pressures, and gas concentration. RTE computes fluxes given spectrally-resolved optical descriptions and source functions. The fluxes are normally summarized or reduced via a user extensible class."
identifiers:
- description: "All versions"
Expand Down Expand Up @@ -65,4 +65,4 @@ references:
volume: 11
number: 10
pages: 3074-3089
year: 2019
year: 2019
12 changes: 6 additions & 6 deletions Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ Thanks for considering making a contribution to RTE+RRTMGP.

The code in this repository is intended to work with compilers supporting the Fortran 2008 standard. It is also expected to run end-to-end on GPUs when compiled with OpenACC or OpenMP (though OpenMP is still unreliable). Commits are tested automatically against a range of compilers using Github Actions and also resources provided by the [Swiss Supercomputing Center](https://cscs.ch). The testing uses two general codes in `examples/`for which results are compared against existing implemetations, and custom codes in `tests/` intended to excercise all code options.

##### Did you find a bug?
##### Did you find a bug?

Please file an issue on the [Github page](https://github.com/RobertPincus/rte-rrtmgp/issues). Please include a minimal reproducer of the bug it at all possible.
Please file an issue on the [Github page](https://github.com/RobertPincus/rte-rrtmgp/issues). Please include a minimal reproducer of the bug it at all possible.

##### Did you write a patch that fixes a bug?

Please fork this repository, branch from `develop`, make your changes, and open a Github [pull request](https://github.com/RobertPincus/rte-rrtmgp/pulls) against branch `develop`.
Please fork this repository, branch from `develop`, make your changes, and open a Github [pull request](https://github.com/RobertPincus/rte-rrtmgp/pulls) against branch `develop`.

##### Did you add functionality?
##### Did you add functionality?

Please fork this repository, branch from `develop`, make your changes, and open a Github [pull request](https://github.com/RobertPincus/rte-rrtmgp/pulls) against branch `develop`, adding a new regression test or comparison against the reference in `tests/verification.py` or `tests/validation-plots.py` as appropriate. Add the test to the `tests` target in `tests/Makefile`.
Please fork this repository, branch from `develop`, make your changes, and open a Github [pull request](https://github.com/RobertPincus/rte-rrtmgp/pulls) against branch `develop`, adding a new regression test or comparison against the reference in `tests/verification.py` or `tests/validation-plots.py` as appropriate. Add the test to the `tests` target in `tests/Makefile`.

RTE+RRTMGP is intended to be a core that users can extend with custom code to suit their own needs.
RTE+RRTMGP is intended to be a core that users can extend with custom code to suit their own needs.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[RTE+RRTMGP's GitHub Pages site](https://earth-system-radiation.github.io/rte-rrtmgp/) contains
a mix of automatically-generated documentation and hand-written descriptions. The documentation is
incomplete and evolving. Thanks to the folks at [Sourcery Institute](https://www.sourceryinstitute.org)
for help in setting this up.
for help in setting this up.

For the moment the [Wiki](https://github.com/earth-system-radiation/rte-rrtmgp/wiki) may also be useful.

Expand All @@ -20,22 +20,22 @@ RTE computes fluxes given spectrally-resolved optical descriptions and source fu

A description of building RTE+RRTMGP with an ad hoc homemade system is described in the [documentation](https://earth-system-radiation.github.io/rte-rrtmgp/how-tos/).

See also the `autoconf` branch for a Gnu autotools build system.
See also the `autoconf` branch for a Gnu autotools build system.

## Examples

Two examples are provided in `examples/`, one for clear skies and one including clouds. Directory `tests/` contains regression testing (e.g. to ensure that answers are independent of orientation) and unit testing (to be sure all the code paths are tested). See the README file and codes in each directory for further information.

## Citing the code
## Citing the code

Code releases are archived at Zenodo. All releases are available at
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3403172.svg)](https://doi.org/10.5281/zenodo.3403172).
Code releases are archived at Zenodo. All releases are available at
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3403172.svg)](https://doi.org/10.5281/zenodo.3403172).
The current release is available at: [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7521518.svg)](https://doi.org/10.5281/zenodo.10211873)

Please cite the code using these DOIs and the information in the `CITATION.cff` file in addition to the reference [paper](https://doi.org/10.1029/2019MS001621)

## Acknowledgements

The development of RTE+RRTMGP has been funded in the US by the Office of Naval Research, NASA, NOAA, and the Department of Energy. We
are grateful for contributions from a range of collaborators at institutions including the Swiss Supercomputing Center,
the German Climate Computing Center, and Nvidia.
The development of RTE+RRTMGP has been funded in the US by the Office of Naval Research, NASA, NOAA, and the Department of Energy. We
are grateful for contributions from a range of collaborators at institutions including the Swiss Supercomputing Center,
the German Climate Computing Center, and Nvidia.
4 changes: 2 additions & 2 deletions doc/class_diagrams/mo_optical_props.puml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ hide empty members

class stuff_t{
z_ : complex
defined_ : logical
defined_ : logical
z() : complex
defined() : logical
stuff_t(z : complex) : stuff_t
Expand All @@ -26,4 +26,4 @@ class characterizable_stuff_t{
characterizable_stuff_t *-down- stuff_t : aggregates
characterizable_stuff_t .up.|> characterizable_t : implements

@enduml
@enduml
1 change: 0 additions & 1 deletion doc/jekyll_site/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ end

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]

2 changes: 1 addition & 1 deletion doc/jekyll_site/_posts/2022-06-02-Release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: "2022-06-02: Release notes"
categories: Release-notes
---

Commit [a4fe30c](https://github.com/earth-system-radiation/rte-rrtmgp/commit/a4fe30cf4dab2e5fd8d3ab6f11683a82ae584475)
Commit [a4fe30c](https://github.com/earth-system-radiation/rte-rrtmgp/commit/a4fe30cf4dab2e5fd8d3ab6f11683a82ae584475)
to branch `main` makes the following changes:

- Solar zenith angle can vary with height, allowing for calculations on a pseudo-spherical earth
Expand Down
12 changes: 6 additions & 6 deletions doc/jekyll_site/_posts/2023-11-27-v1.7-Release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ title: "v1.7 Release notes"
categories: Release-notes
---

Commit [3ac0636](https://github.com/earth-system-radiation/rte-rrtmgp/commit/3ac0636b17d6a3f11e4085f91679393fceaa4e18)
Commit [3ac0636](https://github.com/earth-system-radiation/rte-rrtmgp/commit/3ac0636b17d6a3f11e4085f91679393fceaa4e18)
to branch `main` makes the following changes:

- Libraries can be built in single precision by changes in `rte-kind/mo_rte_kind.F90`. Differences with respect to double precision are roughly 0.13 W/m2.
- A class for computing the optical properties of aerosols following the MERRA representation has been added.
- The repository is reorganized into `frontend` and `kernel` directories for `rte` and `rrtmgp`. Data has been moved to a separate [repository]((https://github.com/earth-system-radiation/rrtmgp-data/).
- Citation information has been added.
- Libraries can be built in single precision by changes in `rte-kind/mo_rte_kind.F90`. Differences with respect to double precision are roughly 0.13 W/m2.
- A class for computing the optical properties of aerosols following the MERRA representation has been added.
- The repository is reorganized into `frontend` and `kernel` directories for `rte` and `rrtmgp`. Data has been moved to a separate [repository]((https://github.com/earth-system-radiation/rrtmgp-data/).
- Citation information has been added.

As usual some bugs have been fixed, the use of OpenACC and OpenMP GPU offload directives continues to evolve, and the continous integration continues to be fine-tuned.
As usual some bugs have been fixed, the use of OpenACC and OpenMP GPU offload directives continues to evolve, and the continous integration continues to be fine-tuned.
2 changes: 1 addition & 1 deletion doc/jekyll_site/explanations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ title: "Explanations"

The spectral properties of the atmosphere and the source functions depend on electromagnetic wavelength (or frequency or wavenumber). RTE treats this spectral dependence by dividing the spectrum into one or more _bands_, each of which represents a continuous set of wavelengths/frequencies. Bands may be further sub-divided into _g-points_ (the language is borrowed from _k_-distributions). Each _g_-point is treated as a independent psudo-monchromatic calculation but there is no inherent mapping between _g_-points and wavelengths; the sum over _g_-points is the band-average value.

The bands defined by RRTMGP cover the full spectrum of radiation emitted by the Sun and Earth: these are _broadband_ calculations. In RRTMGP the bands are continuous so that the ending wavelength of one band is the starting wavelength of the next.
The bands defined by RRTMGP cover the full spectrum of radiation emitted by the Sun and Earth: these are _broadband_ calculations. In RRTMGP the bands are continuous so that the ending wavelength of one band is the starting wavelength of the next.
50 changes: 25 additions & 25 deletions doc/jekyll_site/how-tos/build-and-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ title: "How to build and run tests"
---
How to build the libraries, tests, and examples, run the tests, and verify the results

## In a nutshell
RTE+RRTMGP uses `CMake`. In the root directory:
`cmake -S . -B build` will guide you through configuration options.
## In a nutshell
RTE+RRTMGP uses `CMake`. In the root directory:
`cmake -S . -B build` will guide you through configuration options.

Environment variables can also be set and passed to `CMake` as in this example, which
builds and runs the tests:
Environment variables can also be set and passed to `CMake` as in this example, which
builds and runs the tests:

`
cmake -S . -B build \
Expand All @@ -26,55 +26,55 @@ cmake -S . -B build \
Evaluating the results of the tests requires `Python` and the packages described in `environment*.yml`.


## Building and testing using (Gnu) autotools
## Building and testing using (Gnu) autotools

Sergey Kosukhin and his colleagues at the Max Planck Institute for Meteorology
maintain the `autoconf` branch which adds Gnu `autotools` building to `main` branch.

## Supplying data
## Supplying data

Running the tests and verifying the results requires the RRTMGP data. Clone the
[data repository](https://github.com/earth-system-radiation/rrtmgp-data) or download the
[Zenodo archive](https://doi.org/10.5281/zenodo.7988260). Set the environment variable `RRTMGP_DATA`
to the root of this directory.
Running the tests and verifying the results requires the RRTMGP data. Clone the
[data repository](https://github.com/earth-system-radiation/rrtmgp-data) or download the
[Zenodo archive](https://doi.org/10.5281/zenodo.7988260). Set the environment variable `RRTMGP_DATA`
to the root of this directory.

## Example compiler flags
## Example compiler flags

In these examples `FC` is the Fortran compilers using flags `FCFLAGS`

### Gnu Fortran
### Gnu Fortran
(see also the [continuous integration](https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/continuous-integration.yml))
`FC`: `gfortran-10` or `gfortran-11` or `gfortran-12`
#### Debugging flags
`FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -finit-real=nan -DRTE_USE_CBOOL"`
`FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -finit-real=nan -DRTE_USE_CBOOL"`
#### Even stricter debugging flags
`FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fbacktrace -finit-real=nan -DRTE_USE_CBOOL -pedantic -g -Wall"`
`FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -fbacktrace -finit-real=nan -DRTE_USE_CBOOL -pedantic -g -Wall"`

### Intel Fortran Classic
### Intel Fortran Classic
(see also the [continuous integration](https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/containerized-ci.yml))
`FC: ifort`
`FC: ifort`
#### Debugging flags
`FCFLAGS: "-m64 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -check bounds,uninit,pointers,stack -stand f08"`
#### Optimization flags:
`FCFLAGS: "-m64 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -check bounds,uninit,pointers,stack -stand f08"`
#### Optimization flags:
`FCFLAGS:"-m64 -O3 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132"`

### Intel Fortran
### Intel Fortran
(LLVM, see also the [continuous integration](https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/containerized-ci.yml))
`FC: ifort`
`FC: ifort`
#### Debugging flags
`FCFLAGS: "-debug -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -stand f08"`
#### Using OpenMP GPU offload
`FCFLAGS: "-debug -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -stand f08"`
#### Using OpenMP GPU offload
See [this open issue](https://github.com/earth-system-radiation/rte-rrtmgp/issues/194)

### NVFortran
(see also the see also the [continuous integration](https://github.com/earth-system-radiation/rte-rrtmgp/blob/main/.github/workflows/containerized-ci.yml))
`FC: nvfortran`
#### Debugging flags
`FCFLAGS: "-g -Minfo -Mbounds -Mchkptr -Mstandard -Kieee -Mchkstk -Mallocatable=03 -Mpreprocess"`
#### Optimization flags:
#### Optimization flags:
`FCFLAGS: "-O3 -fast -Minfo -Mallocatable=03 -Mpreprocess"`

### HPE CCE for GPU using OpenMP-acc: crayftn -- requires at least CCE 14.0.0
`FC: crayftn`
#### Debugging flags (these appear to be insufficient during the link stage)
`FCFLAGS: "-hnoacc -homp -O0"`
`FCFLAGS: "-hnoacc -homp -O0"`
10 changes: 5 additions & 5 deletions doc/jekyll_site/index.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ title: "RTE+RRTMGP documentation"
This is the documentation for RTE+RRTMGP, a set of codes for computing radiative
fluxes in planetary atmospheres. RTE+RRTMGP is described in a
[paper](https://doi.org/10.1029/2019MS001621) in
[Journal of Advances in Modeling Earth Systems](http://james.agu.org).
The code itself can be sited as
doi:[10.5281/zenodo.3403172](https://doi.org/10.5281/zenodo.3403172) or via the
[Journal of Advances in Modeling Earth Systems](http://james.agu.org).
The code itself can be sited as
doi:[10.5281/zenodo.3403172](https://doi.org/10.5281/zenodo.3403172) or via the
DOI attached to each release.

RRTMGP uses a k-distribution to provide an optical description (absorption and
Expand All @@ -34,5 +34,5 @@ We are starting with the [reference documentation](./reference/index.html),
auto-generated from the code itself. This is provided separately for
RTE and RRTMGP and for the user-facing classes and underlying computational kernels.

We welcome contributions to the documentation via pull requests to the `documentation` branch
of the Github repository.
We welcome contributions to the documentation via pull requests to the `documentation` branch
of the Github repository.
2 changes: 1 addition & 1 deletion doc/jekyll_site/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RTE aspires to follow a set of coding conventions:
and spectral quadrature point.
- RTE and RRTMGP are agnostic to vertical ordering
- Units are MKS
- Procedures (with the exception of testing code) do not perform I/O
- Procedures (with the exception of testing code) do not perform I/O

## Fortran user-facing class interfaces

Expand Down
2 changes: 1 addition & 1 deletion doc/jekyll_site/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A typical workflow for a clear-sky calculation is to
1. allocate memory
2. set gas concentration values
3. compute the optical properties of the gaseous atmosphere
4. compute radiative fluxes
4. compute radiative fluxes

This repository contains all the pieces needed to perform a clear-sky calculation. An [example](https://github.com/RobertPincus/rte-rrtmgp/tree/master/examples/rfmip-clear-sky) is provided.

Expand Down
2 changes: 1 addition & 1 deletion examples/all-sky/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ This example provides a modestly more realistic setting the clear-sky problem do

The example uses the first of the Garand atmosphere used for developing RRTMGP, as described in the [paper](https://doi.org/10.1029/2019MS001621) documenting the code, repeats the column a user-specified number of times, computes the optical properties of an arbitrary cloud in each column, and computes the broadband fluxes. Fractional cloudiness is not considered, and the clouds are extensive but quite boring, with uniform condensate amount and particle size everywhere (though with different values for liquid and ice).

Note that this example is run, and the results checked automatically, when `make` is invoked in the root directory.
Note that this example is run, and the results checked automatically, when `make` is invoked in the root directory.
Loading

0 comments on commit 0d5be57

Please sign in to comment.