time_slice.h

00001 /*
00002  *  Definition of Lorene class Time_slice
00003  *
00004  */
00005 
00006 /*
00007  *   Copyright (c) 2004 Eric Gourgoulhon, Jose Luis Jaramillo & Jerome Novak
00008  *
00009  *   This file is part of LORENE.
00010  *
00011  *   LORENE is free software; you can redistribute it and/or modify
00012  *   it under the terms of the GNU General Public License version 2
00013  *   as published by the Free Software Foundation.
00014  *
00015  *   LORENE is distributed in the hope that it will be useful,
00016  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *   GNU General Public License for more details.
00019  *
00020  *   You should have received a copy of the GNU General Public License
00021  *   along with LORENE; if not, write to the Free Software
00022  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  */
00025 
00026 #ifndef __TIME_SLICE_H_ 
00027 #define __TIME_SLICE_H_ 
00028 
00029 /*
00030  * $Id: time_slice.h,v 1.31 2012/02/06 12:59:07 j_novak Exp $
00031  * $Log: time_slice.h,v $
00032  * Revision 1.31  2012/02/06 12:59:07  j_novak
00033  * Correction of some errors.
00034  *
00035  * Revision 1.30  2010/10/20 07:58:09  j_novak
00036  * Better implementation of the explicit time-integration. Not fully-tested yet.
00037  *
00038  * Revision 1.29  2008/12/04 18:22:49  j_novak
00039  * Enhancement of the dzpuis treatment + various bug fixes.
00040  *
00041  * Revision 1.28  2008/12/02 15:02:21  j_novak
00042  * Implementation of the new constrained formalism, following Cordero et al. 2009
00043  * paper. The evolution eqs. are solved as a first-order system. Not tested yet!
00044  *
00045  * Revision 1.27  2008/08/19 06:41:59  j_novak
00046  * Minor modifications to avoid warnings with gcc 4.3. Most of them concern
00047  * cast-type operations, and constant strings that must be defined as const char*
00048  *
00049  * Revision 1.26  2007/11/06 14:47:06  j_novak
00050  * New constructor from a rotating star in Dirac gauge (class Star_rot_Dirac).
00051  * Evolution can take into account matter terms.
00052  *
00053  * Revision 1.25  2007/04/25 15:20:59  j_novak
00054  * Corrected an error in the initialization of tildeB in
00055  * Tslice_dirac_max::initial_dat_cts. + New method for solve_hij_AB.
00056  *
00057  * Revision 1.24  2007/03/21 14:51:48  j_novak
00058  * Introduction of potentials A and tilde(B) of h^{ij} into Tslice_dirac_max.
00059  *
00060  * Revision 1.23  2005/03/28 19:44:00  f_limousin
00061  * Function tgam() is now virtual.
00062  *
00063  * Revision 1.22  2004/06/24 20:36:07  e_gourgoulhon
00064  * Class Time_slice_conf: added method check_psi_dot.
00065  *
00066  * Revision 1.21  2004/06/14 20:46:35  e_gourgoulhon
00067  * Added argument method_poisson to Tslice_dirac_max::solve_hij.
00068  *
00069  * Revision 1.20  2004/05/31 20:28:20  e_gourgoulhon
00070  * -- Class Time_slice : added inline functions get_latest_j() and
00071  *    get_time()
00072  * -- Class Tslice_dirac_max: method hh_det_one takes now a time step
00073  *    as argument, to compute h^{ij} from khi and mu at an arbitrary
00074  *    time step and not only the latest one.
00075  *
00076  * Revision 1.19  2004/05/27 15:22:28  e_gourgoulhon
00077  * Added functions save and sauve, as well as constructors from file.
00078  *
00079  * Revision 1.18  2004/05/20 20:30:37  e_gourgoulhon
00080  * Added arguments check_mod and save_mod to method Tsclice_dirac_max::evolve.
00081  *
00082  * Revision 1.17  2004/05/17 19:52:16  e_gourgoulhon
00083  * -- Method initial_data_cts: added arguments graph_device and
00084  *    method_poisson_vect.
00085  * -- Method Tslice_dirac_max::solve_beta : added argument method
00086  * -- Method Tslice_dirac_max::solve_hij : added argument graph_device
00087  * -- Method Tslice_dirac_max::evolve : added arguments
00088  *    method_poisson_vect, nopause and graph_device.
00089  *
00090  * Revision 1.16  2004/05/12 15:16:25  e_gourgoulhon
00091  * Added #include "metric.h" before #include "evolution.h".
00092  *
00093  * Revision 1.15  2004/05/09 20:56:09  e_gourgoulhon
00094  * Added member adm_mass_evol and corresponding virtual method adm_mass().
00095  *
00096  * Revision 1.14  2004/05/06 15:23:10  e_gourgoulhon
00097  * initial_data_cts is know a virtual function of class Time_slice_conf
00098  * and is implemented also for class Tslice_dirac_max.
00099  *
00100  * Revision 1.13  2004/05/03 14:46:11  e_gourgoulhon
00101  * Class Tslice_dirac_max: -- changed prototype of method solve_hij
00102  *                         -- added new method evolve
00103  *
00104  * Revision 1.12  2004/04/30 14:36:15  j_novak
00105  * Added the method Tslice_dirac_max::solve_hij(...)
00106  * NOT READY YET!!!
00107  *
00108  * Revision 1.11  2004/04/30 10:51:38  e_gourgoulhon
00109  * Class Tslice_dirac_max: added methods solve_n, solve_q and solve_beta
00110  * for resolution of the elliptic part of Einstein equations.
00111  *
00112  * Revision 1.10  2004/04/29 17:07:27  e_gourgoulhon
00113  * Added argument pdt to Time_slice_conf::initial_data_cts.
00114  *
00115  * Revision 1.9  2004/04/08 16:42:11  e_gourgoulhon
00116  * Many changes:
00117  * -- class Time_slice_conf: added methods set_*, changed argument list of
00118  *    method initial_data_cts.
00119  * -- class Tslice_dirac_max: added methods set_* and  hh_det_one().
00120  *
00121  * Revision 1.8  2004/04/05 21:21:51  e_gourgoulhon
00122  * class Time_slice_conf: added method initial_data_cts (computation of
00123  *  initial data from conformally thin sandwich method).
00124  * classes  Time_slice_conf and Tslice_dirac_max: added constructor as
00125  *  standard time slice of Minkowski spacetime.
00126  *
00127  * Revision 1.7  2004/04/01 16:09:01  j_novak
00128  * Trace of K_ij is now member of Time_slice (it was member of Time_slice_conf).
00129  * Added new methods for checking 3+1 Einstein equations (preliminary).
00130  *
00131  * Revision 1.6  2004/03/30 14:00:30  j_novak
00132  * New class Tslide_dirac_max (first version).
00133  *
00134  * Revision 1.5  2004/03/29 11:58:53  e_gourgoulhon
00135  * Many modif. to class Time_slice_conf.
00136  * Minor modif. to class Time_slice.
00137  *
00138  * Revision 1.4  2004/03/28 21:33:14  e_gourgoulhon
00139  * Constructor  Time_slice::Time_slice(int depth_in) declared "explicit".
00140  *
00141  * Revision 1.3  2004/03/28 21:27:57  e_gourgoulhon
00142  * Class Time_slice: - renamed the Evolution_std with suffix "_evol".
00143  *                   - added protected constructor for derived classes
00144  * Added class Time_slice_conf.
00145  *
00146  * Revision 1.2  2004/03/26 13:33:02  j_novak
00147  * New methods for accessing/updating members (nn(), beta(), gam_uu(), k_uu(), ...)
00148  *
00149  * Revision 1.1  2004/03/24 14:56:18  e_gourgoulhon
00150  * First version
00151  *
00152  *
00153  * $Header: /cvsroot/Lorene/C++/Include/time_slice.h,v 1.31 2012/02/06 12:59:07 j_novak Exp $
00154  *
00155  */
00156 
00157 #include "star_rot_dirac.h"
00158 #include "evolution.h"
00159 
00160                     //---------------------------//
00161                     //      class Time_slice     //
00162                     //---------------------------//
00163 
00169 class Time_slice {
00170 
00171     // Data : 
00172     // -----
00173     protected:
00175         int depth ; 
00176         
00183         int scheme_order ; 
00184         
00186         int jtime ; 
00187         
00189     Evolution_std<double> the_time ;
00190         
00194     mutable Evolution_std<Sym_tensor> gam_dd_evol ; 
00195         
00199     mutable Evolution_std<Sym_tensor> gam_uu_evol ; 
00200 
00204     mutable Evolution_std<Sym_tensor> k_dd_evol ; 
00205 
00209     mutable Evolution_std<Sym_tensor> k_uu_evol ; 
00210 
00212     mutable Evolution_std<Scalar> n_evol ; 
00213         
00215     mutable Evolution_std<Vector> beta_evol ; 
00216         
00220     mutable Evolution_std<Scalar> trk_evol ; 
00221 
00229         mutable Evolution_full<Tbl> adm_mass_evol ; 
00230 
00231     // Derived data : 
00232     // ------------
00233     protected:
00235     mutable Metric* p_gamma ;   
00236 
00237     // Constructors - Destructor
00238     // -------------------------
00239     public:
00240     
00252     Time_slice(const Scalar& lapse_in, const Vector& shift_in,
00253            const Sym_tensor& gamma_in, const Sym_tensor& kk_in,
00254            int depth_in = 3) ; 
00255     
00265     Time_slice(const Scalar& lapse_in, const Vector& shift_in,
00266            const Evolution_std<Sym_tensor>& gamma_in) ; 
00267     
00278     Time_slice(const Map& mp, const Base_vect& triad, int depth_in = 3) ; 
00279     
00294     Time_slice(const Map& mp, const Base_vect& triad, FILE* fich, 
00295            bool partial_read, int depth_in = 3) ; 
00296     
00297     Time_slice(const Time_slice& ) ;   
00298     
00299     protected:
00303     explicit Time_slice(int depth_in) ; 
00304     
00305     public:
00306     virtual ~Time_slice() ;         
00307  
00308 
00309     // Memory management
00310     // -----------------
00311     protected:
00312         
00314     virtual void del_deriv() const ; 
00315     
00317     void set_der_0x0() const ; 
00318 
00319 
00320     // Mutators / assignment
00321     // ---------------------
00322     public:
00324     void operator=(const Time_slice&) ;
00325 
00327     void set_scheme_order(int ord) { 
00328         assert ((0<= ord)&&(ord < 4)) ;
00329       scheme_order = ord ; } ; 
00330     
00331     // Accessors
00332     // ---------
00333     public:
00334 
00336     int get_scheme_order() const { return scheme_order ; } ;
00337         
00339         int get_latest_j() const {return jtime; } ;
00340         
00342         const Evolution_std<double>& get_time() const {return the_time; } ; 
00343     
00345     virtual const Scalar& nn() const ;
00346     
00348     virtual const Vector& beta() const ;
00349     
00351     const Metric& gam() const ;
00352     
00356     virtual const Sym_tensor& gam_dd() const ;
00357     
00361     virtual const Sym_tensor& gam_uu() const ;
00362     
00366     virtual const Sym_tensor& k_dd() const ;
00367     
00371     virtual const Sym_tensor& k_uu() const ;
00372     
00376         virtual const Scalar& trk() const ; 
00377         
00378     
00379     // Computational functions
00380     // -----------------------
00381     public:
00397      Tbl check_hamiltonian_constraint(const Scalar* energy_density = 0x0,
00398                       ostream& ost = cout, bool verb=true) const ;
00399     
00415      Tbl check_momentum_constraint(const Vector* momentum_density = 0x0,
00416                        ostream& ost = cout, bool verb=true) const ;
00417     
00440      Tbl check_dynamical_equations(const Sym_tensor* strain_tensor = 0x0,
00441                        const Scalar* energy_density = 0x0,
00442                        ostream& ost = cout, bool verb=true) const  ; 
00443     
00448         virtual double adm_mass() const ; 
00449         
00450     // Outputs
00451     // -------
00452     protected:
00454     virtual ostream& operator>>(ostream& ) const ; 
00455     
00457     friend ostream& operator<<(ostream& , const Time_slice& ) ; 
00458 
00459     public:
00466     void save(const char* rootname) const ; 
00467     
00468     protected:
00477     virtual void sauve(FILE* fich, bool partial_save) const ; 
00478 
00479 };
00480 
00481 ostream& operator<<(ostream& , const Time_slice& ) ;    
00482 
00483 
00484 
00485                     //---------------------------//
00486                     //   class Time_slice_conf   //
00487                     //---------------------------//
00488 
00494 class Time_slice_conf : public Time_slice {
00495 
00496     // Data : 
00497     // -----
00498     protected: 
00499     
00503         const Metric_flat& ff ;  
00504 
00513     mutable Evolution_std<Scalar> psi_evol ; 
00514         
00518     mutable Evolution_std<Scalar> npsi_evol ; 
00519         
00520         
00526     mutable Evolution_std<Sym_tensor> hh_evol ; 
00527 
00538     mutable Evolution_std<Sym_tensor> hata_evol ; 
00539 
00543     mutable Evolution_std<Scalar> A_hata_evol ;
00544         
00548     mutable Evolution_std<Scalar> B_hata_evol ;
00549         
00550     // Derived data : 
00551     // ------------
00552     protected:
00556         mutable Metric* p_tgamma ; 
00557         
00559         mutable Scalar* p_psi4 ; 
00560         
00562         mutable Scalar* p_ln_psi ; 
00563         
00567         mutable Vector* p_hdirac ; 
00568 
00573     mutable Vector* p_vec_X ;
00574 
00575     // Constructors - Destructor
00576     // -------------------------
00577     public:
00578     
00603     Time_slice_conf(const Scalar& lapse_in, const Vector& shift_in,
00604             const Metric_flat& ff_in, const Scalar& psi_in, 
00605             const Sym_tensor& hh_in, const Sym_tensor& hata_in, 
00606             const Scalar& trk_in, int depth_in = 3) ; 
00607     
00608     
00623     Time_slice_conf(const Scalar& lapse_in, const Vector& shift_in,
00624                const Sym_tensor& gamma_in, const Sym_tensor& kk_in,
00625                const Metric_flat& ff_in, int depth_in = 3) ; 
00626                
00639     Time_slice_conf(const Map& mp, const Base_vect& triad, 
00640                     const Metric_flat& ff_in, int depth_in = 3) ; 
00641     
00658     Time_slice_conf(const Map& mp, const Base_vect& triad, 
00659                     const Metric_flat& ff_in, FILE* fich, 
00660                     bool partial_read, int depth_in = 3) ; 
00661 
00662     Time_slice_conf(const Time_slice_conf& ) ;  
00663 
00664     virtual ~Time_slice_conf() ;            
00665  
00666 
00667     // Memory management
00668     // -----------------
00669     protected:
00670         
00672     virtual void del_deriv() const ; 
00673     
00675     void set_der_0x0() const ; 
00676 
00677 
00678     // Mutators / assignment
00679     // ---------------------
00680     public:
00682     void operator=(const Time_slice_conf&) ;
00683 
00685     void operator=(const Time_slice&) ;
00686         
00697         virtual void set_psi_del_npsi(const Scalar& psi_in) ; 
00698         
00709         virtual void set_psi_del_n(const Scalar& psi_in) ; 
00710         
00715         virtual void set_npsi_del_psi(const Scalar& npsi_in) ; 
00716         
00721         virtual void set_npsi_del_n(const Scalar& npsi_in) ; 
00722         
00731         virtual void set_hh(const Sym_tensor& hh_in) ; 
00732 
00739         virtual void set_hata(const Sym_tensor& hata_in) ; 
00740 
00744     virtual void set_hata_TT(const Sym_tensor_tt& hata_tt) ;
00745 
00752     virtual void set_hata_from_XAB(Param* par_bc=0x0, Param* par_mat=0x0) ;
00753 
00754     // Accessors
00755     // ---------
00756     public:
00757 
00758         // Virtual functions from base class Time_slice:
00759         // ---------------------------------------------
00760 
00762     virtual const Scalar& nn() const ;
00763     
00767     virtual const Sym_tensor& gam_dd() const ;
00768     
00772     virtual const Sym_tensor& gam_uu() const ;
00773     
00777     virtual const Sym_tensor& k_dd() const ;
00778     
00782     virtual const Sym_tensor& k_uu() const ;
00783     
00784         // Virtual functions from this class:
00785         // ----------------------------------
00786 
00791     virtual const Scalar& A_hata() const ; 
00792     
00797     virtual const Scalar& B_hata() const ;
00798     
00806         virtual const Scalar& psi() const ; 
00807         
00809         const Scalar& psi4() const ; 
00810         
00812         const Scalar& ln_psi() const ; 
00813         
00816         virtual const Scalar& npsi() const ; 
00817         
00822         virtual const Metric& tgam() const ; 
00823 
00830         virtual const Sym_tensor& hh(Param* = 0x0, Param* = 0x0) const ; 
00831 
00837         virtual const Sym_tensor& hata() const ; 
00838 
00844         virtual Sym_tensor aa() const ; 
00845 
00849         virtual const Scalar& trk() const ; 
00850         
00854         virtual const Vector& hdirac() const ;
00855 
00859         virtual const Vector& vec_X(int method_poisson=6) const ;
00860         
00861     // Computational methods
00862     // ---------------------
00863     public:
00867     void compute_X_from_momentum_constraint
00868         (const Vector& hat_S, const Sym_tensor_tt& hata_tt, 
00869           int iter_max = 200, double precis = 1.e-12,
00870          double relax = 0.8, int methode_poisson = 6) ;
00871 
00877     virtual void set_AB_hata(const Scalar& A_in, const Scalar& B_in) ; 
00878 
00912          virtual void initial_data_cts(const Sym_tensor& uu, const Scalar& trk_in, 
00913                 const Scalar& trk_point, double pdt, double precis = 1.e-12,
00914                 int method_poisson_vect = 6, const char* graph_device = 0x0, 
00915                 const Scalar* ener_dens = 0x0, const Vector* mom_dens = 0x0, 
00916                 const Scalar* trace_stress = 0x0 ) ; 
00917         
00922         virtual double adm_mass() const ; 
00923         
00935         void check_psi_dot(Tbl& tlnpsi_dot, Tbl& tdiff, Tbl& tdiff_rel) const ; 
00936         
00937     // Outputs
00938     // -------
00939     protected:
00941     virtual ostream& operator>>(ostream& ) const ; 
00942     
00951     virtual void sauve(FILE* fich, bool partial_save) const ; 
00952 
00953 } ; 
00954                     //----------------------------//
00955                     //   class Tslice_dirac_max   //
00956                     //----------------------------//
00957 
00964 class Tslice_dirac_max : public Time_slice_conf {
00965 
00966   // Data : 
00967   // -----
00968  protected: 
00973   mutable Evolution_std<Scalar> A_hh_evol ;
00974   
00979   mutable Evolution_std<Scalar> B_hh_evol ;
00980 
00985   mutable Evolution_std<Scalar> source_A_hh_evol ;
00986   
00991   mutable Evolution_std<Scalar> source_B_hh_evol ;
00992 
00997   mutable Evolution_std<Scalar> source_A_hata_evol ;
00998   
01003   mutable Evolution_std<Scalar> source_B_hata_evol ;
01004 
01006   mutable Evolution_std<Scalar> trh_evol ;
01007 
01008 
01009     // Constructors - Destructor
01010     // -------------------------
01011     public:
01036     Tslice_dirac_max(const Scalar& lapse_in, const Vector& shift_in,
01037             const Metric_flat& ff_in, const Scalar& psi_in, 
01038             const Sym_tensor_trans& hh_in, const Sym_tensor& hata_in, 
01039             int depth_in = 3) ; 
01040     
01053     Tslice_dirac_max(const Map& mp, const Base_vect& triad, 
01054                      const Metric_flat& ff_in, int depth_in = 3) ; 
01055     
01072     Tslice_dirac_max(const Map& mp, const Base_vect& triad, 
01073                      const Metric_flat& ff_in, FILE* fich, 
01074                      bool partial_read, int depth_in = 3) ; 
01075 
01077     Tslice_dirac_max(const Star_rot_Dirac& star, double pdt, int depth_in = 3) ;
01078 
01079     Tslice_dirac_max(const Tslice_dirac_max& ) ;   
01080 
01081     virtual ~Tslice_dirac_max() ;           
01082  
01083 
01084     // Mutators / assignment
01085     // ---------------------
01086     public:
01088     void operator=(const Tslice_dirac_max&) ;   
01089     
01090         // Virtual functions from base class Time_slice_conf:
01091         // -------------------------------------------------
01092 
01101         virtual void set_hh(const Sym_tensor& hh_in) ; 
01102 
01136          virtual void initial_data_cts(const Sym_tensor& uu, const Scalar& trk_in, 
01137                 const Scalar& trk_point, double pdt, double precis = 1.e-12,
01138                 int method_poisson_vect = 6, const char* graph_device = 0x0, 
01139                 const Scalar* ener_dens = 0x0, const Vector* mom_dens = 0x0, 
01140                 const Scalar* trace_stress = 0x0 ) ; 
01141         
01142         // Virtual functions from this class:
01143         // ----------------------------------
01144 
01152     virtual void set_khi_mu(const Scalar& khi_in, const Scalar& mu_in) ; 
01153 
01160     virtual void set_AB_hh(const Scalar& A_in, const Scalar& B_in) ; 
01161 
01168     virtual void set_trh(const Scalar& trh_in) ;
01169     
01180     virtual Scalar solve_psi(const Scalar* ener_dens=0x0) const ; 
01181         
01197     virtual Scalar solve_npsi(const Scalar* ener_dens=0x0,
01198                   const Scalar* trace_stress=0x0) const ; 
01199         
01210     virtual Vector solve_beta(int method = 6) const ; 
01211         
01233     void evolve(double pdt, int nb_time_steps, int niter_elliptic,
01234                 double relax_elliptic, int check_mod, int save_mod,
01235                 int method_poisson_vect = 6, int nopause = 1, 
01236                 const char* graph_device = 0x0, bool verbose=true, 
01237         const Scalar* ener_euler = 0x0,
01238         const Vector* mom_euler = 0x0, const Scalar* s_euler = 0x0,
01239         const Sym_tensor* strain_euler = 0x0) ; 
01240         
01245     virtual double adm_mass() const ; 
01246         
01247     protected:
01256     void compute_sources(const Sym_tensor* strain_tensor = 0x0) const ;
01257 
01259     void initialize_sources_copy() const ;
01260 
01268     void hh_det_one(int j, Param* par_bc = 0x0, Param* par_mat = 0x0) const ; 
01269     
01275     void hh_det_one(const Sym_tensor_tt& hijtt, Param* par_mat = 0x0) const ;
01276 
01277     // Accessors
01278     // ---------
01279     public:
01280     // Virtual functions from base class Time_slice_conf:
01281     // -------------------------------------------------
01282     
01289     virtual const Sym_tensor& hh(Param* par_bc = 0x0, Param* par_mat = 0x0) const ; 
01290     
01295     virtual const Scalar& trk() const ; 
01296     
01301     virtual const Vector& hdirac() const ; 
01302     
01303     // Virtual functions from this class:
01304     // ----------------------------------
01305     
01310     virtual const Scalar& A_hh() const ; 
01311     
01316     virtual const Scalar& B_hh() const ;
01317     
01322     virtual const Scalar& trh() const ;
01323     
01324     
01325     // Outputs
01326     // -------
01327     protected:
01329     virtual ostream& operator>>(ostream& ) const ;  
01330     
01339     virtual void sauve(FILE* fich, bool partial_save) const ; 
01340   
01341 };
01342 #endif

Generated on Tue Feb 7 01:35:21 2012 for LORENE by  doxygen 1.4.6