Code construction – 4: Surface fitted coordinate for the fluid and hydrostatic eq.
On top of the spherical coordinates for the field (r, θ, φ), we introduce
surface fitted coordinates for the fluid as follows.
where R(θ,φ) is the surface of a star.

The surface R(θ, φ) is normalized by the value at θ = π/2, and φ = 0.
R0 := R(π/2,0).
subroutine interpolation_grav_to_fluid
θ, and φ coordinates are the same for the field and fluid coordinates. So, aninterpolation along the radial coordinate (1D interpolation) is required.
It is recommended to use an interpolating formula higher than the 2nd order.

r0

rfj-1

rfj

end interpolation_grav_to_fluid

rgi-1

rgi

subroutine coordinate_patch_kit_fluid
We use the same grid spacing for the fluid coordinate (rf , θf ,φf) as thecoordinate grids for the gravitational field.
Radial coordinate input parameters: nrf. (rf = rg up to rf = 1)
R(θ,φ) : rf

[0, 1], the grid spacing rule is the same as rg.

nrf : Total number of radial grid points (-1).
rf(ir), ir = 0, nrf : Radial coordinate grid points ri .
hrf(ir) : Mid-point of radial grids.
drf(ir) : Radial grid spacing ∆ri := ri – ri-1.
θ coordinate input parameter: ntf.
θ [0, π], the grid spacing is equidistant. thf(it), it = 0, ntf : θ grid points θi .
hthf(it) : Mid-point of θ grids θi+1/2 .
ntf : Total number of θ grid points (-1).
dthf : θ grid spacing ∆θ.
Functions associated with θ coordinate.
Trigonometric funcitons.
sinthf(it), it = 0, ntf : sinθi. hsinthf(it) : sinθi+1/2 sin at mid-point of θ grids.
costhf(it), it = 0, ntf : cosθi. hcosthf(it) : cosθi+1/2 cosin at mid-point of θ grids.

φ coordinate input parameter: npf.
[0, 2π], the grid spacing is equidistant. phif(ip), ip = 0, npf : φ grid points φi .
npf : Total number of φ grid points (-1). hphif(ip) : Mid-point of φ grids φi+1/2 .
dphif : φ grid spacing ∆φ.

φ

Functions associated with φ coordinate.
Trigonometric funcitons.
sinphif(ip), ip = 0, npf : sinφi. hsinphif(ip) : sinφi+1/2 sin at mid-point of φ grids.
cosphif(ip), ip = 0, npf : cosφi. hcosphif(ip): cosφi+1/2 cos at mid-point of φ grids.
Weight for the integration: assigned at the mid-points.
wrf(irr) = hrf(irr)2 drf(irr) : weight for the radial integratoin ri2∆riwtf(itt) = hsinthef(itt) dthf : weight for the θ integratoin sinθi ∆θiwpf(ipp) = dphif: weight for the φ integratoin ∆φiwrtpf(irr,itt,ipp) = hR(itt,ipp)3 wrf(irr) wtf(itt) wpf(ipp)hR(itt,ipp) is the radius of the stellar surface at the mid-points of (θ, φ) grids.
That is, at hth(itt), and hphi(ipp) .

end subroutine coordinate_patch_kit_fluidsubroutine rotating_compact_star

Interpolate
which
are used to compute ut.

call interpolation_grav_to_fluid
call hydrostatic_equation
call update_mattercall update_surface
call update_parameterend subroutine rotating_compact_star

Same as the gravitational field(a different value for λ mightmake a convergence faster.)Recall: polytropic (adiabatic) EOS.

subroutine update_parameter

Same as the Newtonian calculation, we have three parameters,
Three conditions are imposed at the center, and two points at the surface.
When the length scale is updated from Ri to R0 , the lapse and the conformal
factor changes as,(When an iteration is made, the physical size of a star may change. Whilein numerical computation, we normalize the size (to set R(π/2,0)=1) andupdate the length scale R0.)Three conditions h=hc at the center, h=1 at Req and Rp, are applied toand solved for the parameters
end subroutine update_parameter.