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
00027
00028 char tslice_conf_init_C[] = "$Header: /cvsroot/Lorene/C++/Source/Time_slice/tslice_conf_init.C,v 1.11 2010/10/20 07:58:09 j_novak Exp $" ;
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 #include <assert.h>
00077
00078
00079 #include "time_slice.h"
00080 #include "unites.h"
00081 #include "graphique.h"
00082 #include "utilitaires.h"
00083
00084 void Time_slice_conf::initial_data_cts(const Sym_tensor& uu,
00085 const Scalar& trk_in, const Scalar& trk_point,
00086 double pdt, double precis, int method_poisson_vect,
00087 const char* graph_device, const Scalar* p_ener_dens,
00088 const Vector* p_mom_dens, const Scalar* p_trace_stress) {
00089
00090 using namespace Unites ;
00091
00092
00093
00094 double tr_uu = max(maxabs(uu.trace(tgam()), "trace tgam_{ij} u^{ij}")) ;
00095 if (tr_uu > 1.e-7) {
00096 cerr <<
00097 "Time_slice_conf::initial_data_cts : the trace of u^{ij} with respect\n"
00098 << " to the conformal metric tgam_{ij} is not zero !\n"
00099 << " error = " << tr_uu << endl ;
00100 abort() ;
00101 }
00102
00103 assert(trk_in.check_dzpuis(2)) ;
00104 assert(trk_point.check_dzpuis(4)) ;
00105
00106
00107
00108 double ttime = the_time[jtime] ;
00109
00110 trk_evol.update(trk_in, jtime, ttime) ;
00111
00112
00113 k_dd_evol.downdate(jtime) ;
00114 k_uu_evol.downdate(jtime) ;
00115
00116 set_hata(psi4()*psi()*psi()* uu / (2.* nn()) ) ;
00117
00118 const Map& map = uu.get_mp() ;
00119 const Base_vect& triad = *(uu.get_triad()) ;
00120
00121
00122 int ngraph0 = 10 ;
00123 int nz = map.get_mg()->get_nzone() ;
00124 double ray_des = 1.25 * map.val_r(nz-2, 1., 0., 0.) ;
00125
00126
00127 Scalar ener_dens(map) ;
00128 if (p_ener_dens != 0x0) ener_dens = *(p_ener_dens) ;
00129 else ener_dens.set_etat_zero() ;
00130
00131 Vector mom_dens(map, CON, triad) ;
00132 if (p_mom_dens != 0x0) mom_dens = *(p_mom_dens) ;
00133 else mom_dens.set_etat_zero() ;
00134
00135 Scalar trace_stress(map) ;
00136 if (p_trace_stress != 0x0) trace_stress = *(p_trace_stress) ;
00137 else trace_stress.set_etat_zero() ;
00138
00139 Scalar tmp(map) ;
00140 Scalar source_psi(map) ;
00141 Scalar source_nn(map) ;
00142 Vector source_beta(map, CON, triad) ;
00143
00144
00145
00146 int imax = 100 ;
00147 for (int i=0; i<imax; i++) {
00148
00149
00150
00151
00152
00153 const Vector& dpsi = psi().derive_cov(ff) ;
00154 const Vector& dln_psi = ln_psi().derive_cov(ff) ;
00155 const Vector& dnn = nn().derive_cov(ff) ;
00156
00157 Sym_tensor taa = aa().up_down(tgam()) ;
00158 Scalar aa_quad = contract(taa, 0, 1, aa(), 0, 1) ;
00159
00160
00161
00162 tmp = 0.125* psi() * tgam().ricci_scal()
00163 - contract(hh(), 0, 1, dpsi.derive_cov(ff), 0, 1 ) ;
00164 tmp.inc_dzpuis() ;
00165
00166 tmp -= contract(hdirac(), 0, dpsi, 0) ;
00167
00168 source_psi = tmp - psi()*psi4()* ( 0.5*qpig* ener_dens
00169 + 0.125* aa_quad
00170 - 8.33333333333333e-2* trk()*trk() ) ;
00171
00172
00173
00174
00175 source_nn = psi4()*( nn()*( qpig* (ener_dens + trace_stress) + aa_quad
00176 - 0.3333333333333333* trk()*trk() )
00177 - trk_point )
00178 - 2.* contract(dln_psi, 0, nn().derive_con(tgam()), 0)
00179 - contract(hdirac(), 0, dnn, 0) ;
00180
00181 tmp = psi4()* contract(beta(), 0, trk().derive_cov(ff), 0)
00182 - contract( hh(), 0, 1, dnn.derive_cov(ff), 0, 1 ) ;
00183
00184 tmp.inc_dzpuis() ;
00185
00186 source_nn += tmp ;
00187
00188
00189
00190
00191
00192 source_beta = 2.* contract(aa(), 1,
00193 dnn - 6.*nn() * dln_psi, 0) ;
00194
00195 source_beta += 2.* nn() * ( 2.*qpig* psi4() * mom_dens
00196 + 0.66666666666666666* trk().derive_con(tgam())
00197 - contract(tgam().connect().get_delta(), 1, 2,
00198 aa(), 0, 1) ) ;
00199
00200 Vector vtmp = contract(hh(), 0, 1,
00201 beta().derive_cov(ff).derive_cov(ff), 1, 2)
00202 + 0.3333333333333333*
00203 contract(hh(), 1, beta().divergence(ff).derive_cov(ff), 0)
00204 - hdirac().derive_lie(beta())
00205 + uu.divergence(ff) ;
00206 vtmp.inc_dzpuis() ;
00207
00208 source_beta -= vtmp ;
00209
00210 source_beta += 0.66666666666666666* beta().divergence(ff) * hdirac() ;
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220 Scalar psi_jp1 = source_psi.poisson() + 1. ;
00221
00222 if (psi_jp1.get_etat() == ETATUN) psi_jp1.std_spectral_base() ;
00223
00224
00225 maxabs(psi_jp1.laplacian() - source_psi,
00226 "Absolute error in the resolution of the equation for Psi") ;
00227
00228 des_meridian(psi_jp1, 0., ray_des, "Psi", ngraph0, graph_device) ;
00229
00230
00231
00232
00233 Scalar nn_jp1 = source_nn.poisson() + 1. ;
00234
00235 if (nn_jp1.get_etat() == ETATUN) nn_jp1.std_spectral_base() ;
00236
00237
00238 maxabs(nn_jp1.laplacian() - source_nn,
00239 "Absolute error in the resolution of the equation for N") ;
00240
00241 des_meridian(nn_jp1, 0., ray_des, "N", ngraph0+1, graph_device) ;
00242
00243
00244
00245
00246 Vector beta_jp1 = source_beta.poisson(0.3333333333333333, ff,
00247 method_poisson_vect) ;
00248
00249 des_meridian(beta_jp1(1), 0., ray_des, "\\gb\\ur\\d", ngraph0+2,
00250 graph_device) ;
00251 des_meridian(beta_jp1(2), 0., ray_des, "\\gb\\u\\gh\\d", ngraph0+3,
00252 graph_device) ;
00253 des_meridian(beta_jp1(3), 0., ray_des, "\\gb\\u\\gf\\d", ngraph0+4,
00254 graph_device) ;
00255
00256
00257 Vector test_beta = (beta_jp1.derive_con(ff)).divergence(ff)
00258 + 0.3333333333333333 * (beta_jp1.divergence(ff)).derive_con(ff) ;
00259 test_beta.inc_dzpuis() ;
00260 maxabs(test_beta - source_beta,
00261 "Absolute error in the resolution for beta") ;
00262
00263
00264
00265
00266
00267 double diff_psi = max( diffrel(psi(), psi_jp1) ) ;
00268 double diff_nn = max( diffrel(nn(), nn_jp1) ) ;
00269 double diff_beta = max( diffrel(beta(), beta_jp1) ) ;
00270
00271 cout << "step = " << i << " : diff_psi = " << diff_psi
00272 << " diff_nn = " << diff_nn
00273 << " diff_beta = " << diff_beta << endl ;
00274 if ( (diff_psi < precis) && (diff_nn < precis) && (diff_beta < precis) )
00275 break ;
00276
00277
00278
00279
00280
00281 set_psi_del_npsi(psi_jp1) ;
00282
00283 n_evol.update(nn_jp1, jtime, ttime) ;
00284
00285 beta_evol.update(beta_jp1, jtime, ttime) ;
00286
00287
00288 Sym_tensor aa_jp1 = ( beta().ope_killing_conf(tgam()) + uu )
00289 / (2.* nn()) ;
00290
00291 set_hata( aa_jp1 / (psi4()*psi()*psi()) ) ;
00292
00293 }
00294
00295
00296
00297
00298
00299 npsi_evol.update( n_evol[jtime]*psi_evol[jtime], jtime, ttime ) ;
00300 A_hata() ;
00301 B_hata() ;
00302
00303
00304
00305
00306 double ttime1 = ttime ;
00307 int jtime1 = jtime ;
00308 for (int j=1; j < depth; j++) {
00309 jtime1++ ;
00310 ttime1 += pdt ;
00311 psi_evol.update(psi_evol[jtime], jtime1, ttime1) ;
00312 npsi_evol.update(npsi_evol[jtime], jtime1, ttime1) ;
00313 n_evol.update(n_evol[jtime], jtime1, ttime1) ;
00314 beta_evol.update(beta_evol[jtime], jtime1, ttime1) ;
00315 hh_evol.update(hh_evol[jtime], jtime1, ttime1) ;
00316 hata_evol.update(hata_evol[jtime], jtime1, ttime1) ;
00317 A_hata_evol.update(A_hata_evol[jtime], jtime1, ttime1) ;
00318 B_hata_evol.update(B_hata_evol[jtime], jtime1, ttime1) ;
00319 trk_evol.update(trk_evol[jtime], jtime1, ttime1) ;
00320 the_time.update(ttime1, jtime1, ttime1) ;
00321 }
00322 jtime += depth - 1 ;
00323
00324
00325
00326 Sym_tensor uu0 = uu ;
00327 uu0.dec_dzpuis(2) ;
00328
00329 for (int j=1; j < depth; j++) {
00330 hh_evol.update(hh_evol[jtime] - j*pdt* uu0,
00331 jtime-j, the_time[jtime-j]) ;
00332
00333 trk_evol.update(trk_evol[jtime] - j*pdt* trk_point,
00334 jtime-j, the_time[jtime-j]) ;
00335
00336 }
00337
00338
00339
00340 del_deriv() ;
00341
00342 }