From 0ac98e1f196c1e1916203e154ee9f6eb78cece2e Mon Sep 17 00:00:00 2001 From: David Schneider Date: Thu, 3 Aug 2023 17:29:39 +0200 Subject: [PATCH] Read data at correct relative read time --- include/adapter/adapter.h | 4 ++-- source/linear_elasticity/linear_elasticity.cc | 9 +++++++-- source/nonlinear_elasticity/nonlinear_elasticity.cc | 6 +++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/adapter/adapter.h b/include/adapter/adapter.h index a31ddc1..72244be 100644 --- a/include/adapter/adapter.h +++ b/include/adapter/adapter.h @@ -228,8 +228,8 @@ namespace Adapter Adapter::initialize( const DoFHandler &dof_handler, const VectorType & deal_to_precice, - VectorType & precice_to_deal, - double relative_read_time) + double relative_read_time, + VectorType & precice_to_deal) { AssertThrow( dim == precice.getMeshDimensions(mesh_name), diff --git a/source/linear_elasticity/linear_elasticity.cc b/source/linear_elasticity/linear_elasticity.cc index 0a1eebc..7aba638 100644 --- a/source/linear_elasticity/linear_elasticity.cc +++ b/source/linear_elasticity/linear_elasticity.cc @@ -643,7 +643,9 @@ namespace Linear_Elasticity // Then, we initialize preCICE i.e. we pass our mesh and coupling // information to preCICE - adapter.initialize(dof_handler, displacement, stress); + // We aways read data at the end of a time-step, as we blend the beginning + // and the end via the theta scheme + adapter.initialize(dof_handler, displacement, time.get_delta_t(), stress); // Then, we start the time loop. The loop itself is steered by preCICE. This // line replaces the usual 'while( time < end_time)' @@ -680,7 +682,10 @@ namespace Linear_Elasticity // participant to finish their time step. Therefore, we measure the // timings around this functionality timer.enter_subsection("Advance adapter"); - adapter.advance(displacement, stress, time.get_delta_t()); + adapter.advance(displacement, + time.get_delta_t(), + stress, + time.get_delta_t()); timer.leave_subsection("Advance adapter"); // Next, we reload the data we have previosuly stored in the beginning diff --git a/source/nonlinear_elasticity/nonlinear_elasticity.cc b/source/nonlinear_elasticity/nonlinear_elasticity.cc index 30cecaf..e3e7158 100644 --- a/source/nonlinear_elasticity/nonlinear_elasticity.cc +++ b/source/nonlinear_elasticity/nonlinear_elasticity.cc @@ -107,7 +107,10 @@ namespace Nonlinear_Elasticity // Initialize preCICE before starting the time loop // Here, all information concerning the coupling is passed to preCICE - adapter.initialize(dof_handler_ref, total_displacement, external_stress); + adapter.initialize(dof_handler_ref, + total_displacement, + time.get_delta_t(), + external_stress); BlockVector solution_delta(dofs_per_block); @@ -138,6 +141,7 @@ namespace Nonlinear_Elasticity // ... and pass the coupling data to preCICE, in this case displacement // (write data) and stress (read data) adapter.advance(total_displacement, + time.get_delta_t(), external_stress, time.get_delta_t());