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),
181 A_hata_evol(depth_in), B_hata_evol(depth_in) {
189 0.3333333333333333) ) ;
217 A_hata_evol(depth_in), B_hata_evol(depth_in) {
252 bool partial_read,
int depth_in)
253 :
Time_slice(mp, triad, fich, true, depth_in),
259 A_hata_evol(depth_in), B_hata_evol(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 ;
323 psi_evol(tin.psi_evol),
324 npsi_evol(tin.npsi_evol),
325 hh_evol(tin.hh_evol),
326 hata_evol(tin.hata_evol),
327 A_hata_evol(tin.A_hata_evol),
328 B_hata_evol(tin.B_hata_evol){
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 ;
648 + 0.3333333333333333*
trk()*
gam().con(),
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 ) ;
847 assert( hh_evol.is_known(jtime) ) ;
851 const Tensor_sym& delta = tgam().connect().get_delta() ;
852 if (p_vec_X != 0x0) {
859 - 2./3.*psi4()*psi()*psi()*
contract( tgam().con(), 0, trk().derive_cov(ff), 0 );
861 p_vec_X =
new Vector( source.
poisson( 1./3., meth_poisson ) ) ;
865 for (
int it=0; it<iter_max; it++) {
868 -
contract( delta, 1, 2, p_vec_X->ope_killing_conf(ff), 0, 1 ) ;
874 for (
int i=1; i<=3; i++)
875 diff +=
max(
max(
abs( X_new(i) - (*p_vec_X)(i) ) ) ) ;
878 (*p_vec_X) = relax*X_new + ( 1. - relax )*(*p_vec_X) ;
881 if (diff < precis) break ;
885 hata_evol.update( hata_tt + p_vec_X->ope_killing_conf(ff), jtime, the_time[jtime] ) ;
887 k_dd_evol.downdate(jtime) ;
888 k_uu_evol.downdate(jtime) ;
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 {
908 Scalar lnpsi_dot(
psi().get_mp()) ;
917 tlnpsi_dot =
max(
abs(lnpsi_dot)) ;
926 Tbl tref =
max(
abs(diff)) + tlnpsi_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 !"
virtual void del_deriv() const
Deletes all the derived quantities.
Evolution_std< Sym_tensor > hh_evol
Values at successive time steps of the components .
virtual const Sym_tensor & k_dd() const
Extrinsic curvature tensor (covariant components ) at the current time step (jtime )
void operator=(const Time_slice_conf &)
Assignment to another Time_slice_conf.
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
virtual const Vector & hdirac() const
Vector which vanishes in Dirac gauge.
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...
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Scalar * p_psi4
Pointer on the factor at the current time step (jtime)
int depth
Number of stored time slices.
Class intended to describe valence-2 symmetric tensors.
Metric for tensor calculation.
void set_etat_one()
Sets the logical state to ETATUN (one).
virtual const Scalar & npsi() const
Factor at the current time step (jtime ).
virtual const Scalar & nn() const
Lapse function N at the current time step (jtime )
Symmetric tensors (with respect to two of their arguments).
virtual void set_psi_del_npsi(const Scalar &psi_in)
Sets the conformal factor relating the physical metric to the conformal one: .
const Scalar & ln_psi() const
Logarithm of at the current time step (jtime ).
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 .
Metric * p_tgamma
Pointer on the conformal metric at the current time step (jtime)
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 const Sym_tensor & hata() const
Conformal representation of the traceless part of the extrinsic curvature: .
Evolution_std< Vector > beta_evol
Values at successive time steps of the shift vector .
virtual void set_npsi_del_psi(const Scalar &npsi_in)
Sets the factor at the current time step (jtime ) and deletes the value of .
Cmp log(const Cmp &)
Neperian logarithm.
Transverse and traceless symmetric tensors of rank 2.
virtual const Sym_tensor & k_uu() const
Extrinsic curvature tensor (contravariant components ) at the current time step (jtime )
virtual const Sym_tensor & k_uu() const
Extrinsic curvature tensor (contravariant components ) at the current time step (jtime )
virtual const Scalar & determinant() const
Returns the determinant.
int scheme_order
Order of the finite-differences scheme for the computation of time derivatives.
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 .
Evolution_std< Scalar > n_evol
Values at successive time steps of the lapse function N.
Evolution_full< Tbl > adm_mass_evol
ADM mass at each time step, since the creation of the slice.
virtual void set_etat_zero()
Sets the logical state of all components to ETATZERO (zero state).
virtual ~Time_slice_conf()
Destructor.
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
virtual const Sym_tensor & hh(Param *=0x0, Param *=0x0) const
Deviation of the conformal metric from the flat metric : .
Evolution_std< Scalar > B_hata_evol
Potential associated with the symmetric tensor .
virtual const Vector & vec_X(int method_poisson=6) const
Vector representing the longitudinal part of .
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
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.
const Scalar & divergence(const Metric &) const
The divergence of this with respect to a Metric .
Evolution_std< Scalar > npsi_evol
Values at successive time steps of the factor .
Cmp abs(const Cmp &)
Absolute value.
Flat metric for tensor calculation.
Vector poisson(double lambda, int method=6) const
Solves the vector Poisson equation with *this as a source.
Tensor field of valence 0 (or component of a tensorial field).
const Map & get_mp() const
Returns the mapping.
const Scalar & compute_A(bool output_ylm=true, Param *par=0x0) const
Gives the field A (see member p_aaa ).
Cmp pow(const Cmp &, int)
Power .
Sym_tensor ope_killing_conf(const Metric &gam) const
Computes the conformal Killing operator associated with a given metric.
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...
Spacelike time slice of a 3+1 spacetime with conformal decomposition.
Evolution_std< Sym_tensor > gam_dd_evol
Values at successive time steps of the covariant components of the induced metric .
virtual const Sym_tensor & gam_uu() const
Induced metric (contravariant components ) at the current time step (jtime )
virtual const Scalar & determinant() const
Returns the determinant.
Evolution_std< Sym_tensor > k_dd_evol
Values at successive time steps of the covariant components of the extrinsic curvature tensor .
virtual const Scalar & psi() const
Conformal factor relating the physical metric to the conformal one: .
Vector * p_vec_X
Pointer on the vector representing the longitudinal part of .
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
virtual void del_deriv() const
Deletes all the derived quantities.
virtual void set_hh(const Sym_tensor &hh_in)
Sets the deviation of the conformal metric from the flat metric : .
Sym_tensor derive_lie(const Vector &v) const
Computes the Lie derivative of this with respect to some vector field v.
Evolution_std< Scalar > psi_evol
Values at successive time steps of the conformal factor relating the physical metric to the conform...
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator<<).
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
Evolution_std< double > the_time
Time label of each slice.
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.
Scalar * p_ln_psi
Pointer on the logarithm of at the current time step (jtime)
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 Metric_flat & ff
Pointer on the flat metric with respect to which the conformal decomposition is performed.
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
const Scalar & psi4() const
Factor at the current time step (jtime ).
Tensor field of valence 1.
Spacelike time slice of a 3+1 spacetime.
Evolution_std< Scalar > A_hata_evol
Potential A associated with the symmetric tensor .
virtual const Sym_tensor & gam_dd() const
Induced metric (covariant components ) at the current time step (jtime )
virtual const Scalar & B_hata() const
Returns the potential of .
Evolution_std< Scalar > trk_evol
Values at successive time steps of the trace K of the extrinsic curvature.
virtual void inc_dzpuis(int inc=1)
Increases by inc units the value of dzpuis and changes accordingly the values in the compactified ext...
Evolution_std< Sym_tensor > gam_uu_evol
Values at successive time steps of the contravariant components of the induced metric .
Vector * p_hdirac
Pointer on the vector (which vanishes in Dirac gauge), at the current time step (jtime).
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field.
int jtime
Time step index of the latest slice.
void operator=(const Time_slice &)
Assignment to another Time_slice.
virtual const Scalar & trk() const
Trace K of the extrinsic curvature at the current time step (jtime )
virtual const Scalar & A_hata() const
Returns the potential A of .
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...
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.
virtual const Vector & beta() const
shift vector at the current time step (jtime )
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the metric is defined.
Metric * p_gamma
Pointer on the induced metric at the current time step (jtime)
int get_dzpuis() const
Returns dzpuis.
virtual void set_hata(const Sym_tensor &hata_in)
Sets the conformal representation of the traceless part of the extrinsic curvature: .
Base class for coordinate mappings.
Evolution_std< Sym_tensor > hata_evol
Values at successive time steps of the components .
virtual void set_hata_TT(const Sym_tensor_tt &hata_tt)
Sets the TT part of (see member hata_evol ).
Vectorial bases (triads) with respect to which the tensorial components are defined.
virtual void sauve(FILE *fich, bool partial_save) const
Total or partial saves in a binary file.
virtual Sym_tensor aa() const
Conformal representation of the traceless part of the extrinsic curvature: .
Evolution_std< Sym_tensor > k_uu_evol
Values at successive time steps of the contravariant components of the extrinsic curvature tensor .
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
virtual void set_psi_del_n(const Scalar &psi_in)
Sets the conformal factor relating the physical metric to the conformal one: .
virtual const Metric & tgam() const
Conformal metric Returns the value at the current time step (jtime ).
void dec_dzpuis()
dzpuis -= 1 ;
const Metric & gam() const
Induced metric at the current time step (jtime )