Skip to content
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
181 changes: 181 additions & 0 deletions parm/stofs_3d_atl/grib2_stofs_3d_atl_conus.east_cwl

Large diffs are not rendered by default.

181 changes: 181 additions & 0 deletions parm/stofs_3d_atl/grib2_stofs_3d_atl_puertori_cwl

Large diffs are not rendered by default.

97 changes: 69 additions & 28 deletions scripts/stofs_3d_atl/exstofs_3d_atl_hot_restart_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# (2) save the newly created file as stofs_3d_atl.t12z.hotstart.stofs3d.nc #
# #
# Remarks: #
# May 2023 #
# September 2025 #
#################################################################################################################

seton='-xa'
Expand Down Expand Up @@ -35,14 +35,19 @@
echo "Current dir=`pwd`"; echo


# NCPU_PBS==4320; minus N_scribe=6, hence, 4316;
# note: count (0, ..., 4316-1)
NCPU_PBS_hot_restart=4314
# NCPU_PBS==4320; minus N_scribe=8, hence, 4312;
# note: count (0, ..., 4312-1)
#NCPU_PBS_hot_restart=4314

let n_scribes=8
let NCPU_PBS_hot_restart=${NCPU_PBS}-${n_scribes}
echo "NCPU_PBS_hot_restart=${NCPU_PBS_hot_restart}"

sz_cr_ht_subdmn_MB=100000 # bytes

# list_steps_OI=(288 576 864 1152 1440 1728 2016 2304 2592 2880)
list_steps_OI=(2880 2592 2304 2016 1728 1440 1152 864 576 288)
# list_steps_OI=(2880 2592 2304 2016 1728 1440 1152 864 576 288)
list_steps_OI=(2592 2304 2016 1728 1440 1152 864 576 288)

dt_timestep=150

# str_ht_fn_prefix=
Expand All @@ -52,16 +57,28 @@

rm -f tmp_chk_hotstart_file


dir_nco_tmp_archive=${COMOUT}/outputs_watchdog


echo
echo "In exstofs_3d_atl_hot_restart_prep.sh: `pwd`: dir_nco_tmp_archive=${dir_nco_tmp_archive}"
echo


# mkdir -p ${dir_nco_tmp_archive}


cd ${dir_nco_tmp_archive}

for k_OI in ${list_steps_OI[@]}
do


# list_fn_ht_OI=`ls ${DATA}/outputs/hotstart_0?????_${k_OI}.nc`
list_fn_ht_OI=`ls ./outputs/hotstart_0?????_${k_OI}.nc 2> tmp_chk_hotstart_file`
list_fn_ht_OI=`ls hotstart_0?????_${k_OI}.nc 2> tmp_chk_hotstart_file`

echo "checking hotstart file of step=${k_OI}"

N_file_hotstart_default=`ls -lr ./outputs/hotstart_0?????_*${k_OI}.nc 2>> tmp_chk_hotstart_file | wc -l`
N_file_hotstart_default=`ls -lr ./hotstart_0?????_*${k_OI}.nc 2>> tmp_chk_hotstart_file | wc -l`

echo
echo checking hotstart file of step=${k_OI}
Expand Down Expand Up @@ -117,18 +134,21 @@ if [[ ${time_sec_merge_hotstart} -ne 0 ]]; then

cd ${DATA}

mv param.nml param.nml_cold_restart
fn_src_nml_rerun_ihot1=${COMOUTrerun}/${RUN}.${cycle}.param.nml
mv ${fn_src_nml_rerun_ihot1} ${fn_src_nml_rerun_ihot1}_backup_ihot1

cat param.nml_cold_restart | sed "s/ihot = 1/ihot = 2/" > param.nml
cpreq -f ${fn_src_nml_rerun_ihot1}_backup_ihot1 param.nml_ihot1_tmp
rm -f param.nml
cat param.nml_ihot1_tmp | sed "s/ihot = 1/ihot = 2/" > param.nml

# backup param.nml of cold restart
fn_param_modelRun_std=${RUN}.${cycle}.param.nml
cpreq -f param.nml ${COMOUT}/rerun/${fn_param_modelRun_std}_hot_restart
cpreq -f param.nml ${COMOUT}/rerun/${fn_param_modelRun_std}
cpreq -f param.nml ${COMOUT}/rerun/${fn_param_modelRun_std}_backup_ihot2

