diff --git a/LDDsimulation/functions.py b/LDDsimulation/functions.py index 8c0b5686342bc85dbabe1a250adc78c0195d499d..430dcb06146b2d3f551076788167a1b4da04c8f2 100644 --- a/LDDsimulation/functions.py +++ b/LDDsimulation/functions.py @@ -8,6 +8,7 @@ import typing as tp import dolfin as df import functools as ft +# RELATIVE PERMEABILITIES ##################################################### # Functions used as relative permeabilty functions for wetting phases def SpowN(S,N): return S**N @@ -76,93 +77,92 @@ def generate_relative_permeability_dicts( raise(NotImplementedError()) return output -# class SpcRelation(object): -# """provide capillary pressure saturation relationships functions.""" -# def __init__(self, Spc_on_subdomains): -# """build base fuction dictionary""" -# self._build_base_dict() -# self._Spc_on_subdomains = Spc_on_subdomains -# self._build_callables() -# -# def _build_base_dict(self): -# """Build base dictionary.""" -# self.__Spc = { -# "testSpc": self.testSpc(), -# } -# -# def _build_callables(self): -# """Build callable dictionaries.""" -# self.symbolic = dict() -# self.prime_symbolic = dict() -# self.dolfin = dict() -# -# for subdomain, Spc_dict in self._Spc_on_subdomains.items(): -# for Spc_type, parameters in Spc_dict.items(): -# if Spc_type == "testSpc": -# self.symbolic.update( -# {subdomain: ft.partialmethod( -# self.__Spc[Spc_type].S_sym, -# index=parameters["index"] -# )}, -# ) -# self.prime_symbolic.update( -# {subdomain: ft.partial( -# self.__Spc[Spc_type].S_prime_sym, -# index=parameters["index"] -# )}, -# ) -# self.dolfin.update( -# {subdomain: ft.partial( -# self.__Spc[Spc_type].S, -# index=parameters["index"] -# )}, -# ) -# elif Spc_type == "vanGenuchten": -# raise(NotImplementedError()) -# else: -# raise(NotImplementedError()) -# -# class testSpc(object): -# """Test S-pc relationship used in R-R paper.""" -# -# def __init__(self): -# """Construct testSpc.""" -# print("testSpc") -# -# def S(pc, index): -# """Inverse capillary pressure-saturation-relationship. -# -# Inverse capillary pressure-saturation-relationship that will -# be used by the simulation class -# this function needs to be monotonically decreasing in the -# capillary_pressure. Since in the richards case pc=-pw, this -# becomes as a function of pw a monotonically INCREASING function -# like in our Richards-Richards paper. -# However since we unify the treatment in the -# code for Richards and two-phase, we need the same requierment -# for both cases, two-phase and Richards. -# """ -# # inverse capillary pressure-saturation-relationship -# return df.conditional(pc > 0, 1/((1 + pc)**(1/(index + 1))), 1) -# -# def S_sym(pc, index): -# """Inverse capillary pressure-saturation-relationship. -# -# Inverse capillary pressure-saturation-relationship as symbolic -# expression, that will be used by -# helpers.generate_exact_solution_expressions() -# """ -# # inverse capillary pressure-saturation-relationship -# return 1/((1 + pc)**(1/(index + 1))) -# -# # derivative of S-pc relationship with respect to pc. -# # This is needed for the construction of a analytic solution. -# def S_prime_sym(pc, index): -# """Derivative of inverse pc-S-relationship. -# -# Derivative of the inverse pc-S-relationship as symbolic -# expression, that will be used by -# helpers.generate_exact_solution_expressions() -# """ -# # inverse capillary pressure-saturation-relationship -# return -1/((index+1)*(1 + pc)**((index+2)/(index+1))) + +# S-Pc RELATIONSHIPS ########################################################## +def test_S(pc, index): + """Inverse capillary pressure-saturation-relationship. + + Inverse capillary pressure-saturation-relationship that will + be used by the simulation class + this function needs to be monotonically decreasing in the + capillary_pressure. Since in the richards case pc=-pw, this + becomes as a function of pw a monotonically INCREASING function + like in our Richards-Richards paper. + However since we unify the treatment in the + code for Richards and two-phase, we need the same requierment + for both cases, two-phase and Richards. + """ + # inverse capillary pressure-saturation-relationship + return df.conditional(pc > 0, 1/((1 + pc)**(1/(index + 1))), 1) + +def test_S_sym(pc, index): + """Inverse capillary pressure-saturation-relationship. + + Inverse capillary pressure-saturation-relationship as symbolic + expression, that will be used by + helpers.generate_exact_solution_expressions() + """ + # inverse capillary pressure-saturation-relationship + return 1/((1 + pc)**(1/(index + 1))) + +# derivative of S-pc relationship with respect to pc. +# This is needed for the construction of a analytic solution. +def test_S_prime_sym(pc, index): + """Derivative of inverse pc-S-relationship. + + Derivative of the inverse pc-S-relationship as symbolic + expression, that will be used by + helpers.generate_exact_solution_expressions() + """ + # inverse capillary pressure-saturation-relationship + return -1/((index+1)*(1 + pc)**((index+2)/(index+1))) + + +def generate_Spc_dicts( + Spc_on_subdomains: tp.Dict[int, tp.Dict[str, tp.Dict[str, float]]] + )-> tp.Dict[str, tp.Dict[int, tp.Callable]]: + """Generate S-pc dictionaries from definition dict. + + Generate S-pc dictionaries from input definition dictionary + Spc_on_subdomains. This dictionary contains for each subdomain a + dictionary which in turn contains as key a descriptive string + describing which function should be used as S-pc relation for that + particular subdomain. The values are parameters for that function type + e.g. in the case of Van Genuchten or Brooks and Correy. + The supported cases are defined by the if statements + below. + The output is a dictionary containing three dictionaries, the S-pc + relationship for the simulation class as well as a symbolic version and + its derivative for exact solution generation. + """ + output = dict() + output.update({"symbolic": dict()}) + output.update({"prime_symbolic": dict()}) + output.update({"dolfin": dict()}) + for subdomain, Spc_dict in Spc_on_subdomains.items(): + for Spc_type, parameters in Spc_dict.items(): + if Spc_type == "testSpc": + output["symbolic"].update( + {subdomain: ft.partial( + test_S_sym, + index=parameters["index"] + )}, + ) + output["prime_symbolic"].update( + {subdomain: ft.partial( + test_S_prime_sym, + index=parameters["index"] + )}, + ) + output["dolfin"].update( + {subdomain: ft.partial( + test_S, + index=parameters["index"] + )}, + ) + elif Spc_type == "vanGenuchten": + raise(NotImplementedError()) + else: + raise(NotImplementedError()) + + return output diff --git a/Two-phase-Richards/multi-patch/five_patch_domain_with_inner_patch/TP-R-multi-patch-with-inner-patch.py b/Two-phase-Richards/multi-patch/five_patch_domain_with_inner_patch/TP-R-multi-patch-with-inner-patch.py index eaedb8e7a036d5bdf90f2af5fd61cdcad9a27052..3ac7aa54c8db4df5a7007b47dc81dae0df6be060 100755 --- a/Two-phase-Richards/multi-patch/five_patch_domain_with_inner_patch/TP-R-multi-patch-with-inner-patch.py +++ b/Two-phase-Richards/multi-patch/five_patch_domain_with_inner_patch/TP-R-multi-patch-with-inner-patch.py @@ -5,13 +5,11 @@ This program sets up an LDD simulation """ import dolfin as df import sympy as sym -import functools as ft import functions as fts import LDDsimulation as ldd import helpers as hlp import datetime import os -import pandas as pd import multiprocessing as mp import domainSubstructuring as dss @@ -274,7 +272,7 @@ intrinsic_permeability = { 6: 0.01, #10e-3 } -# rel_perm_generator = func.relative_permeability() +# relative permeabilties rel_perm_definition = { 1: {"wetting": "Spow2", "nonwetting": "oneMinusSpow2"}, @@ -292,66 +290,18 @@ rel_perm_dict = fts.generate_relative_permeability_dicts(rel_perm_definition) relative_permeability = rel_perm_dict["ka"] ka_prime = rel_perm_dict["ka_prime"] -# Spc_on_subdomains = { -# 1: {"testSpc": {"index": 1}}, -# 2: {"testSpc": {"index": 2}}, -# 3: {"testSpc": {"index": 2}}, -# 4: {"testSpc": {"index": 2}}, -# 5: {"testSpc": {"index": 1}} -# } -# Spc = fts.SpcRelation(Spc_on_subdomains) -# S_pc_sym = Spc.symbolic -# S_pc_sym_prime = Spc.prime_symbolic -# sat_pressure_relationship = Spc.dolfin - -# this function needs to be monotonically decreasing in the capillary_pressure. -# since in the richards case pc=-pw, this becomes as a function of pw a mono -# tonically INCREASING function like in our Richards-Richards paper. However -# since we unify the treatment in the code for Richards and two-phase, we need -# the same requierment -# for both cases, two-phase and Richards. -def saturation(pc, index): - # inverse capillary pressure-saturation-relationship - return df.conditional(pc > 0, 1/((1 + pc)**(1/(index + 1))), 1) - - -def saturation_sym(pc, index): - # inverse capillary pressure-saturation-relationship - return 1/((1 + pc)**(1/(index + 1))) - - -# derivative of S-pc relationship with respect to pc. This is needed for the -# construction of a analytic solution. -def saturation_sym_prime(pc, index): - # inverse capillary pressure-saturation-relationship - return -1/((index+1)*(1 + pc)**((index+2)/(index+1))) - - -# note that the conditional definition of S-pc in the nonsymbolic part will be -# incorporated in the construction of the exact solution below. -S_pc_sym = { - 1: ft.partial(saturation_sym, index=1), - 2: ft.partial(saturation_sym, index=2), - 3: ft.partial(saturation_sym, index=2), - 4: ft.partial(saturation_sym, index=2), - 5: ft.partial(saturation_sym, index=1) -} - -S_pc_sym_prime = { - 1: ft.partial(saturation_sym_prime, index=1), - 2: ft.partial(saturation_sym_prime, index=2), - 3: ft.partial(saturation_sym_prime, index=2), - 4: ft.partial(saturation_sym_prime, index=2), - 5: ft.partial(saturation_sym_prime, index=1) -} - -sat_pressure_relationship = { - 1: ft.partial(saturation, index=1), - 2: ft.partial(saturation, index=2), - 3: ft.partial(saturation, index=2), - 4: ft.partial(saturation, index=2), - 5: ft.partial(saturation, index=1) +# S-pc relation +Spc_on_subdomains = { + 1: {"testSpc": {"index": 1}}, + 2: {"testSpc": {"index": 2}}, + 3: {"testSpc": {"index": 2}}, + 4: {"testSpc": {"index": 2}}, + 5: {"testSpc": {"index": 1}} } +Spc = fts.generate_Spc_dicts(Spc_on_subdomains) +S_pc_sym = Spc["symbolic"] +S_pc_sym_prime = Spc["prime_symbolic"] +sat_pressure_relationship = Spc["dolfin"] ############################################# # Manufacture source expressions with sympy # diff --git a/Two-phase-Richards/multi-patch/five_patch_domain_with_inner_patch/mesh_studies/TP-R-multi-patch-with-inner-patch.py b/Two-phase-Richards/multi-patch/five_patch_domain_with_inner_patch/mesh_studies/TP-R-multi-patch-with-inner-patch.py new file mode 100755 index 0000000000000000000000000000000000000000..3622fa9d7b8f1db72d027d5953cc6e81f9be6eae --- /dev/null +++ b/Two-phase-Richards/multi-patch/five_patch_domain_with_inner_patch/mesh_studies/TP-R-multi-patch-with-inner-patch.py @@ -0,0 +1,436 @@ +#!/usr/bin/python3 +"""Multi-patch simulation with inner patch. + +This program sets up an LDD simulation +""" +import dolfin as df +import sympy as sym +import functions as fts +import LDDsimulation as ldd +import helpers as hlp +import datetime +import os +import multiprocessing as mp +import domainSubstructuring as dss + +# init sympy session +sym.init_printing() + +# PREREQUISITS ############################################################### +# check if output directory "./output" exists. This will be used in +# the generation of the output string. +if not os.path.exists('./output'): + os.mkdir('./output') + print("Directory ", './output', " created ") +else: + print("Directory ", './output', " already exists. Will use as output \ + directory") + +date = datetime.datetime.now() +datestr = date.strftime("%Y-%m-%d") + +# Name of the usecase that will be printed during simulation. +use_case = "TP-R-five-domain-with-inner-patch-realistic" +# The name of this very file. Needed for creating log output. +thisfile = "TP-R-multi-patch-with-inner-patch.py" + +# GENERAL SOLVER CONFIG ###################################################### +# maximal iteration per timestep +max_iter_num = 1000 +FEM_Lagrange_degree = 1 + +# GRID AND MESH STUDY SPECIFICATIONS ######################################### +mesh_study = True +resolutions = { + 1: 5e-5, + 2: 5e-5, + 4: 2e-5, + 8: 2e-5, + 16: 5e-6, + 32: 5e-6, + 64: 3e-6, + 128: 3e-6, + # 256: 1e-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] +timestep_size = 0.001 +number_of_timesteps = 1000 + +# LDD scheme parameters ###################################################### +Lw1 = 0.5 # /timestep_size +Lnw1 = Lw1 + +Lw2 = 0.5 # /timestep_size +Lnw2 = Lw2 + +Lw3 = 0.5 # /timestep_size +Lnw3 = Lw3 + +Lw4 = 0.5 # /timestep_size +Lnw4 = Lw4 + +Lw5 = 0.5 # /timestep_size +Lnw5 = Lw5 + + +lambda13_w= 4 +lambda13_nw= 4 + +lambda12_w = 4 +lambda12_nw = 4 + +lambda23_w = 4 +lambda23_nw = 4 + +lambda24_w = 4 +lambda24_nw= 4 + +lambda34_w = 4 +lambda34_nw = 4 + +lambda45_w = 4 +lambda45_nw = 4 + +lambda15_w = 4 +lambda15_nw = 4 + + +include_gravity = 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 = 4 +# 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 = 8 + +# 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. +if mesh_study: + write_to_file = { + # output the relative errornorm (integration in space) w.r.t. an exact + # solution for each timestep into a csv file. + 'space_errornorms': True, + # save the mesh and marker functions to disk + 'meshes_and_markers': True, + # save xdmf/h5 data for each LDD iteration for timesteps determined by + # number_of_timesteps_to_analyse. I/O intensive! + 'L_iterations_per_timestep': False, + # save solution to xdmf/h5. + 'solutions': True, + # save absolute differences w.r.t an exact solution to xdmf/h5 file + # to monitor where on the domains errors happen + 'absolute_differences': True, + # analyise condition numbers for timesteps determined by + # number_of_timesteps_to_analyse and save them over time to csv. + 'condition_numbers': analyse_condition, + # output subsequent iteration errors measured in L^2 to csv for + # timesteps determined by number_of_timesteps_to_analyse. + # Usefull to monitor convergence of the acutal LDD solver. + 'subsequent_errors': True + } +else: + write_to_file = { + 'space_errornorms': True, + 'meshes_and_markers': True, + 'L_iterations_per_timestep': False, + 'solutions': True, + 'absolute_differences': True, + 'condition_numbers': analyse_condition, + 'subsequent_errors': True + } + +# OUTPUT FILE STRING ######################################################### +output_string = "./output/{}-{}_timesteps{}_P{}".format( + datestr, use_case, number_of_timesteps, FEM_Lagrange_degree + ) + +# DOMAIN AND INTERFACE ####################################################### +substructuring = dss.chessBoardInnerPatch() +interface_def_points = substructuring.interface_def_points +adjacent_subdomains = substructuring.adjacent_subdomains +subdomain_def_points = substructuring.subdomain_def_points +outer_boundary_def_points = substructuring.outer_boundary_def_points + +# MODEL CONFIGURATION ######################################################### +isRichards = { + 1: True, + 2: False, + 3: False, + 4: False, + 5: True, + } + +# isRichards = { +# 1: True, +# 2: True, +# 3: True, +# 4: True, +# 5: True, +# 6: True +# } + +# Dict of the form: { subdom_num : viscosity } +viscosity = { + 1: {'wetting' :1, + 'nonwetting': 1/50}, + 2: {'wetting' :1, + 'nonwetting': 1/50}, + 3: {'wetting' :1, + 'nonwetting': 1/50}, + 4: {'wetting' :1, + 'nonwetting': 1/50}, + 5: {'wetting' :1, + 'nonwetting': 1/50}, +} + +# Dict of the form: { subdom_num : density } +densities = { + 1: {'wetting': 997.0, #997 + 'nonwetting': 1.225}, #1}, #1.225}, + 2: {'wetting': 997.0, #997 + 'nonwetting': 1.225}, #1.225}, + 3: {'wetting': 997.0, #997 + 'nonwetting': 1.225}, #1.225}, + 4: {'wetting': 997.0, #997 + 'nonwetting': 1.225}, #1.225} + 5: {'wetting': 997.0, #997 + 'nonwetting': 1.225}, #1.225}, +} +gravity_acceleration = 9.81 +# porosities taken from +# https://www.geotechdata.info/parameter/soil-porosity.html +# Dict of the form: { subdom_num : porosity } +porosity = { + 1: 0.2, #0.2, # Clayey gravels, clayey sandy gravels + 2: 0.2, #0.22, # Silty gravels, silty sandy gravels + 3: 0.2, #0.37, # Clayey sands + 4: 0.2, #0.2 # Silty or sandy clay + 5: 0.2, # +} + +# subdom_num : subdomain L for L-scheme +L = { + 1: {'wetting' :Lw1, + 'nonwetting': Lnw1}, + 2: {'wetting' :Lw2, + 'nonwetting': Lnw2}, + 3: {'wetting' :Lw3, + 'nonwetting': Lnw3}, + 4: {'wetting' :Lw4, + 'nonwetting': Lnw4}, + 5: {'wetting' :Lw5, + 'nonwetting': Lnw5}, +} + +# interface_num : lambda parameter for the L-scheme on that interface. +# Note that interfaces are numbered starting from 0, because +# adjacent_subdomains is a list and not a dict. Historic fuckup, I know +# We have defined above as interfaces +# # interface_vertices introduces a global numbering of interfaces. +# interface_def_points = [interface13_vertices, +# interface12_vertices, +# interface23_vertices, +# interface24_vertices, +# interface34_vertices, +# interface45_vertices, +# interface15_vertices,] +lambda_param = { + 0: {'wetting': lambda13_w, + 'nonwetting': lambda13_nw},# + 1: {'wetting': lambda12_w, + 'nonwetting': lambda12_nw},# + 2: {'wetting': lambda23_w, + 'nonwetting': lambda23_nw},# + 3: {'wetting': lambda24_w, + 'nonwetting': lambda24_nw},# + 4: {'wetting': lambda34_w, + 'nonwetting': lambda34_nw},# + 5: {'wetting': lambda45_w, + 'nonwetting': lambda45_nw},# + 6: {'wetting': lambda15_w, + 'nonwetting': lambda15_nw}# +} + + +# after Lewis, see pdf file +intrinsic_permeability = { + 1: 0.01, # sand + 2: 0.01, # sand, there is a range + 3: 0.01, #10e-2, # clay has a range + 4: 0.01, #10e-3 + 5: 0.01, #10e-2, # clay has a range + 6: 0.01, #10e-3 +} + +# relative permeabilties +rel_perm_definition = { + 1: {"wetting": "Spow2", + "nonwetting": "oneMinusSpow2"}, + 2: {"wetting": "Spow3", + "nonwetting": "oneMinusSpow3"}, + 3: {"wetting": "Spow3", + "nonwetting": "oneMinusSpow3"}, + 4: {"wetting": "Spow3", + "nonwetting": "oneMinusSpow3"}, + 5: {"wetting": "Spow2", + "nonwetting": "oneMinusSpow2"} +} + +rel_perm_dict = fts.generate_relative_permeability_dicts(rel_perm_definition) +relative_permeability = rel_perm_dict["ka"] +ka_prime = rel_perm_dict["ka_prime"] + +# S-pc relation +Spc_on_subdomains = { + 1: {"testSpc": {"index": 1}}, + 2: {"testSpc": {"index": 2}}, + 3: {"testSpc": {"index": 2}}, + 4: {"testSpc": {"index": 2}}, + 5: {"testSpc": {"index": 1}} +} +Spc = fts.generate_Spc_dicts(Spc_on_subdomains) +S_pc_sym = Spc["symbolic"] +S_pc_sym_prime = Spc["prime_symbolic"] +sat_pressure_relationship = Spc["dolfin"] + +############################################# +# Manufacture source expressions with sympy # +############################################# +x, y = sym.symbols('x[0], x[1]') # needed by UFL +t = sym.symbols('t', positive=True) + + +p_e_sym = { + 1: {'wetting': -7.0 - (1.0 + t*t)*(1.0 + x*x + y*y), + 'nonwetting': 0*t }, + 2: {'wetting': -7.0 - (1.0 + t*t)*(1.0 + x*x), + 'nonwetting': (-1.0 -t*(1.0 + x**2) - sym.sqrt(2+t**2)**2)*y**2 }, + 3: {'wetting': -7.0 - (1.0 + t*t)*(1.0 + x*x), + 'nonwetting': (-1.0 -t*(1.0 + x**2) - sym.sqrt(2+t**2)**2)*y**2 }, + 4: {'wetting': -7.0 - (1.0 + t*t)*(1.0 + x*x), + 'nonwetting': (-1.0 -t*(1.0 + x**2) - sym.sqrt(2+t**2)**2)*y**2 }, + 5: {'wetting': -7.0 - (1.0 + t*t)*(1.0 + x*x + y*y), + 'nonwetting': 0*t }, +} + +pc_e_sym = hlp.generate_exact_symbolic_pc( + isRichards=isRichards, + symbolic_pressure=p_e_sym + ) + +symbols = {"x": x, + "y": y, + "t": t} +# turn above symbolic code into exact solution for dolphin and +# construct the rhs that matches the above exact solution. +exact_solution_example = hlp.generate_exact_solution_expressions( + symbols=symbols, + isRichards=isRichards, + symbolic_pressure=p_e_sym, + symbolic_capillary_pressure=pc_e_sym, + saturation_pressure_relationship=S_pc_sym, + saturation_pressure_relationship_prime=S_pc_sym_prime, + viscosity=viscosity, + porosity=porosity, + intrinsic_permeability=intrinsic_permeability, + relative_permeability=relative_permeability, + relative_permeability_prime=ka_prime, + densities=densities, + gravity_acceleration=gravity_acceleration, + include_gravity=include_gravity, + ) +source_expression = exact_solution_example['source'] +exact_solution = exact_solution_example['exact_solution'] +initial_condition = exact_solution_example['initial_condition'] + +# BOUNDARY CONDITIONS ######################################################### +# Dictionary of dirichlet boundary conditions. If an exact solution case is +# used, use the hlp.generate_exact_DirichletBC() method to generate the +# Dirichlet Boundary conditions from the exact solution. +dirichletBC = hlp.generate_exact_DirichletBC( + isRichards=isRichards, + outer_boundary_def_points=outer_boundary_def_points, + exact_solution=exact_solution + ) +# If no exact solution is provided you need to provide a dictionary of boundary +# conditions. See the definiton of hlp.generate_exact_DirichletBC() to see +# the structure. + +# LOG FILE OUTPUT ############################################################# +# read this file and print it to std out. This way the simulation can produce a +# log file with ./TP-R-layered_soil.py | tee simulation.log +f = open(thisfile, 'r') +print(f.read()) +f.close() + + +# MAIN ######################################################################## +if __name__ == '__main__': + # dictionary of simualation parameters to pass to the run function. + # mesh_resolution and starttime are excluded, as they get passed explicitly + # to achieve parallelisation in these parameters in these parameters for + # mesh studies etc. + simulation_parameter = { + "tol": 1E-14, + "debugflag": debugflag, + "max_iter_num": max_iter_num, + "FEM_Lagrange_degree": FEM_Lagrange_degree, + "mesh_study": mesh_study, + "use_case": use_case, + "output_string": output_string, + "subdomain_def_points": subdomain_def_points, + "isRichards": isRichards, + "interface_def_points": interface_def_points, + "outer_boundary_def_points": outer_boundary_def_points, + "adjacent_subdomains": adjacent_subdomains, + # "mesh_resolution": mesh_resolution, + "viscosity": viscosity, + "porosity": porosity, + "L": L, + "lambda_param": lambda_param, + "relative_permeability": relative_permeability, + "intrinsic_permeability": intrinsic_permeability, + "sat_pressure_relationship": sat_pressure_relationship, + # "starttime": starttime, + "number_of_timesteps": number_of_timesteps, + "number_of_timesteps_to_analyse": number_of_timesteps_to_analyse, + "plot_timestep_every": plot_timestep_every, + "timestep_size": timestep_size, + "source_expression": source_expression, + "initial_condition": initial_condition, + "dirichletBC": dirichletBC, + "exact_solution": exact_solution, + "densities": densities, + "include_gravity": include_gravity, + "gravity_acceleration": gravity_acceleration, + "write_to_file": write_to_file, + "analyse_condition": analyse_condition + } + for starttime in starttimes: + for mesh_resolution, solver_tol in resolutions.items(): + simulation_parameter.update({"solver_tol": solver_tol}) + hlp.info(simulation_parameter["use_case"]) + LDDsim = mp.Process( + target=hlp.run_simulation, + args=( + simulation_parameter, + starttime, + mesh_resolution + ) + ) + LDDsim.start() + LDDsim.join() + # hlp.run_simulation( + # mesh_resolution=mesh_resolution, + # starttime=starttime, + # parameter=simulation_parameter + # ) diff --git a/Two-phase-Richards/multi-patch/five_patch_domain_with_inner_patch/mesh_studies/run-simulation b/Two-phase-Richards/multi-patch/five_patch_domain_with_inner_patch/mesh_studies/run-simulation new file mode 100755 index 0000000000000000000000000000000000000000..0eb497502a082a0fec07a5449b1fe946d59c8cc7 --- /dev/null +++ b/Two-phase-Richards/multi-patch/five_patch_domain_with_inner_patch/mesh_studies/run-simulation @@ -0,0 +1,16 @@ +#!/bin/bash + +[ $# -eq 0 ] && { echo "Usage: $0 simulation_file [logfile_name]"; exit 1; } + +SIMULATION_FILE=$1 +SIMULATION=${SIMULATION_FILE%.py} +LOGFILE_DEFAULT="$SIMULATION.log" + +DATE=$(date -I) +LOGFILE=${2:-$DATE-$LOGFILE_DEFAULT} + +GREETING="Simulation $SIMULATION is run on $DATE by $USER" + +echo $GREETING +echo "running $SIMULATION_FILE | tee $LOGFILE" +./$SIMULATION_FILE | tee $LOGFILE