Skip to content

Commit

Permalink
Merge pull request #53 from NCAR/update_version
Browse files Browse the repository at this point in the history
v0.5.0 Release
  • Loading branch information
boulderdaze authored Jan 10, 2024
2 parents 6b0cba8 + f6cfc96 commit 8e22784
Show file tree
Hide file tree
Showing 17 changed files with 248 additions and 41 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,21 @@ jobs:
run: docker build -t musica-mpi-openmp -f Dockerfile.mpi_openmp .
- name: run tests in container
run: docker run --name test-container -t musica-mpi-openmp bash -c 'make test'
build_test_connections_musica-fortran:
# build_test_connections_musica-fortran:
# runs-on: ubuntu-latest
# if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
# steps:
# - name: delete unnessary tools to free up space
# run: rm -rf /opt/hostedtoolcache

# - uses: actions/checkout@v2
# with:
# submodules: recursive
# - name: build Docker image
# run: docker build -t musica-fortran -f Dockerfile.fortran .
# - name: run tests in container
# run: docker run --name test-container -t musica-fortran bash -c 'make test'
build_test_connections_musica-fortran-same-compiler:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
Expand All @@ -69,6 +83,6 @@ jobs:
with:
submodules: recursive
- name: build Docker image
run: docker build -t musica-fortran -f Dockerfile.fortran .
run: docker build -t musica-fortran-ubuntu -f Dockerfile.fortran-ubuntu .
- name: run tests in container
run: docker run --name test-container -t musica-fortran bash -c 'make test'
run: docker run --name test-container -t musica-fortran-ubuntu bash -c 'make test'
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.21)

project(
musica
VERSION 0.4.0
VERSION 0.5.0
LANGUAGES Fortran CXX C
)

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.fortran
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ RUN cd musica/musica-fortran/test \
&& make

RUN cd musica/musica-fortran/test \
&& cp -r micm_config ./build/micm_config
&& cp -r configs/chapman ./build/chapman

WORKDIR musica/musica-fortran/test/build
60 changes: 60 additions & 0 deletions Dockerfile.fortran-ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
FROM ubuntu:22.04

RUN apt update \
&& apt -y install \
cmake \
cmake-curses-gui \
curl \
libcurl4-openssl-dev \
libhdf5-dev \
m4 \
nlohmann-json3-dev \
vim \
zlib1g-dev \
git \
lcov \
make \
libnetcdff-dev \
valgrind \
gcc \
gfortran \
g++ \
&& apt clean

# Set environment variables to install MUSICA using gcc
ENV FC=gfortran
ENV FFLAGS="-I/usr/include/"

# Install json-fortran for gnu version
RUN curl -LO https://github.com/jacobwilliams/json-fortran/archive/8.2.0.tar.gz \
&& tar -zxvf 8.2.0.tar.gz \
&& cd json-fortran-8.2.0 \
&& mkdir build \
&& cd build \
&& cmake -D SKIP_DOC_GEN:BOOL=TRUE .. \
&& make install

# Copy the musica code
COPY . musica

# Set json-fortran variable to install MUSICA using gcc
ENV JSON_FORTRAN_HOME="/usr/local/jsonfortran-gnu-8.2.0"

# Build and install MUSICA
RUN cd musica \
&& cmake -S . \
-B build \
-D ENABLE_TESTS=ON \
-D ENABLE_TUVX=OFF \
&& cd build \
&& make install -j 8

RUN cd musica/musica-fortran/test \
&& mkdir build && cd build \
&& cmake .. \
&& make

RUN cd musica/musica-fortran/test \
&& cp -r configs/chapman ./build/chapman

