-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprocessTransientSolutions.m
72 lines (66 loc) · 1.9 KB
/
processTransientSolutions.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
clear
close all
% Setting
projPath = './';
EXP = 'EXP4';
filename = '20240722_EXP4_res_5000/Model_Thule_Transient';
savename = 'EXP4_Dartmouth';
profilefolder = [projPath, '/Profiles/'];
% Loading model
org=organizer('repository', [projPath, 'Models/'], 'prefix', '', 'steps', 0);
disp(['Load the model from ', filename])
md = loadmodel(org, filename);
% create Profiles folder
if ~exist(profilefolder, 'dir')
mkdir(profilefolder)
end
% create profiles if they don't exist
% get the solutions along the profiles
if strcmp(EXP, 'EXP2')
suffixname = 'Circle';
profilename = [profilefolder, '/', suffixname, '_Profiles.csv'];
if ~exist(profilename, 'file')
createProfiles(EXP, profilefolder)
end
P = readtable(profilename);
profiles = project2Profiles(md, P, suffixname);
elseif strcmp(EXP, 'EXP4')
% Caprona
suffixname = 'Caprona';
profilename = [profilefolder, '/', suffixname, '_Profiles.csv'];
if ~exist(profilename, 'file')
createProfiles(EXP, profilefolder)
end
P = readtable(profilename);
profiles = project2Profiles(md, P, suffixname);
% Halbrane
suffixname = 'Halbrane';
profilename = [profilefolder, '/', suffixname, '_Profiles.csv'];
if ~exist(profilename, 'file')
createProfiles(EXP, profilefolder)
end
Q = readtable(profilename);
Q_profiles = project2Profiles(md, Q, suffixname);
% merge Q_profiles to profiles
profiles = mergeProfiles(profiles, Q_profiles);
end
% process
names = fieldnames(profiles);
pfnames = names(2:end);
time = profiles.time;
Nt = numel(time);
Np = numel(pfnames);
distance = zeros(Np, Nt);
thickness = zeros(Np, Nt);
vel = zeros(Np, Nt);
for j = 1:Np
front = getFrontFromProfiles(profiles.(pfnames{j}));
distance(j,:) = front.distance;
thickness(j,:) = front.thickness;
vel(j,:) = front.vel;
end
% save
if ~exist([projPath, '/Results/'], 'dir')
mkdir([projPath, '/Results/'])
end
save([projPath, '/Results/', savename, '.mat'], 'time', 'distance', 'thickness', 'vel')