diff --git a/.gitmodules b/.gitmodules index 76c266d5..ef7afbf9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -20,7 +20,7 @@ [submodule "ncar-physics"] path = src/physics/ncar_ccpp url = https://github.com/ESCOMP/atmospheric_physics - fxtag = 36f336e87 + fxtag = ac83803062a5d38b92e416e1cf737d3811e20cd1 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics [submodule "ccs_config"] diff --git a/cime_config/atm_musica_config.py b/cime_config/atm_musica_config.py index 79cfa0bc..464d3f97 100644 --- a/cime_config/atm_musica_config.py +++ b/cime_config/atm_musica_config.py @@ -4,7 +4,8 @@ """ MUSICA_CCPP_SCHEME_NAME = "musica_ccpp" +MUSICA_CONFIG_DIR_NAME = "musica_configurations" MUSICA_REPO_URL = "https://github.com/NCAR/musica.git" MUSICA_TAG = "cc39bb00d2220fc81c85b22d3ceea4a39bd2bacf" CHEMISTRY_DATA_REPO_URL = "https://github.com/NCAR/cam-sima-chemistry-data.git" -CHEMISTRY_DATA_TAG = "2b58f2410ec7a565bcf80dee16ec20f6bc35d78b" +CHEMISTRY_DATA_TAG = "71ed143c54b0d5d6e3e70f3d05d413fddcf8d59e" diff --git a/cime_config/buildlib b/cime_config/buildlib index 1aa4e2af..0db7d95a 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -12,7 +12,7 @@ import subprocess import logging from cam_config import ConfigCAM # CAM's configure structure -from atm_musica_config import MUSICA_CCPP_SCHEME_NAME +from atm_musica_config import MUSICA_CCPP_SCHEME_NAME, MUSICA_CONFIG_DIR_NAME from atm_musica_config import MUSICA_REPO_URL, MUSICA_TAG from atm_musica_config import CHEMISTRY_DATA_REPO_URL, CHEMISTRY_DATA_TAG @@ -176,7 +176,7 @@ def _build_cam(): # If MUSICA-CCPP scheme is used in a suite, download # the MUSICA configuration and build the MUSICA library if MUSICA_CCPP_SCHEME_NAME in scheme_names: - _download_musica_configuration(caseroot) + _ = _download_musica_configuration(caseroot) musica_install_path = _build_musica(caseroot) cam_linked_libs = case.get_value("CAM_LINKED_LIBS") @@ -184,13 +184,14 @@ def _build_cam(): if not musica_libs in cam_linked_libs: _set_musica_lib_path(musica_install_path, caseroot) - cmd += ' USER_INCLDIR="'\ - f'-I{os.path.join(musica_install_path, "include", "micm")} '\ - f'-I{os.path.join(musica_install_path, "include", "musica")} '\ - f'-I{os.path.join(musica_install_path, "include", "musica", "micm")} '\ - f'-I{os.path.join(musica_install_path, "include", "musica", "tuvx")} '\ - f'-I{os.path.join(musica_install_path, "include", "musica", "fortran")} '\ + cmd += (' USER_INCLDIR="' + f'-I{os.path.join(musica_install_path, "include", "micm")} ' + f'-I{os.path.join(musica_install_path, "include", "musica")} ' + f'-I{os.path.join(musica_install_path, "include", "musica", "micm")} ' + f'-I{os.path.join(musica_install_path, "include", "musica", "tuvx")} ' + f'-I{os.path.join(musica_install_path, "include", "musica", "fortran")} ' '"' + ) retcode, out, err = run_cmd(cmd) _LOGGER.info("Command %s:\n\nstdout:\n%s\n\nstderr:\n%s\n", cmd, out, err) @@ -284,8 +285,8 @@ def _build_musica(clone_dest: str) -> str: subprocess.run(command, cwd=bld_path, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=False) except subprocess.CalledProcessError as e: - raise subprocess.CalledProcessError(e.returncode, e.cmd, "The subprocess \ - for cmake to configure the MUSICA CMake project failed.") from e + raise subprocess.CalledProcessError(e.returncode, e.cmd, + "The subprocess for cmake to configure the MUSICA CMake project failed.") from e except FileNotFoundError as e: raise FileNotFoundError("The 'cmake' command was not found.") from e except OSError as e: @@ -294,10 +295,10 @@ def _build_musica(clone_dest: str) -> str: command = ["cmake", "--build", ".", "--target", "install"] try: subprocess.run(command, cwd=bld_path, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, text=True, check=False) + text=True, check=False) except subprocess.CalledProcessError as e: - raise subprocess.CalledProcessError(e.returncode, e.cmd, "The subprocess \ - for cmake to build the MUSICA library failed.") from e + raise subprocess.CalledProcessError(e.returncode, e.cmd, + "The subprocess for cmake to build the MUSICA library failed.") from e except FileNotFoundError as e: raise FileNotFoundError("The 'cmake' command was not found.") from e except OSError as e: @@ -308,7 +309,7 @@ def _build_musica(clone_dest: str) -> str: return musica_install_path ############################################################################### -def _download_musica_configuration(download_dest: str) -> None: +def _download_musica_configuration(download_dest: str) -> str: ############################################################################### """ Downloads the MUSICA configuration and renames the configuration @@ -321,13 +322,14 @@ def _download_musica_configuration(download_dest: str) -> None: Exception: If the directory to be renamed is not found or any other exceptions occur during the renaming process, an exception is raised with the error message. + Returns: + musica_config_path: path to the MUSICA configuration directory """ - musica_config_dir_name = "musica_configurations" _clone_and_checkout(CHEMISTRY_DATA_REPO_URL, CHEMISTRY_DATA_TAG, download_dest) original_dir = os.path.join(download_dest, "cam-sima-chemistry-data", "mechanisms") - renamed_dir = os.path.join(download_dest, "cam-sima-chemistry-data", musica_config_dir_name) + renamed_dir = os.path.join(download_dest, "cam-sima-chemistry-data", MUSICA_CONFIG_DIR_NAME) try: os.rename(original_dir, renamed_dir) except FileNotFoundError as e: @@ -339,12 +341,14 @@ def _download_musica_configuration(download_dest: str) -> None: except OSError as e: raise OSError("An error occurred while renaming.") from e - musica_config_path = os.path.join(download_dest, musica_config_dir_name) + musica_config_path = os.path.join(download_dest, MUSICA_CONFIG_DIR_NAME) if os.path.exists(musica_config_path): shutil.rmtree(musica_config_path) shutil.move(renamed_dir, download_dest) + return musica_config_path + ############################################################################### def _set_musica_lib_path(musica_install_path: str, caseroot: str) -> None: ############################################################################### @@ -374,8 +378,8 @@ def _set_musica_lib_path(musica_install_path: str, caseroot: str) -> None: subprocess.run(command, cwd=caseroot, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=False) except subprocess.CalledProcessError as e: - raise subprocess.CalledProcessError(e.returncode, e.cmd, "The subprocess \ - for xmlchange to set the MUSICA library path failed.") from e + raise subprocess.CalledProcessError(e.returncode, e.cmd, + "The subprocess for xmlchange to set the MUSICA library path failed.") from e except FileNotFoundError as e: raise FileNotFoundError("The 'xmlchange' command was not found.") from e except OSError as e: @@ -408,8 +412,8 @@ def _clone_and_checkout(repo_url: str, tag_name: str, clone_dest: str) -> None: subprocess.run(["git", "clone", repo_url, repo_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=False) except subprocess.CalledProcessError as e: - raise subprocess.CalledProcessError(e.returncode, e.cmd, f"The subprocess \ - for git to clone the repository {repo_url} failed.") from e + raise subprocess.CalledProcessError(e.returncode, e.cmd, + f"The subprocess for git to clone the repository {repo_url} failed.") from e except FileNotFoundError as e: raise FileNotFoundError("The 'git' command was not found.") from e except OSError as e: @@ -419,8 +423,8 @@ def _clone_and_checkout(repo_url: str, tag_name: str, clone_dest: str) -> None: subprocess.run(["git", "-C", repo_path, "checkout", tag_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=False) except subprocess.CalledProcessError as e: - raise subprocess.CalledProcessError(e.returncode, e.cmd, f"The subprocess \ - for git to checkout the branch {tag_name} failed.") from e + raise subprocess.CalledProcessError(e.returncode, e.cmd, + f"The subprocess for git to checkout the branch {tag_name} failed.") from e except FileNotFoundError as e: raise FileNotFoundError("The 'git' command was not found.") from e except OSError as e: diff --git a/cime_config/buildnml b/cime_config/buildnml index 32aa01a2..f6b8842a 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -22,7 +22,7 @@ from CIME.Tools.standard_script_setup import * from CIME.XML.standard_module_setup import * from CIME.buildnml import create_namelist_infile, parse_input from CIME.case import Case -from CIME.utils import expect +from CIME.utils import expect, symlink_force # Save local (cime_config) directory path: _CIME_CONFIG_PATH = os.path.dirname(os.path.abspath(__file__)) @@ -35,8 +35,10 @@ from cam_config import ConfigCAM # HistoryConfig allows translation from user_nl_cam into Fortran namelists from hist_config import HistoryConfig -#Import CAM's ParamGen class: +# Import CAM's ParamGen class: from atm_in_paramgen import AtmInParamGen +# Import specific names associated with the MUSICA scheme +from atm_musica_config import MUSICA_CCPP_SCHEME_NAME, MUSICA_CONFIG_DIR_NAME # Open CIME case log: _LOGGER = logging.getLogger(__name__) @@ -166,7 +168,7 @@ def buildnml(case, caseroot, compname): gen_indent = 3 #Generate model code and meta-data: - _ = config.generate_cam_src(gen_indent) + scheme_names = config.generate_cam_src(gen_indent) #---------------------------------------------------------------- # Create namelist attribute dictionary (to set namelist defaults): @@ -376,6 +378,21 @@ def buildnml(case, caseroot, compname): # end for # end with + # If MUSICA-CCPP scheme is used in a suite, create symlinks in the run + # directory pointing to the MUSICA configuration data located in the caseroot + if MUSICA_CCPP_SCHEME_NAME in scheme_names: + musica_config_src_dir = os.path.join(caseroot, MUSICA_CONFIG_DIR_NAME) + musica_config_dest_dir = os.path.join(rundir, MUSICA_CONFIG_DIR_NAME) + + if os.path.exists(musica_config_src_dir): + os.makedirs(musica_config_dest_dir, exist_ok=True) + for root, _, files in os.walk(musica_config_src_dir): + rel_path = os.path.relpath(root, musica_config_src_dir) + dest_dir = os.path.join(musica_config_dest_dir, rel_path) + + os.makedirs(dest_dir, exist_ok=True) + for file in files: + symlink_force(os.path.join(root, file), os.path.join(dest_dir, file)) ############################################################################### def _main_func(): diff --git a/docker/Dockerfile.musica b/docker/Dockerfile.musica index f5deedbc..0a716b7e 100644 --- a/docker/Dockerfile.musica +++ b/docker/Dockerfile.musica @@ -77,11 +77,29 @@ RUN /home/cam_sima_user/CAM-SIMA/cime/scripts/create_newcase --case $CASE_NAME \ WORKDIR $CASE_NAME -RUN ./case.setup - +RUN ./xmlchange COMPILER=gnu +RUN ./xmlchange DEBUG=true RUN ./xmlchange CAM_CONFIG_OPTS="--dyn none --physics-suites musica" -RUN ./xmlchange ROF_NCPL=48 RUN ./xmlchange STOP_OPTION=nsteps RUN ./xmlchange STOP_N=5 +# Match the GLC timestep to atmosphere timestep +RUN ./xmlchange ATM_NCPL=48 +RUN ./xmlchange GLC_NCPL=48 + +# Avoid writing restart files +RUN ./xmlchange REST_N=100 + +RUN ./case.setup + +# Specify the path to the MUSICA configuraiton files by adding the following lines to the `user_nl_cam` file. +# For example, to configure the Chapman mechanisms, include these lines. +# filename_of_micm_configuration=/home/cam_sima_user/case_name/test-case/musica_configurations/chapman/micm/config.json +# filename_of_tuvx_configuration=/home/cam_sima_user/case_name/test-case/musica_configurations/chapman/tuvx/config.json +# filename_of_tuvx_micm_mapping_configuration=/home/cam_sima_user/case_name/test-case/musica_configurations/chapman/tuvx_micm_mapping.json + +# You can run the model with the snapshot file by adding this line to the end of 'user_nl_cam' file on Derecho. +# Note that this snapshot contains only ten time slices. +# ncdata=/glade/campaign/cesm/community/amwg/sima_baselines/cam_sima_test_snapshots/cam_ne3pg3_kessler_snapshot_derecho_gnu_before_c20240412.nc + RUN ./case.build \ No newline at end of file diff --git a/src/control/cam_comp.F90 b/src/control/cam_comp.F90 index 0a8b1b63..16e32984 100644 --- a/src/control/cam_comp.F90 +++ b/src/control/cam_comp.F90 @@ -84,27 +84,31 @@ subroutine cam_init(caseid, ctitle, model_doi_url, & ! !----------------------------------------------------------------------- - use cam_initfiles, only: cam_initfiles_open - use dyn_grid, only: model_grid_init - use phys_comp, only: phys_init - use phys_comp, only: phys_register - use dyn_comp, only: dyn_init -! use cam_restart, only: cam_read_restart - use camsrfexch, only: hub2atm_alloc, atm2hub_alloc - use cam_history, only: history_init_files -! use history_scam, only: scm_intht - use cam_pio_utils, only: init_pio_subsystem - use cam_instance, only: inst_suffix -! use history_defaults, only: initialize_iop_history - use stepon, only: stepon_init - use air_composition, only: air_composition_init - use cam_ccpp_cap, only: cam_ccpp_initialize_constituents - use physics_grid, only: columns_on_task - use vert_coord, only: pver - use phys_vars_init_check, only: mark_as_initialized - use tropopause_climo_read, only: tropopause_climo_read_file - use musica_ccpp_dependencies, only: musica_ccpp_dependencies_init - use orbital_data, only: orbital_data_init + use cam_initfiles, only: cam_initfiles_open + use dyn_grid, only: model_grid_init + use phys_comp, only: phys_init + use phys_comp, only: phys_register + use dyn_comp, only: dyn_init +! use cam_restart, only: cam_read_restart + use camsrfexch, only: hub2atm_alloc, atm2hub_alloc + use cam_history, only: history_init_files +! use history_scam, only: scm_intht + use cam_pio_utils, only: init_pio_subsystem + use cam_instance, only: inst_suffix +! use history_defaults, only: initialize_iop_history + use stepon, only: stepon_init + use air_composition, only: air_composition_init + use cam_ccpp_cap, only: cam_ccpp_initialize_constituents + use cam_ccpp_cap, only: cam_model_const_properties + use cam_ccpp_cap, only: cam_constituents_array + use physics_grid, only: columns_on_task + use vert_coord, only: pver + use phys_vars_init_check, only: mark_as_initialized + use tropopause_climo_read, only: tropopause_climo_read_file + use orbital_data, only: orbital_data_init + use ccpp_kinds, only: kind_phys + use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t + use musica_ccpp_dependencies, only: musica_ccpp_dependencies_init ! Arguments character(len=cl), intent(in) :: caseid ! case ID @@ -146,10 +150,13 @@ subroutine cam_init(caseid, ctitle, model_doi_url, & type(cam_out_t), pointer :: cam_out ! Output from CAM to surface type(cam_in_t), pointer :: cam_in ! Merged input state to CAM - ! Local variables + ! Local variables character(len=cs) :: filein ! Input namelist filename integer :: errflg character(len=cx) :: errmsg + + type(ccpp_constituent_prop_ptr_t), pointer :: constituent_properties(:) + real(kind_phys), pointer :: constituents_array(:,:,:) !----------------------------------------------------------------------- call init_pio_subsystem() @@ -248,6 +255,21 @@ subroutine cam_init(caseid, ctitle, model_doi_url, & ! Read tropopause climatology call tropopause_climo_read_file() + ! Temporary: Prescribe realistic but inaccurate physical quantities + ! necessary for MUSICA that are currently unavailable in CAM-SIMA. + ! It also initializes the MUSICA constituent values until the file + ! I/O object is implemented. + ! + ! Remove this when MUSICA input data are available from CAM-SIMA or + ! other physics schemes. + constituent_properties => cam_model_const_properties() + constituents_array => cam_constituents_array() + call musica_ccpp_dependencies_init(columns_on_task, pver, & + constituent_properties, constituents_array) + + ! Initialize orbital data + call orbital_data_init(columns_on_task) + call phys_init() !!XXgoldyXX: v need to import this @@ -261,16 +283,6 @@ subroutine cam_init(caseid, ctitle, model_doi_url, & ! end if call history_init_files(model_doi_url, caseid, ctitle) - ! Temporary: Prescribe realistic but inaccurate physical quantities - ! necessary for MUSICA that are currently unavailable in CAM-SIMA. - ! - ! Remove this when MUSICA input data are available from CAM-SIMA or - ! other physics schemes. - call musica_ccpp_dependencies_init(columns_on_task, pver, iulog) - - ! Initialize orbital data - call orbital_data_init(columns_on_task) - end subroutine cam_init ! diff --git a/src/physics/ncar_ccpp b/src/physics/ncar_ccpp index 36f336e8..ac838030 160000 --- a/src/physics/ncar_ccpp +++ b/src/physics/ncar_ccpp @@ -1 +1 @@ -Subproject commit 36f336e876ece9fcfcb97a29cf1785d172a5252d +Subproject commit ac83803062a5d38b92e416e1cf737d3811e20cd1 diff --git a/src/physics/utils/musica_ccpp_dependencies.F90 b/src/physics/utils/musica_ccpp_dependencies.F90 index 885ed7a8..f9d0e927 100644 --- a/src/physics/utils/musica_ccpp_dependencies.F90 +++ b/src/physics/utils/musica_ccpp_dependencies.F90 @@ -1,4 +1,4 @@ -! Copyright (C) 2024 National Science Foundation-National Center for Atmospheric Research +! Copyright (C) 2024-2025 University Corporation for Atmospheric Research ! SPDX-License-Identifier: Apache-2.0 module musica_ccpp_dependencies !-------------------------------------------------------------------------- @@ -33,14 +33,147 @@ module musica_ccpp_dependencies ! local parameters character(len=*), parameter :: module_name = '(musica_ccpp_dependencies)' + !> Definition of temporary MUSICA species object + type, private :: temp_musica_species_t + character(len=:), allocatable :: name + real(kind_phys) :: constituent_value = 0.0_kind_phys ! kg kg-1 + end type temp_musica_species_t + + interface temp_musica_species_t + procedure species_constructor + end interface temp_musica_species_t + !============================================================================== contains !============================================================================== - subroutine musica_ccpp_dependencies_init(horizontal_dimension, & - vertical_layer_dimension, log_file_unit) + function species_constructor(name, value) result( this ) + + !----------------------------------------------------------------------- + ! + ! Constructor for temporary MUSICA species object + ! + !----------------------------------------------------------------------- + + character(len=*), intent(in) :: name + real(kind_phys), intent(in) :: value + type(temp_musica_species_t) :: this + + this%name = name + this%constituent_value = value + + end function species_constructor + + subroutine initialize_musica_species_constituents(constituents_properties, & + constituents_array, errmsg, errcode) + + !----------------------------------------------------------------------- + ! + ! Initialize temporary MUSICA species constituents. + ! + !----------------------------------------------------------------------- + + use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t + use ccpp_const_utils, only: ccpp_const_get_idx + use cam_logfile, only: iulog + use musica_ccpp_namelist, only: filename_of_micm_configuration + + type(ccpp_constituent_prop_ptr_t), pointer :: constituents_properties(:) + real(kind_phys), pointer :: constituents_array(:,:,:) + character(len=512), intent(out) :: errmsg + integer, intent(out) :: errcode + + ! local variables + type(temp_musica_species_t), allocatable :: species_group(:) + character(len=*), parameter :: chapman_config = 'chapman' + character(len=*), parameter :: terminator_config = 'terminator' + logical :: is_chapman = .false. + logical :: is_terminator = .false. + integer :: num_micm_species = 0 + integer :: num_tuvx_constituents = 1 + integer :: num_tuvx_only_gas_species = 0 + integer :: position + integer :: constituent_index + integer :: i_species + + if (.not. associated(constituents_properties)) then + errcode = 1 + errmsg = "[MUSICA Error] The pointer to the constituents properties object is not associated." + return + end if + + ! Currently, we only support two types of MUSICA configurations: Chapman and Terminator, + ! until the file I/O object is implemented. If the configuration is neither of these, + ! an error will be thrown. + position = index(filename_of_micm_configuration, chapman_config) ! Check if the substring exists + if (position > 0) then + is_chapman = .true. + write(iulog,*) "[MUSICA Info] Using the Chapman configuriation." + else + position = index(filename_of_micm_configuration, terminator_config) + if (position > 0) then + is_terminator = .true. + write(iulog,*) "[MUSICA Info] Using the Terminator configuriation." + else + errcode = 1 + errmsg = "[MUSICA Error] MUSICA configuration is not found." + return + end if + end if + + if (is_chapman) then + num_micm_species = 5 + num_tuvx_only_gas_species = 1 + else if (is_terminator) then + num_micm_species = 2 + num_tuvx_only_gas_species = 3 + end if + + allocate (species_group(num_micm_species + num_tuvx_constituents + num_tuvx_only_gas_species), & + stat=errcode, errmsg=errmsg) + if (errcode /= 0) return + + species_group(1) = species_constructor(& + "cloud_liquid_water_mixing_ratio_wrt_moist_air_and_condensed_water", 0.00060_kind_phys) - use cam_abortutils, only: check_allocate + if (is_chapman) then + species_group(2) = species_constructor("O2", 0.22474_kind_phys) + species_group(3) = species_constructor("O", 5.3509e-10_kind_phys) + species_group(4) = species_constructor("O1D", 5.3509e-10_kind_phys) + species_group(5) = species_constructor("O3", 0.00016_kind_phys) + species_group(6) = species_constructor("N2", 0.74015_kind_phys) + species_group(7) = species_constructor("air", 1.0_kind_phys) + + else if (is_terminator) then + species_group(2) = species_constructor("Cl", 1.0e-12_kind_phys) + species_group(3) = species_constructor("Cl2", 1.0e-12_kind_phys) + species_group(4) = species_constructor("air", 1.0_kind_phys) + species_group(5) = species_constructor("O2", 0.21_kind_phys) + species_group(6) = species_constructor("O3", 4.0e-6_kind_phys) + end if + + do i_species = 1, num_micm_species + num_tuvx_constituents + num_tuvx_only_gas_species + call ccpp_const_get_idx(constituents_properties, trim(species_group(i_species)%name), & + constituent_index, errmsg, errcode) + if (errcode /= 0) then + deallocate (species_group) + return + end if + + constituents_array(:,:,constituent_index) = species_group(i_species)%constituent_value + end do + + deallocate (species_group) + + end subroutine initialize_musica_species_constituents + + subroutine musica_ccpp_dependencies_init( & + horizontal_dimension, vertical_layer_dimension, & + constituents_properties, constituents_array) + + use cam_abortutils, only: check_allocate, endrun + use cam_logfile, only: iulog + use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t !----------------------------------------------------------------------- ! @@ -48,32 +181,41 @@ subroutine musica_ccpp_dependencies_init(horizontal_dimension, & ! !----------------------------------------------------------------------- - integer, intent(in) :: horizontal_dimension - integer, intent(in) :: vertical_layer_dimension - integer, intent(in) :: log_file_unit + integer, intent(in) :: horizontal_dimension + integer, intent(in) :: vertical_layer_dimension + type(ccpp_constituent_prop_ptr_t), pointer :: constituents_properties(:) + real(kind_phys), pointer :: constituents_array(:,:,:) - integer :: error_code + ! local variables character(len=*), parameter :: subroutine_name = & trim(module_name)//':(musica_ccpp_dependencies_init)' + character(len=512) :: errmsg + integer :: errcode + + write(iulog,*) 'WARNING: Using placeholder data for MUSICA chemistry.' - write(log_file_unit,*) 'WARNING: Using placeholder data for MUSICA chemistry.' + call initialize_musica_species_constituents(constituents_properties, & + constituents_array, errmsg, errcode) + if (errcode /= 0) then + call endrun(errmsg, file=__FILE__, line=__LINE__) + end if allocate(photolysis_wavelength_grid_interfaces(photolysis_wavelength_grid_interface_dimension), & - stat=error_code) - call check_allocate(error_code, subroutine_name, & + stat=errcode, errmsg=errmsg) + call check_allocate(errcode, subroutine_name, & 'photolysis_wavelength_grid_interfaces(photolysis_wavelength_grid_interface_dimension)', & file=__FILE__, line=__LINE__) allocate(extraterrestrial_radiation_flux(photolysis_wavelength_grid_section_dimension), & - stat=error_code) - call check_allocate(error_code, subroutine_name, & + stat=errcode, errmsg=errmsg) + call check_allocate(errcode, subroutine_name, & 'extraterrestrial_radiation_flux(photolysis_wavelength_grid_section_dimension)', & file=__FILE__, line=__LINE__) - allocate(surface_albedo(horizontal_dimension), stat=error_code) - call check_allocate(error_code, subroutine_name, & + allocate(surface_albedo(horizontal_dimension), stat=errcode, errmsg=errmsg) + call check_allocate(errcode, subroutine_name, & 'surface_albedo(horizontal_dimension)', & file=__FILE__, line=__LINE__) - allocate(blackbody_temperature_at_surface(horizontal_dimension), stat=error_code) - call check_allocate(error_code, subroutine_name, & + allocate(blackbody_temperature_at_surface(horizontal_dimension), stat=errcode, errmsg=errmsg) + call check_allocate(errcode, subroutine_name, & 'blackbody_temperature_at_surface(horizontal_dimension)', & file=__FILE__, line=__LINE__) diff --git a/src/physics/utils/orbital_data.F90 b/src/physics/utils/orbital_data.F90 index df9f852d..bced4e1e 100644 --- a/src/physics/utils/orbital_data.F90 +++ b/src/physics/utils/orbital_data.F90 @@ -1,4 +1,4 @@ -! Copyright (C) 2024 National Science Foundation-National Center for Atmospheric Research +! Copyright (C) 2024-2025 University Corporation for Atmospheric Research ! SPDX-License-Identifier: Apache-2.0 module orbital_data !--------------------------------------------------------------------------