WORKDIR musica/musica-fortran/test/build
2 changes: 1 addition & 1 deletion lib/micm
Submodule micm updated 484 files
2 changes: 1 addition & 1 deletion lib/musica-core
2 changes: 1 addition & 1 deletion lib/tuv-x
Submodule tuv-x updated 39 files
+1 −1 CMakeLists.txt
+1 −1 README.md
+1 −1 cmake/dependencies.cmake
+1 −1 docs/source/conf.py
+47 −1 docs/source/user_guide.rst
+6 −1 docs/switcher.json
+50 −0 etc/derecho/README.md
+51 −0 etc/derecho/build_tuvx_derecho_gnu.sh
+49 −0 etc/derecho/build_tuvx_derecho_intel.sh
+2 −17 etc/modeling2/build_tuvx_modeling2_gnu.sh
+3 −1 src/cross_section.F90
+3 −1 src/cross_sections/hno3-oh_no2.F90
+3 −1 src/cross_sections/no2_tint.F90
+3 −1 src/cross_sections/o3_tint.F90
+3 −1 src/cross_sections/rono2.F90
+3 −1 src/cross_sections/temperature_based.F90
+3 −1 src/cross_sections/tint.F90
+3 −2 src/grids/equal_delta.F90
+37 −27 src/interpolate.F90
+2 −1 src/profiles/air.F90
+2 −1 src/profiles/extraterrestrial_flux.F90
+2 −1 src/profiles/from_csv_file.F90
+2 −1 src/profiles/o2.F90
+2 −1 src/profiles/o3.F90
+3 −1 src/quantum_yield.F90
+3 −1 src/quantum_yields/no2_tint.F90
+4 −2 src/quantum_yields/tint.F90
+8 −0 src/radiative_transfer/radiator_factory.F90
+1 −0 src/radiative_transfer/radiators/CMakeLists.txt
+6 −3 src/radiative_transfer/radiators/aerosol.F90
+116 −0 src/radiative_transfer/radiators/from_netcdf_file.F90
+3 −1 src/spectral_weight.F90
+13 −0 src/tuvx.F90
+ test/data/radiator.nc
+23 −0 test/data/radiators.from_netcdf_file.config.json
+2 −1 test/unit/cross_section/base.F90
+3 −1 test/unit/quantum_yield/base.F90
+1 −0 test/unit/radiator/CMakeLists.txt
+96 −0 test/unit/radiator/from_netcdf_file.F90
2 changes: 1 addition & 1 deletion musica-fortran/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ find_package(PkgConfig REQUIRED)
pkg_check_modules(netcdff IMPORTED_TARGET REQUIRED netcdf-fortran)

# Find MUSICA package
find_package(musica 0.4.0 REQUIRED)
find_package(musica 0.5.0 REQUIRED)

target_link_libraries(musica-fortran
PUBLIC
Expand Down
2 changes: 1 addition & 1 deletion musica-fortran/src/micm/micm_mod.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module musica_micm
module micm_mod
use iso_c_binding
implicit none

Expand Down
2 changes: 1 addition & 1 deletion musica-fortran/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(ENABLE_TUVX OFF)

FetchContent_Declare(musica
GIT_REPOSITORY https://github.com/NCAR/musica.git
GIT_TAG bad9756 # TODO(jiwon) - update the tag
GIT_TAG 264396b # TODO(jiwon) - update the tag
)

FetchContent_MakeAvailable(musica)
Expand Down
6 changes: 6 additions & 0 deletions musica-fortran/test/configs/chapman/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"camp-files": [
"species.json",
"reactions.json"
]
}
97 changes: 97 additions & 0 deletions musica-fortran/test/configs/chapman/reactions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"camp-data": [
{
"name": "Chapman",
"type": "MECHANISM",
"reactions": [
{
"type": "PHOTOLYSIS",
"reactants": {
"O2": {}
},
"products": {
"O": {
"yield": 2.0
}
},
"MUSICA name": "R1"
},
{
"type": "ARRHENIUS",
"A": 8.018e-17,
"reactants": {
"O": {},
"O2": {}
},
"products": {
"O3": {}
},
"MUSICA name": "R2"
},
{
"type": "PHOTOLYSIS",
"reactants": {
"O3": {}
},
"products": {
"O": {},
"O2": {}
},
"MUSICA name": "R3"
},
{
"type": "ARRHENIUS",
"A": 1.576e-15,
"reactants": {
"O": {},
"O3": {}
},
"products": {
"O2": {
"yield": 2.0
}
},
"MUSICA name": "R4"
},
{
"type": "PHOTOLYSIS",
"reactants": {
"O3": {}
},
"products": {
"O1D": {},
"O2": {}
},
"MUSICA name": "R5"
},
{
"type": "ARRHENIUS",
"A": 7.11e-11,
"reactants": {
"O1D": {},
"M": {}
},
"products": {
"O": {},
"M": {}
},
"MUSICA name": "R6"
},
{
"type": "ARRHENIUS",
"A": 1.2e-10,
"reactants": {
"O1D": {},
"O3": {}
},
"products": {
"O2": {
"yield": 2.0
}
},
"MUSICA name": "R7"
}
]
}
]
}
29 changes: 29 additions & 0 deletions musica-fortran/test/configs/chapman/species.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"camp-data": [
{
"name": "M",
"type": "CHEM_SPEC",
"tracer type": "CONSTANT"
},
{
"name": "O2",
"type": "CHEM_SPEC",
"tracer type": "CONSTANT"
},
{
"name": "O",
"type": "CHEM_SPEC",
"absolute tolerance": 1e-12
},
{
"name": "O1D",
"type": "CHEM_SPEC",
"absolute tolerance": 1e-12
},
{
"name": "O3",
"type": "CHEM_SPEC",
"absolute tolerance": 1e-12
}
]
}
1 change: 0 additions & 1 deletion musica-fortran/test/micm_config/mechanism.json

