From 3d8bbb0d0a69eb4b6af8d7a12807f89a7cc112e9 Mon Sep 17 00:00:00 2001 From: Jiwon Gim Date: Wed, 7 Feb 2024 10:00:17 -0700 Subject: [PATCH] addressed code review --- .github/workflows/test.yaml | 2 +- .gitignore | 7 ----- cmake/atmosphericphysicsConfig.cmake.in | 5 --- cmake/cmake_uninstall.cmake.in | 37 ----------------------- musica/micm/micm.F90 | 4 +-- .dockerignore => test/.dockerignore | 0 CMakeLists.txt => test/CMakeLists.txt | 6 ++-- {cmake => test/cmake}/SetDefaults.cmake | 0 {docker => test/docker}/Dockerfile.musica | 11 ++++--- test/musica/micm/CMakeLists.txt | 3 +- test/musica/micm/test_micm_api.F90 | 21 +++++++++---- utilities/state_converters.meta | 2 +- 12 files changed, 30 insertions(+), 68 deletions(-) delete mode 100644 .gitignore delete mode 100644 cmake/atmosphericphysicsConfig.cmake.in delete mode 100644 cmake/cmake_uninstall.cmake.in rename .dockerignore => test/.dockerignore (100%) rename CMakeLists.txt => test/CMakeLists.txt (87%) rename {cmake => test/cmake}/SetDefaults.cmake (100%) rename {docker => test/docker}/Dockerfile.musica (82%) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 74750206..558dca07 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,7 +7,7 @@ jobs: 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: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive - name: build Docker image diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 0f1ca0fa..00000000 --- a/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -# cmake and build stuff - -build/ -CMakeCache.txt -CMakeFiles -.DS_Store -.vscode \ No newline at end of file diff --git a/cmake/atmosphericphysicsConfig.cmake.in b/cmake/atmosphericphysicsConfig.cmake.in deleted file mode 100644 index 3cc6a433..00000000 --- a/cmake/atmosphericphysicsConfig.cmake.in +++ /dev/null @@ -1,5 +0,0 @@ -@PACKAGE_INIT@ - -include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@_Exports.cmake") - -check_required_components("@PROJECT_NAME@") \ No newline at end of file diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in deleted file mode 100644 index 66e6b1d2..00000000 --- a/cmake/cmake_uninstall.cmake.in +++ /dev/null @@ -1,37 +0,0 @@ -# https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake - -if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") - message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") -endif() - -file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) -string(REGEX REPLACE "\n" ";" files "${files}") -foreach(file ${files}) - message(STATUS "Uninstalling $ENV{DESTDIR}${file}") - if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - exec_program( - "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" - OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval - ) - if(NOT "${rm_retval}" STREQUAL 0) - message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") - endif() - else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - message(STATUS "File $ENV{DESTDIR}${file} does not exist.") - endif() -endforeach() - -set(uninstall_dirs "@INSTALL_PREFIX@;@cmake_config_install_location@") - -foreach(dir IN LISTS uninstall_dirs) - message(STATUS "Uninstalling ${dir}") - exec_program( - "@CMAKE_COMMAND@" ARGS "-E remove_directory ${dir}" - OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval - ) - if(NOT "${rm_retval}" STREQUAL 0) - message(FATAL_ERROR "Problem when removing ${dir}") - endif() -endforeach() \ No newline at end of file diff --git a/musica/micm/micm.F90 b/musica/micm/micm.F90 index fc6e0523..00421210 100644 --- a/musica/micm/micm.F90 +++ b/musica/micm/micm.F90 @@ -32,8 +32,8 @@ subroutine micm_init(config_path, iulog, errcode, errmsg) errcode = micm_obj%create_solver() if (errcode /= 0) then - errmsg = "[fatal] [micm] Failed to creat MICM solver. Parsing configuration failed. & - Please look over at the other file for further information." + errmsg = "[fatal] [micm] Failed to create MICM solver. Parsing configuration failed. & + Please look over at MICM log file for further information." write(iulog,*) trim(errmsg) return endif diff --git a/.dockerignore b/test/.dockerignore similarity index 100% rename from .dockerignore rename to test/.dockerignore diff --git a/CMakeLists.txt b/test/CMakeLists.txt similarity index 87% rename from CMakeLists.txt rename to test/CMakeLists.txt index 5498e4b2..74db2091 100644 --- a/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,11 +21,11 @@ option(ENABLE_MICM_TEST "Build the micm test" OFF) if (ENABLE_MICM_TEST) set(MUSICA_VERSION $ENV{MUSICA_VERSION}) - set(MICM_SRC_PATH ${CMAKE_SOURCE_DIR}/musica/micm) + set(MICM_SRC_PATH ${CMAKE_SOURCE_DIR}/../musica/micm) set(CCPP_SRC_PATH ${CMAKE_SOURCE_DIR}/$ENV{CCPP_SRC_PATH}) - set(CCPP_TEST_SRC_PATH ${CMAKE_SOURCE_DIR}/test/include) + set(CCPP_TEST_SRC_PATH ${CMAKE_SOURCE_DIR}/include) - add_subdirectory(test/musica/micm) + add_subdirectory(musica/micm) enable_testing() endif() \ No newline at end of file diff --git a/cmake/SetDefaults.cmake b/test/cmake/SetDefaults.cmake similarity index 100% rename from cmake/SetDefaults.cmake rename to test/cmake/SetDefaults.cmake diff --git a/docker/Dockerfile.musica b/test/docker/Dockerfile.musica similarity index 82% rename from docker/Dockerfile.musica rename to test/docker/Dockerfile.musica index 70d40957..27bb7cef 100644 --- a/docker/Dockerfile.musica +++ b/test/docker/Dockerfile.musica @@ -44,6 +44,7 @@ RUN cd musica \ -D USE_MUSICA=ON \ -D USE_MUSICA_FORTRAN=OFF \ -D MAKE_MUSICA_FORTRAN_INSTALLABLE=ON \ + -D ENABLE_MICM=ON \ -D ENABLE_TESTS=OFF \ -D ENABLE_TUVX=OFF \ && cd build \ @@ -54,19 +55,19 @@ ENV MUSICA_VERSION="0.5.0" COPY . atmospheric_physics -RUN cd atmospheric_physics \ +RUN cd atmospheric_physics/test \ && mkdir lib \ && cd lib \ - && git clone -b add_const_interface --depth 1 https://github.com/peverwhee/ccpp-framework.git + && git clone -b CPF_0.2.051 --depth 1 https://github.com/peverwhee/ccpp-framework.git ENV CCPP_SRC_PATH="lib/ccpp-framework/src" -RUN cd atmospheric_physics \ +RUN cd atmospheric_physics/test \ && cmake -S. \ -B build \ -D ENABLE_MICM_TEST=ON \ && cmake --build ./build RUN cd atmospheric_physics \ - && cp -r test/musica/micm/configs/chapman ./build/chapman + && cp -r test/musica/micm/configs/chapman ./test/build/chapman -WORKDIR atmospheric_physics/build \ No newline at end of file +WORKDIR atmospheric_physics/test/build \ No newline at end of file diff --git a/test/musica/micm/CMakeLists.txt b/test/musica/micm/CMakeLists.txt index 625e27b5..05d9bd64 100644 --- a/test/musica/micm/CMakeLists.txt +++ b/test/musica/micm/CMakeLists.txt @@ -43,7 +43,8 @@ target_link_libraries(test_micm_api set_target_properties(test_micm_api PROPERTIES - LINKER_LANGUAGE Fortran) + LINKER_LANGUAGE Fortran +) include(CTest) diff --git a/test/musica/micm/test_micm_api.F90 b/test/musica/micm/test_micm_api.F90 index 6dfa6437..5a8470b5 100644 --- a/test/musica/micm/test_micm_api.F90 +++ b/test/musica/micm/test_micm_api.F90 @@ -96,24 +96,33 @@ subroutine test_micm_ccpp_api() call micm_init("chapman", iulog, errcode, errmsg) + if (errcode /= 0) then + write(*,*) " -- Failed to create solver" + stop 3 + endif + write(*,*) " -- Initial time_step", time_step write(*,*) " -- Initial temp", temperature write(*,*) " -- Initial pressure", pressure write(*,*) " -- Initial concentrations", constituents - if (errcode == 0) then - call micm_run(time_step, temperature, pressure, dry_air_density, constituent_props_ptr, & + call micm_run(time_step, temperature, pressure, dry_air_density, constituent_props_ptr, & constituents, iulog, errcode, errmsg) - write(*,*) " -- After solving, conentrations", constituents - else - write(*,*) " -- Exiting due to the error in creating solver" + if (errcode /= 0) then + write(*,*) " -- Solver failed to converge" stop 3 endif - write(*,*) " -- Completed solving" + write(*,*) " -- Completed solving. After solving, conentrations", constituents + call micm_final(iulog, errcode, errmsg) + if (errcode /= 0) then + write(*,*) " -- Failed to finalize micm" + stop 3 + endif + end subroutine test_micm_ccpp_api program run_test_micm_ccpp diff --git a/utilities/state_converters.meta b/utilities/state_converters.meta index 70b71899..3e02409c 100644 --- a/utilities/state_converters.meta +++ b/utilities/state_converters.meta @@ -152,7 +152,7 @@ dimensions = (horizontal_loop_extent, vertical_layer_dimension) intent = in [ rho ] - standard_name = density_of_dry_air + standard_name = dry_air_density long_name = dry air density units = kg m-3 dimensions = (horizontal_loop_extent, vertical_layer_dimension)