-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconvertHOTo2D.m
32 lines (31 loc) · 1.43 KB
/
convertHOTo2D.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
clear
close all
% Setting {{{
projPath = './';
filename = 'cmip-AWI-ex2-G5000-refined-pulse-linear-normal-100.mat';
%}}}
% Loading data {{{
org=organizer('repository', [projPath, 'Models/'], 'prefix', '', 'steps', 1);
disp(['Load the model from ', filename])
if perform(org, [filename, '_save2d']) % {{{
md = loadmodel(org, filename);
% project solutions onto the 2D mesh before extrusion
md2 = model();
md2.mesh.numberofelements = md.mesh.numberofelements2d;
md2.mesh.numberofvertices = md.mesh.numberofvertices2d;
md2.mesh.elements = md.mesh.elements2d;
md2.mesh.x = md.mesh.x2d;
md2.mesh.y = md.mesh.y2d;
%project solutions to md2
for i=1:numel(md.results.TransientSolution)
md2.results.TransientSolution(i).time = md.results.TransientSolution(i).time;
md2.results.TransientSolution(i).Vx = project2d(md,md.results.TransientSolution(i).Vx,md.mesh.numberoflayers);
md2.results.TransientSolution(i).Vy = project2d(md,md.results.TransientSolution(i).Vy,md.mesh.numberoflayers);
md2.results.TransientSolution(i).Thickness = project2d(md,md.results.TransientSolution(i).Thickness,md.mesh.numberoflayers);
md2.results.TransientSolution(i).MaskIceLevelset = project2d(md,md.results.TransientSolution(i).MaskIceLevelset,md.mesh.numberoflayers);
md2.results.TransientSolution(i).MaskOceanLevelset = project2d(md,md.results.TransientSolution(i).MaskOceanLevelset,md.mesh.numberoflayers);
end
% save md2
savemodel(org, md2);
end %}}}
%}}}