This file was deleted.

1 change: 0 additions & 1 deletion musica-fortran/test/micm_config/species.json

This file was deleted.

42 changes: 23 additions & 19 deletions musica-fortran/test/test_musica_api.F90
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
program test
use iso_c_binding
use musica_micm
use micm_mod
implicit none
type(micm_t) :: m

real(c_double) :: temperature
real(c_double) :: pressure
real(c_double) :: time_step
real(c_double), dimension(10) :: concentrations
real(c_double), dimension(5) :: concentrations
integer(c_size_t) :: num_concentrations
integer :: errcode

temperature = 10d0
pressure = 20d0
time_step = 1d0
concentrations = (/ 1d0, 2d0, 3d0, 4d0, 5d0, 6d0, 7d0, 8d0, 9d0, 10d0 /)
num_concentrations = 10
concentrations = (/ 0.75, 0.4, 0.8, 0.01, 0.02 /)
num_concentrations = 5

write(*,*) " * [Fortran] Creating MICM"
m = micm_t("micm_config")
m = micm_t("chapman")

write(*,*) " * [Fortran] Creating solver"
write(*,*) " * [Fortran] Solver creating status indicates ", m%create_solver(), " (1 is success, else failure) "

write(*,*) " * [Fortran] Initial temp", temperature
write(*,*) " * [Fortran] Initial pressure", pressure
write(*,*) " * [Fortran] Initial time_step", time_step
write(*,*) " * [Fortran] Initial concentrations", concentrations
write(*,*) " * [Fortran] Initial number of concentrations", num_concentrations

write(*,*) " * [Fortran] Starting to solve"
call m%solve(temperature, pressure, time_step, concentrations, num_concentrations)
write(*,*) " * [Fortran] After solving, concentrations", concentrations

write(*,*) " * [Fortran] Calling destructor for MICM"
call m%delete
errcode = m%create_solver()

if (errcode == 1) then
write(*,*) " * [Fortran] Failed in creating solver"
stop 3
else
write(*,*) " * [Fortran] Initial temp", temperature
write(*,*) " * [Fortran] Initial pressure", pressure
write(*,*) " * [Fortran] Initial time_step", time_step
write(*,*) " * [Fortran] Initial number of concentrations", num_concentrations
write(*,*) " * [Fortran] Initial concentrations", concentrations

write(*,*) " * [Fortran] Solving starts..."
call m%solve(temperature, pressure, time_step, concentrations, num_concentrations)

write(*,*) " * [Fortran] After solving, concentrations", concentrations
endif

end program
Loading

0 comments on commit 8e22784

Please sign in to comment.