Skip to content
Snippets Groups Projects
Commit 87047601 authored by David's avatar David
Browse files

revert parallelisation attempts

parent f4952ce1
Branches parallelistation_of_subdomain_loop
No related tags found
No related merge requests found
...@@ -466,39 +466,38 @@ class LDDsimulation(object): ...@@ -466,39 +466,38 @@ class LDDsimulation(object):
# the future. # the future.
for sd_index, subdomain in self.subdomain.items(): for sd_index, subdomain in self.subdomain.items():
# set subdomain iteration to current iteration # set subdomain iteration to current iteration
# mp.set_start_method('fork') # # mp.set_start_method('fork')
processQueue = mp.Queue() # processQueue = mp.Queue()
Lsolver_step = mp.Process( # Lsolver_step = mp.Process(
target=self.run_Lsolver_step, # target=self.run_Lsolver_step,
args=( # args=(
iteration, # iteration,
sd_index, # sd_index,
processQueue, # processQueue,
solution_over_iteration_within_timestep, # solution_over_iteration_within_timestep,
debug, # debug,
analyse_timestep, # analyse_timestep,
analyse_condition, # analyse_condition,
) # )
) # )
Lsolver_step.start() # Lsolver_step.start()
max_subsequent_error[sd_index-1] = processQueue.get() # max_subsequent_error[sd_index-1] = processQueue.get()
print(Lsolver_step.exitcode) # print(Lsolver_step.exitcode)
Lsolver_step.join() # Lsolver_step.join()
print(Lsolver_step.exitcode) # print(Lsolver_step.exitcode)
# update interface iteration numbers # # update interface iteration numbers
# for index in subdomain.has_interface: # # for index in subdomain.has_interface:
# interface = self.interface[index] # # interface = self.interface[index]
# interface.current_iteration[sd_index] = iteration # # interface.current_iteration[sd_index] = iteration
# Lsolver_step.terminate() # # Lsolver_step.terminate()
# self.run_Lsolver_step( max_subsequent_error[sd_index - 1] = self.run_Lsolver_step(
# iteration=iteration, iteration=iteration,
# subdomain_index=sd_index, subdomain_index=sd_index,
# max_subsequent_error=max_subsequent_error, sol_over_iter_file=solution_over_iteration_within_timestep,
# sol_over_iter_file=solution_over_iteration_within_timestep, analyse_timestep=analyse_timestep,
# analyse_timestep=analyse_timestep, analyse_condition=analyse_condition,
# analyse_condition=analyse_condition, debug=debug
# debug=debug )
# )
# end loop over subdomains # end loop over subdomains
# stopping criterion for the solver. # stopping criterion for the solver.
total_subsequent_error = np.amax(max_subsequent_error) total_subsequent_error = np.amax(max_subsequent_error)
...@@ -522,7 +521,7 @@ class LDDsimulation(object): ...@@ -522,7 +521,7 @@ class LDDsimulation(object):
self, self,
iteration: int, iteration: int,
subdomain_index: int, subdomain_index: int,
processQueue, # processQueue,
sol_over_iter_file: tp.Dict[int, tp.Type[SolutionFile]], sol_over_iter_file: tp.Dict[int, tp.Type[SolutionFile]],
debug: bool = False, debug: bool = False,
analyse_timestep: bool = False, analyse_timestep: bool = False,
...@@ -616,8 +615,8 @@ class LDDsimulation(object): ...@@ -616,8 +615,8 @@ class LDDsimulation(object):
# calculate the maximum over phase of subsequent errors for the # calculate the maximum over phase of subsequent errors for the
# stopping criterion. # stopping criterion.
# max_subsequent_error[sd_index-1] = max(subsequent_iter_error.values()) # max_subsequent_error[sd_index-1] = max(subsequent_iter_error.values())
processQueue.put(max(subsequent_iter_error.values())) # processQueue.put(max(subsequent_iter_error.values()))
return max(subsequent_iter_error.values())
def prepare_LDDsolver( def prepare_LDDsolver(
self, self,
......
...@@ -38,7 +38,7 @@ thisfile = "TP-R-2-patch-realistic.py" ...@@ -38,7 +38,7 @@ thisfile = "TP-R-2-patch-realistic.py"
# GENERAL SOLVER CONFIG ###################################################### # GENERAL SOLVER CONFIG ######################################################
# maximal iteration per timestep # maximal iteration per timestep
max_iter_num = 50 max_iter_num = 5
FEM_Lagrange_degree = 1 FEM_Lagrange_degree = 1
# GRID AND MESH STUDY SPECIFICATIONS ######################################### # GRID AND MESH STUDY SPECIFICATIONS #########################################
...@@ -46,8 +46,8 @@ mesh_study = False ...@@ -46,8 +46,8 @@ mesh_study = False
resolutions = { resolutions = {
# 1: 1e-5, # 1: 1e-5,
# 2: 1e-5, # 2: 1e-5,
# 4: 1e-5, 4: 1e-5,
# 8: 1e-5, 8: 1e-5,
16: 5e-6, 16: 5e-6,
# 32: 5e-6, # 32: 5e-6,
# 64: 2e-6, # 64: 2e-6,
...@@ -69,21 +69,21 @@ Lnw1= 0.025 ...@@ -69,21 +69,21 @@ Lnw1= 0.025
Lw2 = 0.025 #/timestep_size Lw2 = 0.025 #/timestep_size
Lnw2= 0.025 Lnw2= 0.025
lambda_w = 44 lambda_w = 4
lambda_nw = 4 lambda_nw = 4
include_gravity = False include_gravity = False
debugflag = True debugflag = False
analyse_condition = False analyse_condition = False
# I/O CONFIG ################################################################# # I/O CONFIG #################################################################
# when number_of_timesteps is high, it might take a long time to write all # 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 # timesteps to disk. Therefore, you can choose to only write data of every
# plot_timestep_every timestep to disk. # plot_timestep_every timestep to disk.
plot_timestep_every = 4 plot_timestep_every = 1
# Decide how many timesteps you want analysed. Analysed means, that # Decide how many timesteps you want analysed. Analysed means, that
# subsequent errors of the L-iteration within the timestep are written out. # subsequent errors of the L-iteration within the timestep are written out.
number_of_timesteps_to_analyse = 5 number_of_timesteps_to_analyse = 1
# fine grained control over data to be written to disk in the mesh study case # 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. # as well as for a regular simuation for a fixed grid.
...@@ -528,18 +528,18 @@ if __name__ == '__main__': ...@@ -528,18 +528,18 @@ if __name__ == '__main__':
for mesh_resolution, solver_tol in resolutions.items(): for mesh_resolution, solver_tol in resolutions.items():
simulation_parameter.update({"solver_tol": solver_tol}) simulation_parameter.update({"solver_tol": solver_tol})
hlp.info(simulation_parameter["use_case"]) hlp.info(simulation_parameter["use_case"])
# LDDsim = mp.Process( LDDsim = mp.Process(
# target=hlp.run_simulation, target=hlp.run_simulation,
# args=( args=(
# simulation_parameter, simulation_parameter,
# starttime, starttime,
# mesh_resolution mesh_resolution
# ) )
# ) )
# LDDsim.start() LDDsim.start()
# LDDsim.join() LDDsim.join()
hlp.run_simulation( # hlp.run_simulation(
mesh_resolution=mesh_resolution, # mesh_resolution=mesh_resolution,
starttime=starttime, # starttime=starttime,
parameter=simulation_parameter # parameter=simulation_parameter
) # )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment