From eab9d9a7e574c2e91faa88937975b2d0569c86db Mon Sep 17 00:00:00 2001
From: David Seus <david.seus@ians.uni-stuttgart.de>
Date: Wed, 12 Aug 2020 17:31:00 +0200
Subject: [PATCH] setup pure DD TPTP layered soil

---
 ...layered_soil_with_inner_patch-realistic.py | 95 ++++++++++---------
 .../TP-TP-layered_soil-different-intrinsic.py | 34 +++----
 .../TP-TP-layered_soil.py                     | 48 +++++-----
 .../TP-TP-layered_soil_pure_dd.py             | 45 ++++-----
 4 files changed, 116 insertions(+), 106 deletions(-)

diff --git a/Two-phase-Richards/multi-patch/layered_soil_with_inner_patch/mesh_study/TP-R-layered_soil_with_inner_patch-realistic.py b/Two-phase-Richards/multi-patch/layered_soil_with_inner_patch/mesh_study/TP-R-layered_soil_with_inner_patch-realistic.py
index 9af0be5..f5f90f1 100755
--- a/Two-phase-Richards/multi-patch/layered_soil_with_inner_patch/mesh_study/TP-R-layered_soil_with_inner_patch-realistic.py
+++ b/Two-phase-Richards/multi-patch/layered_soil_with_inner_patch/mesh_study/TP-R-layered_soil_with_inner_patch-realistic.py
@@ -29,83 +29,83 @@ date = datetime.datetime.now()
 datestr = date.strftime("%Y-%m-%d")
 
 # Name of the usecase that will be printed during simulation.
-use_case = "TP-R-layered-soil-with-inner-patch-realistic"
+use_case = "TP-R-layered-soil-with-inner-patch-realistic-recalculate-low-mesh-sizes-16-07"
 # The name of this very file. Needed for creating log output.
 thisfile = "TP-R-layered_soil_with_inner_patch-realistic.py"
 
 # GENERAL SOLVER CONFIG  ######################################################
 # maximal iteration per timestep
-max_iter_num = 1000
+max_iter_num = 2000
 FEM_Lagrange_degree = 1
 
 # GRID AND MESH STUDY SPECIFICATIONS  #########################################
 mesh_study = True
 resolutions = {
-                1: 5e-5,  # h=2
-                2: 5e-5,  # h=1.1180
-                4: 5e-5,  # h=0.5590
-                8: 5e-5,  # h=0.2814
-                16: 3e-5, # h=0.1412
-                32: 5e-6,
-                64: 3e-6,
-                128: 2e-6
+                1: 1e-5,  # h=2
+                2: 1e-5,  # h=1.1180
+                # 4: 1e-5,  # h=0.5590
+                # 8: 1e-6,  # h=0.2814
+                # 16: 1e-6, # h=0.1412
+                # 32: 5e-6,
+                # 64: 3e-6,
+                # 128: 2e-6
                 }
 
 # starttimes gives a list of starttimes to run the simulation from.
 # The list is looped over and a simulation is run with t_0 as initial time
 #  for each element t_0 in starttimes.
 starttimes = {0: 0.0}
-timestep_size = 0.0025
-number_of_timesteps = 400
+timestep_size = 0.001
+number_of_timesteps = 1000
 
 # LDD scheme parameters  ######################################################
 
-Lw1 = 0.5  # /timestep_size
-Lnw1 = 0.5
+Lw1 = 0.01  # /timestep_size
+Lnw1 = 0.01
 
-Lw2 = 0.5  # /timestep_size
-Lnw2 = 0.5
+Lw2 = 0.01  # /timestep_size
+Lnw2 = 0.01
 
-Lw3 = 0.5  # /timestep_size
-Lnw3 = 0.5
+Lw3 = 0.01  # /timestep_size
+Lnw3 = 0.003
 
-Lw4 = 0.5  # /timestep_size
-Lnw4 = 0.5
+Lw4 = 0.01  # /timestep_size
+Lnw4 = 0.003
 
-Lw5 = 0.5  # /timestep_size
-Lnw5 = 0.5
+Lw5 = 0.01  # /timestep_size
+Lnw5 = 0.003
 
-Lw6 = 0.5  # /timestep_size
-Lnw6 = 0.5
+Lw6 = 0.01  # /timestep_size
+Lnw6 = 0.003
 
-lambda12_w = 40
-lambda12_nw = 4
+lambda12_w = 0.5
+lambda12_nw = 0.5
 
