Debian Codegraph @

Codes/Test/Einstein/test_time_slice.C

raw
1 /*
2 * Tests of class Time_slice
3 *
4 * (see file time_slice.h for documentation).
5 *
6 */
7
8 /*
9 * Copyright (c) 2004 Eric Gourgoulhon, Jose Luis Jaramillo & Jerome Novak
10 *
11 * This file is part of LORENE.
12 *
13 * LORENE is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2
15 * as published by the Free Software Foundation.
16 *
17 * LORENE is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with LORENE; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28 char test_time_slice_C[] = "$Header: /cvsroot/Lorene/Codes/Test/Einstein/test_time_slice.C,v 1.7 2014/10/13 08:54:00 j_novak Exp $" ;
29
30 /*
31 * $Id: test_time_slice.C,v 1.7 2014/10/13 08:54:00 j_novak Exp $
32 * $Log: test_time_slice.C,v $
33 * Revision 1.7 2014/10/13 08:54:00 j_novak
34 * Lorene classes and functions now belong to the namespace Lorene.
35 *
36 * Revision 1.6 2014/10/06 15:12:52 j_novak
37 * Modified #include directives to use c++ syntax.
38 *
39 * Revision 1.5 2004/04/05 11:54:43 j_novak
40 * First operational (but not tested!) version of checks of Eintein equation.
41 *
42 * Revision 1.4 2004/03/30 14:02:05 j_novak
43 * Test of the class Tslide_dirac_max (preliminary version).
44 *
45 * Revision 1.3 2004/03/29 12:01:12 e_gourgoulhon
46 * Added test for new class Time_slice_conf.
47 *
48 * Revision 1.2 2004/03/26 13:33:03 j_novak
49 * New methods for accessing/updating members (nn(), beta(), gam_uu(), k_uu(), ...)
50 *
51 * Revision 1.1 2004/03/24 14:58:19 e_gourgoulhon
52 * First version
53 *
54 *
55 * $Header: /cvsroot/Lorene/Codes/Test/Einstein/test_time_slice.C,v 1.7 2014/10/13 08:54:00 j_novak Exp $
56 *
57 */
58
59 // C++ headers
60 #include "headcpp.h"
61
62 // C headers
63 #include <cstdlib>
64
65 // Lorene headers
66 #include "nbr_spx.h"
67 #include "tensor.h"
68 #include "metric.h"
69 #include "time_slice.h"
70 #include "utilitaires.h"
71 #include "graphique.h"
72
73 using namespace Lorene ;
74
75 int main() {
76
77 // Setup of a multi-domain grid (Lorene class Mg3d)
78 // ------------------------------------------------
79
80 int nz = 3 ; // Number of domains
81 int nr = 7 ; // Number of collocation points in r in each domain
82 int nt = 5 ; // Number of collocation points in theta in each domain
83 int np = 8 ; // Number of collocation points in phi in each domain
84 int symmetry_theta = SYM ; // symmetry with respect to the equatorial plane
85 int symmetry_phi = NONSYM ; // no symmetry in phi
86 bool compact = true ; // external domain is compactified
87
88 // Multi-domain grid construction:
89 Mg3d mgrid(nz, nr, nt, np, symmetry_theta, symmetry_phi, compact) ;
90
91 cout << mgrid << endl ;
92
93
94 // Setup of an affine mapping : grid --> physical space (Lorene class Map_af)
95 // --------------------------------------------------------------------------
96
97 // radial boundaries of each domain:
98 double r_limits[] = {0., 2., 3., __infinity} ;
99 assert( nz == 3 ) ; // since the above array described only 3 domains
100
101 Map_af map(mgrid, r_limits) ; // Mapping construction
102
103 cout << map << endl ;
104
105 // Construction of a time slice Sigma_t
106 // ------------------------------------
107
108 Time_slice sigma(map, map.get_bvect_spher()) ;
109
110 sigma.set_scheme_order(0) ; //stationary space-time
111
112 // cout << sigma << endl ;
113 // arrete() ;
114
115 // cout << sigma.nn() ;
116 // arrete() ;
117 // cout << sigma.beta() ;
118 // arrete() ;
119 // cout << sigma.gam_uu() ;
120 // arrete() ;
121 // cout << sigma.gam_dd() ;
122 // arrete() ;
123 // cout << sigma.k_dd() ;
124 // arrete() ;
125 // cout << sigma.k_uu() << endl ;
126
127 // cout << "nn : " << sigma.nn() << endl ;
128 // cout << "beta : " << sigma.beta() << endl ;
129 // cout << "gam_uu : " << sigma.gam_uu() << endl ;
130 // cout << "gam : " << sigma.gam() << endl ;
131 // cout << "gam_dd : " << sigma.gam_dd() << endl ;
132
133
134 // Construction of a time slice with conformal decomposition
135 // ---------------------------------------------------------
136
137 Time_slice_conf sigma_c(sigma.nn(), sigma.beta(), sigma.gam_uu(),
138 sigma.k_uu(), map.flat_met_spher()) ;
139
140 //cout << sigma_c << endl ;
141
142 const Coord& x = map.x ;
143 const Coord& y = map.y ;
144 const Coord& r = map.r ;
145
146 Scalar khi_init(map) ;
147 khi_init = exp( - r*r ) * x*y ;
148 khi_init.std_spectral_base() ;
149 khi_init.set_outer_boundary(nz-1, 0.) ;
150
151 Scalar mu_init(map) ;
152 mu_init = 1. / (1.+r*r*r*r*r*r) ;
153 mu_init.std_spectral_base() ;
154 mu_init.mult_r() ;
155 mu_init.mult_r() ;
156 mu_init.mult_r() ;
157 mu_init.mult_cost() ;
158
159 Sym_tensor_tt hijtt(map, map.get_bvect_spher() , map.flat_met_spher()) ;
160 hijtt.set_khi_mu( khi_init, mu_init ) ;
161
162 Scalar trace_nulle(map) ;
163 trace_nulle = 0 ;
164 Sym_tensor_trans hij(map, map.get_bvect_spher() , map.flat_met_spher()) ;
165 hij.set_tt_trace(hijtt, trace_nulle) ;
166
167 Tslice_dirac_max dirac_slice(sigma_c.nn(), sigma_c.beta() ,
168 map.flat_met_spher(), sigma_c.psi(),
169 hij, sigma_c.aa()) ;
170
171 dirac_slice.set_scheme_order(0) ; //stationary space-time
172 cout << dirac_slice ;
173
174 dirac_slice.check_hamiltonian_constraint() ;
175
176 dirac_slice.check_momentum_constraint() ;
177
178 dirac_slice.check_dynamical_equations() ;
179
180
181 return EXIT_SUCCESS ;
182 }