




















































































































 


































































































































































 































































































































































































































































 


























































 










 








































































































































































































































 










                                
                                

                                
                                

                                
                                

                                


















































































 
 

subroutine Hydro_Analysis_FindSeparation(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_a&
  &lignment,cctk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_lev&
  &fac,cctk_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_&
  &ash2,cctk_ash3, Hydro_Analysis_masses_fractions_length,Hydro_Analysis_masses_length,Hydro_Analysis_masses_temps_length,Hydro_Ana&
  &lysis_masses,Hydro_Analysis_masses_fractions,Hydro_Analysis_masses_temps,Hydro_Analysis_masses_temps_p,Hydro_Analysis_masses_tem&
  &ps_p_p,grid_spacing_product,total_rest_mass, Avec_length,Bvec_length,Hydro_Analysis_core_rho_centroid_gf_length,Hydro_Analysis_c&
  &ore_rho_centroid_length,Hydro_Analysis_rho_center_volume_weighted_gf_length,Hydro_Analysis_rho_center_volume_weighted_length,Hyd&
  &ro_Analysis_rho_max_loc_length,vel_length,Abar,Abar_p,Abar_p_p,Aphi,Aphi_p,Aphi_p_p,Avec,Avec_p,Avec_p_p,Bvec,Bvec_p,Bvec_p_p,Hy&
  &dro_Analysis_core_rho_centroid,Hydro_Analysis_core_rho_centroid_gf,Hydro_Analysis_core_rho_centroid_gf_p,Hydro_Analysis_core_rho&
  &_centroid_gf_p_p,Hydro_Analysis_core_rho_sum,Hydro_Analysis_rho_center_volume_weighted,Hydro_Analysis_rho_center_volume_weighted&
  &_gf,Hydro_Analysis_rho_center_volume_weighted_gf_p,Hydro_Analysis_rho_center_volume_weighted_gf_p_p,Hydro_Analysis_rho_max,Hydro&
  &_Analysis_rho_max_loc,Hydro_Analysis_rho_max_origin_distance,Hydro_Analysis_rho_sum,Y_e,Y_e_p,Y_e_p_p,alp,alp_p,alp_p_p,betax,be&
  &tax_p,betax_p_p,betay,betay_p,betay_p_p,betaz,betaz_p,betaz_p_p,coarse_dx,coarse_dy,coarse_dz,dtalp,dtalp_p,dtalp_p_p,dtbetax,dt&
  &betax_p,dtbetax_p_p,dtbetay,dtbetay_p,dtbetay_p_p,dtbetaz,dtbetaz_p,dtbetaz_p_p,dtlapse_state,dtshift_state,entropy,entropy_p,en&
  &tropy_p_p,eps,eps_p,eps_p_p,gxx,gxx_p,gxx_p_p,gxy,gxy_p,gxy_p_p,gxz,gxz_p,gxz_p_p,gyy,gyy_p,gyy_p_p,gyz,gyz_p,gyz_p_p,gzz,gzz_p,&
  &gzz_p_p,hydro_excision_mask,kxx,kxx_p,kxx_p_p,kxy,kxy_p,kxy_p_p,kxz,kxz_p,kxz_p_p,kyy,kyy_p,kyy_p_p,kyz,kyz_p,kyz_p_p,kzz,kzz_p,&
  &kzz_p_p,press,press_p,press_p_p,r,rho,rho_p,rho_p_p,shift_state,temperature,temperature_p,temperature_p_p,vel,vel_p,vel_p_p,w_lo&
  &rentz,w_lorentz_p,w_lorentz_p_p,x,y,z)


  use util_Table


  implicit none


  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  INTEGER Hydro_Analysis_masses_fractions_length
  INTEGER Hydro_Analysis_masses_length
  INTEGER Hydro_Analysis_masses_temps_length
  REAL*8 Hydro_Analysis_masses (Hydro_Analysis_masses_length)
  integer, parameter :: cctki_use_Hydro_Analysis_masses = kind(Hydro_Analysis_masses)
  REAL*8 Hydro_Analysis_masses_fractions (Hydro_Analysis_masses_fractions_length)
  integer, parameter :: cctki_use_Hydro_Analysis_masses_fractions = kind(Hydro_Analysis_masses_fractions)
  REAL*8 Hydro_Analysis_masses_temps (cctk_ash1,cctk_ash2,cctk_ash3,Hydro_Analysis_masses_temps_length)
  integer, parameter :: cctki_use_Hydro_Analysis_masses_temps = kind(Hydro_Analysis_masses_temps)
  REAL*8 Hydro_Analysis_masses_temps_p (cctk_ash1,cctk_ash2,cctk_ash3,Hydro_Analysis_masses_temps_length)
  integer, parameter :: cctki_use_Hydro_Analysis_masses_temps_p = kind(Hydro_Analysis_masses_temps_p)
  REAL*8 Hydro_Analysis_masses_temps_p_p (cctk_ash1,cctk_ash2,cctk_ash3,Hydro_Analysis_masses_temps_length)
  integer, parameter :: cctki_use_Hydro_Analysis_masses_temps_p_p = kind(Hydro_Analysis_masses_temps_p_p)
  REAL*8 grid_spacing_product
  integer, parameter :: cctki_use_grid_spacing_product = kind(grid_spacing_product)
  REAL*8 total_rest_mass
  integer, parameter :: cctki_use_total_rest_mass = kind(total_rest_mass)
  INTEGER Avec_length
  INTEGER Bvec_length
  INTEGER Hydro_Analysis_core_rho_centroid_gf_length
  INTEGER Hydro_Analysis_core_rho_centroid_length
  INTEGER Hydro_Analysis_rho_center_volume_weighted_gf_length
  INTEGER Hydro_Analysis_rho_center_volume_weighted_length
  INTEGER Hydro_Analysis_rho_max_loc_length
  INTEGER vel_length
  REAL*8 Abar (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_Abar = kind(Abar)
  REAL*8 Abar_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_Abar_p = kind(Abar_p)
  REAL*8 Abar_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_Abar_p_p = kind(Abar_p_p)
  REAL*8 Aphi (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_Aphi = kind(Aphi)
  REAL*8 Aphi_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_Aphi_p = kind(Aphi_p)
  REAL*8 Aphi_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_Aphi_p_p = kind(Aphi_p_p)
  REAL*8 Avec (cctk_ash1,cctk_ash2,cctk_ash3,Avec_length)
  integer, parameter :: cctki_use_Avec = kind(Avec)
  REAL*8 Avec_p (cctk_ash1,cctk_ash2,cctk_ash3,Avec_length)
  integer, parameter :: cctki_use_Avec_p = kind(Avec_p)
  REAL*8 Avec_p_p (cctk_ash1,cctk_ash2,cctk_ash3,Avec_length)
  integer, parameter :: cctki_use_Avec_p_p = kind(Avec_p_p)
  REAL*8 Bvec (cctk_ash1,cctk_ash2,cctk_ash3,Bvec_length)
  integer, parameter :: cctki_use_Bvec = kind(Bvec)
  REAL*8 Bvec_p (cctk_ash1,cctk_ash2,cctk_ash3,Bvec_length)
  integer, parameter :: cctki_use_Bvec_p = kind(Bvec_p)
  REAL*8 Bvec_p_p (cctk_ash1,cctk_ash2,cctk_ash3,Bvec_length)
  integer, parameter :: cctki_use_Bvec_p_p = kind(Bvec_p_p)
  REAL*8 Hydro_Analysis_core_rho_centroid (Hydro_Analysis_core_rho_centroid_length)
  integer, parameter :: cctki_use_Hydro_Analysis_core_rho_centroid = kind(Hydro_Analysis_core_rho_centroid)
  REAL*8 Hydro_Analysis_core_rho_centroid_gf (cctk_ash1,cctk_ash2,cctk_ash3,Hydro_Analysis_core_rho_centroid_gf_length)
  integer, parameter :: cctki_use_Hydro_Analysis_core_rho_centroid_gf = kind(Hydro_Analysis_core_rho_centroid_gf)
  REAL*8 Hydro_Analysis_core_rho_centroid_gf_p (cctk_ash1,cctk_ash2,cctk_ash3,Hydro_Analysis_core_rho_centroid_gf_length)
  integer, parameter :: cctki_use_Hydro_Analysis_core_rho_centroid_gf_p = kind(Hydro_Analysis_core_rho_centroid_gf_p)
  REAL*8 Hydro_Analysis_core_rho_centroid_gf_p_p (cctk_ash1,cctk_ash2,cctk_ash3,Hydro_Analysis_core_rho_centroid_gf_length)
  integer, parameter :: cctki_use_Hydro_Analysis_core_rho_centroid_gf_p_p = kind(Hydro_Analysis_core_rho_centroid_gf_p_p)
  REAL*8 Hydro_Analysis_core_rho_sum
  integer, parameter :: cctki_use_Hydro_Analysis_core_rho_sum = kind(Hydro_Analysis_core_rho_sum)
  REAL*8 Hydro_Analysis_rho_center_volume_weighted (Hydro_Analysis_rho_center_volume_weighted_length)
  integer, parameter :: cctki_use_Hydro_Analysis_rho_center_volume_weighted = kind(Hydro_Analysis_rho_center_volume_weighted)
  REAL*8 Hydro_Analysis_rho_center_volume_weighted_gf (cctk_ash1,cctk_ash2,cctk_ash3,Hydro_Analysis_rho_center_volume_weighted_gf_l&
  &ength)
  integer, parameter :: cctki_use_Hydro_Analysis_rho_center_volume_weighted_gf = kind(Hydro_Analysis_rho_center_volume_weighted_gf)
  REAL*8 Hydro_Analysis_rho_center_volume_weighted_gf_p (cctk_ash1,cctk_ash2,cctk_ash3,Hydro_Analysis_rho_center_volume_weighted_gf&
  &_length)
  integer, parameter :: cctki_use_Hydro_Analysis_rho_center_volume_weighted_gf_p = kind(Hydro_Analysis_rho_center_volume_weighted_g&
  &f_p)
  REAL*8 Hydro_Analysis_rho_center_volume_weighted_gf_p_p (cctk_ash1,cctk_ash2,cctk_ash3,Hydro_Analysis_rho_center_volume_weighted_&
  &gf_length)
  integer, parameter :: cctki_use_Hydro_Analysis_rho_center_volume_weighted_gf_p_p = kind(Hydro_Analysis_rho_center_volume_weighted&
  &_gf_p_p)
  REAL*8 Hydro_Analysis_rho_max
  integer, parameter :: cctki_use_Hydro_Analysis_rho_max = kind(Hydro_Analysis_rho_max)
  REAL*8 Hydro_Analysis_rho_max_loc (Hydro_Analysis_rho_max_loc_length)
  integer, parameter :: cctki_use_Hydro_Analysis_rho_max_loc = kind(Hydro_Analysis_rho_max_loc)
  REAL*8 Hydro_Analysis_rho_max_origin_distance
  integer, parameter :: cctki_use_Hydro_Analysis_rho_max_origin_distance = kind(Hydro_Analysis_rho_max_origin_distance)
  REAL*8 Hydro_Analysis_rho_sum
  integer, parameter :: cctki_use_Hydro_Analysis_rho_sum = kind(Hydro_Analysis_rho_sum)
  REAL*8 Y_e (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_Y_e = kind(Y_e)
  REAL*8 Y_e_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_Y_e_p = kind(Y_e_p)
  REAL*8 Y_e_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_Y_e_p_p = kind(Y_e_p_p)
  REAL*8 alp (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_alp = kind(alp)
  REAL*8 alp_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_alp_p = kind(alp_p)
  REAL*8 alp_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_alp_p_p = kind(alp_p_p)
  REAL*8 betax (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_betax = kind(betax)
  REAL*8 betax_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_betax_p = kind(betax_p)
  REAL*8 betax_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_betax_p_p = kind(betax_p_p)
  REAL*8 betay (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_betay = kind(betay)
  REAL*8 betay_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_betay_p = kind(betay_p)
  REAL*8 betay_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_betay_p_p = kind(betay_p_p)
  REAL*8 betaz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_betaz = kind(betaz)
  REAL*8 betaz_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_betaz_p = kind(betaz_p)
  REAL*8 betaz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_betaz_p_p = kind(betaz_p_p)
  REAL*8 coarse_dx
  integer, parameter :: cctki_use_coarse_dx = kind(coarse_dx)
  REAL*8 coarse_dy
  integer, parameter :: cctki_use_coarse_dy = kind(coarse_dy)
  REAL*8 coarse_dz
  integer, parameter :: cctki_use_coarse_dz = kind(coarse_dz)
  REAL*8 dtalp (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_dtalp = kind(dtalp)
  REAL*8 dtalp_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_dtalp_p = kind(dtalp_p)
  REAL*8 dtalp_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_dtalp_p_p = kind(dtalp_p_p)
  REAL*8 dtbetax (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_dtbetax = kind(dtbetax)
  REAL*8 dtbetax_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_dtbetax_p = kind(dtbetax_p)
  REAL*8 dtbetax_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_dtbetax_p_p = kind(dtbetax_p_p)
  REAL*8 dtbetay (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_dtbetay = kind(dtbetay)
  REAL*8 dtbetay_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_dtbetay_p = kind(dtbetay_p)
  REAL*8 dtbetay_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_dtbetay_p_p = kind(dtbetay_p_p)
  REAL*8 dtbetaz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_dtbetaz = kind(dtbetaz)
  REAL*8 dtbetaz_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_dtbetaz_p = kind(dtbetaz_p)
  REAL*8 dtbetaz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_dtbetaz_p_p = kind(dtbetaz_p_p)
  INTEGER*4 dtlapse_state
  integer, parameter :: cctki_use_dtlapse_state = kind(dtlapse_state)
  INTEGER*4 dtshift_state
  integer, parameter :: cctki_use_dtshift_state = kind(dtshift_state)
  REAL*8 entropy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_entropy = kind(entropy)
  REAL*8 entropy_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_entropy_p = kind(entropy_p)
  REAL*8 entropy_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_entropy_p_p = kind(entropy_p_p)
  REAL*8 eps (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_eps = kind(eps)
  REAL*8 eps_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_eps_p = kind(eps_p)
  REAL*8 eps_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_eps_p_p = kind(eps_p_p)
  REAL*8 gxx (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gxx = kind(gxx)
  REAL*8 gxx_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gxx_p = kind(gxx_p)
  REAL*8 gxx_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gxx_p_p = kind(gxx_p_p)
  REAL*8 gxy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gxy = kind(gxy)
  REAL*8 gxy_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gxy_p = kind(gxy_p)
  REAL*8 gxy_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gxy_p_p = kind(gxy_p_p)
  REAL*8 gxz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gxz = kind(gxz)
  REAL*8 gxz_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gxz_p = kind(gxz_p)
  REAL*8 gxz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gxz_p_p = kind(gxz_p_p)
  REAL*8 gyy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gyy = kind(gyy)
  REAL*8 gyy_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gyy_p = kind(gyy_p)
  REAL*8 gyy_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gyy_p_p = kind(gyy_p_p)
  REAL*8 gyz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gyz = kind(gyz)
  REAL*8 gyz_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gyz_p = kind(gyz_p)
  REAL*8 gyz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gyz_p_p = kind(gyz_p_p)
  REAL*8 gzz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gzz = kind(gzz)
  REAL*8 gzz_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gzz_p = kind(gzz_p)
  REAL*8 gzz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_gzz_p_p = kind(gzz_p_p)
  INTEGER*4 hydro_excision_mask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_hydro_excision_mask = kind(hydro_excision_mask)
  REAL*8 kxx (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kxx = kind(kxx)
  REAL*8 kxx_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kxx_p = kind(kxx_p)
  REAL*8 kxx_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kxx_p_p = kind(kxx_p_p)
  REAL*8 kxy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kxy = kind(kxy)
  REAL*8 kxy_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kxy_p = kind(kxy_p)
  REAL*8 kxy_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kxy_p_p = kind(kxy_p_p)
  REAL*8 kxz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kxz = kind(kxz)
  REAL*8 kxz_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kxz_p = kind(kxz_p)
  REAL*8 kxz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kxz_p_p = kind(kxz_p_p)
  REAL*8 kyy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kyy = kind(kyy)
  REAL*8 kyy_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kyy_p = kind(kyy_p)
  REAL*8 kyy_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kyy_p_p = kind(kyy_p_p)
  REAL*8 kyz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kyz = kind(kyz)
  REAL*8 kyz_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kyz_p = kind(kyz_p)
  REAL*8 kyz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kyz_p_p = kind(kyz_p_p)
  REAL*8 kzz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kzz = kind(kzz)
  REAL*8 kzz_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kzz_p = kind(kzz_p)
  REAL*8 kzz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_kzz_p_p = kind(kzz_p_p)
  REAL*8 press (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_press = kind(press)
  REAL*8 press_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_press_p = kind(press_p)
  REAL*8 press_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_press_p_p = kind(press_p_p)
  REAL*8 r (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_r = kind(r)
  REAL*8 rho (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_rho = kind(rho)
  REAL*8 rho_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_rho_p = kind(rho_p)
  REAL*8 rho_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_rho_p_p = kind(rho_p_p)
  INTEGER*4 shift_state
  integer, parameter :: cctki_use_shift_state = kind(shift_state)
  REAL*8 temperature (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_temperature = kind(temperature)
  REAL*8 temperature_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_temperature_p = kind(temperature_p)
  REAL*8 temperature_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_temperature_p_p = kind(temperature_p_p)
  REAL*8 vel (cctk_ash1,cctk_ash2,cctk_ash3,vel_length)
  integer, parameter :: cctki_use_vel = kind(vel)
  REAL*8 vel_p (cctk_ash1,cctk_ash2,cctk_ash3,vel_length)
  integer, parameter :: cctki_use_vel_p = kind(vel_p)
  REAL*8 vel_p_p (cctk_ash1,cctk_ash2,cctk_ash3,vel_length)
  integer, parameter :: cctki_use_vel_p_p = kind(vel_p_p)
  REAL*8 w_lorentz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_w_lorentz = kind(w_lorentz)
  REAL*8 w_lorentz_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_w_lorentz_p = kind(w_lorentz_p)
  REAL*8 w_lorentz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_w_lorentz_p_p = kind(w_lorentz_p_p)
  REAL*8 x (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_x = kind(x)
  REAL*8 y (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_y = kind(y)
  REAL*8 z (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_z = kind(z)
  REAL*8 restmass_ref_radius_mass (101)
  integer, parameter :: cctki_use_restmass_ref_radius_mass = kind(restmass_ref_radius_mass)
  REAL*8 restmass_rho_min
  integer, parameter :: cctki_use_restmass_rho_min = kind(restmass_rho_min)
  INTEGER*4 restmass_compute_masses
  integer, parameter :: cctki_use_restmass_compute_masses = kind(restmass_compute_masses)
  INTEGER*4 restmass_masses_nr
  integer, parameter :: cctki_use_restmass_masses_nr = kind(restmass_masses_nr)
  COMMON /Hydro_Analysisrest/restmass_ref_radius_mass, restmass_rho_min, restmass_compute_masses, restmass_masses_nr
  REAL*8 Hydro_Analysis_core_rho_rel_min
  integer, parameter :: cctki_use_Hydro_Analysis_core_rho_rel_min = kind(Hydro_Analysis_core_rho_rel_min)
  REAL*8 Hydro_Analysis_r_core
  integer, parameter :: cctki_use_Hydro_Analysis_r_core = kind(Hydro_Analysis_r_core)
  integer*8 Hydro_Analysis_interpolator_coordinates
  integer, parameter :: cctki_use_Hydro_Analysis_interpolator_coordinates = kind(Hydro_Analysis_interpolator_coordinates)
  integer*8 Hydro_Analysis_interpolator_name
  integer, parameter :: cctki_use_Hydro_Analysis_interpolator_name = kind(Hydro_Analysis_interpolator_name)
  integer*8 Hydro_Analysis_interpolator_options
  integer, parameter :: cctki_use_Hydro_Analysis_interpolator_options = kind(Hydro_Analysis_interpolator_options)
  INTEGER*4 Hydro_Analysis_average_multiple_maxima_locations
  integer, parameter :: cctki_use_Hydro_Analysis_average_multiple_maxima_locations = kind(Hydro_Analysis_average_multiple_maxima_lo&
  &cations)
  INTEGER*4 Hydro_Analysis_comp_core_rho_centroid
  integer, parameter :: cctki_use_Hydro_Analysis_comp_core_rho_centroid = kind(Hydro_Analysis_comp_core_rho_centroid)
  INTEGER*4 Hydro_Analysis_comp_rho_max
  integer, parameter :: cctki_use_Hydro_Analysis_comp_rho_max = kind(Hydro_Analysis_comp_rho_max)
  INTEGER*4 Hydro_Analysis_comp_rho_max_every
  integer, parameter :: cctki_use_Hydro_Analysis_comp_rho_max_every = kind(Hydro_Analysis_comp_rho_max_every)
  INTEGER*4 Hydro_Analysis_comp_rho_max_origin_distance
  integer, parameter :: cctki_use_Hydro_Analysis_comp_rho_max_origin_distance = kind(Hydro_Analysis_comp_rho_max_origin_distance)
  INTEGER*4 Hydro_Analysis_comp_vol_weighted_center_of_mass
  integer, parameter :: cctki_use_Hydro_Analysis_comp_vol_weighted_center_of_mass = kind(Hydro_Analysis_comp_vol_weighted_center_of&
  &_mass)
  INTEGER*4 Hydro_Analysis_rho_max_loc_only_positive_x
  integer, parameter :: cctki_use_Hydro_Analysis_rho_max_loc_only_positive_x = kind(Hydro_Analysis_rho_max_loc_only_positive_x)
  INTEGER*4 Hydro_Analysis_rho_max_loc_use_rotatingsymmetry180
  integer, parameter :: cctki_use_Hydro_Analysis_rho_max_loc_use_rotatingsymmetry180 = kind(Hydro_Analysis_rho_max_loc_use_rotating&
  &symmetry180)
  INTEGER*4 Hydro_Analysis_rho_max_origin_distance_npoints
  integer, parameter :: cctki_use_Hydro_Analysis_rho_max_origin_distance_npoints = kind(Hydro_Analysis_rho_max_origin_distance_npoi&
  &nts)
  INTEGER*4 verbosity_level
  integer, parameter :: cctki_use_verbosity_level = kind(verbosity_level)
  COMMON /Hydro_Analysispriv/Hydro_Analysis_core_rho_rel_min, Hydro_Analysis_r_core, Hydro_Analysis_interpolator_coordinates, Hydro&
  &_Analysis_interpolator_name, Hydro_Analysis_interpolator_options, Hydro_Analysis_average_multiple_maxima_locations, Hydro_Analys&
  &is_comp_core_rho_centroid, Hydro_Analysis_comp_rho_max, Hydro_Analysis_comp_rho_max_every, Hydro_Analysis_comp_rho_max_origin_di&
  &stance, Hydro_Analysis_comp_vol_weighted_center_of_mass, Hydro_Analysis_rho_max_loc_only_positive_x, Hydro_Analysis_rho_max_loc_&
  &use_rotatingsymmetry180, Hydro_Analysis_rho_max_origin_distance_npoints, verbosity_level
  integer*8 CCTKH0
  integer, parameter :: cctki_use_CCTKH0 = kind(CCTKH0)
  integer*8 CCTKH1
  integer, parameter :: cctki_use_CCTKH1 = kind(CCTKH1)
  integer*8 CCTKH2
  integer, parameter :: cctki_use_CCTKH2 = kind(CCTKH2)
  integer*8 CCTKH3
  integer, parameter :: cctki_use_CCTKH3 = kind(CCTKH3)
  integer*8 CCTKH4
  integer, parameter :: cctki_use_CCTKH4 = kind(CCTKH4)
  integer*8 CCTKH6
  integer, parameter :: cctki_use_CCTKH6 = kind(CCTKH6)
  integer*8 CCTKH7
  integer, parameter :: cctki_use_CCTKH7 = kind(CCTKH7)
  integer*8 CCTKH8
  integer, parameter :: cctki_use_CCTKH8 = kind(CCTKH8)
  integer*8 CCTKH9
  integer, parameter :: cctki_use_CCTKH9 = kind(CCTKH9)
  integer*8 CCTKH10
  integer, parameter :: cctki_use_CCTKH10 = kind(CCTKH10)
  integer*8 CCTKH11
  integer, parameter :: cctki_use_CCTKH11 = kind(CCTKH11)
  integer*8 CCTKH12
  integer, parameter :: cctki_use_CCTKH12 = kind(CCTKH12)
  integer*8 CCTKH13
  integer, parameter :: cctki_use_CCTKH13 = kind(CCTKH13)
  integer*8 CCTKH14
  integer, parameter :: cctki_use_CCTKH14 = kind(CCTKH14)
  integer*8 CCTKH15
  integer, parameter :: cctki_use_CCTKH15 = kind(CCTKH15)
  INTEGER*4 CCTKH5
  integer, parameter :: cctki_use_CCTKH5 = kind(CCTKH5)
  INTEGER*4 timelevels
  integer, parameter :: cctki_use_timelevels = kind(timelevels)
  COMMON /HYDROBASErest/CCTKH0, CCTKH1, CCTKH2, CCTKH3, CCTKH4, CCTKH6, CCTKH7, CCTKH8, CCTKH9, CCTKH10, CCTKH11, CCTKH12, CCTKH13,&
  & CCTKH14, CCTKH15, CCTKH5, timelevels
  interface
  integer*8 function CCTK_PointerTo (var)
  implicit none
  type(*),dimension(..),TARGET :: var
  end function CCTK_PointerTo
  end interface
  interface
  integer function CCTK_Equals (arg1, arg2)
  implicit none
  integer*8 arg1
  character(*) arg2
  end function CCTK_Equals
  integer function CCTK_MyProc (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_MyProc
  integer function CCTK_nProcs (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_nProcs
  integer function CCTK_IsThornActive (name)
  implicit none
  character(*) name
  end function CCTK_IsThornActive
  integer*8 function CCTK_NullPointer ()
  implicit none
  end function CCTK_NullPointer
  end interface

  REAL*8 :: separation_dx, separation_dy, separation_dz
  REAL*8, dimension(:), allocatable :: separation_x, separation_y, &
       separation_z
  REAL*8, dimension(:), allocatable :: s_gxx, s_gxy, s_gxz, &
       s_gyy, s_gyz, s_gzz
  integer :: ierr, i
  integer :: param_table_handle, interp_handle, coord_system_handle
  INTEGER*4 :: vindex

  integer*8, dimension(3) :: interp_coords
  INTEGER*4, dimension(6) :: in_array_indices
  integer*8, dimension(6) :: out_arrays
  INTEGER*4, dimension(6) :: out_array_type_codes

  
  
  integer, parameter:: max_string_length = 500
  integer :: string_length
  character(len=max_string_length) :: Hydro_Analysis_interpolator_options_fstring
  character(len=max_string_length) :: Hydro_Analysis_interpolator_name_fstring
  character(len=max_string_length) :: Hydro_Analysis_interpolator_coordinates_fstring




  allocate(separation_x(Hydro_Analysis_rho_max_origin_distance_npoints), &
       separation_y(Hydro_Analysis_rho_max_origin_distance_npoints), &
       separation_z(Hydro_Analysis_rho_max_origin_distance_npoints), STAT=ierr)

  if (ierr .ne. 0) then
    call CCTK_Warn(0,67,"GRHydro_Separation.F90","Hydro_Analysis", "Failed to allocate separation coordinate arrays")
  end if

  call CCTK_FortranString(string_length, Hydro_Analysis_interpolator_options, &
                          Hydro_Analysis_interpolator_options_fstring)
  if (string_length .gt. max_string_length) then
     call CCTK_Warn(1,73,"GRHydro_Separation.F90","Hydro_Analysis", "'Hydro_Analysis_interpolator_options' string too long!")
  end if
  call CCTK_FortranString(string_length, Hydro_Analysis_interpolator_name, &
                          Hydro_Analysis_interpolator_name_fstring)
  if (string_length .gt. max_string_length) then
     call CCTK_Warn(1,78,"GRHydro_Separation.F90","Hydro_Analysis", "'Hydro_Analysis_interpolator_name' string too long!")
  end if
  call CCTK_FortranString(string_length, Hydro_Analysis_interpolator_coordinates, &
                          Hydro_Analysis_interpolator_coordinates_fstring)
  if (string_length .gt. max_string_length) then
     call CCTK_Warn(1,83,"GRHydro_Separation.F90","Hydro_Analysis", "'Hydro_Analysis_interpolator_coordinates' string too long!")
  end if

  
  separation_dx = Hydro_Analysis_rho_max_loc(1) / dble(Hydro_Analysis_rho_max_origin_distance_npoints)
  separation_dy = Hydro_Analysis_rho_max_loc(2) / dble(Hydro_Analysis_rho_max_origin_distance_npoints)
  separation_dz = Hydro_Analysis_rho_max_loc(3) / dble(Hydro_Analysis_rho_max_origin_distance_npoints)

  do i = 1, Hydro_Analysis_rho_max_origin_distance_npoints
    
    separation_x(i) = i * separation_dx
    separation_y(i) = i * separation_dy
    separation_z(i) = i * separation_dz

  end do
  
  allocate(s_gxx(Hydro_Analysis_rho_max_origin_distance_npoints), &
       s_gxy(Hydro_Analysis_rho_max_origin_distance_npoints), &
       s_gxz(Hydro_Analysis_rho_max_origin_distance_npoints), &
       s_gyy(Hydro_Analysis_rho_max_origin_distance_npoints), &
       s_gyz(Hydro_Analysis_rho_max_origin_distance_npoints), &
       s_gzz(Hydro_Analysis_rho_max_origin_distance_npoints), &
       STAT=ierr)

  if (ierr .ne. 0) then
    call CCTK_Warn(0,108,"GRHydro_Separation.F90","Hydro_Analysis", "Failed to allocate separation metric arrays")
  end if

  param_table_handle = -1
  interp_handle = -1
  coord_system_handle = -1

  call Util_TableCreateFromString (param_table_handle, &
                                   Hydro_Analysis_interpolator_options_fstring)
  if (param_table_handle .lt. 0) then
    call CCTK_Warn(0,118,"GRHydro_Separation.F90","Hydro_Analysis","Cannot create parameter table for interpolator")
  endif

  call CCTK_InterpHandle (interp_handle, Hydro_Analysis_interpolator_name_fstring)
  if (interp_handle.lt.0) then
    call CCTK_Warn(0,123,"GRHydro_Separation.F90","Hydro_Analysis","Cannot get handle for interpolation ! Forgot to activate an imp&
  &lementation providing interpolation operators (e.g. LocalInterp)?")
  endif

  call CCTK_CoordSystemHandle (coord_system_handle, Hydro_Analysis_interpolator_coordinates_fstring)
  if (coord_system_handle .lt. 0) then
    call CCTK_Warn(0,128,"GRHydro_Separation.F90","Hydro_Analysis","Cannot get handle for cart3d coordinate system ! Forgot to acti&
  &vate an implementation providing coordinates (e.g. LocalInterp)?")
  endif


  interp_coords(1) = CCTK_PointerTo(separation_x)
  interp_coords(2) = CCTK_PointerTo(separation_y)
  interp_coords(3) = CCTK_PointerTo(separation_z)
  
  call CCTK_VarIndex (vindex, "admbase::gxx")
  in_array_indices(1) = vindex
  call CCTK_VarIndex (vindex, "admbase::gyy")
  in_array_indices(2) = vindex
  call CCTK_VarIndex (vindex, "admbase::gzz")
  in_array_indices(3) = vindex
  call CCTK_VarIndex (vindex, "admbase::gxy")
  in_array_indices(4) = vindex
  call CCTK_VarIndex (vindex, "admbase::gxz")
  in_array_indices(5) = vindex
  call CCTK_VarIndex (vindex, "admbase::gyz")
  in_array_indices(6) = vindex
  
  out_arrays(1) = CCTK_PointerTo(s_gxx)
  out_arrays(2) = CCTK_PointerTo(s_gyy)
  out_arrays(3) = CCTK_PointerTo(s_gzz)
  out_arrays(4) = CCTK_PointerTo(s_gxy)
  out_arrays(5) = CCTK_PointerTo(s_gxz)
  out_arrays(6) = CCTK_PointerTo(s_gyz)
  
  out_array_type_codes = 130
  


  call CCTK_InterpGridArrays (ierr, cctkGH, 3, interp_handle,&
       param_table_handle, coord_system_handle,&
       Hydro_Analysis_rho_max_origin_distance_npoints, 130, interp_coords,&
       6, in_array_indices,&
       6, out_array_type_codes, out_arrays)
  if (ierr < 0) then
    call CCTK_Warn(1,166,"GRHydro_Separation.F90","Hydro_Analysis", "interpolator call returned an error code");
  endif
  

  call Util_TableDestroy (ierr, param_table_handle)
  

  
  Hydro_Analysis_rho_max_origin_distance = 0.d0

  do i=2, Hydro_Analysis_rho_max_origin_distance_npoints
    
    Hydro_Analysis_rho_max_origin_distance = Hydro_Analysis_rho_max_origin_distance + 0.5d0 &
         *(sqrt(s_gxx(i-1)*separation_dx**2  + &
                s_gyy(i-1)*separation_dy**2  + &
                s_gzz(i-1)*separation_dz**2 &
        + 2.d0*(s_gxy(i-1)*separation_dx*separation_dy + &
                s_gxz(i-1)*separation_dx*separation_dz + &
                s_gyz(i-1)*separation_dy*separation_dz)) &
         + sqrt(s_gxx(i  )*separation_dx**2  + &
                s_gyy(i  )*separation_dy**2  + &
                s_gzz(i  )*separation_dz**2 &
        + 2.d0*(s_gxy(i  )*separation_dx*separation_dy + &
                s_gxz(i  )*separation_dx*separation_dz + &
                s_gyz(i  )*separation_dy*separation_dz)))
    
  end do
    
end subroutine Hydro_Analysis_FindSeparation

