diff --git "a/Llama_WaveExtractL.json" "b/Llama_WaveExtractL.json" new file mode 100644--- /dev/null +++ "b/Llama_WaveExtractL.json" @@ -0,0 +1,30 @@ +{ + "thorn_name": "Llama/WaveExtractL", + "url": "https://bitbucket.org/llamacode/llama.git", + "configuration": "REQUIRES THORNS: NaNChecker ADMDerivatives\nREQUIRES Carpet\n", + "interface": "# Interface definition for thorn WaveExtractL\n\nimplements: WaveExtractL\n\ninherits: grid admbase staticconformal io sphericalsurface\n\nuses include: carpetinterp2.hh\n\nprivate:\n\nINT gridsizes_group TYPE=ARRAY DIM=1 SIZE=100 DISTRIB=CONSTANT tags='checkpoint=\"no\"'\n{\n int_nphi, int_ntheta \n} \"gridsizes stored as variables\"\n\nINT handles_group TYPE=SCALAR tags='checkpoint=\"no\"'\n{\n sum_handle\n} \"handles for reduction operators\"\n\nINT do_nothing_group TYPE=SCALAR tags='checkpoint=\"no\"'\n{\n do_nothing\n} \"if equal to 1, then WaveExtract won't do anything (example: all detectors are out of range)\"\n\nREAL sym_factor_group TYPE=SCALAR tags='checkpoint=\"no\"'\n{\n sym_factor\n} \"symmmetry factor for integrals (depends on domain, sym_factor=2 for bitant for example)\"\n\nREAL interp_metric_arrays TYPE=ARRAY DIM=2 SIZE=maxntheta,maxnphi DISTRIB=DEFAULT tags='checkpoint=\"no\"'\n{\n gxxi, gxyi, gxzi,\n gyyi, gyzi, gzzi,\n psii,\n dx_gxxi, dy_gxxi, dz_gxxi,\n dx_gxyi, dy_gxyi, dz_gxyi,\n dx_gxzi, dy_gxzi, dz_gxzi,\n dx_gyyi, dy_gyyi, dz_gyyi,\n dx_gyzi, dy_gyzi, dz_gyzi,\n dx_gzzi, dy_gzzi, dz_gzzi,\n dx_psii, dy_psii, dz_psii,\n} \"2D (theta,phi) Arrays for holding the metric and conformal factor and their first derivatives interpolated onto the extraction coordinate sphere\"\n\nREAL surface_arrays TYPE=ARRAY DIM=2 SIZE=maxntheta,maxnphi DISTRIB=DEFAULT tags='checkpoint=\"no\"'\n{\n interp_x,interp_y,interp_z,\n psi_ext_deriv,\n ctheta, cphi, sintheta, costheta, sinphi, cosphi,\n dr_gxxi,dr_gxyi,dr_gxzi,dr_gyyi,dr_gyzi,dr_gzzi,\n dr_psii,\n grr, grt, grp, gtt, gtp, gpp,\n dr_gtt, dr_gtp, dr_gpp,\n h1i,H2i,Gi,Ki,c1i,c2i,dGi,dKi,dc2i\n ih1i,iH2i,iGi,iKi,ic1i,ic2i,idGi,idKi,idc2i\n} \"2D (theta,phi) grid arrays for points on the sphere\"\n\n\nREAL surface_integrands TYPE=ARRAY DIM=2 SIZE=maxntheta,maxnphi DISTRIB=DEFAULT tags='checkpoint=\"no\"'\n{\n weights,thetaweights, phiweights,\n int_tmp1,int_tmp2,int_tmp3,int_tmp4,int_tmp5,\n int_tmp6,int_tmp7,int_tmp8,int_tmp9,\n int_tmp10,int_tmp11,int_tmp12,int_tmp13,int_tmp14,\n int_tmp15,int_tmp16,int_tmp17,int_tmp18\n} \"weights and temporary integrands\"\n\nREAL Schwarzschild_Mass_Radius_group TYPE=SCALAR tags='checkpoint=\"no\"'\n{\n dtau_dt, sph_grr, sph_gtt, sph_dr_gtt, sph_gpp,\n rsch2, rsch, drsch_dri, dri_drsch, S_factor, \n Schwarzschild_Mass, Schwarzschild_Radius\n} \"Schwarzschild radius, mass and assorted spherical background pieces\"\n\nREAL Schwarzschild_Mass_Radius_Results_group TYPE=ARRAY DIM=1 SIZE=maximum_detector_number DISTRIB=CONSTANT tags='checkpoint=\"no\"'\n{\n Schw_Masses, Schw_Radii\n} \"contains Schwarzschild mass/radius from all detectors\"\n\nREAL MoncriefQ_Results_group TYPE=ARRAY DIM=3 SIZE=maximum_detector_number,l_mode,2*m_mode+1 DISTRIB=CONSTANT tags='checkpoint=\"no\"'\n{\n Qodd_Re_Array,\n Qeven_Re_Array,\n Qodd_Im_Array,\n Qeven_Im_Array\n} \"contains Moncrief Qeven, Qodd wave indicators from all detectors\"\n\nINT l_m_modes_info_group TYPE=SCALAR tags='checkpoint=\"no\"'\n{\n l_min, l_max, l_step,\n m_min, m_max, m_step,\n max_det_no_param\n} \"Information about the modes used for extraction\"\n\n# m_mode goes from index=1 for m=0 and then up to m_max+1\n# FIXME : imaginary part not implemented at the moment\nREAL MoncriefQ TYPE=ARRAY DIM=2 SIZE=l_mode,m_mode+1 DISTRIB=CONSTANT tags='checkpoint=\"no\"'\n{\n Qodd_Re,Qodd_Im,\n Qeven_Re,Qeven_Im\n} \"Moncrief Qeven, Qodd wave indicators, real & imaginary part\"\n\n\n# FIXME : implement this. g00 is needed to calculate dtau_dt\n#REAL g00_group TYPE=GF\n#{\n# g00\n#} \"g00 is needed to calculate proper time. this is not implemented at the moment\"\n\nREAL metric_tmp TYPE=GF tags='tensortypealias=\"DD_sym\" checkpoint=\"no\" prolongation=\"none\"'\n{\n gxx_tmp,gxy_tmp,gxz_tmp,gyy_tmp,gyz_tmp,gzz_tmp\n} \"temp metric for 3d rotation\"\n\n\n# Current Detector Number\nINT current_detector_group TYPE=SCALAR tags='checkpoint=\"no\"'\n{\n current_detector\n} \"the index number of the current detector\"\n\nREAL current_detector_radius_group TYPE=SCALAR tags='checkpoint=\"no\"'\n{\n current_detector_radius\n} \"coordinate radius of the current detector\"\n\nINT my_out_every_det[100] TYPE=SCALAR tags='checkpoint=\"no\"' \"output frequency\"\n\nCCTK_INT FUNCTION \\\n MergerHandler_WeHaveMerger()\nUSES FUNCTION MergerHandler_WeHaveMerger\n\t \n\t \nCCTK_REAL FUNCTION \\\n MergerHandler_MergerTime()\nUSES FUNCTION MergerHandler_MergerTime\n\n", + "params": "", + "schedule": "# Schedule definitions for thorn WaveExtractL\n\n\n# test if this makes a difference\nSTORAGE: MoncriefQ\n\n\n# FIXME : 3D only for 3D corotation undoing\nSTORAGE: metric_tmp\n\nif(active)\n{\n STORAGE: sym_factor_group, handles_group, do_nothing_group\n\n # FIXME : This could be moved where it is needed\n STORAGE: gridsizes_group\n STORAGE: surface_arrays\n STORAGE: surface_integrands\n STORAGE: interp_metric_arrays\n STORAGE: Schwarzschild_Mass_Radius_group\n STORAGE: MoncriefQ_Results_group, Schwarzschild_Mass_Radius_Results_group\n STORAGE: current_detector_group,current_detector_radius_group\n STORAGE: my_out_every_det\n STORAGE: l_m_modes_info_group\n STORAGE: current_detector_group\n STORAGE: current_detector_radius_group\n\n schedule WavExtrL_ParamCheck at PARAMCHECK\n {\n LANG: C\n } \"Check Parameters for WaveExtract\"\n\n schedule WavExtrL_Startup at STARTUP AFTER IOUtil_Startup\n {\n LANG: C\n } \"Register WaveExtract as an IO Method\"\n\n\n\n # Initial Setup\n schedule WavExtrL_Init at BASEGRID after SpatialCoordinates\n {\n LANG: FORTRAN\n } \"Setup weights for integration\"\n\n\n schedule WavExtrL_Setup_Detectors at BASEGRID after SpatialCoordinates\n {\n LANG: FORTRAN\n OPTIONS: LEVEL\n } \"Initial setup of all detectors\"\n\n\n\n # Analysis\n if (use_spherical_surface) {\n schedule WavExtrL_Setup_SphericalSurface at BASEGRID AFTER SphericalSurface_Setup AFTER WavExtrL_ResetCurrDet\n {\n LANG: FORTRAN\n OPTIONS: LOCAL #GLOBAL\n } \"setup detectors from spherical surface\"\n }\n\n schedule WavExtrL_ResetCurrDet at ANALYSIS \\\n before WavExtrL_CalcsAtDetector\n {\n LANG: C\n OPTIONS: GLOBAL\n } \"Reset the value of the current_detector, needed for the while loop next\"\n\n # Create a new group which contains all the calculations done at \n # the detectors. The loop is over the detectors.\n # FIXME : LOTS OF STORAGE SHOULD ONLY BE TURNED ON IN THIS GROUP\n schedule group WavExtrL_CalcsAtDetector \\\n while WaveExtractL::current_detector \\\n at ANALYSIS after WavExtrL_ResetCurrDet\n {\n } \"Calculations done for each detector, we loop over the detectors\"\n\n schedule WavExtrL_SetupSphere in WavExtrL_CalcsAtDetector\n {\n LANG: FORTRAN\n OPTIONS: GLOBAL\n } \"Setup sintheta, sinphi arrays\"\n\n schedule WavExtrL_ProjectSphere in WavExtrL_CalcsAtDetector \\\n after WavExtrL_SetupSphere\n {\n LANG: C #FORTRAN\n OPTIONS: GLOBAL\n } \"Interpolate 3D quantities into 2D grid arrays (on the sphere), project onto sphere\"\n\n schedule WavExtrL_SchwarzMassRad in WavExtrL_CalcsAtDetector \\\n after WavExtrL_ProjectSphere\n {\n LANG: FORTRAN\n OPTIONS: GLOBAL\n } \"Calculate Schwarzschild Radius and Mass and spherical background\"\n\n if (subtract_spherical_background) {\n schedule WavExtrL_SubtrSpherMetric in WavExtrL_CalcsAtDetector \\\n after WavExtrL_SchwarzMassRad\n {\n LANG: FORTRAN\n OPTIONS: GLOBAL\n } \"Substract spherical background part of metric from metric\"\n }\n\n schedule WavExtrL_MoncriefQ in WavExtrL_CalcsAtDetector \\\n after WavExtrL_SubtrSpherMetric\n {\n LANG: FORTRAN\n OPTIONS: GLOBAL\n } \"Compute Moncrief Qeven, Qodd from Regge Wheeler quantities\"\n\n if (maximum_detector_number < switch_output_format)\n {\n schedule WavExtrL_WriteData in WavExtrL_CalcsAtDetector \\\n after WavExtrL_MoncriefQ\n {\n LANG: C\n OPTIONS: GLOBAL\n } \"Write out results to disk and stdout - one file for each detector and (l,m) mode\"\n schedule WavExtrL_AdjustDetector in WavExtrL_CalcsAtDetector \\\n after WavExtrL_WriteData\n {\n LANG: C\n OPTIONS: GLOBAL\n } \"Decrease current_detector, go the the next detector\"\n }\n else\n {\n schedule WavExtrL_AdjustDetector in WavExtrL_CalcsAtDetector \\\n after WavExtrL_MoncriefQ\n {\n LANG: C\n OPTIONS: GLOBAL\n } \"Decrease current_detector, go the the next detector\"\n }\n\n schedule WavExtrL_TimerInfo in WavExtrL_CalcsAtDetector \\\n after WavExtrL_AdjustDetector\n {\n LANG: C\n OPTIONS: GLOBAL\n } \"Output Timer Info if requested\"\n\n\n if (maximum_detector_number >= switch_output_format)\n {\n schedule WavExtrL_WriteLotsOfData after WavExtrL_CalcsAtDetector \\\n at ANALYSIS\n {\n LANG: C\n OPTIONS: GLOBAL\n } \"Output one file per (l,m) mode, all detectors in one file\"\n }\n}\n", + "src": { + "AdjustDetector.c": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see . */\n\n /*@@\n @file AdjustDetector.c\n @date Mon Nov 25 13:01:43 2002\n @author Frank Herrmann\n @desc \n Adjust next detector, increase the variable current_detector\n @enddesc \n @version $Id: AdjustDetector.c 6 2004-06-30 18:08:24Z herrmann $\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\nvoid WavExtrL_AdjustDetector(CCTK_ARGUMENTS);\n\n /*@@\n @routine WavExtrL_AdjustDetector\n @date Mon Nov 25 13:02:44 2002\n @author Frank Herrmann\n @desc \n Adjust next detector. This function decreases the variable \n current_detector by one.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\nvoid WavExtrL_AdjustDetector(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n\n if (verbose>4)\n CCTK_INFO(\"Adjust next detector\");\n\n if (*do_nothing == 1)\n *do_nothing = 0;\n\n if (*current_detector != 0) \n *current_detector=*current_detector-1;\n\n if (*current_detector < 0)\n *current_detector=0;\n\n if (verbose >2)\n CCTK_VInfo(CCTK_THORNSTRING,\"Done with detector %d, next will go to Detector No. %d\",(int)*current_detector +1,(int)*current_detector);\n}\n", + "SchwarzschildMassRadius.F90": "!/*@@\n! @file Schwarzschild_Mass_Radius.F\n! @date unknown\n! @author unknown\n! @desc\n! Computes Schwarzschild Mass quantity and radius\n! @enddesc\n!@@*/\n\n\n\n#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Functions.h\"\n\n\n!/*@@\n! @routine WavExtrL_Schw_Mass_Rad\n! @date unknown\n! @author unknown\n! @desc\n! Computes Schwarzschild Mass quantity and radius\n! @enddesc\n! @calls spher_harm_combs\n! @@*/\n subroutine WavExtrL_SchwarzMassRad(CCTK_ARGUMENTS)\n\n use WavExtrLConstants\n\n\n implicit none\n\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n DECLARE_CCTK_FUNCTIONS\n\n\n CCTK_REAL :: dtp,dtheta,dphi\n\n integer :: ierr, sumhandle, istat\n\n integer :: num_out_vals, num_in_fields, minus_one\n CCTK_REAL,dimension(6) :: out_vals, local_reduced_vals\n\n character(len=200) :: infoline\n\n! _________________________________________________________________\n\n if (verbose>2) &\n call CCTK_INFO(\"Calculate Schwarzschild Mass and Radius\")\n\n if (do_nothing == 1) &\n return\n\n if (cctk_iteration .ne. 0) then\n if (mod(cctk_iteration,my_out_every_det(current_detector)).ne.0) then\n if (verbose>2) call CCTK_INFO(\"No time for this detector\")\n return\n end if\n end if\n\n if (calc_when_necessary .eq. 1) then\n if (cctk_time .lt. current_detector_radius-50) then\n if (verbose>2) call CCTK_INFO(\"No time for this detector\")\n return\n endif\n call CCTK_IsFunctionAliased(istat, \"MergerHandler_WeHaveMerger\")\n if (istat .eq. 1) then\n if (MergerHandler_WeHaveMerger() .eq. 1) then\n if (cctk_time .gt. MergerHandler_MergerTime()+current_detector_radius+ringdown_margin) then\n if (verbose>2) call CCTK_INFO(\"No time for this detector\")\n return\n endif\n endif\n endiF\n end if\n\n ! Get sum reduction operator handle\n call CCTK_ReductionArrayHandle ( sum_handle, 'sum' )\n if ( sum_handle .lt. 0 ) then\n call CCTK_WARN(0,'Could not obtain a handle for sum reduction')\n end if\n\n\n if (size(ctheta,1)<2) call CCTK_WARN (0, \"internal error\")\n if (size(cphi,2)<2) call CCTK_WARN (0, \"internal error\")\n dtheta = ctheta(2,1) - ctheta(1,1)\n dphi = cphi(1,2) - cphi(1,1)\n\n if (cartoon .ne. 0) then\n dphi=two*pi\n end if\n\n dtp= dtheta*dphi\n !print*,'dtheta,dphi,dtp',dtheta,dphi,dtp\n\n call CCTK_TimerStart(ierr,\"Schwarzschild\")\n\n ! spherical parts of the metric\n ! note we compute gpp/sin^2(theta)\n int_tmp1 = sym_factor*weights*sintheta *dtp* grr\n int_tmp2 = sym_factor*weights*sintheta *dtp* gtt\n int_tmp3 = sym_factor*weights*sintheta *dtp* dr_gtt\n int_tmp4 = sym_factor*weights*one/sintheta*dtp* gpp\n\n\n ! Different ways to compute the radius of extraction.\n ! \"aerial radius\" is coordinate invariant and probably the \"best\"\n ! CactusEinstein/Extract uses \"average Schwarzschild metric\"\n\n ! we divide by sintheta and flag points which are in the range ntheta-maxntheta with\n ! zero\n where (sintheta .lt. 1.d-14)\n sintheta = one\n end where\n if (CCTK_EQUALS(rsch2_computation,\"aerial radius\")) then\n int_tmp5 = sym_factor*weights*dtp* sqrt(gtt*gpp -gtp**2)\n else if(CCTK_EQUALS(rsch2_computation,\"average Schwarzschild metric\")) then\n int_tmp5 = sym_factor*weights*sintheta*dtp* half*(gtt+gpp/sintheta**2)\n else if(CCTK_EQUALS(rsch2_computation,\"Schwarzschild gtt\")) then\n int_tmp5 = sym_factor*weights*dtp* gtt\n else if(CCTK_EQUALS(rsch2_computation,\"Schwarzschild gpp\")) then\n int_tmp5 = sym_factor*weights*dtp* gpp/sintheta**2\n end if\n\n ! FIXME : NO sintheta ??? check formula\n\n ! Compute the derivative of the schwarzschild radius\n ! with respect to the isotropic radius eta.\n ! It would be enough to just use dr_gtt. By adding in\n ! dr_gpp, the results become a bit better, but it still \n ! assumes Schwarzschild coordinates.\n if (CCTK_EQUALS(drsch_dri_computation,\"average dr_gtt dr_gpp\")) then\n int_tmp6 = sym_factor*weights*sintheta*dtp* (dr_gtt+dr_gpp/sintheta**2)*half\n else if (CCTK_EQUALS(drsch_dri_computation,\"dr_gtt\")) then\n int_tmp6 = sym_factor*weights*sintheta*dtp* dr_gtt\n else if (CCTK_EQUALS(drsch_dri_computation,\"dr_gpp\")) then\n int_tmp6 = sym_factor*weights*sintheta*dtp* dr_gpp/sintheta**2\n end if\n\n num_out_vals =1\n num_in_fields=6\n sumhandle = sum_handle ! i.e., convert from CCTK_INT to integer\n minus_one = -1\n\n local_reduced_vals(1) = sum(int_tmp1,weights.gt.1.0e-15)\n local_reduced_vals(2) = sum(int_tmp2,weights.gt.1.0e-15)\n local_reduced_vals(3) = sum(int_tmp3,weights.gt.1.0e-15)\n local_reduced_vals(4) = sum(int_tmp4,weights.gt.1.0e-15)\n local_reduced_vals(5) = sum(int_tmp5,weights.gt.1.0e-15)\n local_reduced_vals(6) = sum(int_tmp6,weights.gt.1.0e-15)\n\n\n call CCTK_ReduceLocArrayToArray1D(ierr, cctkGH, minus_one,&\n sumhandle, local_reduced_vals,&\n out_vals, num_in_fields, CCTK_VARIABLE_REAL)\n\n if (ierr.ne.0) then\n call CCTK_WARN(1,\"the reduction calculation of the Schwarzschild mass/radius/related failed\")\n end if\n call CCTK_TimerStop(ierr,\"Schwarzschild\")\n\n sph_grr =out_vals(1)\n sph_gtt =out_vals(2)\n sph_dr_gtt =out_vals(3)\n sph_gpp =out_vals(4)\n rsch2 =out_vals(5)\n drsch_dri =out_vals(6)\n\n ! Normalizations\n ! FIXME DTAU_DT ADD THIS FUNCTIONALITY\n ! dtau_dt = sqrt(one/(four*Pi)*dtau_dt)\n sph_grr = sph_grr/(four*Pi)\n sph_gtt = sph_gtt/(four*Pi)\n sph_dr_gtt = sph_dr_gtt/(four*Pi)\n sph_gpp = sph_gpp/(four*Pi)\n rsch2 = rsch2/(four*Pi)\n\n! try rsch2/=rsch2\n! check for nan in computation of rsch2\n ierr=0\n call NaNChecker_CheckVarsForNaN(ierr, cctkGH, 1, \"waveextractl::rsch2\", &\n \"both\",\"just warn\")\n if (ierr /= 0) then\n call CCTK_WARN(1,\"NaN in rsch2 - stopping all further computations\")\n ! print*,'FIXME ',rsch2,ISNAN(rsch2)\n do_nothing=1\n return\n end if\n\n if (rsch2.lt.1.d-10) then\n call CCTK_WARN(1,\"rsch2 < 10^-10 - stopping all further computations\")\n ! print*,'FIXME rsch2',rsch2\n do_nothing=1\n return\n end if\n\n ! Schwarzschild radius\n rsch = sqrt( rsch2 )\n Schwarzschild_radius = rsch\n Schw_Radii(current_detector) = rsch\n\n ! dr_schwarzschild/dr_isotropic\n drsch_dri = one/(eight*Pi*rsch)*drsch_dri\n dri_drsch = one/drsch_dri\n\n ! Calculate the Schwarzschild mass parameter and S factor\n S_factor = drsch_dri**2/sph_grr\n Schwarzschild_Mass = rsch*(one-S_factor)/two\n Schw_Masses(current_detector) = Schwarzschild_Mass\n\n if (verbose > 3) then\n write(infoline,'(A25,G20.8)') ' rsch2 = ', rsch2\n call CCTK_INFO(infoline)\n write(infoline,'(A25,G20.8)') ' dtau_dt = ',dtau_dt\n call CCTK_INFO(infoline)\n write(infoline,'(A25,G20.8)') ' sph_grr = ',sph_grr\n call CCTK_INFO(infoline)\n write(infoline,'(A25,G20.8)') ' sph_gtt = ',sph_gtt\n call CCTK_INFO(infoline)\n write(infoline,'(A25,G20.8)') ' sph_dr_gtt = ',sph_dr_gtt\n call CCTK_INFO(infoline)\n write(infoline,'(A25,G20.8)') ' sph_gpp = ',sph_gpp\n call CCTK_INFO(infoline)\n write(infoline,'(A25,G20.8)') ' drsch_dri = ',drsch_dri\n call CCTK_INFO(infoline)\n write(infoline,'(A25,G20.8)') ' S_factor = ',S_factor\n call CCTK_INFO(infoline)\n write(infoline,'(A25,G20.8)') ' Schwarzschild_radius = ', &\n Schwarzschild_radius\n call CCTK_INFO(infoline)\n write(infoline,'(A25,G20.8)') ' Schwarzschild_mass = ', &\n Schwarzschild_Mass\n call CCTK_INFO(infoline)\n end if\n\nend subroutine WavExtrL_SchwarzMassRad\n", + "Init.F90": "! Init.F90\n!\n! Initialization of the integral weights\n\n#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Functions.h\"\n\n\n! This routine sets up the weights for the Simpson rule integration\n! over the surface.\n! taken from Peters EHFinder\nsubroutine WavExtrL_Init(CCTK_ARGUMENTS)\n\n use WavExtrLConstants\n\n implicit none\n\n DECLARE_CCTK_PARAMETERS\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_FUNCTIONS\n\n CCTK_INT :: i, j\n CCTK_INT :: ierr\n\n CCTK_INT, dimension(2) :: lsh, lbnd\n\n !________________________________________________________________________\n\n ! Find out the lower bounds of the distributed integration grid arrays.\n call CCTK_GrouplbndGN(ierr, cctkGH,2,lbnd,\"WaveExtractL::surface_integrands\")\n if ( ierr .lt. 0 ) then\n call CCTK_WARN(0, \"cannot get lower bounds for surface integrands\")\n end if\n\n ! Find out the local size of the distributed integration grid arrays\n call CCTK_GrouplshGN(ierr, cctkGH, 2, lsh, \"WaveExtractL::surface_integrands\")\n if ( ierr .lt. 0 ) then\n call CCTK_WARN (0, \"cannot get local size for surface integrands\")\n end if\n\n ! set output iterations\n if (out_every>0) then\n my_out_every_det=out_every\n else\n my_out_every_det=out_every_det\n end if\n\n if (verbose > 4) then\n print*,'out_every_det',my_out_every_det\n end if\n\n\n ! initialize\n do_nothing = 0\n gxx_tmp = zero\n gxy_tmp = zero\n gxz_tmp = zero\n gyy_tmp = zero\n gyz_tmp = zero\n gzz_tmp = zero\n\n ! set ntheta and nphi for detectors which are not explicitely given in par-file\n do i=1,maximum_detector_number\n if (ntheta(i).eq.0 .and. use_spherical_surface .eq. 0) then\n int_ntheta(i)=maxntheta\n end if\n if (nphi(i).eq.0 .and. use_spherical_surface .eq. 0) then\n int_nphi(i)=maxnphi\n end if\n end do\n\n\n ! store the maximum number of detectors.\n ! some arrays use this information and the original parameter gets\n ! overwritten/readjusted\n max_det_no_param=maximum_detector_number\n\n if (CCTK_EQUALS(integration_method,\"extended midpoint rule\")) then\n ! we have to stagger the points, hence we can use the extended midpoint\n ! rule which just assigns a weight of 1 to each point. see Numerical\n ! Recipes p. 135 for details.\n ! Note that this method is only accurate up to O(1/N^2). usually that\n ! is good enough.\n weights = one\n phiweights = one\n thetaweights = one\n else if (CCTK_EQUALS(integration_method,\"open extended\")) then\n call CCTK_WARN(1,\"VERY BAD CHOICE 'open extended'. this code is broken\")\n ! we stagger the origin, so we need an open end formula.\n ! but we have the points at half values.\n ! FIXME: check the weights - these are not correct.\n ! FIXME: it won't work for maxntheta!=ntheta !!\n ! FIXME: BUGBUG: This code is broken, but extended midpoint is accurate enough.\n ! Initialise the weight grid array for the 2D Simpsons rule integration.\n ! To do this I need to figure out the global location of the given point.\n ! There are 3 cases in the one dimensional case. If the point is on the\n ! boundary the weight is 1/3. If it is at an even position the weight\n ! is 4/3 and if it is at an odd position the weight is 2/3. \n\n weights = one\n do j = 1, lsh(2)\n\n ! This is first done in the phi direction. Meaning that all points with\n ! the same theta coordinate are set to the same weight.\n if ( ( lbnd(2)+j .eq. 1 ) .or. ( lbnd(2)+j .eq. maxnphi ) ) then\n weights(:,j) = onethird\n phiweights(:,j) = onethird\n else if ( mod(lbnd(2)+j,2) .eq. 0 ) then\n weights(:,j) = fourthirds\n phiweights(:,j) = fourthirds\n else\n weights(:,j) = twothirds\n phiweights(:,j) = twothirds\n end if\n\n ! Then it is done in the theta direction with the one-dimensional\n ! weights beeing multiplied.\n do i = 1, lsh(1)\n if ( ( lbnd(1)+i .eq. 1 ) .or. ( lbnd(1)+i .eq. maxntheta ) ) then\n weights(i,j) = onethird * weights(i,j)\n thetaweights(i,j) = onethird\n else if ( mod(lbnd(1)+i,2) .eq. 0 ) then\n weights(i,j) = fourthirds * weights(i,j)\n thetaweights(i,j) = fourthirds\n else\n weights(i,j) = twothirds * weights(i,j)\n thetaweights(i,j) = twothirds\n end if\n end do\n end do\n\n ! FIXME: DESCRIPTION is not accurate for open end formula, taken directly from Peters EHFinder.\n ! The end result is a 2D array with the weights in the following pattern.\n ! ie 2D Simpson _ WARN : \n ! 1/9 4/9 2/9 4/9 2/9 4/9 1/9\n ! 4/9 16/9 8/9 16/9 8/9 16/9 4/9\n ! 2/9 8/9 4/9 8/9 4/9 8/9 2/9\n ! 4/9 16/9 8/9 16/9 8/9 16/9 4/9\n ! 2/9 8/9 4/9 8/9 4/9 8/9 2/9\n ! 4/9 16/9 8/9 16/9 8/9 16/9 4/9\n ! 1/9 4/9 2/9 4/9 2/9 4/9 1/9\n\n end if\n\n ! setup the sym_factor to account for symmetries in the integrals. \n ! the integrals are multiplied by this.\n ! default is full mode\n sym_factor=one\n if (cartoon .ne. 0) then\n if (CCTK_EQUALS(domain,\"bitant\")) then\n sym_factor=four\n else if (CCTK_EQUALS(domain,\"full\")) then\n sym_factor=two\n end if\n else if (CCTK_EQUALS(domain,\"bitant\")) then\n sym_factor=two\n else if (CCTK_EQUALS(domain,\"quadrant\")) then\n sym_factor=four\n else if (CCTK_EQUALS(domain,\"octant\")) then\n sym_factor=eight\n else if (CCTK_EQUALS(domain,\"quadrant\")) then\n sym_factor=four\n end if\n\n ! Get sum reduction operator handle\n call CCTK_ReductionArrayHandle ( sum_handle, 'sum' )\n if ( sum_handle .lt. 0 ) then\n call CCTK_WARN(0,'Could not obtain a handle for sum reduction')\n end if\n\n\nend subroutine WavExtrL_Init\n", + "make.code.defn": "# Main make.code.defn file for thorn WaveExtractL\n \nSRCS = AdjustDetector.c \\\n IO.c \\\n SteerableTimeForOutput.c \\\n ParamCheck.c \\\n ResetCurrDet.c \\\n WavExtrLConstants.F90 \\\n Init.F90 \\\n MoncriefQ.F90 \\\n ProjectSphere.cc \\\n SchwarzschildMassRadius.F90 \\\n SetupDetectors.F90 \\\n SetupSphere.F90 \\\n SubtractSphericalMetric.F90 \\\n SphericalSurface.F90\n", + "SteerableTimeForOutput.c": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see . */\n\n/*@@\n @file Output.c\n @date April 11th 2002\n @author Frank Herrmann\n @desc\n Check if it is the right time for WaveExtract.\n \n @enddesc\n@@*/\n\n#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"extractGH.h\"\n\n\nstatic int WaveExtract_ncall=0; /* number of calls to WaveExtract */\n\nvoid WavExtrL_CheckSteerableParameters(extractGH *myGH);\n\n\n/* prototype */\nint WavExtrL_TimeForOutput(const cGH *GH, int vindex);\n\n/*@@\n @routine WavExtrL_TimeForOutput\n @date April 11th 2002\n @author Frank Herrmann\n @desc\n Check if it is time for output\n @enddesc\n @calls CheckSteerableParameters\n\n @var GH\n @vdesc Pointer to CCTK GH\n @vtype const cGH *\n @vio in\n @endvar\n @var vindex\n @vdesc index of variable to check for output\n @vtype int\n @vio in\n @endvar\n\n @returntype int\n @returndesc\n true/false (1 or 0) if analysis should be called\n @endreturndesc\n@@*/\nint WavExtrL_TimeForOutput(const cGH *GH, int vindex)\n{\n extractGH *myGH;\n int retval=1; /* by default we do analysis, next we check when not */\n int WaveExtract_after; /* after which iteration we start analysis */\n\n DECLARE_CCTK_PARAMETERS\n\n\n /* FIXME : There is a lot of crap in this file and in IO.c as well */\n\n\n if (verbose > 6)\n CCTK_INFO(\"Triggering\");\n\n /* FIXME : STEERABLE PARAMETERS */\n /* get myGH extract GH */\n myGH=(extractGH *) CCTK_GHExtension (GH, \"WaveExtractL\");\n WavExtrL_CheckSteerableParameters (myGH);\n\n /* check we should do output at all */\n if(out_every == 0) { \n if (verbose > 5)\n CCTK_INFO(\"You set out_every=0\");\n retval=0;\n }\n else\n {\n /* check we have the right variable */\n if (vindex==CCTK_VarIndex(\"WaveExtractL::triggervar\"))\n {\n if (verbose > 1 )\n CCTK_INFO(\"Starting WaveExtract\");\n\n /* sanity checks */\n if(start_iteration <0 && start_time <0)\n {\n CCTK_WARN(1,\n \"you need to specify start_time or start_iteration\");\n retval=0;\n return retval;\n }\n\n if(start_iteration >= 0 && start_time >= 0)\n {\n CCTK_WARN(1,\n \"specify only one of start_time or start_iteration\");\n retval=0;\n return retval;\n }\n\n /* have we reached the start iteration? */\n if (start_iteration >= 0) \n {\n WaveExtract_after=start_iteration;\n if (GH->cctk_iteration = 0)\n {\n if (GH->cctk_time cctk_iteration;\n }\n \n /* are we at the right iteration? */ \n if ( (GH->cctk_iteration-WaveExtract_after) %out_every) \n retval=0;\n\n if (retval==1) \n {\n WaveExtract_ncall=0; /* store analysis in extract_ncall */\n /*myGH->last_time = myGH->this_time;\n myGH->this_time = GH->cctk_time; */\n }\n }\n /* not the right variable */\n else\n {\n if (verbose > 9 && retval !=0 )\n CCTK_INFO(\"triggered with the wrong variable\");\n retval = 0;\n }\n }\n\n return retval;\n}\n\n", + "MoncriefQ.F90": "!/*@@\n! @file MoncriefQ.F90\n! @date unknown\n! @author unknown\n! @desc\n! Compute Regge Wheeler quantities and from them the Moncrief\n! Qeven, Qodd functions.\n! @enddesc\n! @@*/\n\n\n#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Functions.h\"\n\n!/*@@\n! @routine WavExtrL_MoncriefQ\n! @date unknown\n! @author unknown\n! @desc\n! Compute Regge Wheeler quantities and from them the Moncrief\n! Qeven, Qodd functions.\n! @enddesc\n!@@*/\nsubroutine WavExtrL_MoncriefQ(CCTK_ARGUMENTS)\n\n use WavExtrLConstants\n\n implicit none\n\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n DECLARE_CCTK_FUNCTIONS\n\n CCTK_INT :: i, j, il, im\n CCTK_INT :: status, istat\n integer :: ierr, sumhandle\n CCTK_REAL :: st, ist\n CCTK_INT,dimension(2) :: lsh\n\n CCTK_REAL :: fac_h1, fac_H2, fac_G, fac_K, &\n fac_c1, fac_c2, fac_dG, fac_dK, fac_dc2\n\n CCTK_REAL :: gttcomb, gtpcomb, gppcomb\n\n CCTK_REAL :: Lambda\n\n CCTK_REAL,dimension(2) :: Ylm,Y1,Y2,Y3,Y4, &\n h1,H2,K,G,c1,c2,dG,dK,dc2, &\n ih1,iH2,iK,iG,ic1,ic2,idG,idK,idc2\n\n CCTK_REAL :: dtheta, dphi, dtp\n\n integer :: num_out_vals, num_in_fields, minus_one\n CCTK_REAL,dimension(18) :: out_vals, local_reduced_vals(18)\n\n CCTK_REAL :: lapse,cor_angle\n CCTK_INT :: marr\n\n\n character(len=80) :: infoline\n\n! _________________________________________________________________\n\n if (verbose>4) &\n call CCTK_INFO(\"Compute Regge Wheeler quantities and from them Qeven, Qodd\")\n\n if (do_nothing == 1) &\n return\n\n if (cctk_iteration .ne. 0) then\n if (mod(cctk_iteration,my_out_every_det(current_detector)).ne.0) then\n if (verbose>2) call CCTK_INFO(\"No time for this detector\")\n return\n end if\n end if\n\n if (calc_when_necessary .eq. 1) then\n if (cctk_time .lt. current_detector_radius-50) then\n if (verbose>2) call CCTK_INFO(\"No time for this detector\")\n return\n endif\n call CCTK_IsFunctionAliased(istat, \"MergerHandler_WeHaveMerger\")\n if (istat .eq. 1) then\n if (MergerHandler_WeHaveMerger() .eq. 1) then\n if (cctk_time .gt. MergerHandler_MergerTime()+current_detector_radius+ringdown_margin) then\n if (verbose>2) call CCTK_INFO(\"No time for this detector\")\n return\n endif\n endif\n endif\n end if\n\n ! local shape of grid arrays on sphere\n call CCTK_GrouplshGN(status, cctkGH, 2, lsh, \"WaveExtractL::surface_arrays\")\n if ( status .lt. 0 ) then\n call CCTK_WARN ( 0, \"cannot get local size for surface arrays\" )\n end if\n\n dtheta = ctheta(2,1) - ctheta(1,1)\n dphi = cphi(1,2) - cphi(1,1)\n\n if (cartoon .ne. 0) then\n dphi = two*pi\n end if\n\n dtp= dtheta*dphi\n\n ! l-mode setup\n if (CCTK_EQUALS(mode_type,\"specific mode\")) then\n l_min = l_mode ; l_max = l_mode\n else if (CCTK_EQUALS(mode_type,\"all modes\")) then\n l_min = 2 ; l_max = l_mode\n end if\n\n\n if (cartoon .ne. 0) then\n l_step =2\n m_step =2\n else if (CCTK_EQUALS(domain,\"full\")) then\n l_step =1\n m_step =1\n else if (CCTK_EQUALS(domain,\"octant\")) then\n l_step =2\n m_step =2\n ! FIXME : look at symmetries\n else if (CCTK_EQUALS(domain,\"quadrant\")) then\n l_step =1\n m_step =1\n ! FIXME : REALLY ALL MODES?? Does the bitant symmetry kill some, ie odd modes ???\n else if (CCTK_EQUALS(domain,\"bitant\")) then\n l_step =1\n m_step =1\n end if\n\n if (verbose > 3) then\n write(infoline,'(A29,I2,I2,I2)') 'mode setup: l [min,max,step]:',l_min,l_max,l_step\n call CCTK_INFO(infoline)\n end if\n\n ! Loop over l-modes\n loop_l: do il = l_min,l_max,l_step\n\n ! m-mode setup (depends on l_mode, ie m_mode <= l_mode)\n if (CCTK_EQUALS(mode_type,\"specific mode\")) then\n m_min = -m_mode ; m_max = m_mode\n else if(CCTK_EQUALS(mode_type,\"all modes\")) then\n m_min = 0 ; m_max = m_mode\n if (m_mode>il) then\n m_max=il\n end if\n end if\n\n ! Factors independent of angular coordinates and of m-mode, but not l_mode\n fac_h1 = dri_drsch/dble(il*(il+1))\n fac_H2 = S_factor*dri_drsch**2\n fac_G = one/(rsch**2*dble(il*(il+1)*(il-1)*(il+2)))\n fac_K = half/rsch**2\n fac_c1 = dri_drsch/dble(il*(il+1))\n fac_c2 = two/dble(il*(il+1)*(il-1)*(il+2))\n fac_dG = fac_G\n fac_dK = fac_K\n fac_dc2 = fac_c2\n\n call CCTK_TimerStart(ierr,\"MoncriefQ\")\n\n if (verbose > 3) then\n write(infoline,'(A29,I2,I2,I2)') ' m [min,max,step]:',m_min,m_max,m_step\n call CCTK_INFO(infoline)\n end if\n\n ! Get sum reduction operator handle\n call CCTK_ReductionArrayHandle ( sum_handle, 'sum' )\n if ( sum_handle .lt. 0 ) then\n call CCTK_WARN(0,'Could not obtain a handle for sum reduction')\n end if\n\n ! Loop over m-modes\n loop_m: do im = m_min,m_max,m_step\n ! Real parts of the Regge-Wheeler variables\n loop_phi1: do j = 1, lsh(2)\n loop_theta1: do i = 1, lsh(1)\n\n st = sintheta(i,j)\n ist = one/st\n\n call WavExtrL_spher_harm_combs(ctheta(i,j),cphi(i,j),il,im,Ylm,Y1,Y2,Y3,Y4)\n\n h1i(i,j) = st*grt(i,j)*Y1(1)+ist*grp(i,j)*Y2(1)\n H2i(i,j) = st*grr(i,j)*Ylm(1)\n Gi(i,j) = (st*gtt(i,j)-ist*gpp(i,j))*Y3(1) &\n +four*ist*gtp(i,j)*Y4(1)\n Ki(i,j) = (st*gtt(i,j)+ist*gpp(i,j))*Ylm(1)\n c1i(i,j) = grp(i,j)*Y1(1)-grt(i,j)*Y2(1)\n c2i(i,j) = (gtt(i,j)-ist**2*gpp(i,j))*Y4(1) &\n -gtp(i,j)*Y3(1)\n\n gttcomb = dri_drsch*dr_gtt(i,j)-two/rsch*gtt(i,j)\n gtpcomb = dri_drsch*dr_gtp(i,j)-two/rsch*gtp(i,j)\n gppcomb = dri_drsch*dr_gpp(i,j)-two/rsch*gpp(i,j)\n\n dGi(i,j) = (st*gttcomb-ist*gppcomb)*Y3(1) &\n +four*ist*gtpcomb*Y4(1)\n dKi(i,j) = (st*gttcomb+ist*gppcomb)*Ylm(1)\n dc2i(i,j) = (dr_gtt(i,j)-ist**2*dr_gpp(i,j))*Y4(1) &\n -dr_gtp(i,j)*Y3(1)\n\n ! for m!=0 case we have imaginary part as well from the Ylm's\n if (im.ne.0) then\n ! switch signs - stupid convention\n Ylm(2)=-Ylm(2)\n Y1(2)=-Y1(2)\n Y2(2)=-Y2(2)\n Y3(2)=-Y3(2)\n Y4(2)=-Y4(2)\n ih1i(i,j) = st*grt(i,j)*Y1(2)+ist*grp(i,j)*Y2(2)\n iH2i(i,j) = st*grr(i,j)*Ylm(2)\n iGi(i,j) = (st*gtt(i,j)-ist*gpp(i,j))*Y3(2) &\n +four*ist*gtp(i,j)*Y4(2)\n iKi(i,j) = (st*gtt(i,j)+ist*gpp(i,j))*Ylm(2)\n ic1i(i,j) = grp(i,j)*Y1(2)-grt(i,j)*Y2(2)\n ic2i(i,j) = (gtt(i,j)-ist**2*gpp(i,j))*Y4(2) &\n -gtp(i,j)*Y3(2)\n\n idGi(i,j) = (st*gttcomb-ist*gppcomb)*Y3(2) &\n +four*ist*gtpcomb*Y4(2)\n idKi(i,j) = (st*gttcomb+ist*gppcomb)*Ylm(2)\n idc2i(i,j) = (dr_gtt(i,j)-ist**2*dr_gpp(i,j))*Y4(2) &\n -dr_gtp(i,j)*Y3(2)\n end if\n end do loop_theta1\n end do loop_phi1\n\n ! Integrations over the 2-sphere\n ! Note the abscence of sintheta which is already included\n ! in the above expressions\n int_tmp1=sym_factor*weights*dtp* h1i\n int_tmp2=sym_factor*weights*dtp* H2i\n int_tmp3=sym_factor*weights*dtp* Gi\n int_tmp4=sym_factor*weights*dtp* Ki\n int_tmp5=sym_factor*weights*dtp* c1i\n int_tmp6=sym_factor*weights*dtp* c2i\n int_tmp7=sym_factor*weights*dtp* dGi\n int_tmp8=sym_factor*weights*dtp* dKi\n int_tmp9=sym_factor*weights*dtp* dc2i\n\n local_reduced_vals(1) = sum(int_tmp1,weights.gt.1.0e-15)\n local_reduced_vals(2) = sum(int_tmp2,weights.gt.1.0e-15)\n local_reduced_vals(3) = sum(int_tmp3,weights.gt.1.0e-15)\n local_reduced_vals(4) = sum(int_tmp4,weights.gt.1.0e-15)\n local_reduced_vals(5) = sum(int_tmp5,weights.gt.1.0e-15)\n local_reduced_vals(6) = sum(int_tmp6,weights.gt.1.0e-15)\n local_reduced_vals(7) = sum(int_tmp7,weights.gt.1.0e-15)\n local_reduced_vals(8) = sum(int_tmp8,weights.gt.1.0e-15)\n local_reduced_vals(9) = sum(int_tmp9,weights.gt.1.0e-15)\n\n num_out_vals=1\n minus_one = -1\n sumhandle = sum_handle ! i.e., convert from CCTK_INT to integer\n\n if (im.eq.0) then\n num_in_fields=9\n\n else\n num_in_fields=18\n\n int_tmp10=sym_factor*weights*dtp* ih1i\n int_tmp11=sym_factor*weights*dtp* iH2i\n int_tmp12=sym_factor*weights*dtp* iGi\n int_tmp13=sym_factor*weights*dtp* iKi\n int_tmp14=sym_factor*weights*dtp* ic1i\n int_tmp15=sym_factor*weights*dtp* ic2i\n int_tmp16=sym_factor*weights*dtp* idGi\n int_tmp17=sym_factor*weights*dtp* idKi\n int_tmp18=sym_factor*weights*dtp* idc2i\n\n local_reduced_vals(10) = sum(int_tmp10,weights.gt.1.0e-15)\n local_reduced_vals(11) = sum(int_tmp11,weights.gt.1.0e-15)\n local_reduced_vals(12) = sum(int_tmp12,weights.gt.1.0e-15)\n local_reduced_vals(13) = sum(int_tmp13,weights.gt.1.0e-15)\n local_reduced_vals(14) = sum(int_tmp14,weights.gt.1.0e-15)\n local_reduced_vals(15) = sum(int_tmp15,weights.gt.1.0e-15)\n local_reduced_vals(16) = sum(int_tmp16,weights.gt.1.0e-15)\n local_reduced_vals(17) = sum(int_tmp17,weights.gt.1.0e-15)\n local_reduced_vals(18) = sum(int_tmp18,weights.gt.1.0e-15)\n\n end if\n\n call CCTK_ReduceLocArrayToArray1D(ierr, cctkGH, minus_one,&\n sumhandle, local_reduced_vals(1:num_in_fields),&\n out_vals(1:num_in_fields), num_in_fields,&\n CCTK_VARIABLE_REAL)\n\n if (ierr.ne.0) then\n call CCTK_WARN(1,\"The reduction of the MoncriefQ integrands failed!\")\n end if\n\n h1(1) = out_vals(1)\n H2(1) = out_vals(2)\n G(1) = out_vals(3)\n K(1) = out_vals(4)\n c1(1) = out_vals(5)\n c2(1) = out_vals(6)\n dG(1) = out_vals(7)\n dK(1) = out_vals(8)\n dc2(1) = out_vals(9)\n\n h1(1) = fac_h1 * h1(1)\n H2(1) = fac_h2 * H2(1)\n G(1) = fac_G * G(1)\n K(1) = fac_K * K(1) +dble(il*(il+1))*half*G(1)\n c1(1) = fac_c1 * c1(1)\n c2(1) = fac_c2 * c2(1)\n dG(1) = fac_dG * dG(1)\n dK(1) = fac_dK * dK(1) +dble(il*(il+1))*half*dG(1)\n dc2(1) = fac_dc2* dc2(1)\n\n\n if (verbose >4) then\n print*,'Real Quantities'\n print*,'h1',h1(1)\n print*,'H2',H2(1)\n print*,'G',G(1)\n print*,'K',K(1)\n print*,'c1',c1(1)\n print*,'c2',c2(1)\n print*,'dG',dG(1)\n print*,'dK',dK(1)\n print*,'dc2',dc2(1)\n end if\n\n\n\n if (im.ne.0) then\n h1(2) = out_vals(10)\n H2(2) = out_vals(11)\n G(2) = out_vals(12)\n K(2) = out_vals(13)\n c1(2) = out_vals(14)\n c2(2) = out_vals(15)\n dG(2) = out_vals(16)\n dK(2) = out_vals(17)\n dc2(2) = out_vals(18)\n\n h1(2) = fac_h1 * h1(2)\n H2(2) = fac_h2 * H2(2)\n G(2) = fac_G * G(2)\n K(2) = fac_K * K(2) +dble(il*(il+1))*half*G(2)\n c1(2) = fac_c1 * c1(2)\n c2(2) = fac_c2 * c2(2)\n dG(2) = fac_dG * dG(2)\n dK(2) = fac_dK * dK(2) +dble(il*(il+1))*half*dG(2)\n dc2(2) = fac_dc2* dc2(2)\n end if\n\n ! Moncrief Q\n Lambda = dble((il-1)*(il+2))+three*(one-S_factor)\n\n ! m index into array : fortran: 1,2,3 index -> -m_max,-m_max+1,...\n marr=-m_min+im +1\n if (il<1 .or. il>l_mode .or. marr<1 .or. marr>m_mode+1) call CCTK_WARN (0, \"internal error\")\n Qodd_Re(il,marr) = sqrt(two*dble((il+2)*(il+1)*il*(il-1)))* &\n S_factor/rsch*(c1(1)+half*(dc2(1)-two/rsch*c2(1)))\n\n\n Qeven_Re(il,marr) = one/Lambda*sqrt(two*dble((il-1)*(il+2))/ &\n dble(il*(il+1)))*( dble(il*(il+1))*S_factor* &\n (rsch**2*dG(1)-two*h1(1))+two*rsch*S_factor*(H2(1)-rsch*dK(1)) &\n +Lambda*rsch*K(1) )\n\n if (im.ne.0) then\n Qodd_Im(il,marr) = sqrt(two*dble((il+2)*(il+1)*il*(il-1)))* &\n S_factor/rsch*(c1(2)+half*(dc2(2)-two/rsch*c2(2)))\n\n\n Qeven_Im(il,marr) = one/Lambda*sqrt(two*dble((il-1)*(il+2))/ &\n dble(il*(il+1)))*( dble(il*(il+1))*S_factor* &\n (rsch**2*dG(2)-two*h1(2))+two*rsch*S_factor*(H2(2)-rsch*dK(2)) &\n +Lambda*rsch*K(2) )\n end if\n\n if (verbose>3) then\n write(infoline,'(A9,I2,A1,I2,A1)') ' (l,m)=(',il,',',im,')'\n call CCTK_INFO(infoline)\n write(infoline,'(A10,G20.8,A7,G20.8)') ' Qeven=', &\n Qeven_Re(il,marr),', Qodd=',Qodd_Re(il,marr)\n call CCTK_INFO(infoline)\n if (im.ne.0) then\n write(infoline,'(A16,G20.8,A7,G20.8)') ' imag: Qeven=', &\n Qeven_Im(il,marr),', Qodd=',Qodd_Im(il,marr)\n call CCTK_INFO(infoline)\n end if\n end if\n if (current_detector<1 .or. current_detector>maximum_detector_number .or. il<1 .or. il>l_mode .or. marr<1 .or. marr>2*m_mode+1) call CCTK_WARN (0, \"internal error\")\n Qodd_Re_Array(current_detector,il,marr) = Qodd_Re(il,marr)\n Qeven_Re_Array(current_detector,il,marr) = Qeven_Re(il,marr)\n\n if (im.ne.0) then\n Qodd_Im_Array(current_detector,il,marr) = Qodd_Im(il,marr)\n Qeven_Im_Array(current_detector,il,marr) = Qeven_Im(il,marr)\n else\n Qodd_Im_Array(current_detector,il,marr) = zero\n Qeven_Im_Array(current_detector,il,marr) = zero\n end if\n end do loop_m\n end do loop_l\n\n call CCTK_TimerStop(ierr,\"MoncriefQ\")\n\n if (phicorotate .ne. 0) then\n call CCTK_INFO(\"reset corotation on phi at the end of MoncriefQ for next step\")\n lapse=one\n cor_angle=cctk_time*rotation_omega/lapse\n\n! undo rotation transformation on phi itself.\n do j = 1, lsh(2)\n cphi(:,j) = cphi(:,j) + cor_angle\n end do\n\n sinphi = sin(cphi)\n cosphi = cos(cphi)\n end if\n\nend subroutine WavExtrL_MoncriefQ\n\n\n\n! ------------------------------------------------------------------\n!\n! Calculate the (l,m) spherical harmonic at given angular\n! coordinates. This number is in general complex, and\n!\n! Ylm = Ylm(1) + i Ylm(2)\n!\n! where\n!\n! a ( 2 l + 1 (l-|m|)! ) i m phi\n! Ylm = (-1) SQRT( ------- ------- ) P_l|m| (cos(theta)) e\n! ( 4 Pi (l+|m|)! ) \n!\n! and where\n!\n! a = m/2 (sign(m)+1)\n!\n! ------------------------------------------------------------------\nsubroutine WavExtrL_spherical_harmonic(l,m,theta,phi,Ylm)\n\n use WavExtrLConstants\n\n implicit none\n\n! Input variables\n CCTK_INT :: l,m\n CCTK_REAL :: theta,phi\n\n! Output variables\n CCTK_REAL :: Ylm(2)\n\n! Local variables\n CCTK_INT :: i\n CCTK_REAL :: a,fac,WavExtrL_plgndr\n! _________________________________________________________________\n\n fac = one\n do i = l-abs(m)+1,l+abs(m)\n fac = fac*dble(i)\n end do\n fac = one/fac\n\n! a = (-one)**((m*ISIGN(m,1)/abs(m)+m)/2)*SQRT(dble(2*l+1)\n! & /four/Pi*fac)*WavExtrL_plgndr(l,abs(m),cos(theta))\n\n a = (-one)**max(m,0)*sqrt(dble(2*l+1)/ &\n four/Pi*fac)*WavExtrL_plgndr(l,abs(m),cos(theta))\n Ylm(1) = a*cos(dble(m)*phi)\n Ylm(2) = a*sin(dble(m)*phi)\nend subroutine WavExtrL_spherical_harmonic\n\n\n! __________________________________________________________________\n!\n! FIXME : CHECK THE LICENSE OF THIS ROUTINE\n! From Numerical Recipes FIXME\n!\n! Calculates the associated Legendre polynomial Plm(x).\n! Here m and l are integers satisfying 0 <= m <= l,\n! while x lies in the range -1 <= x <= 1\n!\n! __________________________________________________________________\nfunction WavExtrL_plgndr(l,m,x)\n\n use WavExtrLConstants\n\n implicit none\n\n! Input variables\n CCTK_INT,INTENT(IN) :: l,m\n CCTK_REAL,INTENT(IN) :: x\n\n! Output variables\n CCTK_REAL :: WavExtrL_plgndr\n\n! Local Variables\n CCTK_INT :: i,ll\n CCTK_REAL :: pmm,somx2,fact,pmmp1,pll\n\n! __________________________________________________________________\n\n pmm = one\n\n if (m.gt.0) then\n somx2=sqrt((one-x)*(one+x))\n fact=one\n do i=1,m\n pmm = -pmm*fact*somx2\n fact = fact+two\n end do\n end if\n\n if (l.eq.m) then\n WavExtrL_plgndr = pmm\n else\n pmmp1 = x*(two*m+one)*pmm\n if (l.eq.m+1) then\n WavExtrL_plgndr=pmmp1\n else\n do ll=m+2,l\n pll = ( x*dble(2*ll-1)*pmmp1-dble(ll+m-1)*pmm )/dble(ll-m)\n pmm = pmmp1\n pmmp1 = pll\n end do\n WavExtrL_plgndr = pll\n end if\n end if\nend function WavExtrL_plgndr\n\n\n! __________________________________________________________________\n!\n! Calculates the various combinations of spherical harmonics needed\n! for the extraction (all are complex): \n!\n! Y = Ylm\n! Y1 = Ylm,theta\n! Y2 = Ylm,phi\n! Y3 = Ylm,theta,theta-cot theta Ylm,theta-Ylm,phi,phi/sin^2 theta\n! Y4 = Ylm,theta,phi-cot theta Ylm,phi\n!\n! The local variables Yplus is the spherical harmonic at (l+1,m)\n!\n! All the return values are 2 dim to account for real and complex part.\n! __________________________________________________________________\nsubroutine WavExtrL_spher_harm_combs(theta,phi,l,m,Y,Y1,Y2,Y3,Y4)\n\n use WavExtrLConstants\n\n implicit none\n\n! Input variables\n CCTK_INT :: l,m\n CCTK_REAL :: theta,phi\n\n! Output variables\n CCTK_REAL,DIMENSION(2) :: Y,Y1,Y2,Y3,Y4\n\n! Local variables\n CCTK_INT :: i\n CCTK_REAL :: Yplus(2),rl,rm,cot_theta\n! __________________________________________________________________\n\n rl = dble(l)\n rm = dble(m)\n\n cot_theta = cos(theta)/sin(theta)\n\n call WavExtrL_spherical_harmonic(l+1,m,theta,phi,Yplus)\n\n ! Find Y\n call WavExtrL_spherical_harmonic(l,m,theta,phi,Y)\n\n ! Find Y1\n do i = 1,2\n Y1(i) = -(rl+one)*cot_theta*Y(i)+Yplus(i)/sin(theta)* &\n sqrt(((rl+one)**2-rm**2)*(rl+half)/(rl+one+half))\n end do\n\n ! Find Y2\n Y2(1) = -rm*Y(2)\n Y2(2) = rm*Y(1)\n\n ! Find Y3\n do i = 1,2\n Y3(i) = -two*cot_theta*Y1(i)+(two*rm*rm/(sin(theta)**2) &\n -rl*(rl+one))*Y(i)\n end do\n\n ! Find Y4\n Y4(1) = rm*(cot_theta*Y(2)-Y1(2))\n Y4(2) = rm*(Y1(1)-cot_theta*Y(1))\nend subroutine WavExtrL_spher_harm_combs\n", + "SetupSphere.F90": "#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Functions.h\"\n\nsubroutine WavExtrL_SetupSphere(CCTK_ARGUMENTS)\n\n use WavExtrLConstants\n\n implicit none\n\n DECLARE_CCTK_PARAMETERS\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_FUNCTIONS\n\n CCTK_INT, dimension(2) :: lsh, lbnd\n\n CCTK_INT :: i, j, l\n\n CCTK_INT :: di\n\n CCTK_INT :: status\n\n CCTK_REAL :: ltheta, utheta, lphi, uphi\n CCTK_REAL :: dtheta, dphi\n\n CCTK_REAL :: theta, sum1\n\n character(len=256) :: infoline\n\n ! _________________________________________________________________________\n\n if (verbose>2) &\n call CCTK_INFO(\"Setup Sphere\")\n\n if (do_nothing==1) &\n return\n\n ! get local shape of 2D grid arrays\n call CCTK_GrouplbndGN(status, cctkGH, 2, lbnd,\"WaveExtractL::surface_arrays\")\n if ( status .lt. 0 ) then\n call CCTK_WARN(0, \"cannot get lower bounds for surface arrays\")\n end if\n\n call CCTK_GrouplshGN(status, cctkGH, 2, lsh, \"WaveExtractL::surface_arrays\")\n if ( status .lt. 0 ) then\n call CCTK_WARN ( 0, \"cannot get local size for surface arrays\" )\n end if\n\n ! shorthand for current detector index\n di=current_detector\n\n \n ! set ntheta and nphi for detectors which are not explicitely given in par-file\n !int_ntheta = 0\n !int_nphi = 0\n do i=1,maximum_detector_number\n if (ntheta(i).eq.0 .and. use_spherical_surface .eq. 0) then\n int_ntheta(i)=maxntheta\n else if (use_spherical_surface .eq. 0) then\n int_ntheta(i)=ntheta(i)\n end if\n if (nphi(i).eq.0 .and. use_spherical_surface .eq. 0) then\n int_nphi(i)=maxnphi\n else if (use_spherical_surface .eq. 0) then\n int_nphi(i)=nphi(i)\n end if\n !print*,'WaveExtractL: ntheta.',int_ntheta(i)\n !print*,'WaveExtractL: nphi.',int_nphi(i)\n !print*,'WaveExtractL: detector_radius.',detector_radius(i)\n end do\n\n \n\n ! setup weights\n\n if (CCTK_EQUALS(integration_method,\"extended midpoint rule\")) then\n ! we have to stagger the points, hence we can use the extended midpoint\n ! rule which just assigns a weight of 1 to each point. see Numerical\n ! Recipes p. 135 for details.\n ! Note that this method is only accurate up to O(1/N^2). usually that\n ! is good enough.\n weights = one\n phiweights = one\n thetaweights = one\n else if (CCTK_EQUALS(integration_method,\"Gauss\")) then\n weights = one\n phiweights = one\n thetaweights = one\n \n do i=1, lsh(1)\n theta = pi*((lbnd(1)+i)-0.5d0)/int_ntheta(di)\n sum1 = 0d0\n do l=0, (int_ntheta(di)-1)/2\n sum1 = sum1 + sin((2*l+1)*theta)/(2*l+1)\n end do\n weights(i,:) = 8d0/(2d0*pi)*sum1 !8d0/int_nphi(di)*pi/int_ntheta(di)*sum1/dtheta/dphi\n end do\n \n else if (CCTK_EQUALS(integration_method,\"open extended\")) then\n call CCTK_WARN(1,\"VERY BAD CHOICE 'open extended'. this code is broken\")\n ! we stagger the origin, so we need an open end formula.\n ! but we have the points at half values.\n ! FIXME: check the weights - these are not correct.\n ! FIXME: it won't work for maxntheta!=ntheta !!\n ! FIXME: BUGBUG: This code is broken, but extended midpoint is accurate enough.\n ! Initialise the weight grid array for the 2D Simpsons rule integration.\n ! To do this I need to figure out the global location of the given point.\n ! There are 3 cases in the one dimensional case. If the point is on the\n ! boundary the weight is 1/3. If it is at an even position the weight\n ! is 4/3 and if it is at an odd position the weight is 2/3. \n\n weights = one\n do j = 1, lsh(2)\n\n ! This is first done in the phi direction. Meaning that all points with\n ! the same theta coordinate are set to the same weight.\n if ( ( lbnd(2)+j .eq. 1 ) .or. ( lbnd(2)+j .eq. int_nphi(di) ) ) then\n weights(:,j) = onethird\n phiweights(:,j) = onethird\n else if ( mod(lbnd(2)+j,2) .eq. 0 ) then\n weights(:,j) = fourthirds\n phiweights(:,j) = fourthirds\n else\n weights(:,j) = twothirds\n phiweights(:,j) = twothirds\n end if\n\n ! Then it is done in the theta direction with the one-dimensional\n ! weights beeing multiplied.\n do i = 1, lsh(1)\n if ( ( lbnd(1)+i .eq. 1 ) .or. ( lbnd(1)+i .eq. int_ntheta(di) ) ) then\n weights(i,j) = onethird * weights(i,j)\n thetaweights(i,j) = onethird\n else if ( mod(lbnd(1)+i,2) .eq. 0 ) then\n weights(i,j) = fourthirds * weights(i,j)\n thetaweights(i,j) = fourthirds\n else\n weights(i,j) = twothirds * weights(i,j)\n thetaweights(i,j) = twothirds\n end if\n end do\n end do\n\n ! FIXME: DESCRIPTION is not accurate for open end formula, taken directly from Peters EHFinder.\n ! The end result is a 2D array with the weights in the following pattern.\n ! ie 2D Simpson _ WARN : \n ! 1/9 4/9 2/9 4/9 2/9 4/9 1/9\n ! 4/9 16/9 8/9 16/9 8/9 16/9 4/9\n ! 2/9 8/9 4/9 8/9 4/9 8/9 2/9\n ! 4/9 16/9 8/9 16/9 8/9 16/9 4/9\n ! 2/9 8/9 4/9 8/9 4/9 8/9 2/9\n ! 4/9 16/9 8/9 16/9 8/9 16/9 4/9\n ! 1/9 4/9 2/9 4/9 2/9 4/9 1/9\n\n end if\n\n ! set the weights to zero outside the grid requested on the current sphere\n do j = 1, lsh(2)\n do i = 1, lsh(1)\n if ((lbnd(2)+j.gt.int_nphi(di)) .or. (lbnd(1)+i.gt.int_ntheta(di))) then\n! write (*,*) 'setting weights to zero at ', i, j\n weights(i,j) = 0\n phiweights(i,j) = 0\n thetaweights(i,j) = 0\n end if\n end do\n end do\n\n\n\n ! Theta and phi setup.\n ! Full mode is the default\n ltheta = zero; utheta = pi\n lphi = zero; uphi = two * pi\n if(CCTK_EQUALS(domain,\"bitant\")) then\n if (CCTK_EQUALS(bitant_plane,\"xy\")) then\n ltheta = zero; utheta = half * pi\n else\n ltheta = zero; utheta = pi\n end if\n else if(CCTK_EQUALS(domain, 'quadrant')) then\n if(CCTK_EQUALS(quadrant_direction, 'x')) then\n ltheta = zero; utheta = half * pi\n lphi = zero; uphi = pi\n else if(CCTK_EQUALS(quadrant_direction, 'y')) then\n ltheta = zero; utheta = half * pi\n lphi = zero; uphi = pi\n else if(CCTK_EQUALS(quadrant_direction, 'z')) then\n ltheta = zero; utheta = pi\n lphi = zero; uphi = half * pi\n else\n call CCTK_WARN(1,\"unknown quadrant_direction\")\n end if\n else if(CCTK_EQUALS(domain, 'octant')) then\n ltheta = zero; utheta = half * pi\n lphi = zero; uphi = half*pi\n end if\n\n ! Find dtheta and dphi and initialise the theta and phi grid arrays.\n ! Here i + lbnd(1) - 1 is the global index for theta and\n ! j + lbnd(2) - 1 is the global index for phi.\n dtheta = ( utheta - ltheta ) / int_ntheta(di)\n dphi = ( uphi - lphi ) / int_nphi(di)\n if (cartoon .ne. 0) then\n utheta = pi\n ltheta = zero\n! FIXME : OTHER MODES??\n if (CCTK_EQUALS(domain,\"bitant\")) then\n dtheta = pi/(two*int_ntheta(di))\n else\n dtheta = pi/int_ntheta(di)\n end if\n dphi = two*pi\n uphi = zero\n lphi = zero\n end if\n\n if (verbose>1) then\n write(infoline,'(A5,G20.8,A5,G20.8)') 'dphi=',dphi,'nphi=',int_nphi(di)\n call CCTK_INFO(infoline)\n write(infoline,'(A7,G20.8,A7,G20.8)') 'dtheta=',dtheta,'ntheta=',int_ntheta(di)\n call CCTK_INFO(infoline)\n end if\n\n\n ! We stagger the origin, because we divide by sin(theta) and a division by sin(0) is\n ! not healthy.\n ! this is also useful to be able to use the \"extended midpoint rule\" for\ufffd\n ! integration.\n do i = 1, lsh(1)\n ctheta(i,:) = ltheta + dtheta * ( dble(i) + lbnd(1) - half )\n end do\n do j = 1, lsh(2)\n cphi(:,j) = lphi + dphi * ( dble(j) +lbnd(2) - half )\n end do\n\n ! FIXME : unneccessary or at least combine with normal case\n if (cartoon .ne. 0) then\n cphi = zero\n end if \n\n if (verbose>7) then\n print*,'ctheta',ctheta\n print*,'cphi',cphi\n endif\n\n ! Calculate sines and cosines and store them in grid arrays since they\n ! are expensive.\n sintheta = sin(ctheta)\n costheta = cos(ctheta)\n sinphi = sin(cphi)\n cosphi = cos(cphi)\n\n ! zero the parts of the array which are not used. the arrays are of size \n ! (maxntheta,maxnphi), but we only use (int_ntheta,int_nphi)\n do j=1,lsh(2)\n do i=1,lsh(1)\n if (i+lbnd(1)>int_ntheta(current_detector) .or. &\n j+lbnd(2)>int_nphi(current_detector) ) then\n ctheta(i,j)=zero\n cphi(i,j)=zero\n sintheta(i,j)=zero\n costheta(i,j)=zero\n sinphi(i,j)=zero\n cosphi(i,j)=zero\n end if\n end do\n end do\n\nend subroutine WavExtrL_SetupSphere\n", + "ParamCheck.c": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see . */\n\n /*@@\n @file ParamCheck.c\n @date April 26 2002\n @author Gabrielle Allen\n @desc \n Check parameters for WaveExtract\n @enddesc \n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \n\nvoid WavExtrL_ParamCheck(CCTK_ARGUMENTS);\n\n /*@@\n @routine WavExtrL_ParamCheck\n @date April 26 2002\n @author Gabrielle Allen\n @desc \n Check parameters for WaveExtract\n @enddesc \n @calls \n@@*/\nvoid WavExtrL_ParamCheck(CCTK_ARGUMENTS)\n{\n\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n\n if (verbose>3)\n CCTK_INFO(\"Checking parameters\");\n\n if(! (CCTK_EQUALS(metric_type, \"physical\") || \n CCTK_EQUALS(metric_type, \"static conformal\")))\n {\n CCTK_PARAMWARN(\"WaveExtract only works currently with metric_type \\\"static conformal\\\" or \\\"physical\\\"\");\n }\n \n int store_radial_derivs = *(CCTK_INT const*) CCTK_ParameterGet(\"store_radial_derivatives\", \"ADMDerivatives\", NULL);\n if (!store_radial_derivs)\n CCTK_PARAMWARN(\"Radial derivatives need to be calculated in ADMDerivatives!\");\n\n if (origin_x != 0.0 || origin_y != 0.0 || origin_z !=0)\n CCTK_PARAMWARN(\"Radial derivatives as calculated in ADMDerivatives assume origin(x,y,z) = 0.0!\");\n\n if (!check_rmax && (Cauchy_radius_start_factor > 0. || Cauchy_radius_end_factor > 0))\n CCTK_PARAMWARN(\"When using Cauchy_radius_start_factor or Cauchy_radius_end_factor, check_rmax must also be set\");\n}\n", + "WavExtrLConstants.F90": "! Various useful constants, taken from EHFinder.\n\n#include \"cctk.h\"\n\nmodule WavExtrLConstants\n implicit none\n CCTK_REAL, parameter :: zero = 0.0d0\n CCTK_REAL, parameter :: one = 1.0d0\n CCTK_REAL, parameter :: two = 2.0d0\n CCTK_REAL, parameter :: three = 3.0d0\n CCTK_REAL, parameter :: four = 4.0d0\n CCTK_REAL, parameter :: eight = 8.0d0\n CCTK_REAL, parameter :: ten = 10.0d0\n CCTK_REAL, parameter :: half = 0.5d0\n CCTK_REAL, parameter :: onethird = one / three\n CCTK_REAL, parameter :: twothirds = two / three\n CCTK_REAL, parameter :: fourthirds = four / three\n CCTK_REAL, parameter :: quarter = 0.25d0\n CCTK_REAL, parameter :: tenth = 0.1d0\n CCTK_REAL, parameter :: huge = 1d23\n CCTK_REAL, parameter :: pi = 3.1415926535897932385d0\nend module WavExtrLConstants\n", + "SphericalSurface.F90": "#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Functions.h\"\n\nsubroutine WavExtrL_Setup_SphericalSurface(CCTK_ARGUMENTS)\n\n use WavExtrLConstants\n\n implicit none\n\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n DECLARE_CCTK_FUNCTIONS\n\n CCTK_INT i,rind\n\n CCTK_INT, save :: firstcall = 1\n\n if (verbose>2) call CCTK_INFO(\"spherical surface setup\")\n\n !if (firstcall .eq. 0) then \n! return\n ! end if\n \n firstcall = 0\n\n ! initial setup is done by spherical surface thorn.\n do i=1,maximum_detector_number\n if(surface_index(i).eq.-1) then\n call CCTK_WARN(0,\"this surface was not selected as a spherical surface\")\n continue\n end if\n if(sf_valid(surface_index(i)+1)<=0) then\n call CCTK_WARN(1,\"surface is invalid from sf_valid\")\n continue\n end if\n detector_radius(i)=sf_mean_radius(surface_index(i)+1)\n \n int_ntheta(i)=sf_ntheta(surface_index(i)+1) - 2*nghoststheta(surface_index(i)+1)\n int_nphi(i)=sf_nphi(surface_index(i)+1) - 2*nghostsphi(surface_index(i)+1)\n if (symmetric_z(surface_index(i)+1)/=0) then\n int_ntheta(i) = int_ntheta(i)*2\n endif\n if (symmetric_x(surface_index(i)+1)/=0) then\n int_nphi(i) = int_nphi(i)*2\n endif\n if (symmetric_y(surface_index(i)+1)/=0) then\n int_nphi(i) = int_nphi(i)*2\n endif\n \n !print*,'WaveExtractL: int_ntheta.', int_ntheta(i)\n !print*,'WaveExtractL: int_nphi.', int_nphi(i)\n !print*,'WaveExtractL: r.', detector_radius(i)\n \n end do\n maximum_detector_number=i-1\n\n ! reshuffle detectors\n! rind=1\n! do i=1,maximum_detector_number\n! if (surface_index(i).eq.-two .or. surface_index(i).eq.-one) then\n! continue\n! end if\n! detector_radius(rind)=sf_mean_radius(surface_index(i)+1)\n! \n! ntheta(i)=sf_ntheta(surface_index(i)+1) - 2*nghoststheta(surface_index(i)+1)\n! nphi(i)=sf_nphi(surface_index(i)+1) - 2*nghostsphi(surface_index(i)+1)\n! if (symmetric_z(surface_index(i)+1)/=0) then\n! ntheta(i) = ntheta(i)*2\n! endif\n! if (symmetric_x(surface_index(i)+1)/=0) then\n! nphi(i) = nphi(i)*2\n! endif\n! if (symmetric_y(surface_index(i)+1)/=0) then\n! nphi(i) = nphi(i)*2\n! endif\n! \n! ! print*,'WaveExtractL: ntheta.', ntheta(i)\n! ! print*,'WaveExtractL: nphi.', nphi(i)\n! \n! surface_index(rind)=surface_index(i)\n! rind=rind+1\n! end do\n\n! maximum_detector_number=rind-1\n\n current_detector=0 !maximum_detector_number !rind-1\n\n if (maximum_detector_number>0) then\n do_nothing=0\n else\n do_nothing=1\n end if\n !print*,'max det no.', maximum_detector_number\n !print*,'new detect arrays:',detector_radius\n !print*,'surf ind',surface_index\n\nend subroutine WavExtrL_Setup_SphericalSurface\n", + "IO.c": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see . */\n\n /*@@\n @file IO.c\n @date Mon Nov 25 13:19:46 2002\n @author Frank Herrmann\n @desc \n Write output data to file.\n @enddesc \n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"cctk_Timers.h\"\n\n#include \n#include \n#include \n#include \n\n#include \"extractGH.h\"\n#include \"CactusBase/IOUtil/src/ioGH.h\"\n#include \"CactusBase/IOUtil/src/ioutil_AdvertisedFiles.h\"\n#include \"CactusBase/IOUtil/src/ioutil_Utils.h\"\n\n\nvoid WavExtrL_WriteData(CCTK_ARGUMENTS);\n\nvoid WavExtrL_WriteLotsOfData(CCTK_ARGUMENTS);\n\nint WavExtrL_TimeForOutput (const cGH *GH, int vindex);\n\nstatic void WavExtrL_WriteTimer(cTimerData *info);\n\nstatic void *WavExtrL_SetupGH (tFleshConfig *config, int conv_level, cGH *GH);\n\nstatic int WavExtrL_WriteScalar(const cGH *GH,\n CCTK_INT vindex,\n CCTK_REAL *value,\n CCTK_INT max,\n const char *alias,\n const CCTK_REAL *detector_radii);\n\nstatic FILE *WavExtrL_OpenFile (const cGH *GH,\n int vindex,\n const char *filename,\n const char *slicename,\n const char *description,\n CCTK_INT number_sets,\n const char *aliasname,\n const CCTK_REAL *detector_radii);\n\n/********************************************************************\n ******************** External Routines ************************\n ********************************************************************/\n\n /*@@\n @routine WavExtrL_Startup\n @date Mon 16th December 2002\n @author Gabrielle Allen\n @desc\n The startup registration routine for Extract.\n Registers WaveExtract as an IO Method and provide the\n only necessary method TimeForOutput\n @enddesc\n @calls CCTK_RegisterGHExtensionSetupGH\n@@*/\nint WavExtrL_Startup (void)\n{\n int ierr;\n\n if (CCTK_GHExtensionHandle (\"IO\") < 0)\n {\n CCTK_WARN (1, \"Thorn IOUtil was not activated. \"\n \"No WaveExtractL I/O methods will be enabled.\");\n return 0;\n }\n\n CCTK_RegisterGHExtensionSetupGH(CCTK_RegisterGHExtension(\"WaveExtractL\"),\n WavExtrL_SetupGH);\n\n ierr = CCTK_TimerCreate(\"MoncriefQ\");\n if (ierr < 0)\n {\n CCTK_WARN(1,\"could not create timer MoncriefQ\");\n }\n\n ierr = CCTK_TimerCreate(\"Interpolation\");\n if (ierr < 0)\n {\n CCTK_WARN(1,\"could not create timer Interpolation\");\n }\n \n ierr = CCTK_TimerCreate(\"Schwarzschild\");\n if (ierr < 0)\n {\n CCTK_WARN(1,\"could not create timer Schwarzschild\");\n }\n\n return 0;\n}\n\n\n /*@@\n @routine WavExtrL_WriteData\n @date Mon Nov 25 13:20:06 2002\n @author Frank Herrmann\n @desc \n Write output data to file.\n @enddesc \n @calls \n @calledby \n @history \n \n @endhistory \n\n@@*/\nvoid WavExtrL_WriteData(CCTK_ARGUMENTS)\n{\n char string_var[256],radiusname[256];\n CCTK_INT vindex_rsch;\n CCTK_INT vindex_mass;\n CCTK_INT vindex_Qeven_Re;\n CCTK_INT vindex_Qodd_Re;\n CCTK_INT vindex_Qeven_Im;\n CCTK_INT vindex_Qodd_Im;\n CCTK_INT il,im;\n CCTK_INT index;\n CCTK_REAL *data_Qeven_Re;\n CCTK_REAL *data_Qodd_Re;\n CCTK_REAL *data_Qeven_Im;\n CCTK_REAL *data_Qodd_Im;\n CCTK_REAL val;\n\n DECLARE_CCTK_ARGUMENTS;\n DECLARE_CCTK_PARAMETERS;\n\n\n if (verbose>2)\n CCTK_INFO(\"Writing output data to individual files per detector\");\n\n if (*do_nothing==1)\n return;\n\n if (cctk_iteration != 0) {\n if ((cctk_iteration % my_out_every_det[*current_detector])!=0) {\n if (verbose>2) CCTK_INFO(\"No time for this detector\");\n return;\n }\n }\n\n if (calc_when_necessary == 1)\n {\n if (cctk_time < *current_detector_radius-50)\n {\n if (verbose>2) CCTK_INFO(\"No time for this detector\");\n return;\n } \n if (CCTK_IsFunctionAliased(\"MergerHandler_WeHaveMerger\"))\n {\n if (MergerHandler_WeHaveMerger() == 1)\n {\n if (cctk_time > MergerHandler_MergerTime()+*current_detector_radius+ringdown_margin)\n\t{\n if (verbose>2) CCTK_INFO(\"No time for this detector\");\n return;\n }\n }\n }\n } \n\n\n vindex_rsch = CCTK_VarIndex(\"WaveExtractL::Schwarzschild_Radius\");\n vindex_mass = CCTK_VarIndex(\"WaveExtractL::Schwarzschild_Mass\");\n vindex_Qeven_Re = CCTK_VarIndex(\"WaveExtractL::Qeven_Re\");\n vindex_Qodd_Re = CCTK_VarIndex(\"WaveExtractL::Qodd_Re\");\n vindex_Qeven_Im = CCTK_VarIndex(\"WaveExtractL::Qeven_Im\");\n vindex_Qodd_Im = CCTK_VarIndex(\"WaveExtractL::Qodd_Im\");\n\n if(surface_index[*current_detector]>=0) {\n snprintf(radiusname, sizeof radiusname,\n \"Detector_Number_%d\",(int)*current_detector);\n }\n else {\n snprintf(radiusname, sizeof radiusname,\n \"Detector_Radius_%4.2f\",(double)*current_detector_radius);\n }\n\n if(CCTK_MyProc (cctkGH) == 0)\n {\n /* Schw Mass indicator */\n snprintf(string_var, sizeof string_var,\n \"Schwarzschild_Mass_%s\",radiusname);\n WavExtrL_WriteScalar(cctkGH,vindex_mass,Schwarzschild_Mass,\n -1,string_var,NULL);\n\n /* Schw Radius */\n snprintf(string_var, sizeof string_var,\n \"Schwarzschild_Radius_%s\",radiusname);\n WavExtrL_WriteScalar(cctkGH,vindex_rsch,Schwarzschild_Radius,\n -1,string_var,NULL);\n\n /* write information to screen about the results */\n if(verbose>1)\n {\n CCTK_VInfo(CCTK_THORNSTRING,\"Detector No. %d\",(int)*current_detector);\n CCTK_VInfo(CCTK_THORNSTRING,\n \" Coordinate Radius = %4.3f\",(double)*current_detector_radius);\n CCTK_VInfo(CCTK_THORNSTRING,\n \" Schwarzschild Radius = %2.3f\",(double)*Schwarzschild_Radius);\n CCTK_VInfo(CCTK_THORNSTRING,\n \" Schwarzschild Mass = %2.3f\",(double)*Schwarzschild_Mass);\n }\n\n data_Qeven_Re=(CCTK_REAL *) CCTK_VarDataPtrI(cctkGH,0,vindex_Qeven_Re);\n data_Qodd_Re=(CCTK_REAL *) CCTK_VarDataPtrI(cctkGH,0,vindex_Qodd_Re);\n data_Qeven_Im=(CCTK_REAL *) CCTK_VarDataPtrI(cctkGH,0,vindex_Qeven_Im);\n data_Qodd_Im=(CCTK_REAL *) CCTK_VarDataPtrI(cctkGH,0,vindex_Qodd_Im);\n\n /* loop over l,m modes */\n for (il=*l_min; il<=*l_max; il=il+*l_step) {\n for (im=*m_min; im<=*m_max; im=im+*m_step) {\n if ((im<-il) || (im>+il)) continue;\n /* Qeven */\n index=(il-1)+im*(*l_max);\n snprintf(string_var, sizeof string_var,\n \"Qeven_Re_%s_l%d_m%d\",radiusname,(int)il,(int)im);\n val=data_Qeven_Re[index];\n WavExtrL_WriteScalar(cctkGH,vindex_Qeven_Re,\n &val,-1,string_var,NULL);\n snprintf(string_var, sizeof string_var,\n \"Qeven_Im_%s_l%d_m%d\",radiusname,(int)il,(int)im);\n val=data_Qeven_Im[index];\n WavExtrL_WriteScalar(cctkGH,vindex_Qeven_Im,\n &val,-1,string_var,NULL);\n /* Qodd */\n snprintf(string_var, sizeof string_var,\n \"Qodd_Re_%s_l%d_m%d\",radiusname,(int)il,(int)im);\n val=data_Qodd_Re[index];\n WavExtrL_WriteScalar(cctkGH,vindex_Qodd_Re,\n &val,-1,string_var,NULL);\n snprintf(string_var, sizeof string_var,\n \"Qodd_Im_%s_l%d_m%d\",radiusname,(int)il,(int)im);\n val=data_Qodd_Im[index];\n WavExtrL_WriteScalar(cctkGH,vindex_Qodd_Im,\n &val,-1,string_var,NULL);\n if (verbose>3) {\n CCTK_VInfo(CCTK_THORNSTRING,\n \" IO index: %d (l,m)=(%d,%d) Re: Qeven: %16.8g Qodd: %16.8g\",\n (int)index,(int)il,(int)im,(double)data_Qeven_Re[index],(double)data_Qodd_Re[index]);\n CCTK_VInfo(CCTK_THORNSTRING,\n \" IO index: %d (l,m)=(%d,%d) Im: Qeven: %16.8g Qodd: %16.8g\",\n (int)index,(int)il,(int)im,(double)data_Qeven_Im[index],(double)data_Qodd_Im[index]);\n }\n }\n }\n }\n}\n\n/* for a lot of detectors we have a different output format */\nvoid WavExtrL_WriteLotsOfData(CCTK_ARGUMENTS)\n{\n char string_var[256];\n CCTK_INT vindex_rsch;\n CCTK_INT vindex_mass;\n CCTK_INT vindex_Qeven_Re;\n CCTK_INT vindex_Qodd_Re;\n CCTK_INT vindex_Qeven_Im;\n CCTK_INT vindex_Qodd_Im;\n CCTK_INT index;\n CCTK_INT il,im;\n CCTK_REAL *data_Qeven_Re;\n CCTK_REAL *data_Qodd_Re;\n CCTK_REAL *data_Qeven_Im;\n CCTK_REAL *data_Qodd_Im;\n CCTK_REAL *val_even_Re, *val_odd_Re;\n CCTK_REAL *val_even_Im, *val_odd_Im;\n CCTK_INT idet;\n\n DECLARE_CCTK_ARGUMENTS;\n DECLARE_CCTK_PARAMETERS;\n\n\n if (verbose>4)\n CCTK_INFO(\"Writing output data to many files\");\n\n if (*do_nothing==1)\n return;\n vindex_rsch = CCTK_VarIndex(\"WaveExtractL::Schw_Radii\");\n vindex_mass = CCTK_VarIndex(\"WaveExtractL::Schw_Masses\");\n vindex_Qeven_Re = CCTK_VarIndex(\"WaveExtractL::Qeven_Re_Array\");\n vindex_Qodd_Re = CCTK_VarIndex(\"WaveExtractL::Qodd_Re_Array\");\n vindex_Qeven_Im = CCTK_VarIndex(\"WaveExtractL::Qeven_Im_Array\");\n vindex_Qodd_Im = CCTK_VarIndex(\"WaveExtractL::Qodd_Im_Array\");\n\n if (maximum_detector_number==1)\n return;\n\n if(CCTK_MyProc (cctkGH) == 0)\n {\n /* Schw Mass indicator */\n snprintf(string_var, sizeof string_var,\n \"Schwarzschild_Masses\");\n WavExtrL_WriteScalar(cctkGH,vindex_mass,Schw_Masses,\n maximum_detector_number,\n string_var,detector_radius);\n /* Schw Radius */\n snprintf(string_var, sizeof string_var,\n \"Schwarzschild_Radii\");\n WavExtrL_WriteScalar(cctkGH,vindex_rsch,Schw_Radii,\n maximum_detector_number,\n string_var,detector_radius);\n\n /* write information to screen about the results */\n if(verbose>1)\n {\n CCTK_VInfo(CCTK_THORNSTRING,\n \"Writing data from %d detectors to disk\",(int)maximum_detector_number);\n CCTK_VInfo(CCTK_THORNSTRING,\"Last Detector data (No. %d)\",\n (int)*current_detector);\n CCTK_VInfo(CCTK_THORNSTRING,\n \" Coordinate Radius = %4.3f\",(double)*current_detector_radius);\n CCTK_VInfo(CCTK_THORNSTRING,\n \" Schwarzschild Radius = %2.3f\",(double)*Schwarzschild_Radius);\n CCTK_VInfo(CCTK_THORNSTRING,\n \" Schwarzschild Mass = %2.3f\",(double)*Schwarzschild_Mass);\n }\n\n /* output of the Moncrief Qeven/Qodd */\n data_Qeven_Re=(CCTK_REAL *) CCTK_VarDataPtrI(cctkGH,0,vindex_Qeven_Re);\n data_Qodd_Re =(CCTK_REAL *) CCTK_VarDataPtrI(cctkGH,0,vindex_Qodd_Re);\n data_Qeven_Im=(CCTK_REAL *) CCTK_VarDataPtrI(cctkGH,0,vindex_Qeven_Im);\n data_Qodd_Im =(CCTK_REAL *) CCTK_VarDataPtrI(cctkGH,0,vindex_Qodd_Im);\n val_even_Re=(CCTK_REAL *) malloc(*max_det_no_param*sizeof(CCTK_REAL));\n val_odd_Re =(CCTK_REAL *) malloc(*max_det_no_param*sizeof(CCTK_REAL));\n val_even_Im=(CCTK_REAL *) malloc(*max_det_no_param*sizeof(CCTK_REAL));\n val_odd_Im =(CCTK_REAL *) malloc(*max_det_no_param*sizeof(CCTK_REAL));\n\n for (il=*l_min; il<=*l_max; il=il+*l_step) {\n for (im=*m_min; im<=*m_max; im=im+*m_step) {\n if ((im<-il) || (im>+il)) continue;\n for (idet=0; idet<*max_det_no_param; idet++) {\n assert (idet>=0 && idet<*max_det_no_param);\n index = idet+(il-1)*(*max_det_no_param)+(-*m_min+im)*(*max_det_no_param)*(*l_max);\n assert (index>=0 && index5) {\n CCTK_VInfo(CCTK_THORNSTRING,\n \"idet: %d index: %d Re Qeven: %16.8g, Qodd: %16.8g\",\n (int)idet,(int)index,(double)val_even_Re[idet],(double)val_odd_Re[idet]);\n CCTK_VInfo(CCTK_THORNSTRING,\n \"idet: %d index: %d Im Qeven: %16.8g, Qodd: %16.8g\",\n (int)idet,(int)index,(double)val_even_Im[idet],(double)val_odd_Im[idet]);\n }\n }\n snprintf(string_var, sizeof string_var,\n \"Qeven_Re_l%d_m%d\",(int)il,(int)im);\n WavExtrL_WriteScalar(cctkGH,vindex_Qeven_Re,\n val_even_Re,maximum_detector_number,\n string_var,detector_radius);\n snprintf(string_var, sizeof string_var,\n \"Qodd_Re_l%d_m%d\",(int)il,(int)im);\n WavExtrL_WriteScalar(cctkGH,vindex_Qodd_Re,\n val_odd_Re, maximum_detector_number,\n string_var,detector_radius);\n if (verbose>3) CCTK_VInfo(CCTK_THORNSTRING,\n \" Detector 0: (l,m)=(%d,%d) Re Qeven: %16.8g Qodd: %16.8g\",\n (int)il,(int)im,(double)val_even_Re[0],(double)val_odd_Re[0]);\n snprintf(string_var, sizeof string_var,\n \"Qeven_Im_l%d_m%d\",(int)il,(int)im);\n WavExtrL_WriteScalar(cctkGH,vindex_Qeven_Im,\n val_even_Im,maximum_detector_number,\n string_var,detector_radius);\n snprintf(string_var, sizeof string_var,\n \"Qodd_Im_l%d_m%d\",(int)il,(int)im);\n WavExtrL_WriteScalar(cctkGH,vindex_Qodd_Im,\n val_odd_Im, maximum_detector_number,\n string_var,detector_radius);\n if (verbose>3) CCTK_VInfo(CCTK_THORNSTRING,\n \" Detector 0: (l,m)=(%d,%d) Im Qeven: %16.8g Qodd: %16.8g\",\n (int)il,(int)im,(double)val_even_Im[0],(double)val_odd_Im[0]);\n }\n }\n free(val_even_Re);\n free(val_odd_Re);\n free(val_even_Im);\n free(val_odd_Im);\n }\n\n}\n\n\n\nvoid WavExtrL_TimerInfo(CCTK_ARGUMENTS)\n{\n cTimerData *info_interp, *info_schw, *info_MoncriefQ;\n CCTK_INT ierr;\n\n DECLARE_CCTK_ARGUMENTS;\n DECLARE_CCTK_PARAMETERS;\n\n\n if (*do_nothing==1)\n return;\n\n info_interp = CCTK_TimerCreateData();\n ierr = CCTK_Timer(\"Interpolation\",info_interp);\n\n info_schw = CCTK_TimerCreateData();\n ierr = CCTK_Timer(\"Schwarzschild\",info_schw);\n\n info_MoncriefQ = CCTK_TimerCreateData();\n ierr = CCTK_Timer(\"MoncriefQ\",info_MoncriefQ);\n\n if (write_timer_info == 1)\n {\n CCTK_INFO(\" Interpolation Timer\");\n WavExtrL_WriteTimer(info_interp);\n\n CCTK_INFO(\" Schwarzschild Timer (Integration 1)\");\n WavExtrL_WriteTimer(info_schw);\n\n CCTK_INFO(\" MoncriefQ Timer (Integration 2)\");\n WavExtrL_WriteTimer(info_MoncriefQ);\n }\n\n /* cleanup */\n ierr = CCTK_TimerDestroyData(info_interp);\n ierr = CCTK_TimerReset(\"Interpolation\");\n ierr = CCTK_TimerDestroyData(info_schw);\n ierr = CCTK_TimerReset(\"Schwarzschild\");\n ierr = CCTK_TimerDestroyData(info_MoncriefQ);\n ierr = CCTK_TimerReset(\"MoncriefQ\");\n}\n\nstatic void WavExtrL_WriteTimer(cTimerData *info)\n{\n int i;\n\n for (i=0; i < info->n_vals; i++)\n {\n switch (info->vals[i].type)\n {\n case val_int:\n CCTK_VInfo(CCTK_THORNSTRING,\" %s %d %s\",\n info->vals[i].heading, info->vals[i].val.i, info->vals[i].units);\n break;\n case val_long:\n CCTK_VInfo(CCTK_THORNSTRING,\" %s %ld %s\",\n info->vals[i].heading, info->vals[i].val.l, info->vals[i].units);\n break;\n case val_double:\n CCTK_VInfo(CCTK_THORNSTRING,\" %s %.3f %s\",\n info->vals[i].heading, (double)info->vals[i].val.d, info->vals[i].units);\n break;\n default:\n CCTK_WARN(1,\"Unknown data type for timer info\");\n break;\n }\n }\n}\n\n/* write scalars out to disk */\nstatic int WavExtrL_WriteScalar(const cGH *GH,\n CCTK_INT vindex,\n CCTK_REAL *value,\n CCTK_INT max,\n const char *alias,\n const CCTK_REAL *detector_radii)\n{\n FILE *file;\n extractGH *myGH; char *filename;\n const char *file_extension;\n char format_str_real[15], format_str_int[15], format_str_single[15];\n int i;\n\n DECLARE_CCTK_PARAMETERS;\n\n if (CCTK_MyProc (GH) != 0)\n {\n return (0);\n }\n\n /* set the output format string for the desired notation */\n snprintf (format_str_real, sizeof format_str_real,\n \"%%%s\\t%%%s\\n\", out_format, out_format);\n snprintf (format_str_int, sizeof format_str_int,\n \"%%%s\\t%%d\\n\", out_format);\n\n snprintf (format_str_single, sizeof format_str_single,\n \"%%%s\\t\", out_format);\n\n /* get the GH extensions for Extract */\n myGH = (extractGH *) CCTK_GHExtension (GH, \"WaveExtractL\");\n\n /* set the output file extension according to the output style */\n file_extension = CCTK_Equals (out_style, \"gnuplot\") ? \".asc\" : \".xg\";\n\n filename = (char *) malloc (strlen (myGH->out_dir) + strlen (alias) +\n strlen (file_extension) +1 );\n sprintf (filename, \"%s%s%s\", myGH->out_dir, alias, file_extension);\n\n if(max==-1)\n {\n /* create/reopen the file */\n file = WavExtrL_OpenFile(GH, vindex, filename, \"tl\", \"Scalar value\", \n -1, alias, NULL);\n if (file)\n {\n fprintf (file, format_str_real, GH->cctk_time, (double) *value);\n fclose (file);\n }\n else\n {\n CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Could not open scalar output file '%s'\",\n filename);\n }\n }\n else /* multiple detectors in one file */\n {\n if (CCTK_EQUALS(out_style, \"xgraph\"))\n {\n CCTK_ParameterSet(out_style,\"WaveExtractL\",\"gnuplot\");\n }\n /* create/reopen the file */\n file = WavExtrL_OpenFile(GH, vindex, filename, \"tl\", \"Scalar value\",\n max,alias,detector_radii);\n if (file)\n {\n fprintf (file, \"\\\"Time = %g\\n\",(double)GH->cctk_time);\n /* this is slow, but we don't care */\n for (i=0; ifilenameList, filename)==NULL;\n file = fopen (filename,\n ioUtilGH->recovered || ! first_time_through ? \"a\" : \"w\");\n if (! file)\n {\n CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"WavExtrL_OpenFile: Cannot open output file '%s'\", filename);\n }\n else if (first_time_through)\n {\n if (CCTK_Equals (out_style, \"gnuplot\"))\n {\n comment_char = '#';\n advertised_file.mimetype = \"application/gnuplot\";\n }\n else\n {\n comment_char = '\"'; /* this is for xgraph */\n advertised_file.mimetype = \"application/x-graph\";\n }\n\n /* just store a non-NULL pointer in database */\n StoreNamedData (&myGH->filenameList, filename, (void *) 1);\n\n /* advertise the file for downloading */\n advertised_file.slice = slicename;\n advertised_file.thorn = CCTK_THORNSTRING;\n advertised_file.varname = fullname;\n advertised_file.description = description;\n\n IOUtil_AdvertiseFile (GH, filename, &advertised_file);\n\n /* don't print the header again after recovery */\n if (! ioUtilGH->recovered)\n {\n /* write the file info and the header */\n if (CCTK_Equals (out_fileinfo, \"parameter filename\") ||\n CCTK_Equals (out_fileinfo, \"all\"))\n {\n buffer[0] = 0;\n CCTK_ParameterFilename (sizeof (buffer), buffer);\n fprintf (file, \"%cParameter file %s\\n\", comment_char, buffer);\n }\n if (CCTK_Equals (out_fileinfo, \"creation date\") ||\n CCTK_Equals (out_fileinfo, \"all\"))\n {\n buffer[0] = 0;\n Util_CurrentDate (sizeof (buffer), buffer);\n fprintf (file, \"%cCreated %s \", comment_char, buffer);\n Util_CurrentTime (sizeof (buffer), buffer);\n fprintf (file, \"%s\\n\", buffer);\n }\n if (number_sets==-1)\n {\n if (CCTK_Equals (out_fileinfo, \"axis labels\") ||\n CCTK_Equals (out_fileinfo, \"all\"))\n {\n fprintf (file, \"%cx-label time\\n\", comment_char);\n fprintf (file, \"%cy-label %s\\n\", comment_char, advertised_file.varname);\n }\n }\n else\n {\n if (CCTK_Equals (out_fileinfo, \"axis labels\") ||\n CCTK_Equals (out_fileinfo, \"all\"))\n {\n fprintf (file, \"%cx-label x\\n\", comment_char);\n fprintf (file, \"%cy-label %s\\n\", comment_char,advertised_file.varname);\n fprintf(file, \"\\n\\n\");\n }\n }\n }\n }\n\n free (fullname);\n\n return (file);\n}\n\n\n /*@@\n @routine WavExtrL_SetupGH\n @date Sat Feb 6 1999\n @author Gabrielle Allen\n @desc\n Allocates and sets up Extract's GH extension structure\n @enddesc\n\n @calls CCTK_RegisterIOMethod\n CCTK_RegisterIOMethodOutputGH\n CCTK_RegisterIOMethodTimeToOutput\n CCTK_RegisterIOMethodTriggerOutput\n\n @var config\n @vdesc the CCTK configuration as provided by the flesh\n @vtype tFleshConfig *\n @vio unused\n @endvar\n @var conv_level\n @vdesc the convergence level\n @vtype int\n @vio unused\n @endvar\n @var GH\n @vdesc Pointer to CCTK grid hierarchy\n @vtype cGH *\n @vio in\n @endvar\n\n @returntype void *\n @returndesc\n pointer to the allocated GH extension structure\n @endreturndesc\n@@*/\nstatic void *WavExtrL_SetupGH (tFleshConfig *config, int conv_level, cGH *GH)\n{\n int i;\n extractGH *myGH;\n const char *my_out_dir;\n DECLARE_CCTK_PARAMETERS\n\n CCTK_INFO(\"setup GH\");\n\n /* suppress compiler warnings about unused parameters */\n (void) (config + 0);\n (void) (conv_level + 0);\n (void) (GH + 0);\n\n /* allocate the GH extension and its components */\n myGH = (extractGH *) malloc (sizeof (extractGH));\n if (myGH)\n {\n i = CCTK_RegisterIOMethod (\"WaveExtractL\");\n CCTK_RegisterIOMethodTimeToOutput (i, WavExtrL_TimeForOutput);\n\n i = CCTK_NumVars ();\n\n myGH->filenameList = NULL;\n myGH->this_time = 0.0;\n\n /* get the name of Extract's output directory */\n my_out_dir = out_dir;\n if (*my_out_dir == 0)\n {\n my_out_dir = io_out_dir;\n }\n\n /* skip the directory pathname if output goes into current directory */\n if (strcmp (my_out_dir, \".\"))\n {\n i = strlen (my_out_dir);\n myGH->out_dir = (char *) malloc (i + 2);\n strcpy (myGH->out_dir, my_out_dir);\n myGH->out_dir[i] = '/';\n myGH->out_dir[i+1] = 0;\n }\n else\n {\n myGH->out_dir = strdup (\"\");\n }\n\n /* create the output dir */\n if (*myGH->out_dir && CCTK_MyProc (GH) == 0)\n {\n i = IOUtil_CreateDirectory (GH, myGH->out_dir, 0, 0);\n if (i < 0)\n {\n CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Couldn't create Extract output directory \"\n \"'%s'\", myGH->out_dir);\n }\n else if (i >= 0 && verbose)\n {\n CCTK_VInfo (CCTK_THORNSTRING, \"Output directory is '%s'\",\n myGH->out_dir);\n }\n }\n\n CCTK_VInfo(CCTK_THORNSTRING,\"Setting out_every to %d\",(int)out_every);\n myGH->out_every=out_every;\n }\n else {\n CCTK_WARN(1,\"unable to get GH\");\n }\n\n return (myGH);\n}\n\n\n\n/********************************************************************\n ******************** Internal Routines ************************\n ********************************************************************/\n /*@@\n @routine WavExtrL_CheckSteerableParameters\n @date Fri Dec 20 2002\n @author Gabrielle Allen\n @desc\n Re-evaluates 'Extract::out_every' and/or 'IO::out_every'\n resp. to set myGH->out_every to the frequency of Extract\n output. Copied from Thomas Radke routines in other IO thorns.\n @enddesc\n @calls CCTK_ParameterQueryTimesSet\n\n @var myGH\n @vdesc Pointer to IOBasic's GH extension\n @vtype iobasicGH *\n @vio in\n @endvar\n@@*/\nvoid WavExtrL_CheckSteerableParameters (extractGH *myGH)\n{\n int out_old;\n int i;\n char parname[256];\n char out_everyname[256];\n DECLARE_CCTK_PARAMETERS\n\n if (verbose>2) CCTK_INFO(\"Checking steerable out_every parameter\");\n\n /* how often to output */\n\n out_old = myGH->out_every;\n myGH->out_every = out_every >= 0 ? out_every : io_out_every;\n\n /* report if frequency changed */\n if (myGH->out_every != out_old )\n {\n if (myGH->out_every > 0)\n {\n CCTK_VInfo (CCTK_THORNSTRING, \"Periodic output changed\"\n \"from %d to every %d iterations\", out_old, myGH->out_every);\n /* change all individual detectors */\n snprintf(out_everyname,sizeof out_everyname,\"%d\",(int)out_every);\n for (i=0;i<=maximum_detector_number;i++) {\n /* can't set array parameters in one go, build up name */\n snprintf(parname,sizeof parname,\"out_every_det[%d]\",i);\n if (verbose>3) printf(\"setting %s\\n\",parname);\n CCTK_ParameterSet(parname, CCTK_THORNSTRING, out_everyname);\n }\n }\n else\n {\n CCTK_INFO (\"Periodic output turned off\");\n }\n }\n\n /* return if there's nothing to do */\n if (myGH->out_every <= 0)\n {\n return;\n }\n\n}\n\n", + "SetupDetectors.F90": "#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Functions.h\"\n\nsubroutine WavExtrL_Setup_Detectors(CCTK_ARGUMENTS)\n\n use WavExtrLConstants\n\n implicit none\n\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n DECLARE_CCTK_FUNCTIONS\n\n CCTK_REAL xmin,xmax\n CCTK_REAL ymin,ymax\n CCTK_REAL zmin,zmax\n\n CCTK_REAL dx,dy,dz\n\n CCTK_REAL rmax,rmin\n CCTK_REAL rmax_grid\n\n CCTK_REAL rstart,rend,dr,radius\n CCTK_INT idetector\n\n CCTK_INT ierror\n\n ! interpolator\n CCTK_INT :: interp_handle, table_handle, coord_system_handle\n CCTK_POINTER, dimension(3) :: interp_coords\n CCTK_INT, dimension(1) :: in_array\n CCTK_POINTER, dimension(1) :: out_array\n character(len=200) :: interp\n CCTK_INT :: interp_len\n character(len=20) :: interp_order\n CCTK_INT, dimension(1) :: out_types\n CCTK_INT, dimension(2) :: lsh\n CCTK_REAL, dimension(4,1) :: interp_tmp_x, interp_tmp_y, interp_tmp_z\n\n integer rmax_found\n\n CCTK_REAL grid_acc\n\n integer :: i\n\n character(1000) :: infoline\n\n logical :: firstcal\n\n data firstcal / .true. /\n save firstcal\n\n! _________________________________________________________________\n\n rmax_grid = -1d0 ! poison radius to detect when not set\n\n if (verbose>2) then\n call CCTK_INFO(\"Setup of detectors\")\n end if\n\n if (.not. firstcal) then\n return\n end if\n\n! save firstcal var\n firstcal=.false.\n\n dx=CCTK_DELTA_SPACE(1)\n dy=CCTK_DELTA_SPACE(2)\n dz=CCTK_DELTA_SPACE(3)\n\n ! Check if dx=dy=dz\n if (cartoon .ne. 0) then\n grid_acc=cartoon_grid_acc\n else\n grid_acc=1.d-5\n end if\n if ( (dx-dy)/dx.gt.grid_acc .or. (dx-dz)/dx.gt.grid_acc ) then\n call CCTK_WARN(1,\"Strange grid: dx,dy,dz are not equal!\")\n write(infoline,'(A,G20.8,A,G20.8,A,G20.8)') ' dx = ',dx,' dy = ',dy,' dz = ',dz\n call CCTK_WARN(1,infoline)\n call CCTK_WARN(1,\"No Extraction will be done.\")\n do_nothing=1\n current_detector=0\n return\n end if\n\n if (check_rmax .eq. 1) then\n ! Find the maximum radius we can use for our detectors. Coordinate Range:\n call CCTK_CoordRange(ierror,cctkGH,xmin,xmax,-1,\"x\",\"cart3d\")\n call CCTK_CoordRange(ierror,cctkGH,ymin,ymax,-1,\"y\",\"cart3d\")\n call CCTK_CoordRange(ierror,cctkGH,zmin,zmax,-1,\"z\",\"cart3d\")\n \n rmax=max(xmax,ymax,zmax) - 1.0e-5 * maxval(cctk_delta_space)\n rmax_grid=rmax\n \n ! call interpolator silently and check if a sphere with rmax would work.\n ! if not, reduce rmax by dx and try again. keep trying until it works.\n call CCTK_FortranString(interp_len, interpolation_operator, interp)\n \n call CCTK_InterpHandle(interp_handle,interp(1:interp_len))\n if ( interp_handle .lt. 0 ) then\n call CCTK_WARN( 0, \"Cannot get handle for interpolation. Forgot to activate an implementation providing interpolation operators?\" )\n end if\n \n write(interp_order,'(a6,i1)') 'order=',interpolation_order\n call Util_TableCreateFromString(table_handle,interp_order)\n if ( table_handle .lt. 0 ) then\n call CCTK_WARN( 0, \"Cannot create parameter table for interpolator\" )\n end if\n \n call CCTK_CoordSystemHandle ( coord_system_handle, \"cart3d\" )\n if ( coord_system_handle .lt. 0) then\n call CCTK_WARN( 0, \"Cannot get handle for observers coordinate system. Forgot to activate an implementation providing coordinates?\" )\n end if\n \n ! suppress_warnings is needed to get rid of warning messages\n \n ! loop down rmax until interpolator does not return error anymore\n rmax_found=0\n do while (rmax_found .ne. 1)\n ! test xmax,ymax,zmax and diagonal element only\n interp_tmp_x = zero\n interp_tmp_y = zero\n interp_tmp_z = zero\n interp_tmp_x(1,1) = origin_x + rmax\n interp_tmp_y(1,1) = dx\n interp_tmp_z(1,1) = dx\n interp_tmp_x(2,1) = dx\n interp_tmp_y(2,1) = origin_y + rmax\n interp_tmp_z(2,1) = dx\n interp_tmp_x(3,1) = dx\n interp_tmp_y(3,1) = dx\n interp_tmp_z(3,1) = origin_z + rmax\n interp_tmp_x(4,1) = origin_x + 1.d0/sqrt(3.d0)*rmax\n interp_tmp_y(4,1) = origin_y + 1.d0/sqrt(3.d0)*rmax\n interp_tmp_z(4,1) = origin_z + 1.d0/sqrt(3.d0)*rmax\n lsh(1)=4\n lsh(2)=1\n \n interp_coords(1) = CCTK_PointerTo(interp_tmp_x)\n interp_coords(2) = CCTK_PointerTo(interp_tmp_y)\n interp_coords(3) = CCTK_PointerTo(interp_tmp_z)\n \n call CCTK_VarIndex(in_array(1), \"ADMBase::alp\")\n !!$ call CCTK_VarIndex(in_array(1), \"WaveExtractL::gxx_tmp\")\n out_array(1) = CCTK_PointerTo(psii)\n out_types = CCTK_VARIABLE_REAL\n \n if (verbose > 3) then\n write(infoline,'(A,F6.2)') 'test call to interpolator at rmax=',rmax\n call CCTK_INFO(infoline)\n end if\n \n call CCTK_InterpGridArrays(ierror, cctkGH, 3, interp_handle, &\n table_handle, coord_system_handle, &\n lsh(1) * lsh(2), CCTK_VARIABLE_REAL, &\n interp_coords, &\n 1, &\n in_array, &\n 1, &\n out_types, &\n out_array)\n if (ierror.ne.0) then\n if (make_interpolator_warnings_fatal .ne. 0) then\n call CCTK_WARN(0,\"test interpolation to determine rmax failed\")\n else\n call CCTK_WARN(1,\"test interpolation to determine rmax failed\")\n end if\n \n if (verbose > 1) then\n write(infoline,'(A,F6.2)') 'rmax=',rmax\n call CCTK_INFO(infoline)\n end if\n else\n if (verbose>4) then\n write(infoline,'(A,F6.2)') 'rmax found and nailed at ',rmax\n call CCTK_INFO(infoline)\n end if\n rmax_found=1\n end if\n \n rmax=rmax-dx\n end do\n else\n rmax = 1e6\n rmax_found=1\n endif\n\n\n if (verbose>1) then\n write(infoline,'(A,F6.2)') ' ... rmax=',rmax\n call CCTK_INFO(infoline)\n end if\n\n\n ! for minimum radius we just use 3*dx arbitrarily\n rmin = 3.d0*dx\n\n if (verbose>1) then\n write(infoline,'(A,F6.2)') ' ... rmin=',rmin\n call CCTK_INFO(infoline)\n end if\n\n\n ! There are 2 different modes. In the normal mode the user specifies\n ! locations for a bunch of detectors. Alternatively the user can\n ! ask for a range in which detectors should be placed. In that case\n ! we put as many detectors as requested by maximum_detector_number on\n ! the grid.\n\n ! Method 1: Detectors given\n if (CCTK_EQUALS(detection_mode,\"specific detectors\")) then\n ! Check each detector if it is out of range.\n do i=1,maximum_detector_number\n if (surface_index(i)>=0) then\n continue\n end if\n if(detector_radius(i)>rmax) then\n write(infoline,'(A,I2,A,F6.2,A,F6.2)') &\n ' Out of RANGE! Detector No. ',&\n i,' radius=',detector_radius(i),'> rmax=',rmax\n call CCTK_WARN(1,infoline)\n detector_radius(i)=zero\n end if\n end do\n\n ! Resort the detector array and reset maximum_detector_number\n do i=1,maximum_detector_number\n if (i>1) then\n if(detector_radius(i-1).eq.zero .and. detector_radius(i).ne.zero &\n .and. surface_index(i)<0 .and. surface_index(i-1)<0) then\n detector_radius(i-1)=detector_radius(i)\n detector_radius(i)=zero\n end if\n end if\n if(detector_radius(i).eq.zero .and. surface_index(i)<0) then\n maximum_detector_number=maximum_detector_number-1\n end if\n end do\n\n ! Check if we have no detectors left\n if(maximum_detector_number .eq. 0) then\n do_nothing=1\n current_detector=0\n return\n end if\n\n ! Method 2: Cauchy extraction\n else if (CCTK_EQUALS(detection_mode,\"Cauchy extraction\")) then\n ! check start and end values\n if (Cauchy_radius_start_coord == -two .and. &\n Cauchy_radius_start_factor == -two .and. &\n Cauchy_radius_end_coord == -two .and. &\n Cauchy_radius_end_factor == -two) Then\n write(infoline,'(A)') &\n \"You have specfied Cauchy extraction but deactivated all detectors\"\n call CCTK_WARN(1,infoline)\n maximum_detector_number=0\n do_nothing=1\n current_detector=0\n return\n end if\n\n ! set start and end radius\n ! 1) by coordinate location in par-file\n if (Cauchy_radius_start_coord+one .lt. 1.d-13) then\n rstart=zero\n else if (Cauchy_radius_start_coord > zero) then\n rstart=Cauchy_radius_start_coord\n print*,'set rstart'\n end if\n if (Cauchy_radius_end_coord == -one) then\n rend=rmax\n else if (Cauchy_radius_end_coord > -one) then\n rend=Cauchy_radius_end_coord\n end if\n\n print*,'rstart',rstart\n\n ! 2) by factor of grid size\n if (Cauchy_radius_start_factor .gt. zero) then\n if (rmax_grid .lt. zero) then\n write (infoline, '(\"attempted to use negative rmax_grid: \",&\n & g15.8,\" most likely due to not setting WaveExtract::check_rmax\")') rmax_grid\n call CCTK_ERROR(infoline)\n STOP\n end if\n rstart=rmax_grid*Cauchy_radius_start_factor\n print*,\"set rstart again\"\n end if\n if (Cauchy_radius_end_factor .gt. zero) then\n if (rmax_grid .lt. zero) then\n write (infoline, '(\"attempted to use negative rmax_grid: \",&\n & g15.8,\" most likely due to not setting WaveExtract::check_rmax\")') rmax_grid\n call CCTK_ERROR(infoline)\n STOP\n end if\n rend=rmax_grid*Cauchy_radius_end_factor\n end if\n\n ! work out dr\n ! user given or from maximum_detector_number\n if (Cauchy_radius_dr .gt. zero) then\n dr=Cauchy_radius_dr\n else\n if (maximum_detector_number>1) then\n dr=(rend - rstart)/(maximum_detector_number -1)\n else\n call CCTK_WARN(1,\"you need to set maximum_detector_number>1\")\n do_nothing=1\n current_detector=0\n return\n end if\n if (cauchy_radius_extreme .ne. 0) then\n rstart=rmin\n dr=dx\n end if\n end if\n\n if (verbose>0) then\n write(infoline,'(A,F10.4,A,F10.4,A,F10.4)') &\n 'Cauchy detector setup: [',rstart,' --- ',rend,' ] every: ',dr\n call CCTK_INFO(infoline)\n end if\n\n if (dr < dx) then\n write(infoline,'(A,A,F5.3,A,F5.3)') &\n 'dr used in extraction is smaller than grid spacing: ', &\n 'dr = ',dr,' < dx= ',dx\n call CCTK_WARN(1,infoline)\n call CCTK_WARN(1,\"This is not necessarily a problem ;-)\")\n end if\n\n if (rstart < rmin) then\n call CCTK_WARN(1,\"Don't specify the first detector < rmin. Increasing to rmin.\")\n rstart = rmin\n end if\n\n if (rend>rmax) then\n call CCTK_WARN(1,\"some detectors are out of the possible grid and will be dropped\")\n call CCTK_WARN(1,\"to get more detectors into the grid:\")\n call CCTK_WARN(1,\" adjust interpolation stencil or increase resolution\")\n do while (rend>rmax)\n write(infoline,'(A,G20.8)') ' Dropping Detector at location: ',rend\n call CCTK_INFO(infoline)\n rend=rend-dr\n end do\n write(infoline,'(A,G20.8)') ' Adjusted outer detector range: ',rend\n call CCTK_WARN(1,infoline)\n end if\n\n if (rstart >= rend) then\n call CCTK_WARN(1,\"very strange detector setup, start range > end range\")\n call CCTK_WARN(1,\"we have no useable detectors - NO EXTRACTION\")\n do_nothing=1\n current_detector=0\n return\n end if\n\n ! Compute the locations of the detector\n idetector=1\n radius=rstart\n maximum_detector_number=1\n do while (radius<=rend)\n detector_radius(idetector)=radius\n\n radius=radius+dr\n idetector=idetector+1\n maximum_detector_number=maximum_detector_number+1\n end do\n maximum_detector_number=maximum_detector_number-1\n end if\n\n if (maximum_detector_number.eq.0) then\n call CCTK_WARN(1,\"no appropriate detectors found\")\n do_nothing=1\n current_detector=0\n return\n end if\n\n ! Set the current detector: we go through them backwards\n current_detector=maximum_detector_number\n do_nothing=0\n current_detector=0\n\n if (verbose > 1) then\n call CCTK_INFO(\"We are done with the detector setup.\")\n write(infoline,'(A,I5,A)') ' We have ', &\n maximum_detector_number,' detectors'\n call CCTK_INFO(infoline)\n idetector=1\n do idetector=1,maximum_detector_number\n write(infoline,'(A,I5,A,F10.4)') ' detector', &\n idetector,' Radius ',detector_radius(idetector)\n call CCTK_INFO(infoline)\n end do\n end if\n\n call CCTK_INFO(\"exiting Setup_Detectors...\")\n\n end subroutine WavExtrL_Setup_Detectors\n", + "ResetCurrDet.c": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see . */\n\n /*@@\n @file ResetCurrDet.c\n @date 16 Jul 2003\n @author Frank Herrmann\n @desc \n Reset the current_detector value, this is needed for the while loop in\n the scheduler.\n @enddesc \n @version $Id: ResetCurrDet.c 37 2008-02-14 03:30:05Z schnetter $\n @@*/\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\nvoid WavExtrL_ResetCurrDet(CCTK_ARGUMENTS);\n\n /*@@\n @routine WavExtrL_Reset_CurrDet\n @date 16 Jul 2003\n @author Frank Herrmann\n @desc \n Reset the current_detector value, this is needed for the while loop in\n the scheduler.\n @enddesc \n @calls \n@@*/\nvoid WavExtrL_ResetCurrDet(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n\n if (verbose>0)\n CCTK_VInfo(CCTK_THORNSTRING,\"Calling WaveExtractL at time: %f\",(double)cctkGH->cctk_time);\n\n if (verbose>2)\n CCTK_INFO(\"Reset the current_detector value\");\n\n if (verbose >3)\n CCTK_VInfo(CCTK_THORNSTRING,\"iteration %d detector %d out_every_det[] %d\",cctk_iteration,(int)*current_detector,(int)my_out_every_det[*current_detector]);\n\n if (cctk_iteration != 0) {\n if (cctk_iteration % my_out_every_det[*current_detector] != 0)\n {\n *do_nothing=1;\n }\n else if (Cauchy_time_ID!=0) {\n if((cctk_iteration-1) % my_out_every_det[*current_detector] == 0) {\n *do_nothing=0;\n }\n else if ((cctk_iteration+1) % my_out_every_det[*current_detector] == 0) {\n *do_nothing=0;\n }\n }\n\n if (cctk_iteration % my_out_every_det[*current_detector] == 0) {\n *do_nothing=0;\n }\n }\n else\n *do_nothing = 0;\n\n if (*do_nothing == 1) {\n return;\n }\n\n *current_detector=maximum_detector_number;\n\n}\n", + "extractGH.h": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see . */\n\n /*@@\n @header extractGH.h\n @date Friday 18th September 1999\n @author Gabrielle Allen\n @desc\n The extensions to the GH structure from WaveExtract.\n @enddesc\n @@*/\n\n#include \"StoreNamedData.h\"\n\ntypedef struct EXTRACT_GH\n{\n CCTK_REAL this_time;\n CCTK_REAL last_time; \n\n /* how often to output */\n int out_every;\n\n /* directory in which to place scalar output */\n char *out_dir;\n\n /* database for names of output files that were already created */\n pNamedData *filenameList;\n\n} extractGH;\n\n\n/* prototypes of functions to be registered */\nint WavExtrL_TimeForOutput (const cGH *GH, int vindex);\nvoid WavExtrL_CheckSteerableParameters (extractGH *myGH);\n", + "SubtractSphericalMetric.F90": "!/*@@\n! @file Subtract_spherical_metric.F90\n! @date unknown\n! @author unknown\n! @desc\n! Subtract spherical background from metric\n! @enddesc\n! @version $Id: SubtractSphericalMetric.F90 55 2008-10-03 19:53:10Z reisswig $\n! @@*/\n\n\n#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Functions.h\"\n\n!/*@@\n! @routine WavExtrL_Subtr_spher_metric\n! @date unknown\n! @author unknown\n! @desc\n! Subtract spherical background from metric\n! @enddesc\n!@@*/\nsubroutine WavExtrL_SubtrSpherMetric(CCTK_ARGUMENTS)\n\n implicit none\n\n CCTK_INT :: istat\n\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n DECLARE_CCTK_FUNCTIONS\n! _________________________________________________________________\\\n\n if (verbose>2) &\n call CCTK_INFO(\"Subtract Spherical Background\")\n\n if (do_nothing==1) &\n return\n\n if (cctk_iteration .ne. 0) then\n if (mod(cctk_iteration,my_out_every_det(current_detector)).ne.0) then\n if (verbose>2) call CCTK_INFO(\"No time for this detector\")\n return\n end if\n end if\n\n if (calc_when_necessary .eq. 1) then\n if (cctk_time .lt. current_detector_radius-50) then\n if (verbose>2) call CCTK_INFO(\"No time for this detector\")\n return\n endif\n call CCTK_IsFunctionAliased(istat, \"MergerHandler_WeHaveMerger\")\n if (istat .eq. 1) then\n if (MergerHandler_WeHaveMerger() .eq. 1) then\n if (cctk_time .gt. MergerHandler_MergerTime()+current_detector_radius+ringdown_margin) then\n if (verbose>2) call CCTK_INFO(\"No time for this detector\")\n return\n endif\n endif\n endiF\n end if\n\n grr = grr - sph_grr\n gtt = gtt - sph_gtt\n gpp = gpp - sph_gtt*sintheta**2\n dr_gtt = dr_gtt - sph_dr_gtt\n dr_gpp = dr_gpp - sph_dr_gtt*sintheta**2\n\nend subroutine WavExtrL_SubtrSpherMetric\n", + "ProjectSphere.cc": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see . */\n\n#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Functions.h\"\n\n#include \n#include \"carpetinterp2.hh\"\n\nusing namespace std;\nusing namespace CarpetInterp2;\n\n\nstruct interp_setup_t {\n fasterp_setup_t * fasterp_setup;\n int npoints;\n\n interp_setup_t (int npoints_) : fasterp_setup (NULL), npoints (npoints_) {}\n ~interp_setup_t () { if (fasterp_setup) delete fasterp_setup; }\n};\nvector interp_setups; // has to be the same number as there are detectors!\n\n\n#define SINDEX(lsh, i, j) j*lsh[0]+i\n\nextern \"C\" void WavExtrL_ProjectSphere(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n \n int ierr = 0;\n int di;\n int lsh[2], lbnd[2];\n \n if (verbose>2) CCTK_INFO(\"Interpolating metric and derivatives onto sphere\");\n\n if (*do_nothing == 1) return;\n\n if (cctk_iteration != 0)\n {\n if (cctk_iteration % my_out_every_det[*current_detector-1] != 0)\n {\n if (verbose>2) CCTK_INFO(\"No time for this detector\");\n return;\n }\n }\n\n *current_detector_radius = detector_radius[*current_detector-1];\n di=*current_detector-1;\n\n // Sanity Check\n if (*current_detector_radius < 1.e-10)\n {\n *do_nothing = 1;\n CCTK_WARN(1,\"This should never happen: The detector radius is 0!\");\n return;\n }\n\n if (calc_when_necessary == 1)\n {\n if (cctk_time < *current_detector_radius-50)\n {\n if (verbose>2) CCTK_INFO(\"No time for this detector\");\n return;\n }\n int istat = CCTK_IsFunctionAliased(\"MergerHandler_WeHaveMerger\");\n if (istat == 1)\n {\n if (MergerHandler_WeHaveMerger() == 1)\n {\n if (cctk_time > MergerHandler_MergerTime()+*current_detector_radius+ringdown_margin)\n {\n if (verbose>2) CCTK_INFO(\"No time for this detector\");\n return;\n }\n }\n }\n }\n \n\n if (verbose>1)\n cout << \"Analysing Detector No.: \" << *current_detector << \" Radius \" << *current_detector_radius << endl;\n\n\n\n // local shape of the 2D grid arrays\n ierr = CCTK_GrouplshGN(cctkGH, 2, lsh, \"WaveExtractL::surface_arrays\");\n if ( ierr < 0 )\n CCTK_WARN(0, \"cannot get local size for surface arrays\");\n\n \n int number_of_vars = 12;\n\n vector varnames(number_of_vars);\n \n varnames[0] = \"admbase::gxx\";\n varnames[1] = \"admbase::gxy\";\n varnames[2] = \"admbase::gxz\";\n varnames[3] = \"admbase::gyy\";\n varnames[4] = \"admbase::gyz\";\n varnames[5] = \"admbase::gzz\";\n varnames[6] = \"admderivatives::gxx_dr\";\n varnames[7] = \"admderivatives::gxy_dr\";\n varnames[8] = \"admderivatives::gxz_dr\";\n varnames[9] = \"admderivatives::gyy_dr\";\n varnames[10] = \"admderivatives::gyz_dr\";\n varnames[11] = \"admderivatives::gzz_dr\";\n\n // get the input variable's index\n vector varindices (number_of_vars, -1);\n \n for (int i=0; i < number_of_vars; ++i)\n {\n varindices[i] = CCTK_VarIndex(varnames[i].c_str());\n if (varindices[i] < 0)\n CCTK_VWarn(CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"couldn't get index of slice variable '%s'\", varnames[i].c_str());\n }\n \n vector values (number_of_vars, static_cast(NULL));\n \n // set output pointers\n values[0] = gxxi;\n values[1] = gxyi;\n values[2] = gxzi;\n values[3] = gyyi;\n values[4] = gyzi;\n values[5] = gzzi;\n values[6] = dr_gxxi;\n values[7] = dr_gxyi;\n values[8] = dr_gxzi;\n values[9] = dr_gyyi;\n values[10] = dr_gyzi;\n values[11] = dr_gzzi;\n \n int interpolator_order = interpolation_stencil;\n \n // set up the interpolation\n interp_setups.resize(maximum_detector_number, NULL);\n assert(di > 0);\n assert(interp_setups.size() > (unsigned)di);\n interp_setup_t* &interp_setup = interp_setups[di];\n if (not interp_setup or interp_setup->fasterp_setup->outofdate()) {\n if (interp_setup)\n delete interp_setup;\n interp_setup = new interp_setup_t(lsh[0]*lsh[1]);\n\n // allocate storage for coordinates\n fasterp_glocs_t locations (interp_setup->npoints);\n\n // get Cartesian coordinate values of gridpoints on spherical surface\n CCTK_REAL rad = *current_detector_radius;\n for (int ip=0; ip < lsh[1]; ++ip) {\n for (int it=0; it < lsh[0]; ++it) {\n const int l = SINDEX(lsh, it, ip);\n locations.coords[0][l] = origin_x + rad * sintheta[l] * cosphi[l];\n locations.coords[1][l] = origin_y + rad * sintheta[l] * sinphi[l];\n locations.coords[2][l] = origin_z + rad * costheta[l];\n }\n }\n\n interp_setup->fasterp_setup =\n new fasterp_setup_t(cctkGH, locations, interpolator_order);\n }\n\n // do the interpolation\n assert(interp_setup->fasterp_setup);\n assert(interp_setup->npoints == lsh[0]*lsh[1]);\n interp_setup->fasterp_setup->interpolate (cctkGH, varindices, values);\n\n // Find out the lower bounds of the distributed integration grid arrays.\n ierr = CCTK_GrouplbndGN(cctkGH,2,lbnd,\"WaveExtractL::surface_integrands\");\n if ( ierr < 0 )\n CCTK_WARN(0, \"cannot get lower bounds for surface integrands\");\n\n // Convert to spherical coord. system\n // Note that these equations do not take the conformal factor into\n // account. That has to be done afterwards !!\n // FIXME : WARN, THESE EQUATIONS PROBABLY CANT WORK FOR PHYSICAL METRIC\n CCTK_REAL rad = *current_detector_radius;\n CCTK_REAL r2=rad*rad;\n for (int ip = 0; ip < lsh[1]; ++ip)\n {\n for (int it = 0; it < lsh[0]; ++it)\n {\n const int l = SINDEX(lsh, it, ip);\n \n CCTK_REAL ct = costheta[l]; \n CCTK_REAL ct2 = ct*ct;\n CCTK_REAL st = sintheta[l]; \n CCTK_REAL st2 = st*st;\n CCTK_REAL cp = cosphi[l]; \n CCTK_REAL cp2 = cp*cp;\n CCTK_REAL sp = sinphi[l]; \n CCTK_REAL sp2 = sp*sp;\n \n CCTK_REAL two = 2.0;\n \n CCTK_REAL tgxx = gxxi[l]; \n CCTK_REAL dgxx = dr_gxxi[l];\n CCTK_REAL tgxy = gxyi[l]; \n CCTK_REAL dgxy = dr_gxyi[l];\n CCTK_REAL tgxz = gxzi[l];\n CCTK_REAL dgxz = dr_gxzi[l];\n CCTK_REAL tgyy = gyyi[l];\n CCTK_REAL dgyy = dr_gyyi[l];\n CCTK_REAL tgyz = gyzi[l];\n CCTK_REAL dgyz = dr_gyzi[l];\n CCTK_REAL tgzz = gzzi[l]; \n CCTK_REAL dgzz = dr_gzzi[l];\n \n grr[l] = st2*cp2*tgxx +st2*sp2*tgyy +ct2*tgzz \n +two*( st2*cp*sp*tgxy +st*cp*ct*tgxz +st*ct*sp*tgyz);\n \n grt[l] = rad*(st*cp2*ct*tgxx +two*st*ct*sp*cp*tgxy \n +cp*(ct2-st2)*tgxz +st*sp2*ct*tgyy \n +sp*(ct2-st2)*tgyz-ct*st*tgzz);\n \n grp[l] = rad*st*(-st*sp*cp*tgxx -st*(sp2-cp2)*tgxy \n -sp*ct*tgxz +st*sp*cp*tgyy +ct*cp*tgyz);\n \n gtt[l] = r2*(ct2*cp2*tgxx +two*ct2*sp*cp*tgxy \n -two*st*ct*cp*tgxz +ct2*sp2*tgyy \n -two*st*sp*ct*tgyz +st2*tgzz);\n \n gtp[l] = r2*st*(-cp*sp*ct*tgxx -ct*(sp2-cp2)*tgxy \n +st*sp*tgxz +cp*sp*ct*tgyy -st*cp*tgyz);\n \n gpp[l] = r2*st2*(sp2*tgxx -two*cp*sp*tgxy +cp2*tgyy);\n \n \n dr_gtt[l] = two/rad*gtt[l] +r2*(ct2*cp2*dgxx \n +two*ct2*sp*cp*dgxy -two*st*ct*cp*dgxz \n +ct2*sp2*dgyy -two*st*sp*ct*dgyz +st2*dgzz);\n \n dr_gtp[l] = two/rad*gtp[l] +r2*st*(-cp*sp*ct*dgxx \n -ct*(sp2-cp2)*dgxy +st*sp*dgxz \n +cp*sp*ct*dgyy -st*cp*dgyz);\n \n dr_gpp[l] = two/rad*gpp[l] +r2*st2*(sp2*dgxx \n -two*cp*sp*dgxy+cp2*dgyy);\n \n if (it+lbnd[0]>=int_ntheta[*current_detector-1] ||\n ip+lbnd[1]>=int_nphi[*current_detector-1] )\n {\n grr[l]=0;\n grt[l]=0;\n grp[l]=0;\n gtt[l]=0;\n gtp[l]=0;\n gpp[l]=0;\n dr_gtt[l]=0;\n dr_gtp[l]=0;\n dr_gpp[l]=0;\n }\n }\n }\n\n}\n" + }, + "test": {}, + "doc": { + "documentation.tex": "\\documentclass{article}\n\n% Use the Cactus ThornGuide style file\n% (Automatically used from Cactus distribution, if you have a \n% thorn without the Cactus Flesh download this from the Cactus\n% homepage at www.cactuscode.org)\n\\usepackage{../../../../doc/latex/cactus}\n\n\\begin{document}\n\n\\author{Gabrielle Allen} \n\\title{Extracting Gravitational Waves and Other Quantities from Numerical Spacetimes}\n\n\\date{\\today}\n\n\\maketitle\n\n% START CACTUS THORNGUIDE\n\n% Add all definitions used in this documentation here \n\\def\\a {\\alpha}\n\\def\\b {\\beta}\n\\def\\p {\\phi}\n\\def\\t {\\theta}\n\\def\\Y {Y_{lm}}\n\\def\\Ys {Y^*_{lm}}\n\\def\\Yt {Y_{lm,\\theta}}\n\\def\\Ytt {Y_{lm,\\theta\\theta}}\n\\def\\Ytp {Y_{lm,\\theta\\phi}}\n\\def\\Yp {Y_{lm,\\phi}}\n\\def\\Ypp {Y_{lm,\\phi\\phi}}\n\\def\\Yz {Y_{l0}}\n\\def\\Yzt {Y_{l0,\\theta}}\n\\def\\Yztt{Y_{l0,\\theta\\theta}}\n\\def\\c {\\cos\\theta}\n\\def\\s {\\sin\\theta}\n\n\\begin{abstract}\n\n\\end{abstract}\n\n\\textbf{NB: This documentation is taken from the Extract thorn on which WaveExtractL is based. There may be some differences between WaveExtractL and Extract, which are not documented here.}\n\n\\section{Introduction}\n\nThorn Extract calculates first order gauge invariant waveforms from a\nnumerical spacetime, under the basic assumption that, at the spheres\nof extract the spacetime is approximately Schwarzschild. In addition,\nother quantities such as mass, angular momentum and spin can be\ndetermined.\n\nThis thorn should not be used blindly, it will always return some\nwaveform, however it is up to the user to determine whether this is\nthe appropriate expected first order gauge invariant waveform.\n\n\\section{Physical System}\n\n\\subsection{Wave Forms}\n\nAssume a spacetime $g_{\\alpha\\beta}$ which can be written as a Schwarzschild \nbackground $g_{\\alpha\\beta}^{Schwarz}$ with perturbations $h_{\\alpha\\beta}$:\n%\n\\begin{equation}\ng_{\\alpha\\beta} = g^{Schwarz}_{\\alpha\\beta} + h_{\\alpha\\beta}\n\\end{equation}\nwith\n%\n\\begin{equation}\n\\{g^{Schwarz}_{\\alpha\\beta}\\}(t,r,\\theta,\\phi) = \n\\left( \\begin{array}{cccc}\n -S & 0 & 0 & 0 \\\\\n 0 & S^{-1} & 0 & 0 \\\\\n 0 & 0 & r^2 & 0 \\\\\n 0 & 0 & 0 & r^2 \\sin^2\\theta\n\\end{array}\\right)\n\\qquad\nS(r)=1-\\frac{2M}{r}\n\\end{equation}\n%\nThe 3-metric perturbations $\\gamma_{ij}$ can be decomposed using tensor\nharmonics into $\\gamma_{ij}^{lm}(t,r)$ where\n$$\n \\gamma_{ij}(t,r,\\theta,\\phi)=\\sum_{l=0}^\\infty \\sum_{m=-l}^l\n \\gamma_{ij}^{lm}(t,r)\n$$\n%\nand\n%\n$$\n \\gamma_{ij}(t,r,\\t,\\p) = \\sum_{k=0}^6 p_k(t,r) {\\bf V}_k(\\t,\\p)\n$$\nwhere $\\{{\\bf V}_k\\}$ is some basis for tensors on a 2-sphere\nin 3-D Euclidean space.\n%\n%\n%\nWorking with the Regge-Wheeler basis (see Section~\\ref{reggewheeler})\nthe 3-metric is then expanded in terms of the (six) standard\nRegge-Wheeler functions $\\{c_1^{\\times lm}, c_2^{\\times lm},\nh_1^{+lm}, H_2^{+lm}, K^{+lm},\nG^{+lm}\\}$~\\cite{regge},~\\cite{moncrief74}. Where each of the\nfunctions is either {\\it odd} ($\\times$) or {\\it even} ($+$)\nparity. The decomposition is then written\n%\n\\begin{eqnarray}\n\\gamma_{ij}^{lm} & = & c_1^{\\times lm}(\\hat{e}_1)_{ij}^{lm}\n + c_2^{\\times lm}(\\hat{e}_2)_{ij}^{lm} \n\\nonumber\\\\\n & + & h_1^{+lm}(\\hat{f}_1)_{ij}^{lm} \n + A^2 H_2^{+lm}(\\hat{f}_2)_{ij}^{lm}\n + R^2 K^{+lm}(\\hat{f}_3)_{ij}^{lm}\n + R^2 G^{+lm}(\\hat{f}_4)_{ij}^{lm}\n\\end{eqnarray}\n%\nwhich we can write in an expanded form as \n%\n\\begin{eqnarray}\n\\gamma_{rr}^{lm} \n & = & A^2 H_2^{+lm} \\Y \n\\\\\n\\gamma_{r\\t}^{lm} \n & = & - c_1^{\\times lm} \\frac{1}{\\s} \\Yp+h_1^{+lm}\\Yt \n\\\\\n\\gamma_{r\\p}^{lm} \n & = & c_1^{\\times lm} \\s \\Yt+ h_1^{+lm}\\Yp \n\\\\\n\\gamma_{\\t\\t}^{lm} \n & = & c_2^{\\times lm}\\frac{1}{\\s}(\\Ytp-\\cot\\t \\Yp) \n + R^2 K^{+lm}\\Y + R^2 G^{+lm} \\Ytt \n\\\\\n\\gamma_{\\t\\p}^{lm} \n & = & -c_2^{\\times lm}\\s \\frac{1}{2} \n \\left(\n \\Ytt-\\cot\\t \\Yt-\\frac{1}{\\sin^2\\theta}\\Y \\right)\n + R^2 G^{+lm}(\\Ytp-\\cot\\t \\Yp)\n\\\\\n\\gamma_{\\p\\p}^{lm}\n & = & -\\s c_2^{\\times lm} (\\Ytp - \\cot\\t \\Yp)\n +R^2 K^{+lm}\\sin^2\\t \\Y\n +R^2 G^{+lm} (\\Ypp+\\s\\c \\Yt)\n\\end{eqnarray}\n%\nA similar decomposition allows the four gauge components of the\n4-metric to be written in terms of {\\it three} even-parity variables\n$\\{H_0,H_1,h_0\\}$ and the {\\it one} odd-parity variable $\\{c_0\\}$\n%\n\\begin{eqnarray}\n g_{tt}^{lm} & = & N^2 H_0^{+lm} \\Y \n\\\\\n g_{tr}^{lm} & = & H_1^{+lm} \\Y\n\\\\\n g_{t\\t}^{lm} & = & h_0^{+lm} \\Yt - c_0^{\\times lm}\\frac{1}{\\s}\\Yp\n\\\\\n g_{t\\p}^{lm} & = & h_0^{+lm} \\Yp + c_0^{\\times lm} \\s \\Yt\n\\end{eqnarray} \n% \nAlso from $g_{tt}=-\\alpha^2+\\beta_i\\beta^i$ we have\n%\n\\begin{equation}\n \\alpha^{lm} = -\\frac{1}{2}NH_0^{+lm}Y_{lm}\n\\end{equation}\n%\nIt is useful to also write this with the perturbation split into even and\nodd parity parts:\n$$\ng_{\\alpha\\beta} = {g}^{background}_{\\alpha\\beta} +\n \\sum_{l,m} g^{lm,odd}_{\\alpha\\beta}\n+\\sum_{l,m} g^{lm,even}_{\\alpha\\beta}\n$$\nwhere (dropping some superscripts)\n\\begin{eqnarray*}\n\\{g_{\\alpha\\beta}^{odd}\\}\n&=&\n\\left( \n\\begin{array}{cccc}\n0 & 0 & - c_0\\frac{1}{\\s}\\Yp\n & c_0 \\s \\Yt\n\\\\\n. & 0 & - c_1\\frac{1}{\\s} \\Yp\n & c_1 \\s \\Yt\n\\\\\n. & . & c_2\\frac{1}{\\s}(\\Ytp-\\cot\\t \\Yp) \n & c_2\\frac{1}{2} \\left(\\frac{1}{\\s}\n \\Ypp+\\c\\Yt-\\s\\Ytt\\right)\n\\\\\n.&.&.&c_2 (-\\s \\Ytp+\\c \\Yp)\n\\end{array}\n\\right)\n\\\\\n\\{g_{\\alpha\\beta}^{even}\\}\n&=&\n\\left( \n\\begin{array}{cccc}\nN^2 H_0\\Y & H_1\\Y & h_0\\Yt & h_0 \\Yp \\\\ \n. & A^2H_2\\Y & h_1\\Yt & h_1 \\Yp \\\\\n. & . & R^2K\\Y+r^2G\\Ytt & R^2(\\Ytp-\\cot\\t\\Yp) \\\\\n. & . & . & R^2 K\\sin^2\\t\\Y+R^2G(\\Ypp+\\s\\c\\Yt)\n\\end{array}\n\\right)\n\\end{eqnarray*}\n\nNow, for such a Schwarzschild background we can define two (and only two)\nunconstrained gauge invariant quantities \n $Q^{\\times}_{lm}=Q^{\\times}_{lm}(c_1^{\\times lm},c_2^{\\times lm})$ \nand\n $Q^{+}_{lm}=Q^{+}_{lm}(K^{+ lm},G^{+ lm},H_2^{+lm},h_1^{+lm})$, \nwhich from\n\\cite{abrahams96a} are\n\\begin{eqnarray}\nQ^{\\times}_{lm} \n & = & \\sqrt{\\frac{2(l+2)!}{(l-2)!}}\\left[c_1^{\\times lm}\n + \\frac{1}{2}\\left(\\partial_r c_2^{\\times lm} - \\frac{2}{r}\n c_2^{\\times lm}\\right)\\right] \\frac{S}{r}\n\\\\\nQ^{+}_{lm}\n & = & \\frac{1}{\\Lambda}\\sqrt{\\frac{2(l-1)(l+2)}{l(l+1)}}\n (4rS^2 k_2+l(l+1)r k_1) \n\\\\\n & \\equiv &\n \\frac{1}{\\Lambda}\\sqrt{\\frac{2(l-1)(l+2)}{l(l+1)}}\n \\left(l(l+1)S(r^2\\partial_r G^{+lm}-2h_1^{+lm})+\n 2rS(H_2^{+lm}-r\\partial_r K^{+lm})+\\Lambda r K^{+lm}\\right)\n\\end{eqnarray}\nwhere\n\\begin{eqnarray}\nk_1 & = & K^{+lm} + \\frac{S}{r}(r^2\\partial_r G^{+lm} - 2h^{+lm}_1) \\\\\nk_2 & = & \\frac{1}{2S}\n \\left[H^{+lm}_2-r\\partial_r k_1-\\left(1-\\frac{M}{rS}\\right) \n k_1 + S^{1/2}\\partial_r\n (r^2 S^{1/2} \\partial_r G^{+lm}-2S^{1/2}h_1^{+lm})\\right]\n\\\\\n&\\equiv& \\frac{1}{2S}\\left[H_2-rK_{,r}-\\frac{r-3M}{r-2M}K\\right]\n\\end{eqnarray}\n\n\\noindent\nNOTE: These quantities compare with those in Moncrief \\cite{moncrief74} by\n\\begin{eqnarray*}\n\\mbox{Moncriefs odd parity Q: }\\qquad Q^\\times_{lm} &=&\n \\sqrt{\\frac{2(l+2)!}{(l-2)!}}Q\n \\\\\n\\mbox{Moncriefs even parity Q: } \\qquad Q^+_{lm} &=&\n \\sqrt{\\frac{2(l-1)(l+2)}{l(l+1)}}Q\n\\end{eqnarray*}\n\nNote that these quantities only depend on the purely spatial \nRegge-Wheeler functions, and not the gauge parts. (In the Regge-Wheeler \nand Zerilli gauges, these are just respectively (up to a rescaling)\n the Regge-Wheeler \nand Zerilli functions).\nThese quantities satisfy the wave equations\n\\begin{eqnarray*}\n &&(\\partial^2_t-\\partial^2_{r^*})Q^\\times_{lm}+S\\left[\\frac{l(l+1)}{r^2}-\\frac{6M}{r^3}\n \\right]Q^{\\times}_{lm} = 0 \n \\\\\n &&(\\partial^2_t-\\partial^2_{r^*})Q^+_{lm}+S\\left[\n \\frac{1}{\\Lambda^2}\\left(\\frac{72M^3}{r^5}-\\frac{12M}{r^3}(l-1)(l+2)\\left(1-\\frac{3M}{r}\\right)\n \\right)+\\frac{l(l-1)(l+1)(l+2)}{r^2\\Lambda}\\right]Q^+_{lm}=0\n\\end{eqnarray*}\nwhere\n\\begin{eqnarray*}\n \\Lambda &=& (l-1)(l+2)+6M/r \\\\\n r^* &=& r+2M\\ln(r/2M-1)\n\\end{eqnarray*}\n \n\n\n\n\\section{Numerical Implementation}\n\nThe implementation assumes that the numerical solution, on a Cartesian\ngrid, is approximately Schwarzshild on the spheres of constant\n$r=\\sqrt(x^2+y^2+z^2)$ where the waveforms are extracted. The general\nprocedure is then:\n\n\\begin{itemize}\n\n \\item Project the required metric components, and radial derivatives\n of metric components, onto spheres of constant coordinate radius\n (these spheres are chosen via parameters).\n\n \\item Transform the metric components and there derivatives on the\n 2-spheres from Cartesian coordinates into a spherical coordinate\n system.\n\n \\item Calculate the physical metric on these spheres if a conformal\n factor is being used.\n\n \\item Calculate the transformation from the coordinate radius to an\n areal radius for each sphere.\n\n \\item Calculate the $S$ factor on each sphere. Combined with the\n areal radius This also produces an estimate of the mass.\n\n \\item Calculate the six Regge-Wheeler variables, and required radial\n derivatives, on these spheres by integration of combinations of the\n metric components over each sphere.\n\n \\item Contruct the gauge invariant quantities from these\n Regge-Wheeler variables.\n\n\\end{itemize}\n\n\\subsection{Project onto Spheres of Constant Radius}\n\nThis is performed by interpolating the metric components, and if\nneeded the conformal factor, onto the spheres. Although 2-spheres are\nhardcoded, the source code could easily be changed here to project\nonto e.g. 2-ellipsoids.\n\n\\subsection{Calculate Radial Transformation}\n\nThe areal coordinate $\\hat{r}$ of each sphere is calculated by\n%\n\\begin{equation}\n \\hat{r} = \\hat{r}(r) = \\left[\n \\frac{1}{4\\pi}\n \\int\\sqrt{\\gamma_{\\t\\t}\n \\gamma_{\\p\\p}}d\\t d\\p \\right]^{1/2}\n\\end{equation}\n%\nfrom which\n%\n\\begin{equation}\n\\frac{d\\hat{r}}{d\\eta} = \\frac{1}{16\\pi \\hat{r}}\n \\int\\frac{\\gamma_{\\t\\t,\\eta}\\gamma_{\\p\\p}+\\gamma_{\\t\\t}\\gamma_{\\p\\p,\\eta}}\n {\\sqrt{\\gamma_{\\t\\t}\\gamma_{\\p\\p}}} \\ d\\t d\\p\n\\end{equation}\n%\nNote that this is not the only way to combine metric components to get\nthe areal radius, but this one was used because it gave better values\nfor extracting close to the event horizon for perturbations of black\nholes.\n\n\\subsection{Calculate $S$ factor and Mass Estimate}\n\n\\begin{equation}\nS(\\hat{r}) = \\left(\\frac{\\partial\\hat{r}}{\\partial r}\\right)^2 \\int \\gamma_{rr} \\ d\\t d\\p\n\\end{equation}\n\n\\begin{equation}\nM(\\hat{r}) = \\hat{r}\\frac{1-S}{2}\n\\end{equation}\n\n\\subsection{Calculate Regge-Wheeler Variables}\n\n\\begin{eqnarray*}\nc_1^{\\times lm} &=& \\frac{1}{l(l+1)}\n \\int \\frac{\\gamma_{\\hat{r}\\p}Y^*_{lm,\\t}\n -\\gamma_{\\hat{r}\\t} Y^*_{lm,\\p} }\n {\\s}d\\Omega\n\\\\\nc_2^{\\times lm} & = & -\\frac{2}{l(l+1)(l-1)(l+2)}\n \\int\\left\\{\n \\left(-\\frac{1}{\\sin^2\\t}\\gamma_{\\t\\t}+\\frac{1}\n {\\sin^4\\t}\\gamma_{\\p\\p}\\right)\n (\\s Y^*_{lm,\\t\\p}-\\c Y^*_{lm,\\p})\n\\right.\n\\\\\n&&\\left.\n + \\frac{1}{\\s} \\gamma_{\\t\\p}\n (Y^*_{lm,\\t\\t}-\\cot\\t Y^*_{lm,\\t}\n -\\frac{1}{\\sin^2\\t}Y^*_{lm,\\p\\p}) \\right\\}d\\Omega\n\\\\\nh_1^{+lm} &=& \\frac{1}{l(l+1)}\n \\int \\left\\{\n \\gamma_{\\hat{r}\\t} Y^*_{lm,\\t} + \\frac{1}{\\sin^2\\t}\n \\gamma_{\\hat{r}\\p}Y^*_{lm,\\p}\\right\\} d\\Omega\n\\\\\nH_2^{+lm} &=& S \\int \\gamma_{\\hat{r}\\hat{r}} \\Ys d\\Omega\n\\\\\nK^{+lm} &=& \\frac{1}{2\\hat{r}^2} \\int \\left(\\gamma_{\\t\\t}+\n \\frac{1}{\\sin^2\\t}\\gamma_{\\p\\p}\\right)\\Ys\n d\\Omega\n\\\\\n &&+\\frac{1}{2\\hat{r}^2(l-1)(l+2)}\n\\int \\left\\{\n \\left(\\gamma_{\\t\\t}-\\frac{\\gamma_{\\p\\p}}{\\sin^2\\t}\\right)\n \\left(Y^*_{lm,\\t\\t}-\\cot\\t Y^*_{lm,\\t}-\\frac{1}{\\sin^2\\t}\n Y^*_{lm,\\p\\p}\\right) \n\\right.\n\\\\\n&&\\left.\n + \\frac{4}{\\sin^2\\t}\\gamma_{\\t\\p}(Y^*_{lm,\\t\\p}-\\cot\\t\n Y^*_{lm,\\p})\n \\right \\} d\\Omega\n\\\\\nG^{+lm} &=& \\frac{1}{\\hat{r}^2 l(l+1)(l-1)(l+2)}\n \\int \\left\\{\n \\left(\\gamma_{\\t\\t}-\\frac{\\gamma_{\\p\\p}}{\\sin^2\\t}\\right)\n \\left(Y^*_{lm,\\t\\t}-\\cot\\t Y^*_{lm,\\t}-\\frac{1}{\\sin^2\\t}\n Y^*_{lm,\\p\\p}\\right) \n\\right.\n\\\\\n&&\\left.\n +\\frac{4}{\\sin^2\\t}\\gamma_{\\t\\p}(Y^*_{lm,\\t\\p}-\\cot\\t\n Y^*_{lm,\\p})\n \\right\\}d\\Omega\n\\end{eqnarray*}\nwhere\n\\begin{eqnarray}\n\\gamma_{\\hat{r}\\hat{r}} & = & \\frac{\\partial r}{\\partial \\hat{r}}\n \\frac{\\partial r}{\\partial \\hat{r}}\n \\gamma_{rr} \n\\\\\n\\gamma_{\\hat{r}\\t} & = & \\frac{\\partial r}{\\partial \\hat{r}}\n \\gamma_{r\\t} \n\\\\\n\\gamma_{\\hat{r}\\p} & = & \\frac{\\partial r}{\\partial \\hat{r}}\n \\gamma_{r\\p}\n\\end{eqnarray}\n\n\\subsection{Calculate Gauge Invariant Quantities}\n\n\\begin{eqnarray}\nQ^{\\times}_{lm} \n & = & \\sqrt{\\frac{2(l+2)!}{(l-2)!}}\\left[c_1^{\\times lm}\n + \\frac{1}{2}\\left(\\partial_{\\hat{r}} c_2^{\\times lm} - \\frac{2}{\\hat{r}}\n c_2^{\\times lm}\\right)\\right] \\frac{S}{\\hat{r}}\n\\\\\nQ^{+}_{lm}\n & = & \\frac{1}{(l-1)(l+2)+6M/\\hat{r}}\\sqrt{\\frac{2(l-1)(l+2)}{l(l+1)}}\n (4\\hat{r}S^2 k_2+l(l+1)\\hat{r} k_1) \n\\end{eqnarray}\nwhere\n\\begin{eqnarray}\nk_1 & = & K^{+lm} + \\frac{S}{\\hat{r}}(\\hat{r}^2\\partial_{\\hat{r}} G^{+lm} - 2h^{+lm}_1) \\\\\nk_2 & = & \\frac{1}{2S}\n [H^{+lm}_2-\\hat{r}\\partial_{\\hat{r}} k_1-(1-\\frac{M}{\\hat{r}S}) k_1 + S^{1/2}\\partial_{\\hat{r}}\n (\\hat{r}^2 S^{1/2} \\partial_{\\hat{r}} G^{+lm}-2S^{1/2}h_1^{+lm}\n\\end{eqnarray}\n\n\\section{Using This Thorn}\n\nUse this thorn very carefully. Check the validity of the waveforms by running\ntests with different resolutions, different outer boundary conditions, etc\nto check that the waveforms are consistent.\n\n\\subsection{Basic Usage}\n\n\\subsection{Output Files}\n\nAlthough Extract is really an {\\tt ANALYSIS} thorn, at the moment it\nis scheduled at {\\tt POSTSTEP}, with the iterations at which output is\nperformed determined by the parameter {\\it itout}. Output files from\n{\\tt Extract} are always placed in the main output directory defined\nby {\\tt CactusBase/IOUtil}.\n\nOutput files are generated for each detector (2-sphere) used, and\nthese detectors are identified in the name of each output file by {\\tt\nR1}, {\\tt R2}, \\ldots.\n\nThe extension denotes whether coordinate time ({\\.tl}) or proper time\n({\\.ul}) is used for the first column.\n\n\\begin{itemize}\n\n \\item {\\tt rsch\\_R?.[tu]l} \n\n\tThe extracted areal radius on each 2-sphere.\n\n \\item {\\tt mass\\_R?.[tu]l}\n\n\tMass estimate calculated from $g_{rr}$ on each 2-sphere.\n\n \\item {\\tt Qeven\\_R?\\_??.[tu]l}\n\n\tThe even parity gauge invariate variable ({\\it waveform}) on \n\teach 2-sphere. This is a complex quantity, the 2nd column is \n\tthe real part, and the third column the imaginary part.\n\n \\item {\\tt Qodd\\_R?\\_??.[tu]l}\n\n\tThe odd parity gauge invariate variable ({\\it waveform}) on \n\teach 2-sphere. This is a complex quantity, the 2nd column is \n\tthe real part, and the third column the imaginary part.\n\n \\item {\\tt ADMmass\\_R?.[tu]l}\n\n\tEstimate of ADM mass enclosed within each 2-sphere.\n\t(To produce this set {\\tt doADMmass = ``yes''}).\n\n \\item {\\tt momentum\\_[xyz]\\_R?.[tu]l}\n\n\tEstimate of momentum at each 2-sphere.\n\t(To produce this set {\\tt do\\_momentum = ``yes''}).\n\n \\item {\\tt spin\\_[xyz]\\_R?.[tu]l}\n\n\tEstimate of momentum at each 2-sphere.\n\t(To produce this set {\\tt do\\_spin = ``yes''}).\n\n\n\\end{itemize}\n\n\\section{History}\n\nMuch of the source code\n for Extract comes from a code written outside\nof Cactus for extracting waveforms from data generated by the NCSA\nG-Code for compare with linear evolutions of waveforms extracted from\nthe Cauchy initial data. This work was carried out in collaboration\nwith Karen Camarda and Ed Seidel.\n\n\n\\section{Appendix: Regge-Wheeler Harmonics}\n\n\\label{reggewheeler}\n\n\\begin{eqnarray*}\n(\\hat{e}_1)^{lm} &=& \n\\left( \\begin{array}{ccc}\n0 & -\\frac{1}{\\s}\\Yp & \\s \\Yt \\\\\n. & 0 & 0 \\\\\n. & 0 & 0 \n\\end{array}\\right)\n\\\\\n(\\hat{e}_2)^{lm} &=& \n\\left( \\begin{array}{ccc} \n0 & 0 & 0 \\\\\n0 & \\frac{1}{\\s}(\\Ytp-\\cot\\t \\Yp) & . \\\\\n0 & -\\frac{\\s}{2}[\\Ytt-\\cot\\t \n \\Yt-\\frac{1}{\\sin^2\\t}\\Ypp] & \n -\\s [\\Ytp-\\cot\\t \\Yp]\n\\end{array}\\right)\n\\\\\n(\\hat{f}_1)^{lm} &=& \n\\left( \\begin{array}{ccc}\n 0 & \\Yt & \\Yp \\\\\n . & 0 & 0 \\\\\n . & 0 & 0 \n\\end{array}\\right)\n\\\\\n(\\hat{f}_2)^{lm} &=& \n\\left( \\begin{array}{ccc}\n\\Y & 0 & 0 \\\\\n0 & 0 & 0 \\\\\n0 & 0 & 0 \n\\end{array}\\right)\n\\\\\n(\\hat{f}_3)^{lm} &=& \n\\left( \\begin{array}{ccc}\n0 & 0 & 0 \\\\\n0 & \\Y & 0 \\\\\n0 & 0 & \\sin^2\\t \\Y \n\\end{array}\\right)\n\\\\\n(\\hat{f}_4)^{lm} &=& \n\\left( \\begin{array}{ccc}\n0 & 0 & 0 \\\\\n0 & \\Ytt & . \\\\\n0 & \\Ytp-\\cot \\t \\Yp & \\Ypp+ \\s \\c \\Yt\n\\end{array}\\right)\n\\end{eqnarray*}\n\n\\section{Appendix: Transformation Between Cartesian and Spherical Coordinates}\n\nFirst, the transformations between metric components in $(x,y,z)$ and $(r,\\t,\\p)$ coordinates. Here, $\\rho=\\sqrt{x^2+y^2}=r\\s$,\n\\begin{eqnarray*}\n \\frac{\\partial x}{\\partial r}\n &=&\n \\sin\\t\\cos\\p \n =\n \\frac{x}{r}\n\\\\\n \\frac{\\partial y}{\\partial r}\n &=&\n \\sin\\t\\sin\\p \n =\n \\frac{y}{r}\n\\\\\n \\frac{\\partial z}{\\partial r}\n &=&\n \\cos\\t \n =\n \\frac{z}{r}\n\\\\\n \\frac{\\partial x}{\\partial \\t}\n &=&\n r\\cos\\t\\cos\\p \n =\n \\frac{xz}{\\rho}\n\\\\\n \\frac{\\partial y}{\\partial \\t}\n &=&\n r\\cos\\t\\sin\\p \n =\n \\frac{yz}{\\rho}\n\\\\\n \\frac{\\partial z}{\\partial \\t}\n &=&\n -r\\sin\\t \n =\n -\\rho\n\\\\\n \\frac{\\partial x}{\\partial \\p}\n &=&\n -r\\sin\\t\\sin\\p\n =\n -y\n\\\\\n \\frac{\\partial y}{\\partial \\p}\n &=&\n r\\sin\\t\\cos\\p \n =\n x\n\\\\\n \\frac{\\partial z}{\\partial \\p}\n &=&\n 0\n\\end{eqnarray*}\n\n\n\\begin{eqnarray*}\n \\gamma_{rr} &=&\n \\frac{1}{r^2}\n (x^2\\gamma_{xx}+\n y^2\\gamma_{yy}+\n z^2\\gamma_{zz}+\n 2xy\\gamma_{xy}+\n 2xz\\gamma_{xz}+\n 2yz\\gamma_{yz})\n\\\\\n \\gamma_{r\\t} &=&\n \\frac{1}{r\\rho}\n (x^2 z \\gamma_{xx}\n +y^2 z \\gamma_{yy}\n -z \\rho^2 \\gamma_{zz}\n +2xyz \\gamma_{xy}\n +x(z^2-\\rho^2)\\gamma_{xz}\n +y(z^2-\\rho^2)\\gamma_{yz})\n\\\\\n \\gamma_{r\\p} &=&\n \\frac{1}{r}\n (-xy\\gamma_{xx}\n +xy\\gamma_{yy}\n +(x^2-y^2)\\gamma_{xy}\n -yz \\gamma_{xz}\n +xz\\gamma_{yz})\n\\\\\n \\gamma_{\\t\\t} &=&\n \\frac{1}{\\rho^2}\n (x^2z^2\\gamma_{xx}\n +2xyz^2\\gamma_{xy}\n -2xz\\rho^2\\gamma_{xz}\n +y^2z^2\\gamma_{yy}\n -2yz\\rho^2\\gamma_{yz}\n +\\rho^4\\gamma_{zz})\n\\\\\n \\gamma_{\\t\\p} &=&\n \\frac{1}{\\rho}\n (-xyz\\gamma_{xx}\n +(x^2-y^2)z\\gamma_{xy}\n +\\rho^2 y \\gamma_{xz}\n +xyz\\gamma_{yy}\n -\\rho^2 x \\gamma_{yz})\n\\\\\n \\gamma_{\\p\\p} &=&\n y^2\\gamma_{xx}\n -2xy\\gamma_{xy}\n +x^2\\gamma_{yy}\n\\end{eqnarray*} \nor,\n\\begin{eqnarray*}\n\\gamma_{rr}&=&\n\\sin^2\\t\\cos^2\\p\\gamma_{xx}\n+\\sin^2\\t\\sin^2\\p\\gamma_{yy}\n+\\cos^2\\t\\gamma_{zz}\n+2\\sin^2\\theta\\cos\\p\\sin\\p\\gamma_{xy}\n+2\\sin\\t\\cos\\t\\cos\\p\\gamma_{xz}\n\\\\\n&&\n+2\\s\\c\\sin\\p\\gamma_{yz}\n\\\\\n\\gamma_{r\\t}&=&\nr(\\s\\c\\cos^2\\phi\\gamma_{xx}\n+2*\\s\\c\\sin\\p\\cos\\p\\gamma_{xy}\n+(\\cos^2\\t-\\sin^2\\t)\\cos\\p\\gamma_{xz}\n+\\s\\c\\sin^2\\p\\gamma_{yy}\n\\\\\n&&\n+(\\cos^2\\t-\\sin^2\\t)\\sin\\p\\gamma_{yz}\n-\\s\\c\\gamma_{zz})\n\\\\\n\\gamma_{r\\p}&=&\nr\\s(-\\s\\sin\\p\\cos\\p\\gamma_{xx}\n-\\s(\\sin^2\\p-\\cos^2\\p)\\gamma_{xy}\n-\\c\\sin\\p\\gamma_{xz}\n+\\s\\sin\\p\\cos\\p\\gamma_{yy}\n\\\\\n&&\n+\\c\\cos\\p\\gamma_{yz})\n\\\\\n\\gamma_{\\t\\t}&=&\nr^2(\\cos^2\\t\\cos^2\\p\\gamma_{xx}\n+2\\cos^2\\t\\sin\\p\\cos\\p\\gamma_{xy}\n-2\\s\\c\\cos\\p\\gamma_{xz}\n+\\cos^2\\t\\sin^2\\p\\gamma_{yy}\n\\\\\n&&\n-2\\s\\c\\sin\\p\\gamma_{yz}\n+\\sin^2\\t\\gamma_{zz})\n\\\\\n\\gamma_{\\t\\p}&=&\nr^2\\s(-\\c\\sin\\p\\cos\\p\\gamma_{xx}\n-\\c(\\sin^2\\p-\\cos^2\\p)\\gamma_{xy}\n+\\s\\sin\\p\\gamma_{xz}\n+\\c\\sin\\p\\cos\\p\\gamma_{yy}\n\\\\\n&&\n-\\s\\cos\\p\\gamma_{yz})\n\\\\\n\\gamma_{\\p\\p}&=&\nr^2\\sin^2\\t(\\sin^2\\p\\gamma_{xx}\n-2\\sin\\p\\cos\\p\\gamma_{xy}\n+\\cos^2\\phi\\gamma_{yy})\n\\end{eqnarray*}\n\n\nWe also need \nthe transformation for the radial derivative of the metric components:\n\\begin{eqnarray*}\n\\gamma_{rr,\\eta}&=&\n\\sin^2\\t\\cos^2\\p\\gamma_{xx,\\eta}\n+\\sin^2\\t\\sin^2\\p\\gamma_{yy,\\eta}\n+\\cos^2\\t\\gamma_{zz,\\eta}\n+2\\sin^2\\theta\\cos\\p\\sin\\p\\gamma_{xy,\\eta}\n\\\\\n&&\n+2\\sin\\t\\cos\\t\\cos\\p\\gamma_{xz,\\eta}\n+2\\s\\c\\sin\\p\\gamma_{yz,\\eta}\n\\\\\n\\gamma_{r\\t,\\eta}&=& \n\\frac{1}{r}\\gamma_{r\\t}+\nr(\\s\\c\\cos^2\\phi\\gamma_{xx,\\eta}\n+\\s\\c\\sin\\p\\cos\\p\\gamma_{xy,\\eta}\n+(\\cos^2\\t-\\sin^2\\t)\\cos\\p\\gamma_{xz,\\eta}\n\\\\\n&&\n+\\s\\c\\sin^2\\p\\gamma_{yy,\\eta}\n+(\\cos^2\\t-\\sin^2\\t)\\sin\\p\\gamma_{yz,\\eta}\n-\\s\\c\\gamma_{zz,\\eta})\n\\\\\n\\gamma_{r\\p,\\eta}&=&\n\\frac{1}{r}\\gamma_{r\\p}+\nr\\s(-\\s\\sin\\p\\cos\\p\\gamma_{xx,\\eta}\n-\\s(\\sin^2\\p-\\cos^2\\p)\\gamma_{xy,\\eta}\n-\\c\\sin\\p\\gamma_{xz,\\eta}\n\\\\\n&&\n+\\s\\sin\\p\\cos\\p\\gamma_{yy,\\eta}\n+\\c\\cos\\p\\gamma_{yz,\\eta})\n\\\\\n\\gamma_{\\t\\t,\\eta}&=&\n\\frac{2}{r}\\gamma_{\\t\\t}+\nr^2(\\cos^2\\t\\cos^2\\p\\gamma_{xx,\\eta}\n+2\\cos^2\\t\\sin\\p\\cos\\p\\gamma_{xy,\\eta}\n-2\\s\\c\\cos\\p\\gamma_{xz,\\eta}\n\\\\\n&&\n+\\cos^2\\t\\sin^2\\p\\gamma_{yy,\\eta}\n-2\\s\\c\\sin\\p\\gamma_{yz,\\eta}\n+\\sin^2\\t\\gamma_{zz,\\eta})\n\\\\\n\\gamma_{\\t\\p,\\eta}&=&\n\\frac{2}{r}\\gamma_{\\t\\p}+\nr^2\\s(-\\c\\sin\\p\\cos\\p\\gamma_{xx,\\eta}\n-\\c(\\sin^2\\p-\\cos^2\\p)\\gamma_{xy,\\eta}\n+\\s\\sin\\p\\gamma_{xz,\\eta}\n\\\\\n&&\n+\\c\\sin\\p\\cos\\p\\gamma_{yy,\\eta}\n-\\s\\cos\\p\\gamma_{yz,\\eta})\n\\\\\n\\gamma_{\\p\\p,\\eta}&=&\n\\frac{2}{r}\\gamma_{\\p\\p}+\nr^2\\sin^2\\t(\\sin^2\\p\\gamma_{xx,\\eta}\n-2\\sin\\p\\cos\\p\\gamma_{xy,\\eta}\n+\\cos^2\\phi\\gamma_{yy,\\eta})\n\\end{eqnarray*}\n\n\\section{Appendix: Integrations Over the 2-Spheres}\n\n\nThis is done by using Simpson's rule twice. Once in each coordinate \ndirection. Simpson's rule is\n\\begin{equation}\n\\int^{x_2}_{x_1} f(x) dx = \n \\frac{h}{3} [f_1+4f_2+2f_3+4f_4+\\ldots+2f_{N-2}+4 f_{N-1}+f_N]\n +O(1/N^4)\n\\end{equation}\n$N$ must be an odd number.\n\n\n\\begin{thebibliography}{9}\n\\bibitem{abrahams94} Abrahams A.M. \\& Cook G.B. \n ``Collisions of boosted black holes: \n Perturbation theory predictions of \n gravitational radiation'' \n {\\em Phys. Rev. D} \n {\\bf 50} \n R2364-R2367 \n (1994).\n\\bibitem{abrahams95} Abrahams A.M., Shapiro S.L. \\& Teukolsky S.A. \n ``Calculation of gravitational wave forms from \n black hole collisions and disk collapse: Applying\n perturbation theory to numerical spacetimes''\n {\\em Phys. Rev. D.} \n {\\bf 51}\n 4295\n (1995).\n\\bibitem{abrahams96a} Abrahams A.M. \\& Price R.H. \n ``Applying black hole perturbation\n theory to numerically generated spacetimes'' \n {\\em Phys. Rev. D.} \n {\\bf 53} \n 1963 \n (1996).\n\\bibitem{abrahams96b} Abrahams A.M. \\& Price R.H. \n ``Black-hole collisions from Brill-Lindquist \n initial data: Predictions of perturbation theory'' \n {\\em Phys. Rev. D.} \n {\\bf 53} \n 1972 \n (1996).\n\\bibitem{abram} Abramowitz, M. \\& Stegun A. \n ``Pocket Book of Mathematical Functions \n (Abridged Handbook of Mathematical Functions'', \n Verlag Harri Deutsch \n (1984).\n\\bibitem{andrade96} Andrade Z., \\& Price R.H. \n ``Head-on collisions of unequal mass black holes:\n Close-limit predictions'', \n preprint \n (1996).\n\\bibitem{anninos95} Anninos P., Price R.H., Pullin J., Seidel E., \n and Suen W-M. \n ``Head-on collision of two black holes: \n Comparison of different approaches''\n {\\em Phys. Rev. D.} \n {\\bf 52} \n 4462 \n (1995).\n\\bibitem{arfken} Arfken, G. \n ``Mathematical Methods for Physicists'', \n Academic Press \n (1985).\n\\bibitem{baker96} Baker J., Abrahams A., Anninos P., Brant S., \n Price R., Pullin J. \\& Seidel E. \n ``The collision of boosted black holes'' \n (preprint) \n (1996).\n\\bibitem{baker97} Baker J. \\& Li C.B.\n ``The two-phase approximation for black hole \n collisions: Is it robust''\n preprint (gr-qc/9701035),\n (1997).\n\\bibitem{brandt96} Brandt S.R. \\& Seidel E. \n ``The evolution of distorted rotating black holes III:\n Initial data'' \n (preprint) \n (1996).\n\\bibitem{cunningham78} Cunningham C.T., Price R.H., Moncrief V.,\n ``Radiation from collapsing \n relativistic stars. \n I. Linearized Odd-Parity Radiation''\n {\\em Ap. J.}\n {\\bf 224}\n 543-667\n (1978).\n\\bibitem{cunningham79} Cunningham C.T., Price R.H., Moncrief V.,\n ``Radiation from collapsing \n relativistic stars. \n I. Linearized Even-Parity Radiation''\n {\\em Ap. J.}\n {\\bf 230}\n 870-892\n (1979).\n\\bibitem{landau80} Landau L.D. \\& Lifschitz E.M.,\n ``The Classical Theory of Fields''\n (4th Edition),\n Pergamon Press\n (1980).\n\\bibitem{mathews} Mathews J. ``'', \n {\\em J. Soc. Ind. Appl. Math.} \n {\\bf 10}\n 768 \n (1962).\n\\bibitem{moncrief74} Moncrief V. ``Gravitational perturbations of spherically\n symmetric systems. I. The exterior problem''\n {\\em Annals of Physics} \n {\\bf 88}\n 323-342 \n (1974).\n\\bibitem{numrec} Press W.H., Flannery B.P., Teukolsky S.A., \\& Vetterling W.T.,\n ``Numerical Recipes, The Art of Scientific Computing''\n {\\em Cambridge University Press} \n (1989).\n\\bibitem{price94} Price R.H. \\& Pullin J. \n ``Colliding black holes: The close limit'',\n {\\em Phys. Rev. Lett.} \n {\\bf 72} \n 3297-3300 \n (1994).\n\\bibitem{regge} Regge T., \\& Wheeler J.A. \n ``Stability of a Schwarzschild Singularity'', \n {\\em Phys. Rev. D} \n {\\bf 108} \n 1063 \n (1957).\n\\bibitem{seidel90} Seidel E. \n {\\em Phys Rev D.} \n {\\bf 42} \n 1884 \n (1990).\n\\bibitem{thorne80} Thorne K.S., \n ``Multipole expansions of gravitational radiation'', \n {\\em Rev. Mod. Phys.} \n {\\bf 52} \n 299 \n (1980).\n\\bibitem{vish} Vishveshwara C.V., \n ``Stability of the Schwarzschild metric'',\n {\\em Phys. Rev. D.} \n {\\bf 1} \n 2870, \n (1970).\n\\bibitem{zerilli70a} Zerilli F.J., \n ``Tensor harmonics in canonical form for gravitational \n radiation and other applications'', \n {\\em J. Math. Phys.} \n {\\bf 11} \n 2203, \n (1970).\n\\bibitem{zerilli70} Zerilli F.J., \n ``Gravitational field of a particle falling \n in a Schwarzschild geometry analysed in \n tensor harmonics'',\n {\\em Phys. Rev. D.} \n {\\bf 2} \n 2141, \n (1970).\n\\end{thebibliography}\n\n% END CACTUS THORNGUIDE\n\n\\end{document}\n" + } +} \ No newline at end of file