Skip to content

Commit

Permalink
Merge pull request #70 from upb-lea/nn
Browse files Browse the repository at this point in the history
clear previous simulation results
  • Loading branch information
tillpiepenbrock authored Nov 28, 2023
2 parents 9d6ad0f + a954d46 commit 61ff687
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions femmt/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class MagneticComponent:
silent: bool = False

def __init__(self, component_type: ComponentType = ComponentType.Inductor, working_directory: str = None,
verbosity: Verbosity = 2, is_gui: bool = False, simulation_name: Optional[str] = None, wwr_enabled = True):
clean_previous_results: bool = True, verbosity: Verbosity = 2, is_gui: bool = False,
simulation_name: Optional[str] = None, wwr_enabled = True):
# TODO Add a enum? for the verbosity to combine silent and print_output_to_file variables
"""
:param component_type: Available options:
Expand All @@ -72,7 +73,8 @@ def __init__(self, component_type: ComponentType = ComponentType.Inductor, worki
# Create file paths class in order to handle all paths
self.file_data = FileData(working_directory)
# Clear result folder structure in case of missing
self.file_data.clear_previous_simulation_results()
if clean_previous_results:
self.file_data.clear_previous_simulation_results()

# Variable to set silent mode
self.verbosity = verbosity
Expand Down
6 changes: 3 additions & 3 deletions femmt/examples/hpc_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def create_parallel_example_inductor(inductor_frequency: int, air_gap_height: fl
:param inductor_frequency: Frequency for the inductor.
:type inductor_frequency: int
"""
geo = fmt.MagneticComponent(component_type=fmt.ComponentType.Inductor, working_directory=None, # Can be set to None since it will be overwritten anyways
verbosity=fmt.Verbosity.ToFile)
geo = fmt.MagneticComponent(component_type=fmt.ComponentType.Inductor, working_directory=None, # Can be set to None since it will be overwritten anyways
clean_previous_results=False, verbosity=fmt.Verbosity.ToFile)
core_db = fmt.core_database()["PQ 40/40"]
core_dimensions = fmt.dtos.SingleCoreDimensions(core_inner_diameter=core_db["core_inner_diameter"],
window_w=core_db["window_w"],
Expand Down Expand Up @@ -193,7 +193,7 @@ def parallel_simulation_study(averaging_count):
geos.append(create_parallel_example_inductor(inductor_frequency))
simulation_parameters.append({
"freq": inductor_frequency,
"current": [4.5]
"current": [4.5*(1+i/10)]
})

start_time = time.time()
Expand Down
1 change: 1 addition & 0 deletions femmt/hpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def run_hpc(n_processes: int, models: List[MagneticComponent], simulation_parame

# Update directories for each model
model.file_data.update_paths(model_working_directory, model_electro_magnetic_directory, strands_coefficients_folder)
model.file_data.clear_previous_simulation_results()

# Create pool of workers and apply _hpc to it
with Pool(processes=n_processes) as pool:
Expand Down

0 comments on commit 61ff687

Please sign in to comment.