From 68f084c601250957881afcec3b8f67f02571bbe7 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Tue, 12 Jul 2022 16:41:48 +0200 Subject: [PATCH 1/9] Use linear iteration and subcycling. --- partitioned-heat-conduction/fenics/heat.py | 4 ++-- partitioned-heat-conduction/precice-config.xml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/partitioned-heat-conduction/fenics/heat.py b/partitioned-heat-conduction/fenics/heat.py index e7b7f6529..70c82dcef 100644 --- a/partitioned-heat-conduction/fenics/heat.py +++ b/partitioned-heat-conduction/fenics/heat.py @@ -62,7 +62,7 @@ def determine_gradient(V_g, u, flux): args = parser.parse_args() -fenics_dt = .1 # time step size +fenics_dt = .01 # time step size # Error is bounded by coupling accuracy. In theory we would obtain the analytical solution. error_tol = args.error_tol @@ -178,7 +178,7 @@ def determine_gradient(V_g, u, flux): if precice.is_action_required(precice.action_write_iteration_checkpoint()): precice.store_checkpoint(u_n, t, n) - read_data = precice.read_data() + read_data = precice.read_data(dt(0)) # Update the coupling expression with the new read data precice.update_coupling_expression(coupling_expression, read_data) diff --git a/partitioned-heat-conduction/precice-config.xml b/partitioned-heat-conduction/precice-config.xml index 280fcb2f2..510916fc9 100644 --- a/partitioned-heat-conduction/precice-config.xml +++ b/partitioned-heat-conduction/precice-config.xml @@ -7,7 +7,7 @@ enabled="true" /> - + @@ -25,7 +25,7 @@ - + - + Date: Wed, 27 Sep 2023 22:52:14 +0200 Subject: [PATCH 2/9] Update to current state of software stack. --- partitioned-heat-conduction/fenics/heat.py | 13 +- .../precice-config.xml | 121 +++++++++--------- 2 files changed, 70 insertions(+), 64 deletions(-) diff --git a/partitioned-heat-conduction/fenics/heat.py b/partitioned-heat-conduction/fenics/heat.py index 70c82dcef..466447ef9 100644 --- a/partitioned-heat-conduction/fenics/heat.py +++ b/partitioned-heat-conduction/fenics/heat.py @@ -101,10 +101,12 @@ def determine_gradient(V_g, u, flux): # Initialize the adapter according to the specific participant if problem is ProblemType.DIRICHLET: precice = Adapter(adapter_config_filename="precice-adapter-config-D.json") - precice_dt = precice.initialize(coupling_boundary, read_function_space=V, write_object=f_N_function) + precice.initialize(coupling_boundary, read_function_space=V, write_object=f_N_function) + precice_dt = precice.get_max_time_step_size() elif problem is ProblemType.NEUMANN: precice = Adapter(adapter_config_filename="precice-adapter-config-N.json") - precice_dt = precice.initialize(coupling_boundary, read_function_space=W, write_object=u_D_function) + precice.initialize(coupling_boundary, read_function_space=W, write_object=u_D_function) + precice_dt = precice.get_max_time_step_size() dt = Constant(0) dt.assign(np.min([fenics_dt, precice_dt])) @@ -175,7 +177,7 @@ def determine_gradient(V_g, u, flux): while precice.is_coupling_ongoing(): # write checkpoint - if precice.is_action_required(precice.action_write_iteration_checkpoint()): + if precice.requires_writing_checkpoint(): precice.store_checkpoint(u_n, t, n) read_data = precice.read_data(dt(0)) @@ -198,10 +200,11 @@ def determine_gradient(V_g, u, flux): # Neumann problem reads flux and writes temperature on boundary to Dirichlet problem precice.write_data(u_np1) - precice_dt = precice.advance(dt(0)) + precice.advance(dt(0)) + precice_dt = precice.get_max_time_step_size() # roll back to checkpoint - if precice.is_action_required(precice.action_read_iteration_checkpoint()): + if precice.requires_reading_checkpoint(): u_cp, t_cp, n_cp = precice.retrieve_checkpoint() u_n.assign(u_cp) t = t_cp diff --git a/partitioned-heat-conduction/precice-config.xml b/partitioned-heat-conduction/precice-config.xml index 510916fc9..c6c7bd9aa 100644 --- a/partitioned-heat-conduction/precice-config.xml +++ b/partitioned-heat-conduction/precice-config.xml @@ -7,69 +7,72 @@ enabled="true" /> - - - + + - - - - + + + + - - - - + + + + - - - - - - - + + + + + + + + + - - - - - - - + + + + + + + + + - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + From 4d552aaf77d002785c31aa4018793af79ffa0b69 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Wed, 27 Sep 2023 23:19:19 +0200 Subject: [PATCH 3/9] Introduce change from #333. --- partitioned-heat-conduction/fenics/problem_setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/partitioned-heat-conduction/fenics/problem_setup.py b/partitioned-heat-conduction/fenics/problem_setup.py index b85f30358..ff2996fce 100644 --- a/partitioned-heat-conduction/fenics/problem_setup.py +++ b/partitioned-heat-conduction/fenics/problem_setup.py @@ -33,7 +33,7 @@ def inside(self, x, on_boundary): def get_geometry(domain_part): - nx = ny = 9 + nx = ny = 11 if domain_part is DomainPart.LEFT: p0 = Point(x_left, y_bottom) From 39762626625079e60502567c2860551f7575c372 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Thu, 28 Sep 2023 10:16:30 +0200 Subject: [PATCH 4/9] Use constant underrelaxation until https://github.com/precice/precice/issues/1689 works. --- partitioned-heat-conduction/precice-config.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/partitioned-heat-conduction/precice-config.xml b/partitioned-heat-conduction/precice-config.xml index 54162e2df..d465dbd3d 100644 --- a/partitioned-heat-conduction/precice-config.xml +++ b/partitioned-heat-conduction/precice-config.xml @@ -67,12 +67,15 @@ substeps="true" /> - + + + + From 330136d66af5e6bf8900ed1dc13adc1e59199e82 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Thu, 28 Sep 2023 19:20:18 +0200 Subject: [PATCH 5/9] Adjust convergence limit for constant underrelaxation. --- partitioned-heat-conduction/precice-config.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/partitioned-heat-conduction/precice-config.xml b/partitioned-heat-conduction/precice-config.xml index d465dbd3d..2d9b9983a 100644 --- a/partitioned-heat-conduction/precice-config.xml +++ b/partitioned-heat-conduction/precice-config.xml @@ -65,8 +65,8 @@ to="Dirichlet" initialize="true" substeps="true" /> - - + + - +