# files for ihot=2:
mv outputs/mirror.out outputs/mirror.out_cold_restart
touch outputs/mirror.out
touch outputs/flux.out
# post-crash run started 'new' dir: mv outputs/mirror.out outputs/mirror.out_cold_restart
touch outputs/mirror.out
touch outputs/flux.out

if [[ ! -f "outputs/staout_1" ]]; then
for i in {1,2,3,4,5,6,7,8,9}; do
Expand All @@ -143,33 +163,51 @@ fi

if [[ ${time_sec_merge_hotstart} -eq 0 ]];
then
# cold restart file
# use rerun/_restart.nc (at beginning time of nowcast)
fn_restart_rerun=${COMOUTrerun}/${RUN}.${cycle}.restart.nc

if [[ $(find ${fn_restart_rerun} -type f -size +20G 2>/dev/null) ]]; then
msg="restart.nc: ${fn_restart_rerun}"
ln -sf ${fn_restart_rerun} ${DATA}/hotstart.nc
# cpreq -pf ${fn_restart_rerun} ${DATA}/hotstart.nc

list_fn_avail_input_forcing+=(" \n " $fn_restart_rerun)
msg="restart.nc=${fn_restart_rerun}"

else
else
fn_restart_hotstart="${fn_restart_rerun}"
FLAG_all_exist_model_input_files=0
list_fn_missed_input_forcing+=(" \n " ${fn_restart_rerun})

echo -e "\n ${fn_restart_rerun}/hotstart file is not found in ${COMOUTrerun}"
msg="\n WARNING: None existing: ${COMOUTrerun} - WARNING"
fi
msg="\n To use the cold restart nc"

msg="\n To use the rerun/_restart.nc at beginning time of nowcast"
echo -e $msg; echo $msg >> $pgmout

else
# hot restart file

else

# Generate new global domain _restart.nc: to continue the unfinished run of the current cycle
mkdir -p ${DATA}/outputs/
cd ${DATA}/outputs/

# cp local_global & hotstart nc to $DATA/outputs/
touch ../log_cp_watchdog_hot_local2glb_timing.txt
postmsg ../log_cp_watchdog_hot_local2glb_timing.txt "Before cp dir_nco_tmp_archive"

if [ -d ${dir_nco_tmp_archive} ]; then
echo; echo dir_nco_tmp_archive=${dir_nco_tmp_archive} exists; echo
cp -fp ${dir_nco_tmp_archive}/local_to_global_* ${DATA}/outputs
cp -fp ${dir_nco_tmp_archive}/hotstart_*_${idx_time_step_merge_hotstart}.nc ${DATA}/outputs
cp -fp ${dir_nco_tmp_archive}/staout* ${DATA}/outputs

fi

postmsg ../log_cp_watchdog_hot_local2glb_timing.txt "Done cp dir_nco_tmp_archive"


#idx_time_step_merge_hotstart=576
fn_merged_hotstart_ftn=hotstart_it\=${idx_time_step_merge_hotstart}.nc
fn_hotstart_stofs3d_merged_std=${RUN}.${cycle}.restart.nc
Expand All @@ -191,11 +229,14 @@ else
msg="echo ${fn_merged_hotstart_ftn} has been created";
echo $msg; echo $msg >> $pgmout

cpreq -pf ${fn_merged_hotstart_ftn} ${COMOUT}/rerun/${fn_hotstart_stofs3d_merged_std}_hot_restart

cd ${DATA};
mv hotstart.nc hotstart.nc_cold_restart 2> tmp_rename_cold_restart_file
ln -sf ${COMOUT}/rerun/${fn_hotstart_stofs3d_merged_std}_hot_restart hotstart.nc
mv ${COMOUT}/rerun/${fn_hotstart_stofs3d_merged_std} ${COMOUT}/rerun/${fn_hotstart_stofs3d_merged_std}_ihot1
cpreq -pf ${fn_merged_hotstart_ftn} ${COMOUT}/rerun/${fn_hotstart_stofs3d_merged_std}
ln -sf ${COMOUT}/rerun/${fn_hotstart_stofs3d_merged_std} ${COMOUT}/rerun/${fn_hotstart_stofs3d_merged_std}_back_ihot2

