-
Notifications
You must be signed in to change notification settings - Fork 27
/
master_fem.m
50 lines (43 loc) · 1.81 KB
/
master_fem.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function master_fem(file_init, folder_fem, file_model, model_type, timing, var_type, sweep)
% Make many FEM simulations for different variable combinations.
%
% Sweep different combinations.
% Extract the FEM results and save them.
%
% This function saves the results during the solving process:
% - A maximum run time can be fixed (for cluster batching systems)
% - The results are stored with an hash
% - If the hash already exists the simulation is skiped
% - Therefore, this function can be interrupted and restarted
%
% This function requires a running COMSOL MATLAB Livelink:
% - use 'start_comsol_matlab.bat' on MS Windows
% - use 'start_comsol_matlab.sh' on Linux
%
% Parameters:
% file_init (str): path of the file containing the constant data
% folder_fem (str): path of the folder where the results are stored
% file_model (str): path of the COMSOL file to be used for the simulations
% model_type (str): name of the physics to be solved
% timing (struct): struct controlling simulation time (for batching systems)
% var_type (struct): type of the different variables used in the solver
% sweep (struct): data controlling the samples generation
%
% (c) 2019-2020, ETH Zurich, Power Electronic Systems Laboratory, T. Guillod
% init
fprintf('################## master_fem\n')
% load the constant data
fprintf('load\n')
const = load(file_init);
% generate the combinations to be computed
fprintf('sweep\n')
[n_sol, inp] = get_sweep(sweep);
% create the folder for storing the simulations
fprintf('folder\n')
[s, m] = mkdir(folder_fem);
% make the simulations
fprintf('fem\n')
dataset.get_fem_vec(folder_fem, file_model, model_type, timing, var_type, n_sol, inp, const);
% teardown
fprintf('################## master_fem\n')
end