93 #include "graphique.h" 98 double a_axis,
double b_axis,
double c_axis,
bool verbose,
bool print,
99 double precis,
double precis_exp,
int step_max,
int step_relax,
103 bool ah_flag = false ;
121 double r_min =
min(+rr)(0) ;
122 double r_max =
max(+rr)(nz-1) ;
149 h_tmp = st*st*( cp*cp/aa/aa + sp*sp/bb/bb ) + ct*ct/cc/cc ;
150 h_tmp = 1./
sqrt( h_tmp ) ;
151 h_tmp.std_spectral_base() ;
156 for (
int l=0; l<nz; l++) {
158 int jmax = mg->
get_nt(l) ;
159 int kmax = mg->
get_np(l) ;
161 for (
int k=0; k<kmax; k++) {
162 for (
int j=0; j<jmax; j++) {
163 h_guess.
set(l,k,j,0) = h_tmp.val_grid_point(l,k,j,0) ;
180 double one_third = double(1) / double(3) ;
183 psi4 =
pow( psi4, one_third ) ;
195 Vector s_unit(map, CON, bspher) ;
197 double relax_prev = double(1) - relax ;
198 double diff_exfcn = 1. ;
202 bool no_AH_in_grid = false ;
209 (
max(diff_h) > precis) && (step < step_max) && (!no_AH_in_grid);
221 for (
int l=0; l<nz; l++) {
223 int imax = mg->
get_nr(l) ;
224 int jmax = mg->
get_nt(l) ;
225 int kmax = mg->
get_np(l) ;
227 for (
int k=0; k<kmax; k++) {
228 for (
int j=0; j<jmax; j++) {
229 for (
int i=0; i<imax; i++) {
245 dF_norm =
sqrt( dF_norm ) ;
246 dF_norm.std_spectral_base() ;
258 sou_1 = gamma.
con() - fmets.
con()/psi4 - s_unit*s_unit ;
262 source_tmp = source_tmp / dF_norm ;
267 source_tmp -=
contract( gamma.
con() - s_unit*s_unit, 0, 1,
268 d_gam, 0, 1) / dF_norm ;
270 source_tmp = psi4*dF_norm*( source_tmp - k_dd.
trace(gamma) +
280 double h_min =
min(h)(0) ;
281 double h_max =
max(h)(0) ;
284 if ( (r_min < h_min) && (h_max < r_max) ) {
286 for (
int l=0; l<nz; l++) {
288 int jmax = mg->
get_nt(l) ;
289 int kmax = mg->
get_np(l) ;
290 for (
int k=0; k<kmax; k++) {
291 for (
int j=0; j<jmax; j++) {
292 sou_angu.
set(l,k,j,0) = source_tmp.val_point(h(l,k,j,0)
293 ,(+theta)(l,k,j,0) ,(+phi)(l,k,j,0)) ;
297 sou_angu = h*h*sou_angu ;
300 no_AH_in_grid = true ;
327 diff_h =
max(
abs(h - h_new)) ;
331 if (step >= step_relax) {
332 h_new = relax * h_new + relax_prev * h ;
342 cout <<
"-------------------------------------" << endl ;
343 cout <<
"App_hor iteration step: " << step << endl ;
344 cout <<
" " << endl ;
346 cout <<
"Difference in h : " << diff_h << endl ;
349 Tbl diff_exfcn_tbl =
diffrel( ex_fcn, ex_fcn_old ) ;
350 diff_exfcn = diff_exfcn_tbl(0) ;
351 for (
int l=1; l<nz; l++) {
352 diff_exfcn += diff_exfcn_tbl(l) ;
355 cout <<
"diff_exfcn : " << diff_exfcn << endl ;
357 ex_fcn_old = ex_fcn ;
362 if ( (step == step_max-1) && (
max(diff_h) > precis) ) {
367 for (
int l=0; l<nz; l++) {
369 int jmax = mg->
get_nt(l) ;
370 int kmax = mg->
get_np(l) ;
372 for (
int k=0; k<kmax; k++) {
373 for (
int j=0; j<jmax; j++) {
375 ex_AH.
set(l,k,j,0) = ex_fcn.
val_point(h(l,k,j,0),(+theta)(l,k,j,0)
382 cout <<
" " << endl ;
383 cout <<
"###############################################" << endl ;
384 cout <<
"AH finder: maximum number of iteration reached!" << endl ;
385 cout <<
" No convergence in the 2-surface h! " << endl ;
386 cout <<
" max( difference in h ) > prescribed tolerance " << endl ;
387 cout <<
" " << endl ;
388 cout <<
" prescribed tolerance = " << precis << endl ;
389 cout <<
" max( difference in h ) = " <<
max(diff_h) << endl ;
390 cout <<
" max( expansion function on h ) = " <<
max(
abs(ex_AH(0))) << endl ;
391 cout <<
"###############################################" << endl ;
392 cout <<
" " << endl ;
408 cout <<
" " << endl ;
409 cout <<
"###############################################" << endl ;
410 cout <<
" AH finder: no horizon found inside the grid!" << endl ;
411 cout <<
" Grid: rmin= " << r_min <<
", rmax= " << r_max << endl ;
412 cout <<
"###############################################" << endl ;
413 cout <<
" " << endl ;
417 for (
int l=0; l<nz; l++) {
419 int jmax = mg->
get_nt(l) ;
420 int kmax = mg->
get_np(l) ;
422 for (
int k=0; k<kmax; k++) {
423 for (
int j=0; j<jmax; j++) {
425 ex_AH.
set(l,k,j,0) = ex_fcn.
val_point(h(l,k,j,0),(+theta)(l,k,j,0)
433 if ( (
max(diff_h) < precis) && (
max(
abs(ex_AH(0))) < precis_exp) ) {
438 cout <<
" " << endl ;
439 cout <<
"################################################" << endl ;
440 cout <<
" AH finder: Apparent horizon found!!! " << endl ;
441 cout <<
" Max error of the expansion function on h: " << endl ;
442 cout <<
" max( expansion function on AH ) = " <<
max(
abs(ex_AH(0))) << endl ;
443 cout <<
"################################################" << endl ;
444 cout <<
" " << endl ;
449 if ( (
max(diff_h) < precis) && (
max(
abs(ex_AH(0))) > precis_exp) ) {
452 cout <<
" " << endl ;
453 cout <<
"#############################################" << endl ;
454 cout <<
" AH finder: convergence in the 2 surface h. " << endl ;
455 cout <<
" But max error of the expansion function evaulated on h > precis_exp" << endl ;
456 cout <<
" max( expansion function on AH ) = " <<
max(
abs(ex_AH(0))) << endl ;
457 cout <<
" Probably not an apparent horizon! " << endl ;
458 cout <<
"#############################################" << endl ;
459 cout <<
" " << endl ;
Metric for tensor calculation.
void poisson_angu(double lambda=0)
Resolution of the generalized angular Poisson equation.
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
void ylm_i()
Inverse of ylm()
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Cmp sqrt(const Cmp &)
Square root.
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
virtual const Scalar & determinant() const
Returns the determinant.
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
void ylm()
Computes the coefficients of *this.
void annule_hard()
Sets the Valeur to zero in a hard way.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Flat metric for tensor calculation.
Tensor field of valence 0 (or component of a tensorial field).
void coef_i() const
Computes the physical value of *this.
Base class for coordinate mappings.
bool ah_finder(const Metric &gamma, const Sym_tensor &k_dd_in, Valeur &h, Scalar &ex_fcn, double a_axis, double b_axis, double c_axis, bool verbose=true, bool print=false, double precis=1.e-8, double precis_exp=1.e-6, int it_max=200, int it_relax=200, double relax_fac=1.)
Apparent horizon linked functions.
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
Values and coefficients of a (real-value) function.
virtual void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
const Vector & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of *this with respect to some metric , by raising the index of...
Tensor field of valence 1.
const Tensor_sym & get_delta() const
Returns the tensor which defines the connection with respect to the flat one: is the difference bet...
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
void std_base_scal()
Sets the bases for spectral expansions (member base ) to the standard ones for a scalar.
const Map & get_mp() const
Returns the mapping.
Coord tet
coordinate centered on the grid
Coord phi
coordinate centered on the grid
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
const Mg3d * get_angu() const
Returns the pointer on the associated angular grid.
virtual const Connection & connect() const
Returns the connection.
Mtbl * c
Values of the function at the points of the multi-grid.
int get_nzone() const
Returns the number of domains.
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
const Scalar & divergence(const Metric &) const
The divergence of this with respect to a Metric .
Cmp pow(const Cmp &, int)
Power .
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
const Tensor & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
Active physical coordinates and mapping derivatives.
virtual const Scalar & determinant() const
Returns the determinant.
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.
Spherical orthonormal vectorial bases (triads).
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
double & set_grid_point(int l, int k, int j, int i)
Setting the value of the field at a given grid point.
Cmp abs(const Cmp &)
Absolute value.
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
const Vector & derive_cov(const Metric &gam) const
Returns the gradient (1-form = covariant vector) of *this
const Metric_flat & flat_met_spher() const
Returns the flat metric associated with the spherical coordinates and with components expressed in th...
Class intended to describe valence-2 symmetric tensors.
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.
Coord r
r coordinate centered on the grid
Tbl & set(int l)
Read/write of the value in a given domain (configuration space).