00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef __TIME_SLICE_H_
00027 #define __TIME_SLICE_H_
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 #include "star_rot_dirac.h"
00158 #include "evolution.h"
00159
00160
00161
00162
00163
00169 class Time_slice {
00170
00171
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
00232
00233 protected:
00235 mutable Metric* p_gamma ;
00236
00237
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
00310
00311 protected:
00312
00314 virtual void del_deriv() const ;
00315
00317 void set_der_0x0() const ;
00318
00319
00320
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
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
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
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
00487
00488
00494 class Time_slice_conf : public Time_slice {
00495
00496
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
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
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
00668
00669 protected:
00670
00672 virtual void del_deriv() const ;
00673
00675 void set_der_0x0() const ;
00676
00677
00678
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
00755
00756 public:
00757
00758
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
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
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
00938
00939 protected:
00941 virtual ostream& operator>>(ostream& ) const ;
00942
00951 virtual void sauve(FILE* fich, bool partial_save) const ;
00952
00953 } ;
00954
00955
00956
00957
00964 class Tslice_dirac_max : public Time_slice_conf {
00965
00966
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
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
01085
01086 public:
01088 void operator=(const Tslice_dirac_max&) ;
01089
01090
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
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
01278
01279 public:
01280
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
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
01326
01327 protected:
01329 virtual ostream& operator>>(ostream& ) const ;
01330
01339 virtual void sauve(FILE* fich, bool partial_save) const ;
01340
01341 };
01342 #endif