From b13f64b72c70299d7dc57e4bb64eb67b96402187 Mon Sep 17 00:00:00 2001
From: David Seus <david.seus@ians.uni-stuttgart.de>
Date: Tue, 3 Sep 2019 10:29:24 +0200
Subject: [PATCH] remove redundantly writing pressures to interfaces in
 _init_initial_values

---
 LDDsimulation/LDDsimulation.py | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/LDDsimulation/LDDsimulation.py b/LDDsimulation/LDDsimulation.py
index 9959bbf..c38c71c 100644
--- a/LDDsimulation/LDDsimulation.py
+++ b/LDDsimulation/LDDsimulation.py
@@ -525,10 +525,9 @@ class LDDsimulation(object):
                             )
 
                 # prepare next iteration
-                # write the newly calculated solution to the inteface dictionaries
+                # write the newly calculated solution to the interface dictionaries
                 # of the subdomain for communication.
-                if self.interface_def_points is not None:
-                    subdomain.write_pressure_to_interfaces()
+                subdomain.write_pressure_to_interfaces()
 
                 if analyse_timestep:
                     subdomain.write_solution_to_xdmf(#
@@ -628,8 +627,8 @@ class LDDsimulation(object):
                 self.update_DirichletBC_dictionary(time = time, #
                                                    subdomain_index = ind,
                                                    )
-            #     # this is the beginning of the solver, so iteration must be set
-            #     # to 0.
+            # this is the beginning of the solver, so iteration must be set
+            # to 0.
             subdomain.iteration_number = 0
             for phase in subdomain.has_phases:
                 # evaluate the sources to the current time.
@@ -639,9 +638,11 @@ class LDDsimulation(object):
                     print(colored(f"id(subdomain{subdomain.subdomain_index}.pressure_prev_timestep[{phase}])", "red"), " =\n", f"{id(subdomain.pressure_prev_timestep[phase])}")
                     print(f"subdomain{subdomain.subdomain_index}.pressure_prev_timestep[{phase}].vector()[:]", " =\n", f"{subdomain.pressure_prev_timestep[phase].vector()[:]}")
                     print(f"subdomain{subdomain.subdomain_index}.pressure[{phase}].vector()[:]", " =\n", f"{subdomain.pressure[phase].vector()[:]}")
+
                 subdomain.pressure_prev_timestep[phase].assign(
                     subdomain.pressure[phase]
                 )
+
                 if debug:
                     print(colored(f"id(subdomain{subdomain.subdomain_index}.pressure[{phase}])", "red"), " =\n", f"{id(subdomain.pressure[phase])}")
                     print(f"subdomain{subdomain.subdomain_index}.pressure_prev_timestep[{phase}].vector()[:]", " =\n", f"{subdomain.pressure_prev_timestep[phase].vector()[:]}")
@@ -1217,12 +1218,13 @@ class LDDsimulation(object):
                     data_set_name=data_set_name
                     )
 
-            # populate interface dictionaries with pressure values. The calc_gli_term
-            # of each subdomain reads from the interface.pressure_values_prev
-            # and from interface.pressure_values dictionary so both need to be populated.
-            if self.interface_def_points is not None:
-                subdomain.write_pressure_to_interfaces()
-                subdomain.write_pressure_to_interfaces(previous_iter = True)
+            # this is also being done in the self.prepare_LDDsolver method!!!!
+            # # populate interface dictionaries with pressure values. The calc_gli_term
+            # # of each subdomain reads from the interface.pressure_values_prev
+            # # and from interface.pressure_values dictionary so both need to be populated.
+            # if self.interface_def_points is not None:
+            #     subdomain.write_pressure_to_interfaces()
+            #     subdomain.write_pressure_to_interfaces(previous_iter = True)
 
             subdomain.write_solution_to_xdmf(#
                 file = self.solution_file[num], #
-- 
GitLab