cd ${DATA};
rm -f mv hotstart.nc
ln -sf ${COMOUT}/rerun/${fn_hotstart_stofs3d_merged_std} hotstart.nc

else
msg=`echo ${fn_merged_hotstart_ftn}} was not created`
Expand Down
18 changes: 17 additions & 1 deletion scripts/stofs_3d_atl/exstofs_3d_atl_post_1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@


# -----------------------> check & wait for model run complete
fn_mirror=${DATA}/outputs/mirror.out
fn_mirror=${COMOUT}/outputs_watchdog/mirror.out

str_model_run_status="Run completed successfully"

Expand All @@ -79,6 +79,22 @@ if [[ ${flag_run_status} == 0 ]]; then
cd ${DATA}


echo "date/time before cp data to post_1 outputs: `date`"


cpreq -f ${COMOUT}/outputs_watchdog/{horizontalVelX,horizontalVelY,out2d,salinity,temperature,zCoordinates,verticalVelocity,diffusivity}_*.nc ${dir_outputs_local};
cpreq -f ${COMOUT}/outputs_watchdog/staout_* ${dir_outputs_local}


echo "date/time when done cp data to post_1 outputs: `date`"

# Following is done in watchdog.sh
# including: history nc & local_to_global & hotstart_*_576.nc
# cpreq -fp ${COMOUT}/outputs_hotstart/hotstart_*_576.nc ${dir_outputs_local}
# cpreq -fp ${COMOUT}/outputs_hotstart/local_to_global_?????? ${dir_outputs_local}



# ---------> Update 2d & 3d nc: adding variable attributes
cd ${DATA}; pwd
file_log_attr=log_add_attribute_2d_3d_nc.${cycle}.log
Expand Down
36 changes: 30 additions & 6 deletions scripts/stofs_3d_atl/exstofs_3d_atl_post_2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@


# -----------------------> static files
# fn_station_in=$FIXstofs3d/${RUN}_station.in
# cpreq --remove-destination -f ${fn_station_in} station.in

cd ${DATA}

fn_src_nml=${COMOUTrerun:-${COMOUT}}/${RUN}.${cycle}.param.nml
if [ -f "${fn_src_nml}" ]; then
ln -sf ${fn_src_nml} param.nml
fi
fn_src_nml=${COMOUTrerun}/${RUN}.${cycle}.param.nml
ln -sf ${fn_src_nml} param.nml


# -----------------------> check for model run complete
fn_mirror=outputs/mirror.out
# -----------------------> check & wait for model run complete
fn_mirror=${COMOUT}/outputs_watchdog/mirror.out
str_model_run_status="Run completed successfully"


Expand All @@ -56,6 +57,29 @@ if [[ ${flag_run_status} == 0 ]]; then
echo $msg
echo $msg >> $pgmout

dir_outputs_local=${DATA}/outputs

mkdir -p ${dir_outputs_local}
cd ${DATA}

# including: history nc & local_to_global & hotstart_*_576.nc
#cpreq -fp ${COMOUT}/outputs_watchdog/hotstart_*_576.nc ${dir_outputs_local}
#cpreq -fp ${COMOUT}/outputs_watchdog/local_to_global_?????? ${dir_outputs_local}
#cpreq -fp ${COMOUT}/outputs_2d3d_sta/* ${dir_outputs_local}

postmsg "before cp data to post_1 outputs"

for i in ${COMOUT}/outputs_watchdog/local_to_global*; do
cpreq -f "$i" ${dir_outputs_local};
done

cpreq -f ${COMOUT}/outputs_watchdog/{horizontalVelX,horizontalVelY,out2d,salinity,temperature,zCoordinates,verticalVelocity,diffusivity}_*.nc ${dir_outputs_local};

TIME_STEP_restart=576
cpreq -f ${COMOUT}/outputs_watchdog/hotstart_*_${TIME_STEP_restart}.nc ${dir_outputs_local};

postmsg "done cp data to post_1 outputs"

# ---------> Update 2d & 3d nc: adding variable attributes
cd ${DATA}; pwd

Expand Down
Loading