-lambda23_w = 40
-lambda23_nw = 4
+lambda23_w = 0.5
+lambda23_nw = 0.5
 
-lambda24_w = 40
-lambda24_nw= 4
+lambda24_w = 0.5
+lambda24_nw= 0.5
 
-lambda25_w= 40
-lambda25_nw= 4
+lambda25_w= 0.5
+lambda25_nw= 0.5
 
-lambda34_w = 40
-lambda34_nw = 4
+lambda34_w = 0.5
+lambda34_nw = 0.5
 
-lambda36_w = 40
-lambda36_nw = 4
+lambda36_w = 0.5
+lambda36_nw = 0.5
 
-lambda45_w = 40
-lambda45_nw = 4
+lambda45_w = 0.5
+lambda45_nw = 0.5
 
-lambda46_w = 40
-lambda46_nw = 4
+lambda46_w = 0.5
+lambda46_nw = 0.5
 
-lambda56_w = 40
-lambda56_nw = 4
+lambda56_w = 0.5
+lambda56_nw = 0.5
 
-include_gravity = True
+include_gravity = False
 debugflag = False
 analyse_condition = False
 
@@ -453,10 +453,12 @@ if __name__ == '__main__':
         for mesh_resolution, solver_tol in resolutions.items():
             simulation_parameter.update({"solver_tol": solver_tol})
             hlp.info(simulation_parameter["use_case"])
