@@ -167,24 +167,24 @@ function Ridge(::Type{T},P::Parameter,G::Grid) where {T<:AbstractFloat}
167
167
return T .(Hx),T .(Hy)
168
168
end
169
169
170
- """ Same as Ridge() but for 3 ridges at 1/4,1/2,3/4 of the domain ."""
170
+ """ Same as Ridge() but for n ridges at various x positions ."""
171
171
function Ridges (:: Type{T} ,P:: Parameter ,G:: Grid ) where {T<: AbstractFloat }
172
172
173
173
@unpack x_T_halo,y_T_halo,Lx,Ly = G
174
174
@unpack topo_width,topo_height,H = P
175
+ @unpack topo_ridges_positions = P
176
+ n_ridges = length (topo_ridges_positions)
175
177
176
178
xx_T,yy_T = meshgrid (x_T_halo,y_T_halo)
177
179
178
- # bumps in x direction
179
- # shift slightly left/right to avoid a symmetric solution
180
- b0x = exp .(- (xx_T.^ 2 )/ (2 * topo_width^ 2 ))
181
- b1x = exp .(- ((xx_T .- 0.99 * Lx/ 4 ). ^ 2 )/ (2 * topo_width^ 2 ))
182
- b2x = exp .(- ((xx_T .- 1.01 * Lx/ 2 ). ^ 2 )/ (2 * topo_width^ 2 ))
183
- b3x = exp .(- ((xx_T .- 0.99 * 3 * Lx/ 4 ). ^ 2 )/ (2 * topo_width^ 2 ))
184
- b4x = exp .(- ((xx_T .- Lx). ^ 2 )/ (2 * topo_width^ 2 ))
180
+ # loop over bumps in x direction
181
+ R = zero (xx_T) .+ H
185
182
186
- th = topo_height # for convenience
187
- return T .(H .- th* b0x .- th* b1x .- th* b2x .- th* b3x .- th* b4x)
183
+ for i in 1 : n_ridges
184
+ R .- = topo_height* exp .(- ((xx_T .- topo_ridges_positions[i]* Lx). ^ 2 )/ (2 * topo_width^ 2 ))
185
+ end
186
+
187
+ return T .(R)
188
188
end
189
189
190
190
""" Returns a matrix of constant water depth H."""
213
213
214
214
""" Time evolution of forcing."""
215
215
function Ftime (:: Type{T} ,t:: Int ,ω:: Real ) where {T<: AbstractFloat }
216
- return T ( sin (ω* t))
217
- end
216
+ return convert (T, sin (ω* t))
217
+ end
0 commit comments