28 char time_slice_conf_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Time_slice/time_slice_conf.C,v 1.18 2014/10/13 08:53:47 j_novak Exp $" ;
104 #include "time_slice.h" 105 #include "utilitaires.h" 121 const Scalar& trk_in,
int depth_in)
124 psi_evol(psi_in, depth_in),
126 hh_evol(hh_in, depth_in),
127 hata_evol(hata_in, depth_in),
128 A_hata_evol(depth_in), B_hata_evol(depth_in){
141 Scalar det_in = tgam_in(1, 1)*tgam_in(2, 2)*tgam_in(3, 3)
142 + tgam_in(1, 2)*tgam_in(2, 3)*tgam_in(3, 1)
143 + tgam_in(1, 3)*tgam_in(2, 1)*tgam_in(3, 2)
144 - tgam_in(3, 1)*tgam_in(2, 2)*tgam_in(1, 3)
145 - tgam_in(3, 2)*tgam_in(2, 3)*tgam_in(1, 1)
146 - tgam_in(3, 3)*tgam_in(2, 1)*tgam_in(1, 2) ;
149 "Deviation of det tgam^{ij} from 1/f")) ;
150 if ( diffdet > 1.e-13 ) {
152 "Time_slice_conf::Time_slice_conf : the input h^{ij} does not" 153 <<
" ensure \n" <<
" det tgam_{ij} = f ! \n" 154 <<
" error = " << diffdet << endl ;
175 :
Time_slice(lapse_in, shift_in, gamma_in, kk_in, depth_in),
189 0.3333333333333333) ) ;
252 bool partial_read,
int depth_in)
253 :
Time_slice(mp, triad, fich, true, depth_in),
271 for (
int j=jmin; j<=
jtime; j++) {
272 fread_be(&indicator,
sizeof(
int), 1, fich) ;
273 if (indicator == 1) {
279 for (
int j=jmin; j<=
jtime; j++) {
280 fread_be(&indicator,
sizeof(
int), 1, fich) ;
281 if (indicator == 1) {
288 for (
int j=jmin; j<=
jtime; j++) {
289 fread_be(&indicator,
sizeof(
int), 1, fich) ;
290 if (indicator == 1) {
295 for (
int j=jmin; j<=
jtime; j++) {
296 fread_be(&indicator,
sizeof(
int), 1, fich) ;
297 if (indicator == 1) {
307 "Time_slice constructor from file: the case of full reading\n" 308 <<
" is not ready yet !" << endl ;
396 "Time_slice_conf::operator=(const Time_slice& ) : not implemented yet !" 495 Scalar det_in = tgam_in(1, 1)*tgam_in(2, 2)*tgam_in(3, 3)
496 + tgam_in(1, 2)*tgam_in(2, 3)*tgam_in(3, 1)
497 + tgam_in(1, 3)*tgam_in(2, 1)*tgam_in(3, 2)
498 - tgam_in(3, 1)*tgam_in(2, 2)*tgam_in(1, 3)
499 - tgam_in(3, 2)*tgam_in(2, 3)*tgam_in(1, 1)
500 - tgam_in(3, 3)*tgam_in(2, 1)*tgam_in(1, 2) ;
503 "Deviation of det tgam^{ij} from 1/f")) ;
504 if ( diffdet > 1.e-13 ) {
506 "Time_slice_conf::set_hh : the input h^{ij} does not" 507 <<
" ensure \n" <<
" det tgam_{ij} = f ! \n" 508 <<
" error = " << diffdet << endl ;
576 hata_tt.inc_dzpuis(2) ;
648 + 0.3333333333333333*
trk()*
gam().con(),
670 if (tmp.get_dzpuis() == 3)
684 if (tmp.get_dzpuis() == 3)
779 hh_point.inc_dzpuis(2) ;
830 source.inc_dzpuis() ;
831 p_vec_X =
new Vector( source.poisson( 1./3., methode_poisson ) ) ;
838 double relax,
int meth_poisson) {
843 for (
int i=1; i<=3; i++)
844 for (
int j=i; j<=3; j++)
845 assert( hata_tt(i,j).get_dzpuis() == 2 ) ;
865 for (
int it=0; it<iter_max; it++) {
874 for (
int i=1; i<=3; i++)
878 (*p_vec_X) = relax*X_new + ( 1. - relax )*(*
p_vec_X) ;
881 if (diff < precis) break ;
891 void Time_slice_conf::set_AB_hata(
const Scalar& A_in,
const Scalar& B_in) {
904 void Time_slice_conf::check_psi_dot(
Tbl& tlnpsi_dot,
Tbl& tdiff,
Tbl& tdiff_rel)
const {
917 tlnpsi_dot =
max(
abs(lnpsi_dot)) ;
932 tdiff_rel = tdiff / tref ;
945 flux <<
"Triad on which the components of the flat metric are defined:\n" 962 "Conformal metric tilde gamma is up to date" << endl ;
988 for (
int j=jmin; j<=
jtime; j++) {
989 int indicator = (
psi_evol.is_known(j)) ? 1 : 0 ;
990 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
991 if (indicator == 1)
psi_evol[j].sauve(fich) ;
996 for (
int j=jmin; j<=
jtime; j++) {
997 int indicator = (
hata_evol.is_known(j) ? 1 : 0 ) ;
998 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
999 if (indicator == 1)
hata_evol[j].sauve(fich) ;
1004 for (
int j=jmin; j<=
jtime; j++) {
1005 int indicator = (
A_hata_evol.is_known(j)) ? 1 : 0 ;
1006 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
1011 for (
int j=jmin; j<=
jtime; j++) {
1012 int indicator = (
B_hata_evol.is_known(j)) ? 1 : 0 ;
1013 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
1019 if (!partial_save) {
1020 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.
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.
const Tensor_sym & get_delta() const
Returns the tensor which defines the connection with respect to the flat one: is the difference bet...
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.
virtual const Connection & connect() const
Returns the connection.
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).
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 .
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.
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 )