andrewdnolan / thermal-structure

Thermomechanically coupled surging experiments with Elmer/Ice
MIT License
0 stars 0 forks source link

Rerun subset of periodic surging experiments that did not make it 9ka #17

Open andrewdnolan opened 2 weeks ago

andrewdnolan commented 2 weeks ago

About a third of the periodic surging experiment did not make it the end of the 9ka simulation. The purpose of this PR is to rerun those simulations that failed, with a bit more attention and babysitting this time around.

andrewdnolan commented 2 weeks ago

Identifying incomplete runs

Assuming you have a PeriodicSurges_Timeseries_9ka.zarrr file as generated by expr/03_PeriodicSurge/run/crmpt12/postprocess_timeseries.py, we can identify the runs that did not make it past 8ka with:

import numpy as np
import xarray as xr

zarr_path = 'data/PeriodicSurges_Timeseries_9ka.zarr'

src = xr.open_dataset(zarr_path, engine='zarr')

nt = src.dims["t"]

betas = []
periods = []
for SP in src.SP:
    for beta in src.beta:
        da = src.sel(SP=SP, beta=beta).percent_temperate

        # number of nans
        nn = np.count_nonzero(da.isnull())
        # final valid timestep
        idx, = np.where(da.isnull())
        t_f = da.t.isel(t=idx[0]-1)

        if (nn > 1) & (t_f < 8e3):
            betas.append(float(beta))
            periods.append(float(SP))

np.savetxt("incomplete_runs.dat",  np.array([periods, betas]).T)

The incomplete_runs.dat file is then used by the expr/03_PeriodicSurge/make_experiment.py script in order to generate the run commands and job submission script for the simulations that need to be rerun.