-
Notifications
You must be signed in to change notification settings - Fork 1
/
PT2Z_1_Propagate_Temp_To_DepthZ_ManualInput_Master.m
209 lines (145 loc) · 10.1 KB
/
PT2Z_1_Propagate_Temp_To_DepthZ_ManualInput_Master.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
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
%% Master script for propagating the temperature driven by the ambient OBT to depths defined by the user through materials
% Introduction %
% Master Script to generate common outputs associated with extrapolating an
% ambient ocean bottom (OBT) time series to a depth z through one or many
% different sediments with differing thermal properties:
% jrd1g15@soton.ac.uk
% Read_me: Propagate Temperature time series to Depth PTZ ReadMe.docx
% functions: PT2Z_2_ProcessOBT_Data.m
% : PT2Z_3_AutoFill_PT2Z_4.m
% : PT2Z_4_Gen_Annual_Input_Sinusoid.m
% : PT2Z_5_Exract_T_at_Z_to_Table.m
% : PT2Z_6_Temp_To_DepthZ_Figure.m
% : PT2Z_7_Temp_vs_Depth_At_times_t_Figure.m
% Example Ocean Bottom Temperature (OBT) Dataset: AMM15_OBT.txt
% Potential Figures Generatted:
% Open "ExampleFigures" folder and run the following to view:
% Or just open the .jpeg versions in file explorer....
open PT2Z_2_ExampleFigure.fig; % PT2Z_2_ProcessOBT_Data.m
open PT2Z_4_ExampleFigure.fig; % PT2Z_4_Gen_Annual_Input_Sinusoid.m
open PT2Z_6_ExampleFigure.fig; % PT2Z_6_Temp_To_DepthZ_Figure.m
open PT2Z_7_ExampleFigure.fig; % PT2Z_7_Temp_vs_Depth_A _times_t_Figure.m
% Output folder: 'Propagated_Temp_To_Depth_Z_OutputFolder_CurrentData'
% To Run: Run each section sequentially;
% Sections are separated by a '%%' at the start and will turn yellow when
% the cursor is inside. Once highlighted press 'Run Section' in the "Run"
% section in the "Editor Toolbar". Or Press (Ctrl + Enter).
% Section Notes:
% Section 1: Isn't essential though makes figures look better - so i'd
% recommend running it.
% Section 2 & 3: Are required if you have an OBT dataset and wish to use it
% to generate subsequent datasets and figures
% Otherwise skip straight to Section 4.
% Section 4: Mandatory, fill in all inputs and run to generate the annual
% input sinusoid
% Section 5: Mandatory: Fill inputs and run to extract output tables to
% output folder
% Section 6: Mandatory: Fill inputs and run to extract output figure to
% output folder
% Section 7: Mandatory: Fill inputs and run to extract output figure to
% output folder
%% Section 1: Make Subsequent figures pretty
% Not essential - but will make figures look great. Open Pretty_Figures.m
% to change any defaults. You can change it as many times as you like but
% re-run this section.
Pretty_Figures
%% Section 2: Run if you have an ambient ocean bottom temperature time series
% Section 2 and Section 3 are only required if an OBT time series is used
% as the input to the rest of the script:
% Inputs:
ModelData.InputOBT.OBTTimeSeries_FileName = 'AMM15_OBT.txt'; % Filename of the ambient Ocean Bottom Temperature (OBT) Data
% Function:
ModelData = PT2Z_2_ProcessOBT_Data(ModelData);
% Outputs:
% This section produces a new folder called "Propagate_Temp_To_Depth_Z_OutputFolder_"CurrentDate""
% Inside is the "Figures" folder. The figure generated by section 2 is auto - saved to this folder as:
% ModelData.InputOBT.OBTTimeSeries_FileName e.g.
% "PT2Z_2_AMM15_OBT_txt_OBT_Options.jpeg"
%% Section 3: From the output to Section 2; choose the year you want use to
% Inputs
ModelData.Auto_Fill_Data.UserChosenData.Y = 2; % Year (See legend of figure from section 2)
% Function
ModelData = PT2Z_3_AutoFill_PT2Z_4(ModelData);
% Outputs:
% The inputs to section 4 which can be auto from an (OBT) time series
% Will be displayed in the command window.
%% Section 4: Organising the input diffusivities and generating data
% This section has 12 inputs, the first 7 are mandatory,
% The remaining 5 can be manually defined or automatically calculated from
% an input OBT time series processed in section 2 and 3. To use an auto
% input, set ModelData.Auto_Fill_Data.UserChosenData.Flag = 1. Set = 0 for
% manual inputs.
% Inputs - 7 to define regardeless of OBT time series
ModelData.Diffusivity_Data.Names = {'Forth Mud';'Forth Sand';...
'Forth Gravel';'Wee Bankie Mud';'Wee Bankie Sand';'Wee Bankie Gravel'};% Name of formations / zones - Diffusivitie(s) Names
ModelData.Diffusivity_Data.Diffusivities = [3.9e-07; 5.3e-07;...
6.9e-07; 4.9e-07; 5.2e-07; 5.4e-07]; % Diffusivitie(s)
ModelData.Date_Data.Dt = 30*60; % Time interval of the generated sinusiod (s) i.e. 60*30 = .5 hr
ModelData.Temp_Data.Geotherm = 0.03; % Geothermal Gradient (K/m) - 0.3 is global average (Global HF DB,2014)
ModelData.Depth_Data.zmin = 0; % min depth (m)
ModelData.Depth_Data.dz = 0.05; % depth interval (m)
ModelData.Depth_Data.zmax = 10; % max depth (m)
% Define the following inputs or automatically fill inputs based on
% real ambient OBT data processing in (Section 2 & 3)
ModelData.Auto_Fill_Data.UserChosenData.Flag = 1; % (1) Use auto gen OBT; (0) Manually fill input
% Inputs - remaining 5 to set if flag = 0
ModelData.Date_Data.Year = 2017; % The year you are interested in in the format (YYYY)
ModelData.Date_Data.Minday = 61; % The nth day the year when minimum temperature was recorded
% e.g. 2/3/YYYY is the 61st day
ModelData.Temp_Data.MinTemp = 10; % The min of temperature recorded that year
ModelData.Temp_Data.MaxTemp = 16.7572; % The max of temperature recorded that year
ModelData.Temp_Data.MeanTemp = 13; % The mean temperature recorded that year
% Function
ModelData = PT2Z_4_Gen_Annual_Input_Sinusoid(ModelData); % Function
% Outputs:
% Inside is "Propagate_Temp_To_Depth_Z_OutputFolder_"CurrentDate" is a
% "Figures" folder the figure produced by Section 4 are automatically saved
% in this folder as e.g. "PT2Z_4_Input_OBT_Y_2017_Sinusoid_Parameters.jpeg"
%% Section 5: Output the temperature propagated through every formation/zone to depths defined by the user as .txt files
% Depths of interest must coincide with those calculate i.e. defined by
% zmin:dz:zmax, run the line below (line 114) to show the available
% depths:
ModelData.Depth_Data.zlist
% Define the depths to extract
ModelData.Extract_to_Table.input.Depths = [0,1,2,2.5,3]; % The depth(s) you want to extract
ModelData.Extract_to_Table.input.dt = 60*30; % Define the time step (s) to be extracted.
% Same as or larger than ModelData.Date_Data.Dt (line 81)
% Function
ModelData = PT2Z_5_Extract_T_at_Z_to_Table(ModelData) ; % Function
% Outputs:
% In the output folder "Propagate_Temp_To_Depth_Z_OutputFolder_"Current Date"
% Inside is the "PT2Z_5_Output_T_Extract_at_Z_Tables" output folder
% Inside this is a list of .txt tables for each formation name with temps
% Extracted at the depths defined by the user.
%% Section 6 Generate Plot of T vs t for depth ranges z defined by Depth above for a single formation / zone (f)
% Check available depths:
ModelData.Depth_Data.zlist
% Check the order of available formation names:
ModelData.Diffusivity_Data.Names % Run to check the possible formation / zones to define f
% Inputs:
ModelData.T_at_Z_figure.input.Depths = [0,1,2,2.5,3]; % Depths to plot
ModelData.T_at_Z_figure.input.f = 2; % f is the formation / zone, you can check by running "PossibleFormations":
% Function:
ModelData = PT2Z_6_Temp_To_DepthZ_Figure(ModelData) ; % Function
% Outputs:
% Inside the "Figures" folder the figure from section 6 is saved with a
% title "PT2Z_6_OBT_2017_Forth Sand_0m_to_3m.jpeg".
%% Section 7 Generate a plot of T vs Z for each month t and formation f
% Check the order of available formations:
ModelData.Diffusivity_Data.Names % Run to check the possible formation / zones to define f
% Inputs:
ModelData.T_vs_Z_at_t_figure.f = 4 ; % Formation Names
ModelData.T_vs_Z_at_t_figure.Day = 15; % Choose which day of each month to choose probs 1 or 15 is best
% Function:
PT2Z_7_Temp_vs_Depth_At_times_t_Figure(ModelData) % Function
% Outputs:
% Inside the "Figures" folder the figure from Section 7 will be
% automatically saved as
% e.g."PT2Z_7_OBT_2017_Monthly_Extrap_through_Wee_Bankie_Mud_0m_to_10m"
%% References:
% Carslaw, H.S. and Jaeger, J.C. (1959) Conduction of Heat in Solids. Clarendon Press, Oxford.
% HILLEL, D. (1982). Soil Temperature and Heat Flow. Introduction to Soil Physics, pp. 155175. https://doi.org/10.1016/b978-0-08-091869-3.50013-5
% Müller, C., Usbeck, R., & Miesner, F. (2016). Temperatures in shallow marine sediments: Influence of thermal properties, seasonal forcing, and man-made heat sources. Applied Thermal Engineering, 108, 2029. https://doi.org/10.1016/j.applthermaleng.2016.07.105
% Matsubara, Y., H. Kinoshita, S. Uyeda, and A. Thienpraser, Development of a new system for shallow sea heat flow measurements and its test application in the Gulf of Thailand, Tectonophysics, 83, 13-31, 1982.
% Lee, T. C., & Cohen, L. H. (1979). Onshore and offshore measurements of temperature gradients in the Salton Sea geothermal area, California. Geophysics, 44(2), 206215. https://doi.org/10.1190/1.1440962
% The International Heat Flow Commission: Global Heat Flow Database, available at: http://www.heatflow.und.edu/index2.html (last access: 23 July 2014), 2014.