Skip to content

Commit 9c1f855

Browse files
committed
Merge branch 'ap-mckenzie-temp' of https://github.com/APiccolo89/GeophysicalModelGenerator.jl into ap-mckenzie-temp
2 parents 68df227 + bf92c5b commit 9c1f855

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

src/Setup_geometry.jl

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,17 @@ end
11111111
"""
11121112
LinearWeightedTemperature
11131113
1114-
Weight average structure -> correction from previous version Boris Kaus
1114+
Structure that defined a linear average temperature between two temperature fields as a function of distance
1115+
1116+
Parameters
1117+
===
1118+
- w_min: Minimum weight
1119+
- w_max: Maximum weight
1120+
- crit_dist: Critical distance
1121+
- dir: Direction of the averaging (`:X`, `:Y` or `:Z`)
1122+
- F1: First temperature field
1123+
- F2: Second temperature field
1124+
11151125
"""
11161126
@with_kw_noshow mutable struct LinearWeightedTemperature <: AbstractThermalStructure
11171127
w_min::Float64 = 0.0;
@@ -1147,23 +1157,23 @@ function Compute_ThermalStructure(Temp, X, Y, Z, Phase, s::LinearWeightedTempera
11471157
end
11481158

11491159
# compute the 1D thermal structures
1150-
Temp1 = Compute_ThermalStructure(Temp, X, Y, Z, Phase, F1);
1151-
1152-
Temp2 = Compute_ThermalStructure(Temp, X, Y, Z, Phase, F2);
1160+
Temp1 = zeros(size(Temp));
1161+
Temp2 = zeros(size(Temp));
1162+
Temp1 = Compute_ThermalStructure(Temp1, X, Y, Z, Phase, F1);
1163+
Temp2 = Compute_ThermalStructure(Temp2, X, Y, Z, Phase, F2);
11531164

11541165
# Compute the weights
11551166
weight = w_min .+(w_max-w_min) ./(crit_dist) .*(dist)
11561167

11571168
ind_1 = findall(weight .>w_max);
1158-
1159-
ind_2 =findall(weight .<w_min);
1169+
ind_2 = findall(weight .<w_min);
11601170

11611171
# Change the weight
11621172
weight[ind_1] .= w_max;
1163-
11641173
weight[ind_2] .= w_min;
1174+
1175+
# Average temperature
1176+
Temp .= Temp1 .*(1.0 .- weight) + Temp2 .* weight;
11651177

1166-
# Average
1167-
Temp = Temp1 .*weight+ Temp2 .*(1.0 - weight);
11681178
return Temp
11691179
end

test/test_setup_geometry.jl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,24 @@ Temp = ones(Float64,size(Cart))*1350;
190190
AddBox!(Phase, Temp, Cart; xlim=(0.0,600.0),ylim=(0.0,600.0), zlim=(-80.0, 0.0), phase = ConstantPhase(5), T=TsMK);
191191
@test sum(Temp) 3.518172093383281e8
192192

193-
# inclined
193+
# inclined slab
194194
Temp = ones(Float64,size(Cart))*1350;
195195
AddBox!(Phase, Temp, Cart; xlim=(0.0,600.0),ylim=(0.0,600.0), zlim=(-80.0,0),StrikeAngle=0, DipAngle=45, phase = ConstantPhase(5), T=TsMK);
196196
@test sum(Temp) 3.5133669349123573e8
197197

198198

199-
# T_slab = LinearWeightedTemperature(0.1,1.0,100.0,:X,TsMK,TsHC);
200199

201-
# AddBox!(Phase, Temp, Cart; xlim=(0.0,600.0),ylim=(0.0,600.0), zlim=(0.0,-80.0),StrikeAngle=0, DipAngle=45, phase = ConstantPhase(5), T=McKenzie(20.0));
200+
# horizontal slab, constant T
201+
T_slab = LinearWeightedTemperature(0,1,600.0,:X,ConstantTemp(1000), ConstantTemp(2000));
202+
Temp = ones(Float64,size(Cart))*1350;
203+
AddBox!(Phase, Temp, Cart; xlim=(0.0,600.0),ylim=(0.0,600.0), zlim=(-80.0, 0.0), phase = ConstantPhase(5), T=T_slab);
204+
@test sum(Temp) 3.549127111111111e8
205+
206+
# horizontal slab, halfspace and McKenzie
207+
T_slab = LinearWeightedTemperature(crit_dist=600, F1=TsHC, F2=TsMK);
208+
Temp = ones(Float64,size(Cart))*1350;
209+
AddBox!(Phase, Temp, Cart; xlim=(0.0,600.0),ylim=(0.0,600.0), zlim=(-80.0, 0.0), phase = ConstantPhase(5), T=T_slab);
210+
@test sum(Temp) 3.499457641038468e8
211+
202212

203-
# Data_Final = CartData(X,Y,Z,(Phase=Phase,Temp=Temp))
213+
Data_Final = AddField(Cart,"Temp",Temp)

0 commit comments

Comments
 (0)