107 #include "time_slice.h" 108 #include "utilitaires.h" 124 const Scalar& trk_in,
int depth_in)
127 psi_evol(psi_in, depth_in),
129 hh_evol(hh_in, depth_in),
130 hata_evol(hata_in, depth_in),
131 A_hata_evol(depth_in), B_hata_evol(depth_in){
144 Scalar det_in = tgam_in(1, 1)*tgam_in(2, 2)*tgam_in(3, 3)
145 + tgam_in(1, 2)*tgam_in(2, 3)*tgam_in(3, 1)
146 + tgam_in(1, 3)*tgam_in(2, 1)*tgam_in(3, 2)
147 - tgam_in(3, 1)*tgam_in(2, 2)*tgam_in(1, 3)
148 - tgam_in(3, 2)*tgam_in(2, 3)*tgam_in(1, 1)
149 - tgam_in(3, 3)*tgam_in(2, 1)*tgam_in(1, 2) ;
152 "Deviation of det tgam^{ij} from 1/f")) ;
153 if ( diffdet > 1.e-13 ) {
155 "Time_slice_conf::Time_slice_conf : the input h^{ij} does not" 156 <<
" ensure \n" <<
" det tgam_{ij} = f ! \n" 157 <<
" error = " << diffdet << endl ;
178 :
Time_slice(lapse_in, shift_in, gamma_in, kk_in, depth_in),
184 A_hata_evol(depth_in), B_hata_evol(depth_in) {
192 0.3333333333333333) ) ;
220 A_hata_evol(depth_in), B_hata_evol(depth_in) {
255 bool partial_read,
int depth_in)
256 :
Time_slice(mp, triad, fich, true, depth_in),
262 A_hata_evol(depth_in), B_hata_evol(depth_in) {
274 for (
int j=jmin; j<=
jtime; j++) {
275 fread_be(&indicator,
sizeof(
int), 1, fich) ;
276 if (indicator == 1) {
282 for (
int j=jmin; j<=
jtime; j++) {
283 fread_be(&indicator,
sizeof(
int), 1, fich) ;
284 if (indicator == 1) {
291 for (
int j=jmin; j<=
jtime; j++) {
292 fread_be(&indicator,
sizeof(
int), 1, fich) ;
293 if (indicator == 1) {
298 for (
int j=jmin; j<=
jtime; j++) {
299 fread_be(&indicator,
sizeof(
int), 1, fich) ;
300 if (indicator == 1) {
310 "Time_slice constructor from file: the case of full reading\n" 311 <<
" is not ready yet !" << endl ;
326 psi_evol(tin.psi_evol),
327 npsi_evol(tin.npsi_evol),
328 hh_evol(tin.hh_evol),
329 hata_evol(tin.hata_evol),
330 A_hata_evol(tin.A_hata_evol),
331 B_hata_evol(tin.B_hata_evol){
399 "Time_slice_conf::operator=(const Time_slice& ) : not implemented yet !" 498 Scalar det_in = tgam_in(1, 1)*tgam_in(2, 2)*tgam_in(3, 3)
499 + tgam_in(1, 2)*tgam_in(2, 3)*tgam_in(3, 1)
500 + tgam_in(1, 3)*tgam_in(2, 1)*tgam_in(3, 2)
501 - tgam_in(3, 1)*tgam_in(2, 2)*tgam_in(1, 3)
502 - tgam_in(3, 2)*tgam_in(2, 3)*tgam_in(1, 1)
503 - tgam_in(3, 3)*tgam_in(2, 1)*tgam_in(1, 2) ;
506 "Deviation of det tgam^{ij} from 1/f")) ;
507 if ( diffdet > 1.e-13 ) {
509 "Time_slice_conf::set_hh : the input h^{ij} does not" 510 <<
" ensure \n" <<
" det tgam_{ij} = f ! \n" 511 <<
" error = " << diffdet << endl ;
579 hata_tt.inc_dzpuis(2) ;
651 + 0.3333333333333333*
trk()*
gam().con(),
673 if (tmp.get_dzpuis() == 3)
687 if (tmp.get_dzpuis() == 3)
782 hh_point.inc_dzpuis(2) ;
833 source.inc_dzpuis() ;
834 p_vec_X =
new Vector( source.poisson( 1./3., methode_poisson ) ) ;
841 double relax,
int meth_poisson) {
846 for (
int i=1; i<=3; i++)
847 for (
int j=i; j<=3; j++)
848 assert( hata_tt(i,j).get_dzpuis() == 2 ) ;
850 assert( hh_evol.is_known(jtime) ) ;
854 const Tensor_sym& delta = tgam().connect().get_delta() ;
855 if (p_vec_X != 0x0) {
862 - 2./3.*psi4()*psi()*psi()*
contract( tgam().con(), 0, trk().derive_cov(ff), 0 );
864 p_vec_X =
new Vector( source.
poisson( 1./3., meth_poisson ) ) ;
868 for (
int it=0; it<iter_max; it++) {
871 -
contract( delta, 1, 2, p_vec_X->ope_killing_conf(ff), 0, 1 ) ;
877 for (
int i=1; i<=3; i++)
878 diff +=
max(
max(
abs( X_new(i) - (*p_vec_X)(i) ) ) ) ;
881 (*p_vec_X) = relax*X_new + ( 1. - relax )*(*p_vec_X) ;
884 if (diff < precis) break ;
888 hata_evol.update( hata_tt + p_vec_X->ope_killing_conf(ff), jtime, the_time[jtime] ) ;
890 k_dd_evol.downdate(jtime) ;
891 k_uu_evol.downdate(jtime) ;
920 tlnpsi_dot =
max(
abs(lnpsi_dot)) ;
935 tdiff_rel = tdiff / tref ;
948 flux <<
"Triad on which the components of the flat metric are defined:\n" 965 "Conformal metric tilde gamma is up to date" << endl ;
991 for (
int j=jmin; j<=
jtime; j++) {
992 int indicator = (
psi_evol.is_known(j)) ? 1 : 0 ;
993 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
994 if (indicator == 1)
psi_evol[j].sauve(fich) ;
999 for (
int j=jmin; j<=
jtime; j++) {
1000 int indicator = (
hata_evol.is_known(j) ? 1 : 0 ) ;
1001 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
1002 if (indicator == 1)
hata_evol[j].sauve(fich) ;
1007 for (
int j=jmin; j<=
jtime; j++) {
1008 int indicator = (
A_hata_evol.is_known(j)) ? 1 : 0 ;
1009 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
1014 for (
int j=jmin; j<=
jtime; j++) {
1015 int indicator = (
B_hata_evol.is_known(j)) ? 1 : 0 ;
1016 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
1022 if (!partial_save) {
1023 cout <<
"Time_slice_conf::sauve: the full writing is not ready yet !" void operator=(const Time_slice &)
Assignment to another Time_slice.
virtual const Vector & beta() const
shift vector at the current time step (jtime )
virtual const Scalar & psi() const
Conformal factor relating the physical metric to the conformal one: .
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.
const Scalar & psi4() const
Factor at the current time step (jtime ).
Metric for tensor calculation.
virtual void set_npsi_del_psi(const Scalar &npsi_in)
Sets the factor at the current time step (jtime ) and deletes the value of .
virtual void set_psi_del_npsi(const Scalar &psi_in)
Sets the conformal factor relating the physical metric to the conformal one: .
Cmp log(const Cmp &)
Neperian logarithm.
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
Evolution_std< Scalar > npsi_evol
Values at successive time steps of the factor .
virtual const Sym_tensor & gam_uu() const
Induced metric (contravariant components ) at the current time step (jtime )
void operator=(const Time_slice_conf &)
Assignment to another Time_slice_conf.
virtual const Vector & hdirac() const
Vector which vanishes in Dirac gauge.
Evolution_std< Scalar > psi_evol
Values at successive time steps of the conformal factor relating the physical metric to the conform...
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
virtual const Metric & tgam() const
Conformal metric Returns the value at the current time step (jtime ).
virtual const Scalar & determinant() const
Returns the determinant.
virtual void del_deriv() const
Deletes all the derived quantities.
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator<<).
Scalar * p_ln_psi
Pointer on the logarithm of at the current time step (jtime)
Evolution_full< Tbl > adm_mass_evol
ADM mass at each time step, since the creation of the slice.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Flat metric for tensor calculation.
int scheme_order
Order of the finite-differences scheme for the computation of time derivatives.
Tensor field of valence 0 (or component of a tensorial field).
Evolution_std< Scalar > A_hata_evol
Potential A associated with the symmetric tensor .
Base class for coordinate mappings.
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the metric is defined.
int jtime
Time step index of the latest slice.
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
virtual void set_psi_del_n(const Scalar &psi_in)
Sets the conformal factor relating the physical metric to the conformal one: .
Evolution_std< Sym_tensor > gam_dd_evol
Values at successive time steps of the covariant components of the induced metric ...
virtual void set_hh(const Sym_tensor &hh_in)
Sets the deviation of the conformal metric from the flat metric : .
void compute_X_from_momentum_constraint(const Vector &hat_S, const Sym_tensor_tt &hata_tt, int iter_max=200, double precis=1.e-12, double relax=0.8, int methode_poisson=6)
Computes the vector from the conformally-rescaled momentum , using the momentum constraint.
virtual void set_npsi_del_n(const Scalar &npsi_in)
Sets the factor at the current time step (jtime ) and deletes the value of N.
Tensor field of valence 1.
Vectorial bases (triads) with respect to which the tensorial components are defined.
virtual const Sym_tensor & hh(Param *=0x0, Param *=0x0) const
Deviation of the conformal metric from the flat metric : .
Vector * p_hdirac
Pointer on the vector (which vanishes in Dirac gauge), at the current time step (jtime).
Evolution_std< Scalar > B_hata_evol
Potential associated with the symmetric tensor .
virtual const Sym_tensor & gam_dd() const
Induced metric (covariant components ) at the current time step (jtime )
Evolution_std< Sym_tensor > k_uu_evol
Values at successive time steps of the contravariant components of the extrinsic curvature tensor ...
Sym_tensor ope_killing_conf(const Metric &gam) const
Computes the conformal Killing operator associated with a given metric.
void set_A_tildeB(const Scalar &a_in, const Scalar &tb_in, Param *par_bc=0x0, Param *par_mat=0x0)
Assigns the derived members A and .
virtual const Sym_tensor & k_uu() const
Extrinsic curvature tensor (contravariant components ) at the current time step (jtime ) ...
virtual void set_hata(const Sym_tensor &hata_in)
Sets the conformal representation of the traceless part of the extrinsic curvature: ...
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
Spacelike time slice of a 3+1 spacetime.
virtual const Scalar & trk() const
Trace K of the extrinsic curvature at the current time step (jtime )
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 & A_hata() const
Returns the potential A of .
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
Vector poisson(double lambda, int method=6) const
Solves the vector Poisson equation with *this as a source.
const Scalar & ln_psi() const
Logarithm of at the current time step (jtime ).
int get_dzpuis() const
Returns dzpuis.
const Scalar & compute_A(bool output_ylm=true, Param *par=0x0) const
Gives the field A (see member p_aaa ).
virtual void set_hata_TT(const Sym_tensor_tt &hata_tt)
Sets the TT part of (see member hata_evol ).
Evolution_std< Sym_tensor > gam_uu_evol
Values at successive time steps of the contravariant components of the induced metric ...
virtual const Vector & vec_X(int method_poisson=6) const
Vector representing the longitudinal part of .
virtual ~Time_slice_conf()
Destructor.
void set_etat_one()
Sets the logical state to ETATUN (one).
Evolution_std< Sym_tensor > k_dd_evol
Values at successive time steps of the covariant components of the extrinsic curvature tensor ...
const Metric & gam() const
Induced metric at the current time step (jtime )
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 .
virtual void set_hata_from_XAB(Param *par_bc=0x0, Param *par_mat=0x0)
Sets the conformal representation of the traceless part of the extrinsic curvature from its potentia...
Spacelike time slice of a 3+1 spacetime with conformal decomposition.
Scalar * p_psi4
Pointer on the factor at the current time step (jtime)
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
Metric * p_gamma
Pointer on the induced metric at the current time step (jtime)
virtual const Scalar & npsi() const
Factor at the current time step (jtime ).
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator<<).
Cmp pow(const Cmp &, int)
Power .
virtual Sym_tensor aa() const
Conformal representation of the traceless part of the extrinsic curvature: .
Time_slice_conf(const Scalar &lapse_in, const Vector &shift_in, const Metric_flat &ff_in, const Scalar &psi_in, const Sym_tensor &hh_in, const Sym_tensor &hata_in, const Scalar &trk_in, int depth_in=3)
Constructor from conformal decomposition.
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
Metric * p_tgamma
Pointer on the conformal metric at the current time step (jtime)
virtual const Sym_tensor & k_dd() const
Extrinsic curvature tensor (covariant components ) at the current time step (jtime ) ...
virtual const Scalar & determinant() const
Returns the determinant.
virtual const Sym_tensor & hata() const
Conformal representation of the traceless part of the extrinsic curvature: .
Evolution_std< double > the_time
Time label of each slice.
virtual const Sym_tensor & k_uu() const
Extrinsic curvature tensor (contravariant components ) at the current time step (jtime ) ...
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
const Metric_flat & ff
Pointer on the flat metric with respect to which the conformal decomposition is performed.
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Vector * p_vec_X
Pointer on the vector representing the longitudinal part of .
Cmp abs(const Cmp &)
Absolute value.
Scalar compute_tilde_B_tt(bool output_ylm=true, Param *par=0x0) const
Gives the field (see member p_tilde_b ) associated with the TT-part of the Sym_tensor ...
Evolution_std< Scalar > trk_evol
Values at successive time steps of the trace K of the extrinsic curvature.
Evolution_std< Scalar > n_evol
Values at successive time steps of the lapse function N.
virtual void set_etat_zero()
Sets the logical state of all components to ETATZERO (zero state).
virtual void del_deriv() const
Deletes all the derived quantities.
virtual const Scalar & B_hata() const
Returns the potential of .
Symmetric tensors (with respect to two of their arguments).
void check_psi_dot(Tbl &tlnpsi_dot, Tbl &tdiff, Tbl &tdiff_rel) const
Checks the relation.
Evolution_std< Sym_tensor > hata_evol
Values at successive time steps of the components .
Evolution_std< Vector > beta_evol
Values at successive time steps of the shift vector .
virtual void sauve(FILE *fich, bool partial_save) const
Total or partial saves in a binary file.
const Map & get_mp() const
Returns the mapping.
int depth
Number of stored time slices.
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...
Evolution_std< Sym_tensor > hh_evol
Values at successive time steps of the components .
Sym_tensor derive_lie(const Vector &v) const
Computes the Lie derivative of this with respect to some vector field v.
virtual void set_AB_hata(const Scalar &A_in, const Scalar &B_in)
Sets the potentials A and of the TT part (see the documentation of Sym_tensor for details)...
Class intended to describe valence-2 symmetric tensors.
Transverse and traceless symmetric tensors of rank 2.
virtual void sauve(FILE *fich, bool partial_save) const
Total or partial saves in a binary file.
virtual const Scalar & nn() const
Lapse function N at the current time step (jtime )