107#include "time_slice.h"
108#include "utilitaires.h"
124 const Scalar& trk_in,
int 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) ;
151 double diffdet =
max(
maxabs(det_in - 1. /
ff.determinant(),
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),
192 0.3333333333333333) ) ;
193 p_psi4->std_spectral_base() ;
255 bool partial_read,
int depth_in)
256 :
Time_slice(mp, triad, fich, true, depth_in),
274 for (
int j=jmin; j<=
jtime; j++) {
275 fread_be(&indicator,
sizeof(
int), 1, fich) ;
276 if (indicator == 1) {
277 Scalar psi_file(mp, *(mp.get_mg()), fich) ;
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) {
294 Scalar A_file(mp, *(mp.get_mg()), fich) ;
298 for (
int j=jmin; j<=
jtime; j++) {
299 fread_be(&indicator,
sizeof(
int), 1, fich) ;
300 if (indicator == 1) {
301 Scalar B_file(mp, *(mp.get_mg()), fich) ;
310 "Time_slice constructor from file: the case of full reading\n"
311 <<
" is not ready yet !" << endl ;
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) ;
505 double diffdet =
max(
maxabs(det_in - 1. /
ff.determinant(),
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 ;
651 + 0.3333333333333333*
trk()*
gam().con(),
715 p_psi4->std_spectral_base() ;
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 ) ;
868 for (
int it=0; it<iter_max; it++) {
877 for (
int i=1; i<=3; i++)
881 (*p_vec_X) = relax*X_new + ( 1. - relax )*(*
p_vec_X) ;
884 if (diff < precis) break ;
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"
949 << *(
ff.get_triad()) <<
'\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 !"
Vectorial bases (triads) with respect to which the tensorial components are defined.
const Tensor_sym & get_delta() const
Returns the tensor which defines the connection with respect to the flat one: is the difference bet...
Flat metric for tensor calculation.
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
Metric for tensor calculation.
virtual const Connection & connect() const
Returns the connection.
Tensor field of valence 0 (or component of a tensorial field).
void set_etat_one()
Sets the logical state to ETATUN (one).
int get_dzpuis() const
Returns dzpuis.
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field.
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 void set_etat_zero()
Sets the logical state to ETATZERO (zero).
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...
Transverse and traceless symmetric tensors of rank 2.
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 .
Class intended to describe valence-2 symmetric tensors.
const Scalar & compute_A(bool output_ylm=true, Param *par=0x0) const
Gives the field A (see member p_aaa ).
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 .
Sym_tensor derive_lie(const Vector &v) const
Computes the Lie derivative of this with respect to some vector field v.
Symmetric tensors (with respect to two of their arguments).
virtual const Scalar & npsi() const
Factor at the current time step (jtime ).
Evolution_std< Sym_tensor > hh_evol
Values at successive time steps of the components .
virtual ~Time_slice_conf()
Destructor.
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
virtual const Sym_tensor & gam_dd() const
Induced metric (covariant components ) at the current time step (jtime ).
virtual const Sym_tensor & hh(Param *=0x0, Param *=0x0) const
Deviation of the conformal metric from the flat metric : .
virtual void set_psi_del_n(const Scalar &psi_in)
Sets the conformal factor relating the physical metric to the conformal one: .
virtual void set_hata_TT(const Sym_tensor_tt &hata_tt)
Sets the TT part of (see member hata_evol ).
virtual void sauve(FILE *fich, bool partial_save) const
Total or partial saves in a binary file.
virtual const Sym_tensor & k_dd() const
Extrinsic curvature tensor (covariant components ) at the current time step (jtime ).
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 const Scalar & nn() const
Lapse function N at the current time step (jtime ).
virtual void set_psi_del_npsi(const Scalar &psi_in)
Sets the conformal factor relating the physical metric to the conformal one: .
virtual const Sym_tensor & hata() const
Conformal representation of the traceless part of the extrinsic curvature: .
virtual const Sym_tensor & k_uu() const
Extrinsic curvature tensor (contravariant components ) at the current time step (jtime ).
const Scalar & ln_psi() const
Logarithm of at the current time step (jtime ).
Evolution_std< Sym_tensor > hata_evol
Values at successive time steps of the components .
virtual const Vector & hdirac() const
Vector which vanishes in Dirac gauge.
virtual const Scalar & A_hata() const
Returns the potential A of .
virtual const Vector & vec_X(int method_poisson=6) const
Vector representing the longitudinal part of .
void operator=(const Time_slice_conf &)
Assignment to another Time_slice_conf.
virtual const Scalar & psi() const
Conformal factor relating the physical metric to the conformal one: .
Metric * p_tgamma
Pointer on the conformal metric at the current time step (jtime).
virtual const Scalar & B_hata() const
Returns the potential of .
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator<<).
virtual void del_deriv() const
Deletes all the derived quantities.
void check_psi_dot(Tbl &tlnpsi_dot, Tbl &tdiff, Tbl &tdiff_rel) const
Checks the relation.
Evolution_std< Scalar > npsi_evol
Values at successive time steps of the factor .
Vector * p_vec_X
Pointer on the vector representing the longitudinal part of .
virtual Sym_tensor aa() const
Conformal representation of the traceless part of the extrinsic curvature: .
virtual void set_hata(const Sym_tensor &hata_in)
Sets the conformal representation of the traceless part of the extrinsic curvature: .
Vector * p_hdirac
Pointer on the vector (which vanishes in Dirac gauge), at the current time step (jtime).
const Scalar & psi4() const
Factor at the current time step (jtime ).
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.
Evolution_std< Scalar > psi_evol
Values at successive time steps of the conformal factor relating the physical metric to the conform...
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).
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...
virtual const Metric & tgam() const
Conformal metric Returns the value at the current time step (jtime ).
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.
virtual const Sym_tensor & gam_uu() const
Induced metric (contravariant components ) at the current time step (jtime ).
Evolution_std< Scalar > A_hata_evol
Potential A associated with the symmetric tensor .
const Metric_flat & ff
Pointer on the flat metric with respect to which the conformal decomposition is performed.
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.
Scalar * p_ln_psi
Pointer on the logarithm of at the current time step (jtime).
Evolution_std< Scalar > B_hata_evol
Potential associated with the symmetric tensor .
virtual void set_hh(const Sym_tensor &hh_in)
Sets the deviation of the conformal metric from the flat metric : .
virtual const Scalar & trk() const
Trace K of the extrinsic curvature at the current time step (jtime ).
Scalar * p_psi4
Pointer on the factor at the current time step (jtime).
int jtime
Time step index of the latest slice.
Evolution_std< Scalar > trk_evol
Values at successive time steps of the trace K of the extrinsic curvature.
Metric * p_gamma
Pointer on the induced metric at the current time step (jtime).
Evolution_std< Sym_tensor > k_dd_evol
Values at successive time steps of the covariant components of the extrinsic curvature tensor .
virtual void sauve(FILE *fich, bool partial_save) const
Total or partial saves in a binary file.
void operator=(const Time_slice &)
Assignment to another Time_slice.
Evolution_full< Tbl > adm_mass_evol
ADM mass at each time step, since the creation of the slice.
Evolution_std< Sym_tensor > gam_dd_evol
Values at successive time steps of the covariant components of the induced metric .
Evolution_std< Sym_tensor > gam_uu_evol
Values at successive time steps of the contravariant components of the induced metric .
int scheme_order
Order of the finite-differences scheme for the computation of time derivatives.
virtual const Vector & beta() const
shift vector at the current time step (jtime )
virtual void del_deriv() const
Deletes all the derived quantities.
const Metric & gam() const
Induced metric at the current time step (jtime ).
virtual const Sym_tensor & k_uu() const
Extrinsic curvature tensor (contravariant components ) at the current time step (jtime ).
int depth
Number of stored time slices.
Evolution_std< Scalar > n_evol
Values at successive time steps of the lapse function N.
Time_slice(const Scalar &lapse_in, const Vector &shift_in, const Sym_tensor &gamma_in, const Sym_tensor &kk_in, int depth_in=3)
General constructor (Hamiltonian-like).
Evolution_std< double > the_time
Time label of each slice.
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator<<).
Evolution_std< Sym_tensor > k_uu_evol
Values at successive time steps of the contravariant components of the extrinsic curvature tensor .
Evolution_std< Vector > beta_evol
Values at successive time steps of the shift vector .
Tensor field of valence 1.
Vector poisson(double lambda, int method=6) const
Solves the vector Poisson equation with *this as a source.
const Scalar & divergence(const Metric &) const
The divergence of this with respect to a Metric .
Sym_tensor ope_killing_conf(const Metric &gam) const
Computes the conformal Killing operator associated with a given metric.
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
Cmp pow(const Cmp &, int)
Power .
Cmp abs(const Cmp &)
Absolute value.
Cmp log(const Cmp &)
Neperian logarithm.
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
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.
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
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 void set_etat_zero()
Sets the logical state of all components to ETATZERO (zero state).
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
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.
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.