-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
570 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM fedora:35 | ||
|
||
RUN dnf -y update \ | ||
&& dnf -y install \ | ||
cmake \ | ||
gcc-c++ \ | ||
gcc-gfortran \ | ||
git \ | ||
lcov \ | ||
make \ | ||
netcdf-fortran-devel \ | ||
valgrind \ | ||
&& dnf clean all | ||
|
||
# Install json-fortran | ||
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 | ||
|
||
# Set environment variables | ||
ENV FC=gfortran | ||
ENV JSON_FORTRAN_HOME="/usr/local/jsonfortran-gnu-8.2.0" | ||
|
||
# Copy the musica code | ||
COPY . musica | ||
|
||
# Build | ||
RUN cd musica \ | ||
&& cmake -S . \ | ||
-B build \ | ||
-D ENABLE_TESTS=ON \ | ||
-D ENABLE_TUVX=ON \ | ||
-D ENABLE_MICM=OFF \ | ||
&& cd build \ | ||
&& make install -j 8 | ||
|
||
WORKDIR musica/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule tuv-x
updated
39 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
target_sources(musica-fortran | ||
PUBLIC | ||
interface.F90 | ||
micm_mod.F90 | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
interface | ||
function create_micm_c(config_path) bind(C, name="create_micm") | ||
use iso_c_binding | ||
implicit none | ||
type(c_ptr) :: create_micm_c | ||
character(len=1, kind=C_CHAR), intent(in) :: config_path(*) | ||
end function | ||
|
||
subroutine delete_micm_c(micm_t) bind(C, name="delete_micm") | ||
use iso_c_binding | ||
implicit none | ||
type(c_ptr), value :: micm_t | ||
end subroutine | ||
|
||
function micm_create_solver_c(micm_t) bind(C, name="micm_create_solver") | ||
use iso_c_binding | ||
implicit none | ||
integer(c_int) :: micm_create_solver_c ! TODO(jiwon) return value? | ||
type(c_ptr), intent(in), value :: micm_t | ||
end function | ||
|
||
subroutine micm_solve_c(micm_t, temperature, pressure, time_step, concentrations, num_concentrations) bind(C, name="micm_solve") | ||
use iso_c_binding | ||
implicit none | ||
type(c_ptr), intent(in), value :: micm_t | ||
real(c_double), value :: temperature | ||
real(c_double), value :: pressure | ||
real(c_double), value :: time_step | ||
real(c_double), dimension(*), intent(inout) :: concentrations | ||
integer(c_size_t), value, intent(in) :: num_concentrations | ||
end subroutine | ||
end interface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
module micm_mod | ||
use iso_c_binding | ||
implicit none | ||
|
||
private | ||
public :: micm_t | ||
|
||
include "micm_c_def.F90" | ||
|
||
type micm_t | ||
private | ||
type(c_ptr) :: ptr | ||
contains | ||
procedure :: create_solver => micm_create_solver | ||
procedure :: solve => micm_solve | ||
final :: delete_micm | ||
end type | ||
|
||
interface micm_t | ||
procedure create_micm | ||
end interface | ||
|
||
contains | ||
function create_micm(config_path) | ||
type(micm_t) :: create_micm | ||
character(len=*), intent(in) :: config_path | ||
character(len=1, kind=C_CHAR) :: c_config_path(len_trim(config_path) + 1) | ||
integer :: N, i | ||
|
||
! Converting Fortran string to C string | ||
N = len_trim(config_path) | ||
do i = 1, N | ||
c_config_path(i) = config_path(i:i) | ||
end do | ||
c_config_path(N + 1) = C_NULL_CHAR | ||
|
||
create_micm%ptr = create_micm_c(c_config_path) | ||
end function | ||
|
||
subroutine delete_micm(this) | ||
type(micm_t) :: this | ||
call delete_micm_c(this%ptr) | ||
end subroutine | ||
|
||
integer function micm_create_solver(this) | ||
class(micm_t), intent(in) :: this | ||
micm_create_solver = micm_create_solver_c(this%ptr) | ||
end function | ||
|
||
subroutine micm_solve(this, temperature, pressure, time_step, concentrations, num_concentrations) | ||
class(micm_t), intent(in) :: this | ||
real(c_double), intent(in) :: temperature | ||
real(c_double), intent(in) :: pressure | ||
real(c_double), intent(in) :: time_step | ||
real(c_double), dimension(*), intent(inout) :: concentrations | ||
integer(c_size_t), intent(in) :: num_concentrations | ||
call micm_solve_c(this%ptr, temperature, pressure, time_step, concentrations, num_concentrations) | ||
end subroutine | ||
|
||
end module |
Oops, something went wrong.