From 894830f09af53de360873dcc1ef57b825a5dec1d Mon Sep 17 00:00:00 2001 From: Francesco Radica <51544149+Francyrad@users.noreply.github.com> Date: Thu, 7 May 2026 12:43:45 +0200 Subject: [PATCH] Fix dynamic core CoreData initialization --- source/boundary_temperature/dynamic_core.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source/boundary_temperature/dynamic_core.cc b/source/boundary_temperature/dynamic_core.cc index a01eb499596..081ab26a51b 100644 --- a/source/boundary_temperature/dynamic_core.cc +++ b/source/boundary_temperature/dynamic_core.cc @@ -94,9 +94,16 @@ namespace aspect const Postprocess::CoreStatistics &core_statistics = this->get_postprocess_manager().template get_matching_active_plugin>(); + const internal::CoreData &postprocessor_core_data = core_statistics.get_core_data(); + const bool restored_core_data = postprocessor_core_data.is_initialized; + // The restart data is stored in 'core statistics' postprocessor. // If restart from checkpoint, extract data from there. - core_data = core_statistics.get_core_data(); + // In a fresh run, the postprocessor has not seen valid dynamic core + // data yet, so keep the boundary model's CoreData object and + // initialize it from the parameter file below. + if (restored_core_data) + core_data = postprocessor_core_data; // Read data of other energy source read_data_OES(); @@ -130,6 +137,7 @@ namespace aspect core_data.Xi = compute_X(core_data.Ri); core_data.Q = 0.; + core_data.H = 0.; core_data.dt = 0.; core_data.dT_dt = init_dT_dt; core_data.dR_dt = init_dR_dt; @@ -147,6 +155,12 @@ namespace aspect <get_pcout() << output.str(); } + else if (restored_core_data) + { + core_data.dt = this->get_timestep(); + core_data.H = compute_radioheating_rate(); + update_core_data(); + } is_first_call = false; }