KADATH
metric_ADS.cpp
1 /*
2  Copyright 2017 GrĂ©goire Martinon
3 
4  This file is part of Kadath.
5 
6  Kadath is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Kadath is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Kadath. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "metric_AADS.hpp"
21 namespace Kadath {
22 Metric_ADS::Metric_ADS(const Space& space) : Metric(space), m_rho2(space), m_eps(space)
23 {
24  type_tensor = COV; // assume covariance
26  m_L = espace.get_domain(m_nd - 1)->get_rmax(); // radius at the last collocation point of the last physical domain
27  for (int d(0) ; d < m_nd ; ++d)
28  {
29  m_rho2.set_domain(d) = pow(espace.get_domain(d)->get_radius()/m_L, 2);
30  m_eps.set_domain(d) = (1.0 - m_rho2(d)) / (1.0 + m_rho2(d)); // conformal factor
31  }
32  p_basis = new Base_tensor(space, CARTESIAN_BASIS);
33 }
34 
35 Metric_ADS::Metric_ADS(const Metric_ADS& so) : Metric(so), m_nd(so.m_nd), m_L(so.m_L), m_rho2(so.m_rho2), m_eps(so.m_eps)
36 {
37  p_basis = new Base_tensor(*so.p_basis);
38 }
39 
40 Metric_ADS::~Metric_ADS()
41 {
42  delete p_basis;
43 }
44 
45 void Metric_ADS::update(int d)
46 {
47  assert(type_tensor == COV);
48  if (p_met_cov[d] != nullptr) compute_cov(d);
49  if (p_met_con[d] != nullptr) compute_con(d);
50  if (p_christo[d] != nullptr) compute_christo(d);
51  if (p_riemann[d] != nullptr) compute_riemann(d);
52  if (p_ricci_tensor[d] != nullptr) compute_ricci_tensor(d);
53  if (p_ricci_scalar[d] != nullptr) compute_ricci_scalar(d);
54 }
55 
57 {
58  for (int d(0) ; d < m_nd ; ++d) update(d);
59 }
60 
61 void Metric_ADS::compute_cov(int d) const
62 {
63  // epsilon^2*gama_ij is stored
64  int dim(espace.get_ndim()); // dimension
65  if (p_met_cov[d] == nullptr)
66  { // if covariant metric not computed yet
67  Metric_tensor res(espace, COV, *p_basis);
68  for (int i(1) ; i <= dim ; ++i) // build metric
69  {
70  for (int j(i) ; j <= dim ; ++j)
71  {
72  if (i == j) res.set(i, j).set_domain(d) = 4.0/pow(1.0 + m_rho2(d), 2);
73  else res.set(i, j).set_domain(d) = 0.0;
74  }
75  }
76  p_met_cov[d] = new Term_eq(d, res); // assign metric
77  p_met_cov[d]->set_der_zero(); // don't compute variations
78  }
79 }
80 
81 void Metric_ADS::compute_con(int d) const // compute contravariant metric in domain d
82 { // gama^ij / eps^2 is stored
83  // Standard value everywhere
84  int dim(espace.get_ndim()); // dimension
85  if (p_met_con[d] == nullptr)
86  {
87  Metric_tensor res(espace, CON, *p_basis);
88  for (int i(1) ; i <= dim ; ++i)
89  {
90  for (int j(i) ; j <= dim ; ++j)
91  {
92  if (i == j) res.set(i, j).set_domain(d) = 0.25*pow(1.0 + m_rho2(d), 2);
93  else res.set(i, j).set_domain(d) = 0.0;
94  }
95  }
96  p_met_con[d] = new Term_eq(d, res); // assign
97  p_met_con[d]->set_der_zero();
98  }
99 }
100 
101 void Metric_ADS::manipulate_ind(Term_eq& so, int ind) const // rise or lower indice ind on term_eq via the metric (in place)
102 {
103  int d(so.get_dom()); // domain
104  int dim(espace.get_ndim()); // dimension
105  int valence(so.get_val_t().get_valence()); // number of indices
106  int type_start(so.get_val_t().get_index_type(ind)); // Contravariant or covariant
107  if (p_met_con[d] == nullptr and type_start == COV) compute_con(d); // make sure that metric is computed
108  if (p_met_cov[d] == nullptr and type_start == CON) compute_cov(d);
109 
110  bool doder(so.der_t != nullptr); // compute variations only if tensor need to
111  Array<int> type_res (valence); // CON or COV
112  for (int i(0) ; i < valence ; ++i) type_res.set(i) = (i == ind) ? - so.get_val_t().get_index_type(i) : so.get_val_t().get_index_type(i); // change the COV/CON of ind
113 
114  Tensor val_res(espace, valence, type_res, *p_basis); // tensor
115  Tensor val_der(espace, valence, type_res, *p_basis); // its variation
116 
117  Val_domain cmpval(espace.get_domain(d)); // component value
118  Val_domain cmpder(espace.get_domain(d)); // if variation of tensor need be computed
119  Index pos(val_res);
120  do
121  { // for all indices
122  cmpval = 0.0;
123  cmpder = 0.0;
124  Index copie(pos);
125  for (int k(0) ; k < dim ; ++k)
126  {
127  copie.set(ind) = k; // loop on the indice to rise/lower
128  if (type_start == COV) cmpval += (*p_met_con[d]->val_t)(pos(ind) + 1, k + 1)(d) * (*so.val_t)(copie)(d); // g^ik T_jk
129  else cmpval += (*p_met_cov[d]->val_t)(pos(ind) + 1, k + 1)(d) * (*so.val_t)(copie)(d); // g_ik T^k_j
130  }
131  val_res.set(pos).set_domain(d) = cmpval; // assign cmpval to right component
132 
133  if (doder)
134  {
135  for (int k(0) ; k < dim ; ++k)
136  {
137  copie.set(ind) = k;
138  if (type_start == COV) cmpder += (*p_met_con[d]->val_t)(pos(ind) + 1, k + 1)(d) * (*so.der_t)(copie)(d); // recall that variations of background metric are zero
139  else cmpder += (*p_met_cov[d]->val_t)(pos(ind) + 1, k + 1)(d) * (*so.der_t)(copie)(d);
140  }
141  val_der.set(pos).set_domain(d) = cmpder; // assign cmpder to the component of the variation
142  }
143  }while (pos.inc());
144 
145  // Put the names :
146  if (so.get_val_t().is_name_affected())
147  {
148  val_res.set_name_affected();
149  for (int i(0) ; i < valence ; ++i) val_res.set_name_ind(i, so.val_t->get_name_ind()[i]); // result have same indices names as source
150  }
151 
152  if ((doder) and (so.get_der_t().is_name_affected()))
153  {
154  val_der.set_name_affected();
155  for (int i(0) ; i < valence ; ++i) val_der.set_name_ind(i, so.der_t->get_name_ind()[i]);
156  }
157 
158  delete so.val_t;
159  so.val_t = new Tensor(val_res); // in place substitution
160  delete so.der_t;
161  so.der_t = doder ? new Tensor(val_der) : nullptr;
162 
163  // multiplication/division by eps^2
164  if (type_start == CON) so = div_eps(so, 2);
165  else if (type_start == COV) so = mul_eps(so, 2);
166 }
167 
168 void Metric_ADS::compute_christo(int d) const // compute Christoffel symbols in domain d
169 { // eps*Gam_ij^k is stored
170  if (p_christo[d] == nullptr)
171  {
172  Array<int> type_ind(3);
173  type_ind.set(0) = COV; type_ind.set(1) = COV; type_ind.set(2) = CON; // position of indices
174  Tensor res_val(espace, 3, type_ind, *p_basis); // template of christoffel
175  res_val = 0.0;
176 
177  Val_domain cmpval(espace.get_domain(d));
178  cmpval = 2.0*espace.get_domain(d)->get_cart(1)/m_L/m_L/(1.0 + m_rho2(d));
179  res_val.set(1,1,1).set_domain(d) = cmpval;
180  res_val.set(1,2,2).set_domain(d) = cmpval;
181  res_val.set(2,1,2).set_domain(d) = cmpval;
182  res_val.set(1,3,3).set_domain(d) = cmpval;
183  res_val.set(3,1,3).set_domain(d) = cmpval;
184  res_val.set(2,2,1).set_domain(d) = -cmpval;
185  res_val.set(3,3,1).set_domain(d) = -cmpval;
186 
187  cmpval = 2.0*espace.get_domain(d)->get_cart(2)/m_L/m_L/(1.0 + m_rho2(d));
188  res_val.set(2,2,2).set_domain(d) = cmpval;
189  res_val.set(2,1,1).set_domain(d) = cmpval;
190  res_val.set(1,2,1).set_domain(d) = cmpval;
191  res_val.set(2,3,3).set_domain(d) = cmpval;
192  res_val.set(3,2,3).set_domain(d) = cmpval;
193  res_val.set(1,1,2).set_domain(d) = -cmpval;
194  res_val.set(3,3,2).set_domain(d) = -cmpval;
195 
196  cmpval = 2.0*espace.get_domain(d)->get_cart(3)/m_L/m_L/(1.0 + m_rho2(d));
197  res_val.set(3,3,3).set_domain(d) = cmpval;
198  res_val.set(3,1,1).set_domain(d) = cmpval;
199  res_val.set(1,3,1).set_domain(d) = cmpval;
200  res_val.set(3,2,2).set_domain(d) = cmpval;
201  res_val.set(2,3,2).set_domain(d) = cmpval;
202  res_val.set(1,1,3).set_domain(d) = -cmpval;
203  res_val.set(2,2,3).set_domain(d) = -cmpval;
204 
205  p_christo[d] = new Term_eq(d, res_val);
206  p_christo[d]->set_der_zero(); // don't compute the variations
207  }
208 }
209 
210 Term_eq Metric_ADS::derive_simple(const Term_eq& so) const // covariant derivative which does not affect indices and assume derivative indice is covariant
211 {
212  assert(espace.get_ndim() == 3);
213  bool doder(so.der_t != nullptr);
214  int d(so.get_dom()); // domain
215  int so_val(so.val_t->get_valence());
216  Term_eq res(espace.get_domain(d)->partial_cart(so)); // The partial derivative part
217 
218  Tensor gam_res_arg(espace, res.val_t->get_valence(), res.val_t->get_index_type(), *p_basis); // just to initialise a term_eq gam
219  gam_res_arg = 0.0;
220  Term_eq gam_res(d, gam_res_arg);
221  if (doder) gam_res.set_der_zero();
222  if (p_christo[d] == nullptr) compute_christo(d); // of course you need Christoffel
223 
224  Index posgamres(*gam_res.val_t);
225  Index poschristo(*p_christo[d]->val_t);
226  Index posso(*so.val_t);
227  int genre_indice; // COV or CON
228  for (int cmp(0) ; cmp < so_val ; ++cmp) // loop on the components of so, compute one Christoffel term on each cycle
229  {
230  posgamres.set_start(); // reinitialize the gam_res indice position
231  genre_indice = so.val_t->get_index_type(cmp); // COV or CON
232  do // loop on the components of gam_res, compute all components of the Chritoffel term under consideration
233  {
234  if (genre_indice == CON)
235  {
236  poschristo.set(0) = posgamres(0); // indice of D
237  poschristo.set(2) = posgamres(cmp + 1); // e.g. first indice of so is the second one of gam_res... poschristo.set(1) sumation, see below
238  for (int i(0) ; i < so_val ; ++i) if (i != cmp) posso.set(i) = posgamres(i + 1);// e.g. first indice of so is the second one of gam_res...
239  for (int mute(0) ; mute < 3 ; ++mute) // case sumation
240  {
241  poschristo.set(1) = mute;
242  posso.set(cmp) = mute;
243  gam_res.val_t->set(posgamres).set_domain(d) += (*p_christo[d]->val_t)(poschristo)(d) * (*so.val_t)(posso)(d);
244  if (doder) gam_res.der_t->set(posgamres).set_domain(d) += (*p_christo[d]->val_t)(poschristo)(d) * (*so.der_t)(posso)(d); // no variation of christo
245  }
246  }
247  if (genre_indice == COV)
248  {
249  poschristo.set(0) = posgamres(0); // indice of D
250  poschristo.set(1) = posgamres(cmp + 1); //poschristo.set(2) summation, see below
251  for (int i(0) ; i < so_val ; ++i) if (i != cmp) posso.set(i) = posgamres(i + 1); // e.g. first indice of so is the second one of gam_res...
252  for (int mute(0) ; mute < 3 ; ++mute) // case sumation
253  {
254  poschristo.set(2) = mute;
255  posso.set(cmp) = mute;
256  gam_res.val_t->set(posgamres).set_domain(d) -= (*p_christo[d]->val_t)(poschristo)(d) * (*so.val_t)(posso)(d);
257  if (doder) gam_res.der_t->set(posgamres).set_domain(d) -= (*p_christo[d]->val_t)(poschristo)(d) * (*so.der_t)(posso)(d); // no variation of christo
258  }
259  }
260  }while(posgamres.inc());
261  }
262 
263  // division by eps
264  if (so_val >= 1) return res + div_eps(gam_res, 1);
265  return res;
266 }
267 
268 Term_eq Metric_ADS::derive(int type_der, char ind_der, const Term_eq& so) const // covariant derivative, can only be applied to quantities going at least as O(epsilon)
269 {
270  int d(so.get_dom()); // domain
271  int so_val(so.val_t->get_valence());
272  bool doder(so.der_t != nullptr);
273  if (p_christo[d] == nullptr) compute_christo(d); // of course you need Christoffel
274  Term_eq res(derive_simple(so)); // The simple derivative part (no indice names affected, no inner summation)
275  if (type_der == CON) manipulate_ind(res, 0); // manipulate indice if you want D^i
276 
277  // Set names and check inner summ
278  bool inner_sum(false);
279  if (so.val_t->is_name_affected())
280  {
281  res.val_t->set_name_affected();
282  res.val_t->set_name_ind(0, ind_der);
283  for (int i(0) ; i < so_val ; ++i)
284  {
285  res.val_t->set_name_ind(i + 1, so.val_t->get_name_ind()[i]); // put the names of ressult with name of D and names of tensor indices
286  if (so.val_t->get_name_ind()[i] == ind_der) inner_sum = true;
287  }
288  if (doder)
289  {
290  res.der_t->set_name_affected();
291  res.der_t->set_name_ind(0, ind_der);
292  for (int i(0) ; i < so_val ; ++i) res.der_t->set_name_ind(i + 1, so.val_t->get_name_ind()[i]);
293  }
294  }
295  else if(so_val == 0) // manage the scalar case
296  {
297  res.val_t->set_name_affected();
298  res.val_t->set_name_ind(0, ind_der);
299  if (doder)
300  {
301  res.der_t->set_name_affected();
302  res.der_t->set_name_ind(0, ind_der);
303  }
304  }
305 
306  if (inner_sum)
307  {
308  if (!doder) return Term_eq(d, res.val_t->do_summation_one_dom(d));
309  else return Term_eq(d, res.val_t->do_summation_one_dom(d), res.der_t->do_summation_one_dom(d));
310  }
311  else return res;
312 }
313 
314 void Metric_ADS::compute_riemann(int d) const // eps^2*Riemann is stored
315 {
316  if (p_riemann[d] == nullptr)
317  {
318  if (p_met_cov[d] == nullptr) compute_cov(d); // Maximally symmetric need the metric (COV version)
319  Array<int> indices(4);
320  indices.set(0) = CON; indices.set(1) = COV; indices.set(2) = COV; indices.set(3) = COV;
321  Tensor res_val(espace, 4, indices, *p_basis);
322  Index pos(res_val);
323  Val_domain cmpval(espace.get_domain(d));
324  do
325  {
326  cmpval = 0.0;
327  if (pos(0) == pos(2)) cmpval += (*p_met_cov[d]->val_t)(pos(1) + 1, pos(3) + 1)(d);
328  if (pos(0) == pos(3)) cmpval -= (*p_met_cov[d]->val_t)(pos(1) + 1, pos(2) + 1)(d);
329  res_val.set(pos).set_domain(d) = -cmpval/(m_L*m_L);
330  }while (pos.inc());
331  p_riemann[d] = new Term_eq(d, res_val);
332  p_riemann[d]->set_der_zero();
333  }
334 }
335 
336 void Metric_ADS::compute_ricci_tensor(int d) const // In the last domain epsilon^2 Ricci is stored
337 {
338  if (p_ricci_tensor[d] == nullptr)
339  {
340  if (p_met_cov[d] == nullptr) compute_cov(d); // Maximally symmetric need the metric (COV version)
341  p_ricci_tensor[d] = new Term_eq(d, -2.0*(*p_met_cov[d]->val_t)/(m_L*m_L));
342  p_ricci_tensor[d]->set_der_zero();
343  }
344 }
345 
347 {
348  if (p_ricci_scalar[d] == nullptr)
349  {
350  Scalar val(espace);
351  val = -6.0/(m_L*m_L);
352  p_ricci_scalar[d] = new Term_eq(d, val);
353  p_ricci_scalar[d]->set_der_zero();
354  }
355 }
356 
357 void Metric_ADS::set_system(System_of_eqs& ss, const char* name)
358 {
359  syst = &ss;
360  if (syst->met != nullptr)
361  {
362  cerr << "Metric already set for the system" << endl;
363  abort();
364  }
365  ss.met = this;
366  ss.name_met = new char[LMAX];
367  trim_spaces(ss.name_met, name);
368 }
369 
370 void Metric_ADS::init_system(System_of_eqs& ss, const char* name_back_cov, const char* name_back_con, const char* name_back_ricci)
371 {
372  syst = &ss; // Not to be used alone
373  for (int d(ss.dom_min) ; d <= ss.dom_max ; ++d) // make sure that metric is computed
374  {
375  if (p_met_cov[d] == nullptr) compute_cov(d);
376  if (p_met_con[d] == nullptr) compute_con(d);
377  if (p_ricci_tensor[d] == nullptr) compute_ricci_tensor(d);
378  }
379 
380  int dim(espace.get_ndim());
381  Metric_tensor gamaBcov(espace, COV, *p_basis);
382  Metric_tensor gamaBcon(espace, CON, *p_basis);
383  gamaBcov = 0.0;
384  gamaBcon = 0.0;
385  for (int i(1) ; i <= dim ; ++i)
386  {
387  for (int j(i) ; j <= dim ; ++j)
388  {
389  for (int d(ss.dom_min) ; d <= ss.dom_max ; ++d) // give tensors from Term_eq values
390  {
391  gamaBcov.set(i,j).set_domain(d) = (*p_met_cov[d]->val_t)(i,j)(d);
392  gamaBcon.set(i,j).set_domain(d) = (*p_met_con[d]->val_t)(i,j)(d);
393  }
394  }
395  }
396 
397  Tensor RicciB(espace, 2, COV, *p_basis); // background Ricci
398  RicciB = 0.0;
399  for (int i(1) ; i <= dim ; ++i)
400  for (int j(1) ; j <= dim ; ++j)
401  for (int d(ss.dom_min) ; d <= ss.dom_max ; ++d) // give tensors from Term_eq values
402  RicciB.set(i, j).set_domain(d) = (*p_ricci_tensor[d]->val_t)(i, j)(d);
403 
404  ss.add_cst(name_back_cov, gamaBcov);
405  ss.add_cst(name_back_con, gamaBcon);
406  ss.add_cst(name_back_ricci, RicciB);
407 }
408 
409 void Metric_ADS::init_system(System_of_eqs& ss, const char* name_back_cov, const char* name_back_con, const char* name_back_gam, const char* name_back_ricci)
410 {
411  syst = &ss; // Not to be used alone
412  for (int d(ss.dom_min) ; d <= ss.dom_max ; ++d) // make sure that metric is computed
413  {
414  if (p_met_cov[d] == nullptr) compute_cov(d);
415  if (p_met_con[d] == nullptr) compute_con(d);
416  if (p_christo[d] == nullptr) compute_christo(d);
417  if (p_ricci_tensor[d] == nullptr) compute_ricci_tensor(d);
418  }
419 
420  int dim(espace.get_ndim());
421  Metric_tensor gamaBcov(espace, COV, *p_basis);
422  Metric_tensor gamaBcon(espace, CON, *p_basis);
423  gamaBcov = 0.0;
424  gamaBcon = 0.0;
425  for (int i(1) ; i <= dim ; ++i)
426  for (int j(i) ; j <= dim ; ++j)
427  for (int d(ss.dom_min) ; d <= ss.dom_max ; ++d) // give tensors from Term_eq values
428  {
429  gamaBcov.set(i,j).set_domain(d) = (*p_met_cov[d]->val_t)(i,j)(d);
430  gamaBcon.set(i,j).set_domain(d) = (*p_met_con[d]->val_t)(i,j)(d);
431  }
432 
433  Array<int> ind_type(3);
434  ind_type.set(0) = COV; ind_type.set(1) = COV; ind_type.set(2) = CON;
435  Tensor ChristoB(espace, 3, ind_type, *p_basis);
436  ChristoB = 0.0;
437  for (int i(1) ; i <= dim ; ++i)
438  for (int j(1) ; j <= dim ; ++j)
439  for (int k(1) ; k <= dim ; ++k)
440  for (int d(ss.dom_min) ; d <= ss.dom_max ; ++d) // give tensors from Term_eq values
441  ChristoB.set(i, j, k).set_domain(d) = (*p_christo[d]->val_t)(i, j, k)(d);
442 
443  Tensor RicciB(espace, 2, COV, *p_basis); // background Ricci
444  RicciB = 0.0;
445  for (int i(1) ; i <= dim ; ++i)
446  for (int j(1) ; j <= dim ; ++j)
447  for (int d(ss.dom_min) ; d <= ss.dom_max ; ++d) // give tensors from Term_eq values
448  RicciB.set(i, j).set_domain(d) = (*p_ricci_tensor[d]->val_t)(i, j)(d);
449 
450  ss.add_cst(name_back_cov, gamaBcov);
451  ss.add_cst(name_back_con, gamaBcon);
452  ss.add_cst(name_back_gam, ChristoB);
453  ss.add_cst(name_back_ricci, RicciB);
454 }
455 
457 {
458  int d(so.get_dom());
459  bool doder(so.der_t != nullptr);
460  Term_eq res(so);
461  for (int i(1) ; i <= n ; ++i)
462  {
463  Index pos(*res.val_t);
464  do
465  {
466  (*res.val_t).set(pos).set_domain(d) *= (1.0 + m_rho2(d)); // multiplication by 1 + rho^2
467  if (doder) (*res.der_t).set(pos).set_domain(d) *= (1.0 + m_rho2(d));
468  if (m_nd != 1)
469  {
470  if (d < m_nd - 1)
471  {
472  (*res.val_t).set(pos).set_domain(d) /= (1.0 - m_rho2(d));
473  if (doder) (*res.der_t).set(pos).set_domain(d) /= (1.0 - m_rho2(d));
474  }
475  if (d == m_nd - 1)
476  {
477  Val_domain us1prsL(1.0/(1.0 + espace.get_domain(d)->get_radius()/m_L));
478  (*res.val_t).set(pos).set_domain(d) = espace.get_domain(d)->div_1mrsL((*res.val_t)(pos)(d))*us1prsL;
479  if (doder) (*res.der_t).set(pos).set_domain(d) = espace.get_domain(d)->div_1mrsL((*res.der_t)(pos)(d))*us1prsL;
480  }
481  }
482  }while(pos.inc());
483  if (m_nd == 1) res = div_1mx2(res); // division by 1 - rho^2
484  }
485  return res;
486 }
487 
489 {
490  int d(so.get_dom());
491  bool doder(so.der_t != nullptr);
492  Term_eq res(so);
493  for (int i(1) ; i <= n ; ++i)
494  {
495  Index pos(*res.val_t);
496  do
497  {
498  (*res.val_t).set(pos).set_domain(d) *= (1.0 - m_rho2(d)) / (1.0 + m_rho2(d));
499  if (doder) (*res.der_t).set(pos).set_domain(d) *= (1.0 - m_rho2(d)) / (1.0 + m_rho2(d));
500  }while(pos.inc());
501  }
502  return res;
503 }
504 }
reference set(const Index &pos)
Read/write of an element.
Definition: array.hpp:186
Describes the tensorial basis used by the various tensors.
Definition: base_tensor.hpp:49
virtual Val_domain div_1mrsL(const Val_domain &so) const
Division by .
Definition: domain.cpp:1284
virtual double get_rmax() const
Returns the maximum radius.
Definition: domain.cpp:1369
Val_domain const & get_radius() const
Returns the generalized radius.
Definition: space.hpp:1465
Val_domain const & get_cart(int i) const
Returns a Cartesian coordinates.
Definition: space.hpp:1471
Class that gives the position inside a multi-dimensional Array.
Definition: index.hpp:38
int & set(int i)
Read/write of the position in a given dimension.
Definition: index.hpp:72
void set_start()
Sets the position to zero in all dimensions.
Definition: index.hpp:88
bool inc(int increm, int var=0)
Increments the position of the Index.
Definition: index.hpp:99
Class to manage anti de Sitter metrics.
Definition: metric_AADS.hpp:45
int m_nd
number of physical domains (usually the last compaxtified domain is discarded).
Definition: metric_AADS.hpp:47
void init_system(System_of_eqs &syst, const char *name_back_cov, const char *name_back_con, const char *name_back_ricci)
Put the covariant and contravariant metric, dans the Ricci background into the System_of_eqs,...
Definition: metric_ADS.cpp:370
virtual void compute_riemann(int d) const
Computes the Riemann tensor, in a given Domain.
Definition: metric_ADS.cpp:314
Scalar m_rho2
Scalar containing
Definition: metric_AADS.hpp:49
virtual void compute_ricci_scalar(int d) const
Computes the Ricci scalar, in a given Domain.
Definition: metric_ADS.cpp:346
Metric_ADS(const Space &space)
Standard constructor.
Definition: metric_ADS.cpp:22
virtual void compute_cov(int d) const
Computes the covariant representation, in a given Domain.
Definition: metric_ADS.cpp:61
Scalar m_eps
Scalar containing the conformal factor .
Definition: metric_AADS.hpp:50
virtual void set_system(System_of_eqs &syst, const char *name)
Associate the metric to a given system of equations.
Definition: metric_ADS.cpp:357
virtual Term_eq derive(int type_der, char ind_der, const Term_eq &) const
Computes the covariant derivative of a Term_eq (assumes Cartesian basis of decomposition).
Definition: metric_ADS.cpp:268
Term_eq mul_eps(Term_eq &so, int n) const
Multiplication by the conformal factor .
Definition: metric_ADS.cpp:488
virtual void compute_ricci_tensor(int d) const
Computes the Ricci tensor, in a given Domain.
Definition: metric_ADS.cpp:336
Term_eq div_eps(Term_eq &so, int n) const
Division by the conformal factor .
Definition: metric_ADS.cpp:456
virtual void update()
Updates the derived quantities (Christoffels etc..) This is done only for the ones that are needed,...
Definition: metric_ADS.cpp:56
Base_tensor * p_basis
Pointer on the tensorial basis (Cartesian basis only).
Definition: metric_AADS.hpp:51
double m_L
AdS length.
Definition: metric_AADS.hpp:48
virtual void compute_con(int d) const
Computes the contravariant representation, in a given Domain.
Definition: metric_ADS.cpp:81
virtual void compute_christo(int d) const
Computes the Christoffel symbols, in a given Domain.
Definition: metric_ADS.cpp:168
virtual void manipulate_ind(Term_eq &so, int ind) const
Uses the Metric to manipulate one of the index of a Term_eq (i.e.
Definition: metric_ADS.cpp:101
Term_eq derive_simple(const Term_eq &so) const
Computes the covariant derivative.
Definition: metric_ADS.cpp:210
Particular type of Tensor, dedicated to the desription of metrics.
Purely abstract class for metric handling.
Definition: metric.hpp:39
int type_tensor
States if one works in the CON or COV representation.
Definition: metric.hpp:86
MMPtr_array< Term_eq > p_ricci_tensor
Array of pointers on various Term_eq.
Definition: metric.hpp:70
const Space & espace
The associated Space.
Definition: metric.hpp:42
MMPtr_array< Term_eq > p_met_cov
Array of pointers on various Term_eq.
Definition: metric.hpp:50
MMPtr_array< Term_eq > p_met_con
Array of pointers on various Term_eq.
Definition: metric.hpp:55
MMPtr_array< Term_eq > p_riemann
Array of pointers on various Term_eq.
Definition: metric.hpp:65
MMPtr_array< Term_eq > p_christo
Array of pointers on various Term_eq.
Definition: metric.hpp:60
MMPtr_array< Term_eq > p_ricci_scalar
Array of pointers on various Term_eq.
Definition: metric.hpp:75
const System_of_eqs * syst
Pointer of the system of equations where the metric is used (only one for now).
Definition: metric.hpp:44
The class Scalar does not really implements scalars in the mathematical sense but rather tensorial co...
Definition: scalar.hpp:67
Val_domain & set_domain(int)
Read/write of a particular Val_domain.
Definition: scalar.hpp:555
The Space class is an ensemble of domains describing the whole space of the computation.
Definition: space.hpp:1362
const Domain * get_domain(int i) const
returns a pointer on the domain.
Definition: space.hpp:1385
int get_ndim() const
Returns the number of dimensions.
Definition: space.hpp:1373
int get_nbr_domains() const
Returns the number of Domains.
Definition: space.hpp:1375
Class used to describe and solve a system of equations.
virtual void add_cst(const char *name, double cst)
Addition of a constant (number case)
char * name_met
Name by which the metric is recognized.
int dom_max
Highest domain number.
int dom_min
Smallest domain number.
Metric * met
Pointer on the associated Metric, if defined.
Tensor handling.
Definition: tensor.hpp:149
void set_name_ind(int dd, char name)
Sets the name of one index ; the names must have been affected first.
void set_name_affected()
Affects the name of the indices.
Definition: tensor.hpp:435
Scalar & set(const Array< int > &ind)
Returns the value of a component (read/write version).
Definition: tensor_impl.hpp:91
int get_index_type(int i) const
Gives the type (covariant or contravariant) of a given index.
Definition: tensor.hpp:526
int get_valence() const
Returns the valence.
Definition: tensor.hpp:509
Tensor do_summation_one_dom(int dd) const
Does the inner contraction of the Tensor in a given domain.
This class is intended to describe the manage objects appearing in the equations.
Definition: term_eq.hpp:62
Tensor * der_t
Pointer on the variation, if the Term_eq is a Tensor.
Definition: term_eq.hpp:69
int get_dom() const
Definition: term_eq.hpp:135
void set_der_zero()
Sets the variation of the approriate type to zero.
Definition: term_eq.cpp:187
Tensor * val_t
Pointer on the value, if the Term_eq is a Tensor.
Definition: term_eq.hpp:68
Class for storing the basis of decompositions of a field and its values on both the configuration and...
Definition: val_domain.hpp:69
const Domain * get_domain() const
Definition: val_domain.hpp:111