Skip to content

Commit

Permalink
new grid
Browse files Browse the repository at this point in the history
  • Loading branch information
simone-silvestri committed May 14, 2024
1 parent a9876e0 commit bfc797f
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions src/generate_tripolar_coordinates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,41 @@ It uses a secant root finding method to find the value of `jnum` and an Adams-Ba
jnum[i, 1] = bisection_root_find(myfunc, Jeq-1.0, Nφ+1-Δj, Δj)

for n in 2:N
# Great circles
xnum[i, n] = xnum[i, n-1] - Δx
ynum[i, n] = ynum[i, n-1]

iteration = 0
yₒ = 1e10

func(j) = (xnum[i, n-1] / a_interpolator(j)) ^2 + (ynum[i, n-1] / b_interpolator(j))^2 - 1
jnum[i, n-1] = bisection_root_find(func, Jeq-1.0, Nφ+1.0, Δj)
# Implicit integrator through a fixed point iteration
while norm(ynum[i, n] - yₒ) > 1e-12 && iteration < 1000
yₒ = ynum[i, n]
iteration+=1

# Great circles
func(j) = (xnum[i, n] / a_interpolator(j)) ^2 + (ynum[i, n] / b_interpolator(j))^2 - 1
jnum[i, n-1] = bisection_root_find(func, Jeq-1.0, Nφ+1.0, Δj)

# Semi-Implicit integrator

= a_interpolator(jnum[i, n-1])^2 / b_interpolator(jnum[i, n-1])^2 / xnum[i, n]

ynum[i, n] = ynum[i, n-1] / (1 +* Δx)
end

# Semi-Implicit integrator
= a_interpolator(jnum[i, n-1])^2 / b_interpolator(jnum[i, n-1])^2 / xnum[i, n-1]

ynum[i, n] = ynum[i, n-1] / (1 +* Δx)
xnum[i, n] = xnum[i, n-1] - Δx
end

@show i
end
end

@inline tripolar_stretching_function(φ; d = 0.4) = d / exp(-1) * exp( - 1 / ((pi / 4 - ((90 - φ) / 180) * pi/2)/pi*4))

@inline tan_a_curve(φ) = - equator_fcurve(φ)
@inline exp_b_curve(φ; d = 0.4) = - equator_fcurve(φ) + ifelse> 0, tripolar_stretching_function(φ; d), 0)

@inline zero_c_curve(φ) = 0

"""
generate_tripolar_metrics!(λFF, φFF, λFC, φFC, λCF, φCF, λCC;
size, halo, latitude, longitude,
Expand Down

0 comments on commit bfc797f

Please sign in to comment.