Skip to content
Snippets Groups Projects

Refactor GRHD project

Merged Florian Atteneder requested to merge fa/grhd into main
1 file
+ 7
19
Compare changes
  • Side-by-side
  • Inline
+ 7
19
@@ -182,9 +182,9 @@ function initialdata_equation!(::Val{:tov}, env, P::Project{:rescaled_spherical1
# use a parabola to interpolate data point at riso = 0
# this also ensures that B is symmetric arcoss riso = 0
B2, B3, r2, r3 = B[2], B[3], riso[2], riso[3]
B[1] = B2 - r2^2*(B3-B2)/(B3^2-B2^2)
B[1] = (r3^2*B2-r2^2*B3)/(r3^2-r2^2)
(; Γ, K, ρc, M, rsch, riso, ρ, ϵ, p, A, B)
(; Γ, K, ρc, M, riso, ρ, ϵ, p, A, B)
end
@unpack equation = P
@@ -207,22 +207,16 @@ function initialdata_equation!(::Val{:tov}, env, P::Project{:rescaled_spherical1
# need to split initial data into portion that lies inside and outside of star,
# because derivatives of the hydro variables are discontinuous at the surface
# although metric functions are supposed to be better conditioned there,
# we also split them for the interpolation, because of potential contamination of numerical error
# we also split them for the interpolation, because of potential contamination
# with numerical error from patching
rmax = data.riso[end]
idx_exterior = findfirst(ri -> ri > rmax, r) |> something
@assert idx_exterior > 0
interior = 1:idx_exterior-1
exterior = idx_exterior:length(mesh)
@show r[idx_exterior-1], r[idx_exterior]
rint = view(r, interior)
rext = view(r, exterior)
rsch = similar(r)
# rsch, A, ∂Ar, B, ∂Br = [ similar(r) for _ in 1:5 ]
rsch[interior] .= interpolate(rint, data.riso, data.rsch)
@. rsch[exterior] = 1/2*(rext - M + sqrt(rext^2 - 2*M*rext))
ρ[interior] .= interpolate(rint, data.riso, data.ρ)
ϵ[interior] .= interpolate(rint, data.riso, data.ϵ)
@@ -230,13 +224,9 @@ function initialdata_equation!(::Val{:tov}, env, P::Project{:rescaled_spherical1
A[interior] .= interpolate(rint, data.riso, data.A)
B[interior] .= interpolate(rint, data.riso, data.B)
@show equation.atm_density
ρ[exterior] .= equation.atm_density
p[exterior] .= @. eos(Pressure, Density, ρ[exterior])
ϵ[exterior] .= @. eos(InternalEnergy, Density, ρ[exterior])
@show extrema(ρ[exterior])
@show extrema(p[exterior])
@show extrema(ϵ[exterior])
# metric potentials of Schwarzschild solution in isotropic coordinates:
# ds^2 = -A^2 dt^2 + B^2 γij dx^i dx^j
@unpack M = data
@@ -253,11 +243,9 @@ function initialdata_equation!(::Val{:tov}, env, P::Project{:rescaled_spherical1
@. D = W * ρ
@. Sr = W^2 * ρ * h * vr
@. τ = W^2 * ρ * h - p - D
@. rD = r*A*B^3*D
@. rSr = r*A*B^3*Sr
@. = r*A*B^3*τ
@show(extrema(D))
@. rD = r*B^3*D
@. rSr = r*B^3*Sr
@. = r*B^3*τ
broadcast_volume!(unscale_conservatives, equation, mesh)
impose_symmetry!(equation, mesh)
Loading