31 #include "param_elliptic.h" 33 #include "excised_slice.h" 39 Scalar boundNoK,
bool isCF,
double relax,
int mer_max,
40 int mer_max2,
bool isvoid) {
51 cout <<
"================================================================" << endl;
52 cout <<
"STARTING THE MAIN ITERATION FOR COMPUTING METRIC FIELDS" << endl;
53 cout <<
" iteration parameters are the following: " << endl;
54 cout <<
" convergence precision required:" << precis << endl;
55 cout <<
" max number of global steps :" << mer_max << endl;
56 cout <<
" relaxation parameter :" << relax << endl;
57 cout <<
"================================================================" << endl;
63 const Mg3d* mgrid = (*map).get_mg();
69 int nt = (*mgrid).get_nt(1);
70 const int np = (*mgrid).get_np(1);
71 const Coord& rr = (*map).r;
83 const Map_af map_2(*g_angu, r_limits2);
94 Scalar logpsi(*map) ; logpsi =
log(conf_fact) ;
96 Scalar psi4 (*map) ; psi4 = conf_fact*conf_fact*conf_fact*conf_fact ;
103 Vector shift_new (*map, CON, (*map).get_bvect_spher());
104 for(
int i=1; i<=3; i++){
119 Sym_tensor aa(*map, CON, (*map).get_bvect_spher());
120 for (
int iii= 1; iii<=3; iii++){
121 for(
int j=1; j<=3; j++){
126 Scalar aa_quad_scal(*map) ; aa_quad_scal = 0. ;
128 Sym_tensor aa_hat(*map, CON, (*map).get_bvect_spher());
129 for (
int iii= 1; iii<=3; iii++){
130 for(
int j=1; j<=3; j++){
131 aa_hat.
set(iii,j)= 0;
145 for (
int i=1; i<=3; i++) {
146 for (
int j=1; j<=3; j++) {
147 for (
int k=1; k<=3; k++) {
150 for (
int l=1; l<=3; l++) {
154 delta.
set(k,i,j) += tmp ;
171 if (isvoid ==
false){
172 cout <<
"FAIL: case of non-void spacetime not treated yet" << endl;
179 double diff_ent = 1 ;
188 for(
int mer=0 ;(diff_ent > precis) && (mer<mer_max) ; mer++) {
216 ssalt = ssalt/ssnormalt;
217 ssaltcon = ssaltcon/ssnormalt;
219 Vector ssconalt = ssaltcon*conf_fact*conf_fact;
225 bound3bis += -conf_fact*ssconalt.
divergence(gamt);
227 bound3bis = 0.25*bound3bis;
228 bound3bis += -
contract(conf_fact.derive_cov(gamt),0,ssconalt,0) + conf_fact.dsdr();
237 Scalar source_conf_fact(*map) ; source_conf_fact=3. ;
240 Scalar d2logpsi =
contract(conf_fact.derive_cov(mets).derive_cov(mets), 0, 1,
hij, 0,1);
243 source_conf_fact = -(0.125* aa_quad_scal )/(psi4*conf_fact*conf_fact*conf_fact)
244 + conf_fact* 0.125* Rstar - d2logpsi;
248 if (source_conf_fact.
get_etat() == ETATZERO) {
265 Scalar baba2 = (conf_fact_new-1).laplacian();
271 psinewbis = psinewbis.
dsdr();
272 Scalar psinewfin2 (map_2) ;
277 for (
int k=0; k<np; k++)
278 for (
int j=0; j<nt; j++) {
287 conf_fact = conf_fact_new* (1-relax) + conf_fact* relax ;
288 psi4 = conf_fact*conf_fact*conf_fact*conf_fact;
289 logpsi =
log(conf_fact) ;
301 assert (NorKappa ==
false) ;
303 bound = (boundNoK)*conf_fact -1;
317 Scalar source_npsi = npsi*(aa_quad_scal*(7./8.)/(psi4*psi4) + Rstar/8.) - d2lognpsi;
319 if (source_npsi.
get_etat() == ETATZERO) {
331 npsi_new = npsi_new +1;
340 Scalar npsibound2 (map_2) ;
344 for (
int k=0; k<np; k++)
345 for (
int j=0; j<nt; j++) {
354 npsi = npsi_new*(1-relax) + npsi* relax;
355 lapse = npsi/conf_fact;
368 bound = (boundNoK)/(conf_fact*conf_fact) ;
377 Vector ephi(*map, CON, (*map).get_bvect_spher());
379 ephi.set(2).annule_hard();
381 ephi.std_spectral_base();
382 ephi.annule_domain(nz -1);
384 limit = bound*ssconalt + hor_rot*ephi;
399 hijddivb.inc_dzpuis();
401 Vector sourcevect2(*map,CON, (*map).get_bvect_spher());
404 + deltaA + hijddb + hijddivb ;
407 sourcevect2.set(2).set_dzpuis(4);
408 sourcevect2.set(3).set_dzpuis(4);
409 sourcevect2.std_spectral_base();
410 if(sourcevect2.eta().get_etat() == ETATZERO)
411 { sourcevect2.set(2).annule_hard();}
413 double lam = (1./3.);
417 sourcevect2.poisson_boundary2(lam, shift_new, Vrb, etab, mmub, 1., 0., 1. ,0. ,1. ,0.) ;
422 Vector source2 =
contract(shift_new.derive_con(mets).derive_cov(mets), 1,2)
423 + lam*
contract(shift_new.derive_cov(mets), 0,1).derive_con(mets);
427 Scalar mufin = shift_new.mu();
435 for (
int k=0; k<np; k++)
436 for (
int j=0; j<nt; j++) {
442 Scalar brfin = shift_new(1);
450 for (
int k=0; k<np; k++)
451 for (
int j=0; j<nt; j++) {
460 for (
int ii=1; ii <=3; ii++){
464 diff_ent =
max(
maxabs(npsi_new - npsi ));
473 if (diff_ent <=5.e-3) {
490 double precis2 = 1.e5*precis ;
492 double diff_ent2 = 1 ;
502 for(
int mer2=0 ;(diff_ent2 > precis2) && (mer2<mer_max2) ; mer2++) {
514 hij_new = boundfree_tensBC (sourcehij,
shift , conf_fact,
lapse,
hij, precis2);
516 cout <<
"maximum of convergence marker for the subiteration" << endl;
519 hij = relax2*hij_new + (1 - relax2)*
hij;
521 cout <<
"mer2, diffent2" << endl;
522 cout << mer2 << endl;
523 cout << diff_ent2 << endl;
539 / ((
lapse/(conf_fact*conf_fact))*(
lapse/(conf_fact*conf_fact)));
543 / ((
lapse/(conf_fact*conf_fact))*(
lapse/(conf_fact*conf_fact)));
557 gamtuu = mets.
con() +
hij;
559 gam = gamt.
cov()*psi4;
562 for (
int i=1; i<=3; i++) {
563 for (
int j=1; j<=3; j++) {
574 aa_hat = aa*psi4*
sqrt(psi4);
575 aa_hat.std_spectral_base();
585 for (
int i=1; i<=3; i++) {
586 for (
int j=1; j<=3; j++) {
587 for (
int k=1; k<=3; k++) {
590 for (
int l=1; l<=3; l++) {
594 delta.
set(k,i,j) += tmp ;
611 cout <<
"diffent" << endl;
612 cout<< diff_ent << endl;
613 cout <<
"mer" << mer << endl;
631 Sym_tensor gamt2(*map, COV, (*map).get_bvect_spher());
632 for (
int i=1; i<=3; i++)
633 for (
int j=1; j<=3; j++)
634 { gamt2.
set(i,j)=gam.cov()(i,j);
648 TrK3 = k_uu.
trace(gam);
653 Scalar ham_constr = gam.ricci_scal() ;
655 ham_constr += TrK3*TrK3 -
contract(k_uu, 0, 1, k_dd, 0, 1) ;
676 evol_eq += lapse2*(TrK3*k_dd - 2*
contract(k_dd, 1, k_dd.
up(0, gam), 0) ) ;
684 cout <<
"================================================================" << endl;
685 cout <<
" THE ITERATION HAS NOW CONVERGED" << endl;
686 cout <<
"================================================================" << endl;
Vector shift
Shift vector.
Sym_tensor hatA
Rescaled tracefree extrinsic curvature tensor: rescaled same way as Cordero et al.
void annule_domain(int l)
Sets the Tensor to zero in a given domain.
Tbl maxabs(const Tensor &aa, const char *comment=0x0, ostream &ost=cout, bool verb=true)
Maxima in each domain of the absolute values of the tensor components.
Metric for tensor calculation.
Cmp log(const Cmp &)
Neperian logarithm.
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 coef() const
Computes the coeffcients of *this.
Cmp sqrt(const Cmp &)
Square root.
Standard units of space, time and mass.
Tensor up(int ind, const Metric &gam) const
Computes a new tensor by raising an index of *this.
void ylm()
Computes the coefficients of *this.
const Scalar & laplacian(int ced_mult_r=4) const
Returns the Laplacian of *this.
Flat metric for tensor calculation.
Tensor field of valence 0 (or component of a tensorial field).
Tensor up_down(const Metric &gam) const
Computes a new tensor by raising or lowering all the indices of *this .
const Tensor_sym & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
virtual void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
virtual void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
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 & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
void secmembre_kerr(Sym_tensor &source_hh)
If hor_type=1, computes the rhs of hyperbolic equation for conformal metric assuming stationarity; WA...
void set_dzpuis(int)
Modifies the dzpuis flag.
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 std_spectral_base()
Sets the standard spectal bases of decomposition for each component.
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values in the compactified ext...
void annule_hard()
Sets the Scalar to zero in a hard way.
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
void compute_stat_metric(double precis, double Omega_i, bool NorKappa_i, Scalar NoK_i, bool isCF_i=true, double relax=0.2, int mer_max=2000, int mer_max2=200, bool isvoid=true)
If hor_type=1, computes a quasi-stationary 3-slice from the chosen parameters.
const Vector & divergence(const Metric &) const
Returns the divergence of this with respect to a Metric .
virtual void inc_dzpuis(int inc=1)
Increases by inc units the value of dzpuis and changes accordingly the values of the Scalar in the co...
virtual const Scalar & eta() const
Gives the field such that the angular components of the vector are written: .
Sym_tensor hij
Deviation tensor( non-flat part of the conformal 3-metric on the slice; see Bonazzola et al...
Scalar sol_elliptic_boundary(Param_elliptic ¶ms, const Mtbl_cf &bound, double fact_dir, double fact_neu) const
Resolution of a general elliptic equation, putting zero at infinity and with inner boundary condition...
const Map & mp
Mapping associated with the slice.
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 .
int type_hor
Chosen horizon type.
Scalar lapse
Lapse function.
void mult_rsint()
Multiplication by everywhere; dzpuis is not changed.
This class contains the parameters needed to call the general elliptic solver.
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.
virtual void inc_dzpuis(int inc=1)
Increases by inc units the value of dzpuis and changes accordingly the values in the compactified ext...
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
const Tensor & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
double & set_grid_point(int l, int k, int j, int i)
Setting the value of the field at a given grid point.
Scalar & set(const Itbl &ind)
Returns the value of a component (read/write version).
Coefficients storage for the multi-domain spectral method.
const Scalar & dsdr() const
Returns of *this .
virtual const Scalar & mu() const
Gives the field such that the angular components of the vector are written: .
Valeur & set_spectral_va()
Returns va (read/write version)
Scalar & set(int)
Read/write access to a component.
const Vector & derive_cov(const Metric &gam) const
Returns the gradient (1-form = covariant vector) of *this
const Mg3d * get_angu_1dom() const
Returns the pointer on the associated mono-domain angular grid.
virtual void annule(int l_min, int l_max)
Sets the Tensor to zero in several domains.
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values of the Scalar in the co...
Sym_tensor derive_lie(const Vector &v) const
Computes the Lie derivative of this with respect to some vector field v.
Class intended to describe valence-2 symmetric tensors.
const Valeur & get_spectral_va() const
Returns va (read only version)
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.