Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/wait for files pism #1167

Open
wants to merge 8 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions configs/components/echam/echam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ compile_infos:
branch: ${echam.version}
choose_version:
6.3.05p2-awiesm-2.1:
branch: "6.3.05p2-awiesm-2.1-paleodyn-2.5" #LA: change back to 6.3.05p2-awiesm-2.1 once iceberg feature is merged https://gitlab.awi.de/paleodyn/Models/echam6/-/merge_requests/4
branch: "6.3.05p2-awiesm-2.1"
clean_command: rm -rf src/echam/bin; rm -rf bin; make clean
comp_command: ./config/createMakefiles.pl; autoreconf -i --force; mkdir -p src/.deps yaxt/src/.deps yaxt/tests/.deps; ./configure $configure_opts --with-fortran=intel INSTALL='/usr/bin/install -p'; make -j `nproc --all`; make install -j `nproc --all`; mkdir -p src/echam/bin; cp bin/echam6 src/echam/bin/echam6
git-repository: "https://gitlab.awi.de/paleodyn/Models/echam6.git"
Expand Down Expand Up @@ -411,20 +411,11 @@ choose_scenario:
dataset: r0008
greenhouse_dir: "${input_dir}"
forcing_files:
# aerocoarse: piaerocoarse
# aerofarir: piaerofarir
# aerofin: histaerofin
aerocoarse: piaerocoarse
aerofarir: piaerofarir
aerofin: piaerofin
sst: amipsst
sic: amipsic
aerocoarse_1849: piaerocoarse
aerocoarse_1850: piaerocoarse
aerocoarse_1851: piaerocoarse
aerofarir_1849: piaerofarir
aerofarir_1850: piaerofarir
aerofarir_1851: piaerofarir
aerofin_1849: piaerofin
aerofin_1850: piaerofin
aerofin_1851: piaerofin
ozone: ozone_hist_scenario
greenhouse: greenhouse_hist_scenario
volcir: histvolcir
Expand Down
8 changes: 4 additions & 4 deletions configs/components/pism/pism.compiletime_env_changes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ choose_computer.name:
levante:
environment_changes:
add_export_vars:
- "UDUNITS2_ROOT=/sw/spack-levante/udunits-2.2.28-da6pla/ #/sw/rhel6-x64/util/udunits-2.2.26-gcc64"
- "FFTW_ROOT=/sw/spack-levante/fftw-3.3.10-lnogal/ #/sw/rhel6-x64/numerics/fftw-3.3.7-openmp-gcc64"
- "PROJ_ROOT=/sw/spack-levante/proj-5.2.0-w7auht/ #/sw/rhel6-x64/graphics/proj4-4.9.3-gcc48"
- "PETSC_DIR=/sw/spack-levante/petsc-3.16.2-oorrxp/ #/sw/rhel6-x64/numerics/PETSc-3.12.2-impi2018-intel18/"
- "UDUNITS2_ROOT=/sw/spack-levante/udunits-2.2.28-da6pla/" #/sw/rhel6-x64/util/udunits-2.2.26-gcc64"
- "FFTW_ROOT=/sw/spack-levante/fftw-3.3.10-lnogal/" #/sw/rhel6-x64/numerics/fftw-3.3.7-openmp-gcc64"
- "PROJ_ROOT=/sw/spack-levante/proj-5.2.0-w7auht/" #/sw/rhel6-x64/graphics/proj4-4.9.3-gcc48"
- "PETSC_DIR=/sw/spack-levante/petsc-3.16.2-oorrxp/" #/sw/rhel6-x64/numerics/PETSc-3.12.2-impi2018-intel18/"
- "HDF5_ROOT=$HDF5ROOT"
- "LD_LIBRARY_PATH=/sw/spack-levante/gsl-2.7-5ou4yk/lib:$LD_LIBRARY_PATH"
#- "UDUNITS2_ROOT=/home/a/a270124/model_codes/dependencies/udunits-2.2.28-6havf7"
Expand Down
1 change: 1 addition & 0 deletions configs/components/pism/pism.recipes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ prepcompute_recipe:

- "assemble"
- "log_used_files"
- "wait_for_iterative_coupling"
- "_write_finalized_config"
#- "assemble_filelists"
#- "copy_tools_to_thisrun"
Expand Down
3 changes: 2 additions & 1 deletion couplings/fesom/coupling_fesom2ice.functions
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ function fesom_ice_concatenate_files {
echo ""; echo " * concatenating files"
# New cdo versions sometimes do not allow to overwrite files for
# "collective" commands. Hence delete existing old output file
[[ -f temp.tmp.nc ]] && rm temp.tmp.nc
[[ -f salt.tmp.nc ]] && rm salt.tmp.nc
[[ -f ocean_file_for_ice.nc ]] && rm ocean_file_for_ice.nc
${cdo} -s ensmean ${processed_fesom1x_file3D_T_list_for_ice} temp.tmp.nc
${cdo} -s ensmean ${processed_fesom1x_file3D_S_list_for_ice} salt.tmp.nc
Expand All @@ -573,7 +575,6 @@ function fesom_ice_concatenate_files {
# ${processed_fesom1x_file2D_list_for_ice} \
# ${processed_fesom1x_file2Dstatic_list_for_ice} \
# ocean_file_for_ice.nc

_flag_extract_depth=1
# Extract depth axis and Clean up temporary files
for file in \
Expand Down
38 changes: 3 additions & 35 deletions couplings/fesom/coupling_ice2fesom.functions
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ function ice2fesom {
. ${FUNCTION_PATH}/../pism/coupling_ocean2pism.functions

echo "ICE_TO_FESOM=${ICE_TO_FESOM:-0}"
if [[ "x$ICE_TO_FESOM" == "x0" ]]; then
if [[ "x$ICE_TO_FESOM"=="x0" ]]; then
echo " NOT generating ice forcing for ocean model"
echo " since ICE_TO_FESOM=${ICE_TO_FESOM}"
return
echo " since ICE_TO_FESOM=${ICE_TO_FESOM}"
return
else
echo " Only generating iceberg forcing so far ..."
iterative_coupling_pism_ocean_prepare_ocean_icebergmodel_forcing
Expand Down Expand Up @@ -230,41 +230,9 @@ function iterative_coupling_pism_ocean_prepare_ocean_icebergmodel_forcing {
cdo -s -timmean -selname,tendency_of_ice_amount_due_to_discharge \
-setgrid,${COUPLE_DIR}/ice.griddes ${pism_discharge_file} ${COUPLE_DIR}/latest_discharge.nc

#module unload python
#if [ "$MACHINE" == "ollie" ]; then
# module load python3/3.7.7_intel2020u2
#elif [ "$MACHINE" == "mistral" ]; then
# module load anaconda3/bleeding_edge
#fi
#if [ -f ${COUPLE_DIR}/num_non_melted_icb_file ]; then
# rm ${COUPLE_DIR}/num_non_melted_icb_file
#fi

#if [[ "xMESH_ROTATED_fesom"=="x1" ]]; then
# if [[ ! -f ${COUPLE_DIR}/nod2d.out.rot ]]; then
# python ${FUNCTION_PATH}/../utils/rotate_mesh.py ${MESH_DIR_fesom} ${COUPLE_DIR}
# cp ${MESH_DIR_fesom}/elem2d.out ${COUPLE_DIR}/elem2d.out
# fi
# python ${FUNCTION_PATH}/../utils/icb_apply_distribution.py ${COUPLE_DIR}/latest_discharge.nc ${COUPLE_DIR} ${COUPLE_DIR} ${BASIN_FILE}
#else
# python ${FUNCTION_PATH}/../utils/icb_apply_distribution.py ${COUPLE_DIR}/latest_discharge.nc ${MESH_DIR_fesom} ${COUPLE_DIR} ${BASIN_FILE}
#fi

#echo; echo " * Finished iceberg generation"
#if [ -f ${COUPLE_DIR}/../restart/fesom/iceberg.restart.ISM ]; then
# wc -l ${COUPLE_DIR}/../restart/fesom/iceberg.restart.ISM | awk '{ print $1 }' > ${COUPLE_DIR}/num_non_melted_icb_file
#fi
use_icesheet_coupling=1
}

#function get_ib_num_after_ice_sheet_coupling {
# _a="$( wc -l icb/LON.dat | awk '{ print $1 }' )"
# _b="$( cat ../icb/num_non_melted_icb_file )"
#
# ib_num=$(( $_a + $_b ))
# general_replace_namelist_value namelist.config icebergs ib_num $ib_num
# general_replace_namelist_value namelist.config icebergs use_icesheet_coupling ".true."
#}
############################################################################
############################################################################

Expand Down
2 changes: 1 addition & 1 deletion couplings/fesom/env_fesom.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def prepare_environment(config):
"EXP_ID": config["general"]["command_line_config"]["expid"],
"iter_coup_regrid_method_ice2oce": "INTERPOLATE",
"fesom_use_icebergs": config["fesom"].get("use_icebergs", ""),
"BASIN_FILE": config["fesom"].get("basin_file"),
#"BASIN_FILE": config["fesom"].get("basin_file"),
"MACHINE": config["computer"]["name"],
"ICEBERG_DIR": config["fesom"].get("iceberg_dir", ""),

Expand Down
2 changes: 1 addition & 1 deletion couplings/pism/coupling_atmosphere2pism.functions
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ ic_atm2debm_ablation_debm_run_modify_nml() {
TMP=$( grep cobld $( ls -t ${COUPLE_DIR}/../run_*/work/namelist.echam | head -1 ) | sed 's/^[ \t]*//' )
prefix="cobld = "
MY_OBLIQUITY=${TMP#"$prefix"}
obliquity_value=${MY_OBLIQUITY:-"23.17"}
obliquity_value=${MY_OBLIQUITY:-"23.441"}

echo -e "\t\t- Generating namelist for dEBM Mass Balance Model"
echo -e "\t\t- Obliquity = ${obliquity_value}"
Expand Down
4 changes: 2 additions & 2 deletions couplings/pism/coupling_pism2atmosphere.functions
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ function pism_atmosphere_get_newest_output {

# Define list of variables selected from PISM output depending on whether icebergs are used or not
if [ "x${fesom_use_iceberg}" == "x1" ]; then
echo "LA DEBUG: 1"
echo " * use iceberg coupling and exclude iceberg discharge from mass balance"
CDO_SELECT_VAR_LIST="thk,climatic_mass_balance,topg,${OROG_VARNAME_pism},${GLACIAL_MASK_VARNAME_pism},tendency_of_ice_amount,tendency_of_ice_amount_due_to_conservation_error,tendency_of_ice_amount_due_to_surface_mass_flux,tendency_of_ice_amount_due_to_basal_mass_flux,tendency_of_ice_amount_due_to_discharge,tendency_of_ice_amount_due_to_flow"
else
echo "LA DEBUG: 2"
echo " * no iceberg coupling"
CDO_SELECT_VAR_LIST="thk,climatic_mass_balance,topg,${OROG_VARNAME_pism},${GLACIAL_MASK_VARNAME_pism},tendency_of_ice_amount"
fi

Expand Down
10 changes: 7 additions & 3 deletions couplings/utils/fesom_scalar_array_to_LonLat.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def parse_arguments():
#
#print('* Read the data file args.FESOM_FILE=' + " ".join(args.FESOM_FILE))
#FID = MFDataset(args.FESOM_PATH + "".join("/temp.fesom.*.01.nc"))
FID = xr.open_dataset(str(args.FESOM_PATH[0]) + str(args.FESOM_VARIABLE[0]) + ".fesom." + str(args.FESOM_YEARS[0]) + ".nc")
FID = xr.open_dataset(str(args.FESOM_PATH[0]) + str(args.FESOM_VARIABLE[0]) + ".fesom." + str(args.FESOM_YEARS[0]) + ".nc", decode_times=False)

# ----------------------------------------------------------------
#
Expand Down Expand Up @@ -164,7 +164,7 @@ def parse_arguments():
#
# Prepare data for final netcdf output
#
#ilevel = ilevel + 1
ilevel = ilevel + 1

flag_verbose=False

Expand All @@ -173,9 +173,13 @@ def parse_arguments():
pf.get_data(args.FESOM_PATH[0], args.FESOM_VARIABLE[0], int(args.FESOM_YEARS[0]), mesh, depth=idepth, how="mean") #, flag_verbose)
else:
level_data = \
pf.get_data(args.FESOM_PATH[0], args.FESOM_VARIABLE[0], [int(args.FESOM_YEARS[0]), int(args.FESOM_YEARS[1])], mesh, depth=idepth, how="mean") #, flag_verbose)
pf.get_data(args.FESOM_PATH[0], args.FESOM_VARIABLE[0], [int(args.FESOM_YEARS[0]), int(args.FESOM_YEARS[1])], mesh, depth=idepth, how="mean", use_cftime=True) #, flag_verbose)

print("LA DEBUG: level_data = ", level_data)
level_data[np.where(np.isnan(level_data))] = NAN_REPLACE
TempFields_out[itime, ilevel, :] = level_data
print("LA DEBUG: level_data = ", level_data)
print("LA DEBUG: TempFields_out = ", TempFields_out)


# ----------------------------------------------------------------
Expand Down
Loading