forked from maxrudolph/gerya-julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTopo.jl
155 lines (136 loc) · 5.57 KB
/
Topo.jl
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
# function initial_ice_depth(x::Float64,ice_thickness::Float64,wavelength::Float64,amplitude::Float64,initial_surface_depth::Float64)
# """
# Arguments:
# x::Float64 -- A horizontal value of float64
# Returns:
# The vertical value (depth) corresponding to the horizontal argument value
# Info:
# The initial topography setup follows the following.
# y = A*sin[k(x-b)]+c
# |A| is the amplitude
# k is the wave number (k=2π/wavelength)
# The period is 2π/k
# The horizontal shift is b
# The vertical shift is c
# """
# return ice_thickness + initial_surface_depth + amplitude*sin( 2*pi/wavelength*x )
# end
# function initial_ice_depth(x::Float64,ice_thickness::Float64,wavelength::Float64,amplitude::Float64,initial_surface_depth::Float64)
# return ice_thickness + initial_surface_depth + amplitude*sin( 2*pi/wavelength*x )
# end
# function get_interface(grid::CartesianGrid,mat::Matrix{Float64},contour_value::Float64)
# # Finding interfaces
# interface_position = zeros(Float64,grid.nx+1);
# for j in 1:grid.nx+1
# i = 1
# while i <= grid.ny
# if mat[i,j] == contour_value
# interface_position[j] = grid.yc[i]
# break
# elseif mat[i+1,j] < contour_value
# # interface is located within this cell.
# interface_position[j] = grid.yc[i] + (grid.yc[i+1]-grid.yc[i])/(mat[i+1,j]-mat[i,j])*(contour_value-mat[i,j])
# break
# end
# i = i+1
# end
# end
# return interface_position
# end
function get_halfspace_time_viscous(lambda::Float64)
"""
Arguments:
lambda::Float64 --- Topography Wavelength in (m)
Returns:
time --- Time for viscous flow in (yr)
Info:
***This is the halfspace solution***
g --- Acceleration due to gravity in (m/s^2)
ice_visosity --- Viscosity of ice in (Pa*s = kg/m*s)
delta_rho --- Difference of density in (kg/m^3)
"""
g = 0.113
ice_viscosity = 1e15
delta_rho = 80
time = (4*pi)*(ice_viscosity)*(1/g)*(1/delta_rho)*(1/lambda)
return time/3.15e7
end
function get_thickening_rate(hice::Float64)
"""
Arguments:
hice::Float64 --- Ice shell thickness in (m)
Returns:
rate --- Rate of thickening in (m/s)
Info:
delta_T --- Difference of temperaure in (K)
kthermal --- Thermal conductivity in (W/m*K)
L --- Latent heat of fusion in (J/kg)
rho --- Density in (kg/m^3)
q --- Heat flux in (W/m^2)
q = -k*(T-To)/h
rate = q/rho*L
*1W = 1J/s*
"""
delta_T = 173
kthermal = 2.2
L = 334*10^3
rho = 1000
q = kthermal*(delta_T/hice)
rate = q/(L*rho)
return rate
end
function get_thickening_time(hice::Float64,rate::Float64)
"""
Arguments:
hice::Float64 --- Ice shell thickness in (m)
Returns:
time --- Time for thickening in (yr)
Info:
rate --- Rate of thickening in (m/s)
"""
time = hice/rate
return time/3.15e7
end
function get_numerical_time_viscous(initial_amplitude::Float64,final_amplitude::Float64,time::Float64)
# function get_numerical_time_viscous(i_interface_1::Vector{Float64},interface_1::Vector{Float64},i_interface_2::Vector{Float64},interface_2::Vector{Float64},time::Float64)
"""
Arguments:
time::Float64 --- model time run in (seconds)
Returns:
tr --- Characteristic time for viscous flow in (yr)
Info:
using equation (6.104) from Turcotte and Schubert
w = w0*e^(-t/tr)
i_amp --- Initial amplitude
amp --- Final amplitude
"""
# initial_max_ice_shell_thickness = maximum(i_interface_2-i_interface_1)
# initial_avg_ice_shell_thickness = mean(i_interface_2-i_interface_1)
# initial_amplitude = initial_max_ice_shell_thickness-initial_avg_ice_shell_thickness
# max_ice_shell_thickness = maximum(interface_2-interface_1)
# avg_ice_shell_thickness = mean(interface_2-interface_1)
# amplitude = max_ice_shell_thickness-avg_ice_shell_thickness
lnratio = log2(final_amplitude)-log2(initial_amplitude)
tr = -time/lnratio
return tr/3.15e7
end
# function get_topography_info(interface_1::Vector{Float64},interface_2::Vector{Float64},time::Float64,time_type::String)
# x_time = @sprintf("%.3g",time/3.15e7/1e3)
# max_ice_shell_thickness = maximum(interface_2.-interface_1)
# avg_ice_shell_thickness = mean(interface_2.-interface_1)
# x_ice = interface_2.-interface_1
# amplitude = max_ice_shell_thickness-avg_ice_shell_thickness
# if time_type == "initial"
# infot = printstyled("Intial:\n"; color = :blue, blink = true)
# info1 = println("\tThe maximum total initial thickness of the icy shell is ",@sprintf("%.3g",max_ice_shell_thickness/1000),"(km)")
# info2 = println("\tThe average initial thickness of the icy shell is ",@sprintf("%.3g",avg_ice_shell_thickness/1000),"(km)")
# info3 = println("\tThe initial amplitude is ",@sprintf("%.3g",amplitude/1000),"(km)")
# return infot,info1,info2,info3
# elseif time_type == "final"
# infot = printstyled("After:\n"; color = :blue, blink = true)
# info1 = println("\tThe maximum total thickness of the icy shell after $x_time kyr is ",@sprintf("%.3g",max_ice_shell_thickness/1000),"(km)")
# info2 = println("\tThe average thickness of the icy shell after $x_time kyr is ",@sprintf("%.3g",avg_ice_shell_thickness/1000),"(km)")
# info3 = println("\tThe amplitude after $x_time kyr is ",@sprintf("%.3g",amplitude/1000),"(km)")
# return infot,info1,info2,info3
# end
# end