LORENE
hole_bhns_rk_theta.C
1/*
2 * Methods of class Hole_bhns to compute a forth-order Runge-Kutta
3 * integration to the theta direction for the solution of the Killing vectors
4 *
5 * (see file hole_bhns.h for documentation).
6 *
7 */
8
9/*
10 * Copyright (c) 2006-2007 Keisuke Taniguchi
11 *
12 * This file is part of LORENE.
13 *
14 * LORENE is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2
16 * as published by the Free Software Foundation.
17 *
18 * LORENE is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with LORENE; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 *
27 */
28
29
30
31/*
32 * $Id: hole_bhns_rk_theta.C,v 1.5 2016/12/05 16:17:55 j_novak Exp $
33 * $Log: hole_bhns_rk_theta.C,v $
34 * Revision 1.5 2016/12/05 16:17:55 j_novak
35 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
36 *
37 * Revision 1.4 2014/10/13 08:53:00 j_novak
38 * Lorene classes and functions now belong to the namespace Lorene.
39 *
40 * Revision 1.3 2014/10/06 15:13:10 j_novak
41 * Modified #include directives to use c++ syntax.
42 *
43 * Revision 1.2 2008/07/02 20:49:05 k_taniguchi
44 * Typos removed.
45 *
46 * Revision 1.1 2008/05/15 19:11:01 k_taniguchi
47 * *** empty log message ***
48 *
49 *
50 * $Header: /cvsroot/Lorene/C++/Source/Hole_bhns/hole_bhns_rk_theta.C,v 1.5 2016/12/05 16:17:55 j_novak Exp $
51 *
52 */
53
54// C++ headers
55//#include <>
56
57// C headers
58#include <cmath>
59
60// Lorene headers
61#include "hole_bhns.h"
62#include "unites.h"
63#include "utilitaires.h"
64
65 //---------------------------------------------------//
66 // Forth-order Runge-Kutta to the polar angle //
67 //---------------------------------------------------//
68
69namespace Lorene {
70Tbl Hole_bhns::runge_kutta_theta(const Tbl& xi_i, const double& theta_i,
71 const double& phi,
72 const int& nrk_theta) const {
73
74 using namespace Unites ;
75
76 const Mg3d* mg = mp.get_mg() ;
77 int nt = mg->get_nt(1) ;
78
79 Tbl xi_f(3) ; // xi_f(0)=xi_hat{theta}, xi_f(1)=xi_hat{phi}, xi_f(2)=L
80 xi_f.set_etat_qcq() ;
81
82 if (kerrschild) {
83
84 cout << "Not yet prepared!!!" << endl ;
85 abort() ;
86
87 }
88 else { // Isotropic coordinates
89
90 // Initial data at phi on the equator
91 double xi_t0 = xi_i(0) ; // xi_hat{theta}
92 double xi_p0 = xi_i(1) ; // xi_hat{phi}
93 double xi_l0 = xi_i(2) ; // L
94 double theta0 = theta_i ;
95
96 double dt = - 0.5 * M_PI / double(nt-1) / double(nrk_theta) ;
97 // Compute from M_PI/2 to 0
98
99 double rah = rad_ah() ;
100
101 Scalar dlnconfo(mp) ;
102 dlnconfo = confo_tot.stdsdp() / confo_tot ;
103 dlnconfo.std_spectral_base() ;
104
105 Scalar laplnconfo(mp) ;
106 laplnconfo = confo_tot.lapang() / confo_tot ;
107 laplnconfo.std_spectral_base() ;
108
109 Scalar confo2(mp) ;
110 confo2 = confo_tot * confo_tot ;
111 confo2.std_spectral_base() ;
112
113 double xi_t1, xi_t2, xi_t3, xi_t4, xi_tf ;
114 double xi_p1, xi_p2, xi_p3, xi_p4, xi_pf ;
115 double xi_l1, xi_l2, xi_l3, xi_l4, xi_lf ;
116 double f1, f2, f3, f4 ;
117 double g1, g2, g3, g4 ;
118 double h1, h2, h3, h4 ;
119
120 // Forth-order Runge-Kutta
121 // (nrk_theta times steps between two collocation points)
122 // ------------------------------------------------------
123
124 for (int i=0; i<nrk_theta; i++) {
125
126 // First
127 f1 = -2. * xi_p0 * dlnconfo.val_point(rah, theta0, phi) ;
128 g1 = xi_l0 * rah * confo2.val_point(rah, theta0, phi)
129 + 2. * xi_t0 * dlnconfo.val_point(rah, theta0, phi) ;
130 h1 = - (1. - 2.*laplnconfo.val_point(rah, theta0, phi)) * xi_p0
131 / rah / confo2.val_point(rah, theta0, phi) ;
132
133 xi_t1 = dt * f1 ;
134 xi_p1 = dt * g1 ;
135 xi_l1 = dt * h1 ;
136
137 // Second
138 f2 = -2. * (xi_p0+0.5*xi_p1)
139 * dlnconfo.val_point(rah, theta0+0.5*dt, phi) ;
140 g2 = (xi_l0+0.5*xi_l1) * rah
141 * confo2.val_point(rah, theta0+0.5*dt, phi)
142 + 2. * (xi_t0+0.5*xi_t1)
143 * dlnconfo.val_point(rah, theta0+0.5*dt, phi) ;
144 h2 = - (1. - 2.*laplnconfo.val_point(rah, theta0+0.5*dt, phi))
145 * (xi_p0+0.5*xi_p1) / rah
146 / confo2.val_point(rah, theta0+0.5*dt, phi) ;
147
148 xi_t2 = dt * f2 ;
149 xi_p2 = dt * g2 ;
150 xi_l2 = dt * h2 ;
151
152 // Third
153 f3 = -2. * (xi_p0+0.5*xi_p2)
154 * dlnconfo.val_point(rah, theta0+0.5*dt, phi) ;
155 g3 = (xi_l0+0.5*xi_l2) * rah
156 * confo2.val_point(rah, theta0+0.5*dt, phi)
157 + 2. * (xi_t0+0.5*xi_t2)
158 * dlnconfo.val_point(rah, theta0+0.5*dt, phi) ;
159 h3 = - (1. - 2.*laplnconfo.val_point(rah, theta0+0.5*dt, phi))
160 * (xi_p0+0.5*xi_p2) / rah
161 / confo2.val_point(rah, theta0+0.5*dt, phi) ;
162
163 xi_t3 = dt * f3 ;
164 xi_p3 = dt * g3 ;
165 xi_l3 = dt * h3 ;
166
167 // Forth
168 f4 = -2. * (xi_p0+xi_p3) * dlnconfo.val_point(rah, theta0+dt, phi) ;
169 g4 = (xi_l0+xi_l3) * rah * confo2.val_point(rah, theta0+dt, phi)
170 + 2. * (xi_t0+xi_t3) * dlnconfo.val_point(rah, theta0+dt, phi) ;
171 h4 = - (1. - 2.*laplnconfo.val_point(rah, theta0+dt, phi))
172 * (xi_p0+xi_p3) / rah / confo2.val_point(rah, theta0+dt, phi) ;
173
174 xi_t4 = dt * f4 ;
175 xi_p4 = dt * g4 ;
176 xi_l4 = dt * h4 ;
177
178 // Final results
179 // -------------
180 xi_tf = xi_t0 + (xi_t1 + 2.*xi_t2 + 2.*xi_t3 + xi_t4) / 6. ;
181 xi_pf = xi_p0 + (xi_p1 + 2.*xi_p2 + 2.*xi_p3 + xi_p4) / 6. ;
182 xi_lf = xi_l0 + (xi_l1 + 2.*xi_l2 + 2.*xi_l3 + xi_l4) / 6. ;
183
184 // Final results are put into the initial data
185 // in order for the next step
186 // -------------------------------------------
187 xi_t0 = xi_tf ;
188 xi_p0 = xi_pf ;
189 xi_l0 = xi_lf ;
190
191 } // End of the loop
192
193 xi_f.set(0) = xi_tf ;
194 xi_f.set(1) = xi_pf ;
195 xi_f.set(2) = xi_lf ;
196
197 }
198
199 return xi_f ;
200
201}
202}
Map & mp
Mapping associated with the black hole.
Definition blackhole.h:80
virtual double rad_ah() const
Radius of the apparent horizon.
bool kerrschild
true for a Kerr-Schild background, false for a conformally flat background
Definition blackhole.h:85
Tbl runge_kutta_theta(const Tbl &xi_i, const double &theta_i, const double &phi, const int &nrk) const
Compute a forth-order Runge-Kutta integration to the theta direction for the solution of the Killing ...
Scalar confo_tot
Total conformal factor.
Definition hole_bhns.h:169
Multi-domain grid.
Definition grilles.h:279
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition grilles.h:474
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:393
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field.
Definition scalar.C:790
double val_point(double r, double theta, double phi) const
Computes the value of the field at an arbitrary point , by means of the spectral expansion.
Definition scalar.C:896
Basic array class.
Definition tbl.h:161
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition tbl.C:364
double & set(int i)
Read/write of a particular element (index i) (1D case).
Definition tbl.h:281
Lorene prototypes.
Definition app_hor.h:67
Coord phi
coordinate centered on the grid
Definition map.h:732
Standard units of space, time and mass.