28char app_hor_finder_C[] =
"$Header: /cvsroot/Lorene/C++/Source/App_hor/app_hor_finder.C,v 1.11 2014/10/13 08:52:38 j_novak Exp $" ;
92 double a_axis,
double b_axis,
double c_axis,
bool verbose,
bool print,
93 double precis,
double precis_exp,
int step_max,
int step_relax,
97 bool ah_flag = false ;
115 double r_min =
min(+rr)(0) ;
116 double r_max =
max(+rr)(nz-1) ;
143 h_tmp = st*st*( cp*cp/aa/aa + sp*sp/bb/bb ) + ct*ct/cc/cc ;
144 h_tmp = 1./
sqrt( h_tmp ) ;
150 for (
int l=0; l<nz; l++) {
152 int jmax = mg->
get_nt(l) ;
153 int kmax = mg->
get_np(l) ;
155 for (
int k=0; k<kmax; k++) {
156 for (
int j=0; j<jmax; j++) {
174 double one_third = double(1) / double(3) ;
177 psi4 =
pow( psi4, one_third ) ;
189 Vector s_unit(map, CON, bspher) ;
191 double relax_prev = double(1) - relax ;
192 double diff_exfcn = 1. ;
196 bool no_AH_in_grid = false ;
203 (
max(diff_h) > precis) && (step < step_max) && (!no_AH_in_grid);
215 for (
int l=0; l<nz; l++) {
217 int imax = mg->
get_nr(l) ;
218 int jmax = mg->
get_nt(l) ;
219 int kmax = mg->
get_np(l) ;
221 for (
int k=0; k<kmax; k++) {
222 for (
int j=0; j<jmax; j++) {
223 for (
int i=0; i<imax; i++) {
239 dF_norm =
sqrt( dF_norm ) ;
252 sou_1 = gamma.
con() - fmets.
con()/psi4 - s_unit*s_unit ;
256 source_tmp = source_tmp / dF_norm ;
261 source_tmp -=
contract( gamma.
con() - s_unit*s_unit, 0, 1,
262 d_gam, 0, 1) / dF_norm ;
264 source_tmp = psi4*dF_norm*( source_tmp - k_dd.
trace(gamma) +
274 double h_min =
min(h)(0) ;
275 double h_max =
max(h)(0) ;
276 if ( (r_min < h_min) && (h_max < r_max) ) {
278 for (
int l=0; l<nz; l++) {
280 int jmax = mg->
get_nt(l) ;
281 int kmax = mg->
get_np(l) ;
282 for (
int k=0; k<kmax; k++) {
283 for (
int j=0; j<jmax; j++) {
285 ,(+theta)(l,k,j,0) ,(+phi)(l,k,j,0)) ;
289 sou_angu = h*h*sou_angu ;
292 no_AH_in_grid = true ;
319 diff_h =
max(
abs(h - h_new)) ;
323 if (step >= step_relax) {
324 h_new = relax * h_new + relax_prev * h ;
334 cout <<
"-------------------------------------" << endl ;
335 cout <<
"App_hor iteration step: " << step << endl ;
336 cout <<
" " << endl ;
338 cout <<
"Difference in h : " << diff_h << endl ;
341 Tbl diff_exfcn_tbl =
diffrel( ex_fcn, ex_fcn_old ) ;
342 diff_exfcn = diff_exfcn_tbl(0) ;
343 for (
int l=1; l<nz; l++) {
344 diff_exfcn += diff_exfcn_tbl(l) ;
347 cout <<
"diff_exfcn : " << diff_exfcn << endl ;
349 ex_fcn_old = ex_fcn ;
354 if ( (step == step_max-1) && (
max(diff_h) > precis) ) {
359 for (
int l=0; l<nz; l++) {
361 int jmax = mg->
get_nt(l) ;
362 int kmax = mg->
get_np(l) ;
364 for (
int k=0; k<kmax; k++) {
365 for (
int j=0; j<jmax; j++) {
367 ex_AH.
set(l,k,j,0) = ex_fcn.
val_point(h(l,k,j,0),(+theta)(l,k,j,0)
374 cout <<
" " << endl ;
375 cout <<
"###############################################" << endl ;
376 cout <<
"AH finder: maximum number of iteration reached!" << endl ;
377 cout <<
" No convergence in the 2-surface h! " << endl ;
378 cout <<
" max( difference in h ) > prescribed tolerance " << endl ;
379 cout <<
" " << endl ;
380 cout <<
" prescribed tolerance = " << precis << endl ;
381 cout <<
" max( difference in h ) = " <<
max(diff_h) << endl ;
382 cout <<
" max( expansion function on h ) = " <<
max(
abs(ex_AH(0))) << endl ;
383 cout <<
"###############################################" << endl ;
384 cout <<
" " << endl ;
400 cout <<
" " << endl ;
401 cout <<
"###############################################" << endl ;
402 cout <<
" AH finder: no horizon found inside the grid!" << endl ;
403 cout <<
" Grid: rmin= " << r_min <<
", rmax= " << r_max << endl ;
404 cout <<
"###############################################" << endl ;
405 cout <<
" " << endl ;
409 for (
int l=0; l<nz; l++) {
411 int jmax = mg->
get_nt(l) ;
412 int kmax = mg->
get_np(l) ;
414 for (
int k=0; k<kmax; k++) {
415 for (
int j=0; j<jmax; j++) {
417 ex_AH.
set(l,k,j,0) = ex_fcn.
val_point(h(l,k,j,0),(+theta)(l,k,j,0)
425 if ( (
max(diff_h) < precis) && (
max(
abs(ex_AH(0))) < precis_exp) ) {
430 cout <<
" " << endl ;
431 cout <<
"################################################" << endl ;
432 cout <<
" AH finder: Apparent horizon found!!! " << endl ;
433 cout <<
" Max error of the expansion function on h: " << endl ;
434 cout <<
" max( expansion function on AH ) = " <<
max(
abs(ex_AH(0))) << endl ;
435 cout <<
"################################################" << endl ;
436 cout <<
" " << endl ;
441 if ( (
max(diff_h) < precis) && (
max(
abs(ex_AH(0))) > precis_exp) ) {
444 cout <<
" " << endl ;
445 cout <<
"#############################################" << endl ;
446 cout <<
" AH finder: convergence in the 2 surface h. " << endl ;
447 cout <<
" But max error of the expansion function evaulated on h > precis_exp" << endl ;
448 cout <<
" max( expansion function on AH ) = " <<
max(
abs(ex_AH(0))) << endl ;
449 cout <<
" Probably not an apparent horizon! " << endl ;
450 cout <<
"#############################################" << endl ;
451 cout <<
" " << endl ;
Spherical orthonormal vectorial bases (triads).
const Tensor_sym & get_delta() const
Returns the tensor which defines the connection with respect to the flat one: is the difference bet...
Active physical coordinates and mapping derivatives.
Base class for coordinate mappings.
Coord r
r coordinate centered on the grid
Coord tet
coordinate centered on the grid
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
Coord phi
coordinate centered on the grid
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
const Metric_flat & flat_met_spher() const
Returns the flat metric associated with the spherical coordinates and with components expressed in th...
Flat metric for tensor calculation.
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
virtual const Scalar & determinant() const
Returns the determinant.
Metric for tensor calculation.
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
const Map & get_mp() const
Returns the mapping.
virtual const Connection & connect() const
Returns the connection.
virtual const Scalar & determinant() const
Returns the determinant.
const Mg3d * get_angu() const
Returns the pointer on the associated angular grid.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
int get_nzone() const
Returns the number of domains.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
void poisson_angu(double lambda=0)
Resolution of the generalized angular Poisson equation.
Tensor field of valence 0 (or component of a tensorial field).
const Vector & derive_cov(const Metric &gam) const
Returns the gradient (1-form = covariant vector) of *this
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field.
double val_grid_point(int l, int k, int j, int i) const
Returns the value of the field at a specified grid point.
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
virtual void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
double & set_grid_point(int l, int k, int j, int i)
Setting the value of the field at a given grid point.
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.
const Vector & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of *this with respect to some metric , by raising the index of...
Class intended to describe valence-2 symmetric tensors.
Values and coefficients of a (real-value) function.
void ylm()
Computes the coefficients of *this.
Mtbl * c
Values of the function at the points of the multi-grid
Tbl & set(int l)
Read/write of the value in a given domain (configuration space).
void coef_i() const
Computes the physical value of *this.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
void ylm_i()
Inverse of ylm()
void std_base_scal()
Sets the bases for spectral expansions (member base ) to the standard ones for a scalar.
void annule_hard()
Sets the Valeur to zero in a hard way.
Tensor field of valence 1.
const Scalar & divergence(const Metric &) const
The divergence of this with respect to a Metric .
Cmp sqrt(const Cmp &)
Square root.
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
Cmp pow(const Cmp &, int)
Power .
Cmp abs(const Cmp &)
Absolute value.
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.)
Class for apparent horizon (under heavy development)
const Tensor & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .