Repository navigation
Expand file tree
/
Copy pathCHESS_Usage_Example.m
More file actions
169 lines (148 loc) · 7.17 KB
/
Copy pathCHESS_Usage_Example.m
File metadata and controls
169 lines (148 loc) · 7.17 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
clc;clear all;close all;
addpath(genpath('CHESS_Library'));
% diary 'Log.txt';
%% USER INPUTS
%{
CHS Grid File
CHS Bias And Uncertainty
%}
% Define CHESS Input File Name
chess_input_file = 'CHESS_rubble_mound_inputs.xlsx'; % Include relative path if not in parent directory
%% STEP 1: SET-UP PROJECT ENVIRONMENT
%{
Description:
In order to use the full functionalities included within the CHESS
library it is necesary to provide an input file. Please copy and fill
out the provided "CHESS_rubble_mound_inputs.xlsx" template. Do not change the
values written under "Model Variable Symbol" as this will brake the
toolbox in its entirety.
Outputs:
1. config: Contains parsed information from CHESS input file | 1 x 1 | structure, with nFields
2. structure: Contains parsed information for the specified structure type. | 1x1 | structure, with nFields
%}
t1 = tic;
% Parse CHESS Configuration File
[config, structure] = call_input_parser(chess_input_file);
t1 = toc(t1);
%% STEP 2: IMPORT, PROCESS & FORMAT COASTAL HAZARD SYSTEM (CHS) DATA (h5 -> MATLAB Memory)
%{
Description:
First step of any project is to screen and format the forcing data. In
this case we are showcasing the use of CHS data. CHS host tropical (TC)
and extratropical (XC) "Peaks" and "Timeseries" data in a save point
context. Within each save point you can find ADCIRC & wave model
(STWAVE/SWAN/WAM) storm data. The function "call_chs_data_formatter.m"
reads the provided CHS zip folder (or files) and imports, formats and
screens storm data. Additional screening and datasets can be
constructed if corresponding timeseries files are provided.
Inputs:
Files:
1. CHS HDF5 files (or packaged in .zip from CHS). Files must include
at least 1 data pair ( ADCIRC & Wave Model ) of "Peaks" datasets for a
given storm type (XC or TC). If data pair corresponding timeseries
files are included then additional screening (timeseries inspection)
and datasets are created (WLP and/or WHP) at the request of the user
(config). Max amount of files accepted is 8 -> 2 data pairs
(4 Peaks files) + corresponding timeseries files (4 timeseries files).
Vars:
1. config
Outputs:
Output variables will be in the form of MATLAB data structures in order
to keep everything organized through the whole process. Structures will
have additional levels if needed. Structure levels include: storm type
(XC, TC or CC), data type (Peaks or Timeseries), dataset (Maxima, WLP,
WHP).
Files (.mat):
1. Raw converted CHS HDF5 files -> exported to <outfolder>\<project>\Event_Database
as <db>_raw_files.mat (<db> = config.storm_db, default <CHS region>_SP####)
2. Formated and screened CHS File Data, prob_masses -> <outfolder>\<project>\Event_Database\<db>.mat;
parsed inputs (config) -> <outfolder>\<project>\PSE\<struc_id>\<case_name>\<workflow folder>\
<db>_<workflow>_config_file.mat (layout: Setup/chess_paths.m)
Vars:
1. config: Contains parsed information from CHESS input file | 1 x 1 | structure, with nFields
2. storm: Contains screened and formated CHS storm data. | 1 X 1 | structure, with nfields
Peaks storm data is formated in nStorms x 5
array ([ SWL Hm0 Tp wave_dir stormID ]).
Timeseries storm data is formated in nStorms x 2
cell array ([storm ID, storm hydrograph]) where,
storm hydrograph is a nStorms x 6 array
([datenum SWL Hm0 Tp wave_dir storm_duration])
3. prob_mass: Contains screened and formated CHS storm data probability masses. | 1 X 1 | structure, with nfields
For specified CHS region includes Param, TC_SRR, TC_Freq,
dist, TotalFreq, smpl0, smpl1. LCS workflows use all
these variables. RB workflows only use TC_freq.
%}
t2 = tic;
% Call CHS Set-up Function
[storm, ~, prob_mass, config] = call_chs_data_formater(config);
t2 = toc(t2);
%% STEP 3: CREATE PROJECT FORCING (BOUNDARY CONDITIONS)
%{
Description:
Once input storm data has been formated the next step is to generate the
project forcing. call_chess_boundary_conditions builds it in one call:
build (the input storm data is transformed (reshaped) according to the
user specified workflow), uncertainty (PROS) and forcing adjustments
(SLR, random tides, depth limitation), then saves it once. A complete
cached project forcing (hotstart) is loaded instead. Optional 5th input:
progress_fcn(step, message); default prints to the command window. CHESS provides users with 2 Response Base
methods: CHESS: PROS (Design) & CHESS:LCS (Performance). Additionally, there is a
Frequency Base method (CHESS: PROS-FB) that leverages CHESS: PROS to compute storm
forcing (SWL, Hm0, Tp) hazard curves and computes structure responses as
f(hazards). Workflow ID specification on config file are:
1 -> CHESS: Probabilistic Response Of Structures (PROS)
3-> StorSim: Life Cycle Simulation (LCS) & Coastal Structure Reliability (LCS-CSR)
4-> CHESS: PROS-Frequency Base (PROS-FB)
Inputs:
Vars:
1. config
2. storm
3. prob_mass
4. structure
Outputs:
Output variables will be in the form of MATLAB data structures in order
to keep everything organized through the whole process. Structures will
have additional levels if needed. Structure levels include: storm type
(XC, TC or CC), data type (Peaks or Timeseries), dataset (Maxima, WLP,
WHP).
Files (.mat):
1. Project forcing data -> exported to project folder with
suffix " _project_forcing"
Vars:
1. project_forcing: Contains reshaped storm data. | 1 x 1 | structure, with nFields
First Level:
Size (# of LC's, 1) -> (Rows,Col)
Each row contains a matrix which size depends on the ammount of
storms sampled for that specific life cycle.
Peaks LC Format (Maxima, WHP, WLP):
Size (# of LC's, 8) -> (Rows,Col)
(01) Year [-]
(02) Cyclone Type [XC=0; TC=1]
(03) Same year counter [-]
(04) Water Level [meters, MSL]
(05) Wave Height [meters]
(06) Peak Wave Period [seconds]
(07) Wave Direction [degrees; N=0, E=+90, S=+/-180, W=-90]
(08) Storm Duration [hours]
Timeseries LC Format:
(01) Storm ID [-]
(02) Time Series Length [-]
(03) Timestep Counter [-]
(04) Date/Time [-]
(05) Water Level [meters, MSL]
(06) Wave Height [meters]
(07) Peak Wave Period [seconds]
(08) Wave Direction [degrees; N=0, E=+90, S=+/-180, W=-90]
(09) Storm Duration [days]
(10) Simulation Year [years]
%}
t3 = tic;
[project_forcing, config] = call_chess_boundary_conditions(config, storm, prob_mass, structure);
t3 = toc(t3);
%% STEP 4: COMPUTE PROJECT RESPONSES
t4 = tic;
Resp = call_project_response(config, project_forcing, structure);
t4 = toc(t4);
%% PRINT TIME
disp(['Simulation Completed. Total run time: ' num2str(round(sum([t1,t2,t3,t4])/60,2)) ' mins...']);
% diary 'off';