+            processQueue = mp.Queue()
             LDDsim = mp.Process(
                         target=hlp.run_simulation,
                         args=(
                             simulation_parameter,
+                            processQueue,
                             starttime,
                             mesh_resolution
                             )
@@ -468,3 +470,10 @@ if __name__ == '__main__':
             #     starttime=starttime,
             #     parameter=simulation_parameter
             #     )
+
+        LDDsim.join()
+        if mesh_study:
+            simulation_output_dir = processQueue.get()
+            hlp.merge_spacetime_errornorms(isRichards=isRichards,
+                                           resolutions=resolutions,
+                                           output_dir=simulation_output_dir)
diff --git a/Two-phase-Two-phase/multi-patch/TP-TP-layered-soil-case/TP-TP-layered_soil-different-intrinsic.py b/Two-phase-Two-phase/multi-patch/TP-TP-layered-soil-case/TP-TP-layered_soil-different-intrinsic.py
index 49eb6c0..61aeb2a 100755
--- a/Two-phase-Two-phase/multi-patch/TP-TP-layered-soil-case/TP-TP-layered_soil-different-intrinsic.py
+++ b/Two-phase-Two-phase/multi-patch/TP-TP-layered-soil-case/TP-TP-layered_soil-different-intrinsic.py
@@ -48,7 +48,7 @@ resolutions = {
                 # 4: 1e-6,
                 # 8: 1e-5,
                 # 16: 5e-6,
-                32: 5e-6,
+                32: 1e-6,
                 # 64: 2e-6,
                 # 128: 1e-6,
                 # 256: 1e-6,
@@ -64,21 +64,21 @@ number_of_timesteps = 1
 
 
 # LDD scheme parameters  ######################################################
-Lw1 = 0.05 # /timestep_size
+Lw1 = 0.01 # /timestep_size
 Lnw1 = 0.01
-Lw2 = 0.05  # /timestep_size
-Lnw2 = 0.007
-Lw3 = 0.01  # /timestep_size
-Lnw3 = 0.005
-Lw4 = 0.01  # /timestep_size
-Lnw4 = 0.0005
-
-lambda12_w = 4
-lambda12_nw = 0.5
-lambda23_w = 4
-lambda23_nw = 0.5
-lambda34_w = 4
-lambda34_nw = 0.5
+Lw2 = 0.01  # /timestep_size
+Lnw2 = 0.01
+Lw3 = 0.001  # /timestep_size
+Lnw3 = 0.001
+Lw4 = 0.001  # /timestep_size
+Lnw4 = 0.001
+
+lambda12_w = 40
+lambda12_nw = 40
+lambda23_w = 40
+lambda23_nw = 40
+lambda34_w = 40
+lambda34_nw = 40
 
 include_gravity = False
 debugflag = False
@@ -180,7 +180,7 @@ porosity = {
     1: 0.37,  # 0.2,  # Clayey gravels, clayey sandy gravels
     2: 0.022,  # 0.22, # Silty gravels, silty sandy gravels
     3: 0.002,  # 0.37, # Clayey sands
-    4: 0.00022,  # 0.2 # Silty or sandy clay
+    4: 0.002,  # 0.2 # Silty or sandy clay
 }
 
 # subdom_num : subdomain L for L-scheme
@@ -254,7 +254,7 @@ p_e_sym_2patch = {
     1: {'wetting': -7 - (1+t*t)*(1 + x*x + y*y),
         'nonwetting': -1-t*(1.1 + y + x**2)**2},
     2: {'wetting': -7.0 - (1.0 + t*t)*(1.0 + x*x),
-        'nonwetting': -1-t*(1.1 + x**2)**2 - sym.sqrt(5+t**2)*y**2},
+        'nonwetting': -1-t*(1.1 + x**2)**2 - (1+t**2)*y**2},
 }
 
 
diff --git a/Two-phase-Two-phase/multi-patch/TP-TP-layered-soil-case/TP-TP-layered_soil.py b/Two-phase-Two-phase/multi-patch/TP-TP-layered-soil-case/TP-TP-layered_soil.py
index ead54cc..f5dbeed 100755
--- a/Two-phase-Two-phase/multi-patch/TP-TP-layered-soil-case/TP-TP-layered_soil.py
+++ b/Two-phase-Two-phase/multi-patch/TP-TP-layered-soil-case/TP-TP-layered_soil.py
@@ -31,7 +31,7 @@ datestr = date.strftime("%Y-%m-%d")
 
 
 # Name of the usecase that will be printed during simulation.
-use_case = "TP-TP-layered_soil-realistic-not-VanGenuchten"
+use_case = "TP-TP-layered_soil-realistic"
 # The name of this very file. Needed for creating log output.
 thisfile = "TP-TP-layered_soil.py"
 
@@ -48,7 +48,7 @@ resolutions = {
                 # 4: 1e-6,
                 # 8: 1e-5,
                 # 16: 5e-6,
-                32: 1e-6,
+                32: 1e-7,
                 # 64: 2e-6,
                 # 128: 1e-6,
                 # 256: 1e-6,
@@ -64,21 +64,21 @@ number_of_timesteps = 1
 
 
 # LDD scheme parameters  ######################################################
-Lw1 = 0.1
-Lnw1 = 0.1
-Lw2 = 0.1
-Lnw2 = 0.1
-Lw3 = 0.1
-Lnw3 = 0.1
-Lw4 = 0.1
-Lnw4 = 0.1
-
-lambda12_w = 20
-lambda12_nw = 20
-lambda23_w = 20
-lambda23_nw = 20
-lambda34_w = 20
-lambda34_nw = 20
+Lw1 = 0.001
+Lnw1 = 0.0001
+Lw2 = 0.001
+Lnw2 = 0.0001
+Lw3 = 0.001
+Lnw3 = 0.0001
+Lw4 = 0.001
+Lnw4 = 0.0001
+
+lambda12_w = 2
+lambda12_nw = 2
+lambda23_w = 2
+lambda23_nw = 2
+lambda34_w = 2
+lambda34_nw = 2
 
 include_gravity = False
 debugflag = False
@@ -122,7 +122,7 @@ else:
     write_to_file = {
         'space_errornorms': True,
         'meshes_and_markers': True,
-        'L_iterations_per_timestep': False,
+        'L_iterations_per_timestep': True,
         'solutions': True,
         'absolute_differences': True,
         'condition_numbers': analyse_condition,
@@ -234,10 +234,10 @@ ka_prime = rel_perm_dict["ka_prime"]
 
 # S-pc relation
 Spc_on_subdomains = {
-    1: {"vanGenuchten": {"n": 3, "alpha": 0.1}},
-    2: {"vanGenuchten": {"n": 3, "alpha": 0.1}},
-    3: {"vanGenuchten": {"n": 6, "alpha": 0.1}},
-    4: {"vanGenuchten": {"n": 6, "alpha": 0.1}},
+    1: {"vanGenuchten": {"n": 3, "alpha": 0.001}},
+    2: {"vanGenuchten": {"n": 3, "alpha": 0.001}},
+    3: {"vanGenuchten": {"n": 6, "alpha": 0.001}},
+    4: {"vanGenuchten": {"n": 6, "alpha": 0.001}},
 }
 # Spc_on_subdomains = {
 #     1: {"testSpc": {"index": 1}},
@@ -258,9 +258,9 @@ t = sym.symbols('t', positive=True)
 
 p_e_sym_2patch = {
     1: {'wetting': -7.0 - (1.0 + t*t)*(1.0 + x*x + y*y),
-        'nonwetting': -1-t*(1.1 + y + x**2)**2},
+        'nonwetting': -1 - t*(1.1 + y + x**2)**2},
     2: {'wetting': -7.0 - (1.0 + t*t)*(1.0 + x*x),
-        'nonwetting': -1-t*(1.1 + x**2)**2},
+        'nonwetting': (-1.0 - t*(1.1 + x**2)**2 - (2+t**2))*y**2},
 }
 
 
diff --git a/Two-phase-Two-phase/multi-patch/TP-TP-layered-soil-case/TP-TP-layered_soil_pure_dd.py b/Two-phase-Two-phase/multi-patch/TP-TP-layered-soil-case/TP-TP-layered_soil_pure_dd.py
index 341ad09..17e0dd1 100755
--- a/Two-phase-Two-phase/multi-patch/TP-TP-layered-soil-case/TP-TP-layered_soil_pure_dd.py
+++ b/Two-phase-Two-phase/multi-patch/TP-TP-layered-soil-case/TP-TP-layered_soil_pure_dd.py
@@ -36,7 +36,7 @@ thisfile = "TP-TP-layered_soil_pure_dd.py"
 
 # GENERAL SOLVER CONFIG  ######################################################
 # maximal iteration per timestep
-max_iter_num = 10
+max_iter_num = 2000
 FEM_Lagrange_degree = 1
 
 # GRID AND MESH STUDY SPECIFICATIONS  #########################################
@@ -47,7 +47,7 @@ resolutions = {
                 # 4: 1e-6,
                 # 8: 1e-5,
                 # 16: 5e-6,
-                32: 5e-6,
+                32: 4e-6,
                 # 64: 2e-6,
                 # 128: 1e-6,
                 # 256: 1e-6,
@@ -57,39 +57,40 @@ resolutions = {
 # The list is looped over and a simulation is run with t_0 as initial time
 #  for each element t_0 in starttimes.
 starttimes = {0: 0.0}
+# starttimes = {0: 0.0, 1: 0.3, 2: 0.6, 3: 0.9}
 timestep_size = 0.001
-number_of_timesteps = 5
+number_of_timesteps = 1500
 
 
 # LDD scheme parameters  ######################################################
-Lw1 = 0.025  # /timestep_size
-Lnw1 = Lw1
-Lw2 = 0.025  # /timestep_size
-Lnw2 = Lw2
-Lw3 = 0.025  # /timestep_size
-Lnw3 = Lw3
-Lw4 = 0.025  # /timestep_size
-Lnw4 = Lw4
-
-lambda12_w = 40
-lambda12_nw = 40
-lambda23_w = 40
-lambda23_nw = 40
-lambda34_w = 40
-lambda34_nw = 40
+Lw1 = 0.02  # /timestep_size
+Lnw1 = 0.0025
+Lw2 = 0.02  # /timestep_size
+Lnw2 = 0.0025
+Lw3 = 0.02  # /timestep_size
+Lnw3 = 0.0025
+Lw4 = 0.02  # /timestep_size
+Lnw4 = 0.0025
+
+lambda12_w = 0.5
+lambda12_nw = 0.5
+lambda23_w = 0.5
+lambda23_nw = 0.5
+lambda34_w = 0.5
+lambda34_nw = 0.5
 
 include_gravity = False
-debugflag = True
+debugflag = False
 analyse_condition = False
 
 # I/O CONFIG  #################################################################
 # when number_of_timesteps is high, it might take a long time to write all
 # timesteps to disk. Therefore, you can choose to only write data of every
 # plot_timestep_every timestep to disk.
-plot_timestep_every = 1
+plot_timestep_every = 3
 # Decide how many timesteps you want analysed. Analysed means, that
 # subsequent errors of the L-iteration within the timestep are written out.
-number_of_timesteps_to_analyse = 1
+number_of_timesteps_to_analyse = 10
 
 # fine grained control over data to be written to disk in the mesh study case
 # as well as for a regular simuation for a fixed grid.
@@ -249,7 +250,7 @@ x, y = sym.symbols('x[0], x[1]')  # needed by UFL
 t = sym.symbols('t', positive=True)
 
 p_e_sym_2patch = {
-    1: {'wetting': -7 - (1+t*t)*(1 + x*x + y*y),
+    1: {'wetting': -7.0 - (1.0 + t*t)*(1.0 + x*x + y*y),
         'nonwetting': -1-t*(1.1 + y + x**2)},
     2: {'wetting': -7.0 - (1.0 + t*t)*(1.0 + x*x + y*y),
         'nonwetting': -1-t*(1.1 + y + x**2)},
-- 
GitLab