20 #include "metric_AADS.hpp"
27 for (
int d(0) ; d <
m_nd ; ++d)
40 Metric_ADS::~Metric_ADS()
68 for (
int i(1) ; i <= dim ; ++i)
70 for (
int j(i) ; j <= dim ; ++j)
84 int dim(espace.get_ndim());
85 if (p_met_con[d] ==
nullptr)
88 for (
int i(1) ; i <= dim ; ++i)
90 for (
int j(i) ; j <= dim ; ++j)
92 if (i == j) res.
set(i, j).
set_domain(d) = 0.25*pow(1.0 + m_rho2(d), 2);
96 p_met_con[d] =
new Term_eq(d, res);
97 p_met_con[d]->set_der_zero();
104 int dim(espace.get_ndim());
105 int valence(so.get_val_t().get_valence());
106 int type_start(so.get_val_t().get_index_type(ind));
107 if (p_met_con[d] ==
nullptr and type_start == COV) compute_con(d);
108 if (p_met_cov[d] ==
nullptr and type_start == CON) compute_cov(d);
110 bool doder(so.der_t !=
nullptr);
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);
114 Tensor val_res(espace, valence, type_res, *p_basis);
115 Tensor val_der(espace, valence, type_res, *p_basis);
125 for (
int k(0) ; k < dim ; ++k)
128 if (type_start == COV) cmpval += (*p_met_con[d]->val_t)(pos(ind) + 1, k + 1)(d) * (*so.val_t)(copie)(d);
129 else cmpval += (*p_met_cov[d]->val_t)(pos(ind) + 1, k + 1)(d) * (*so.val_t)(copie)(d);
135 for (
int k(0) ; k < dim ; ++k)
138 if (type_start == COV) cmpder += (*p_met_con[d]->val_t)(pos(ind) + 1, k + 1)(d) * (*so.der_t)(copie)(d);
139 else cmpder += (*p_met_cov[d]->val_t)(pos(ind) + 1, k + 1)(d) * (*so.der_t)(copie)(d);
146 if (so.get_val_t().is_name_affected())
149 for (
int i(0) ; i < valence ; ++i) val_res.
set_name_ind(i, so.val_t->get_name_ind()[i]);
152 if ((doder) and (so.get_der_t().is_name_affected()))
155 for (
int i(0) ; i < valence ; ++i) val_der.
set_name_ind(i, so.der_t->get_name_ind()[i]);
159 so.val_t =
new Tensor(val_res);
161 so.der_t = doder ?
new Tensor(val_der) :
nullptr;
164 if (type_start == CON) so = div_eps(so, 2);
165 else if (type_start == COV) so = mul_eps(so, 2);
170 if (p_christo[d] ==
nullptr)
173 type_ind.
set(0) = COV; type_ind.
set(1) = COV; type_ind.
set(2) = CON;
174 Tensor res_val(espace, 3, type_ind, *p_basis);
205 p_christo[d] =
new Term_eq(d, res_val);
206 p_christo[d]->set_der_zero();
212 assert(espace.get_ndim() == 3);
213 bool doder(so.der_t !=
nullptr);
215 int so_val(so.val_t->get_valence());
216 Term_eq res(espace.get_domain(d)->partial_cart(so));
220 Term_eq gam_res(d, gam_res_arg);
222 if (p_christo[d] ==
nullptr) compute_christo(d);
225 Index poschristo(*p_christo[d]->val_t);
226 Index posso(*so.val_t);
228 for (
int cmp(0) ; cmp < so_val ; ++cmp)
231 genre_indice = so.val_t->get_index_type(cmp);
234 if (genre_indice == CON)
236 poschristo.
set(0) = posgamres(0);
237 poschristo.
set(2) = posgamres(cmp + 1);
238 for (
int i(0) ; i < so_val ; ++i)
if (i != cmp) posso.
set(i) = posgamres(i + 1);
239 for (
int mute(0) ; mute < 3 ; ++mute)
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);
247 if (genre_indice == COV)
249 poschristo.
set(0) = posgamres(0);
250 poschristo.
set(1) = posgamres(cmp + 1);
251 for (
int i(0) ; i < so_val ; ++i)
if (i != cmp) posso.
set(i) = posgamres(i + 1);
252 for (
int mute(0) ; mute < 3 ; ++mute)
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);
260 }
while(posgamres.
inc());
264 if (so_val >= 1)
return res + div_eps(gam_res, 1);
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);
274 Term_eq res(derive_simple(so));
275 if (type_der == CON) manipulate_ind(res, 0);
278 bool inner_sum(
false);
279 if (so.val_t->is_name_affected())
283 for (
int i(0) ; i < so_val ; ++i)
286 if (so.val_t->get_name_ind()[i] == ind_der) inner_sum =
true;
292 for (
int i(0) ; i < so_val ; ++i) res.
der_t->
set_name_ind(i + 1, so.val_t->get_name_ind()[i]);
316 if (p_riemann[d] ==
nullptr)
318 if (p_met_cov[d] ==
nullptr) compute_cov(d);
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);
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);
331 p_riemann[d] =
new Term_eq(d, res_val);
332 p_riemann[d]->set_der_zero();
338 if (p_ricci_tensor[d] ==
nullptr)
340 if (p_met_cov[d] ==
nullptr) compute_cov(d);
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();
362 cerr <<
"Metric already set for the system" << endl;
385 for (
int i(1) ; i <= dim ; ++i)
387 for (
int j(i) ; j <= dim ; ++j)
399 for (
int i(1) ; i <= dim ; ++i)
400 for (
int j(1) ; j <= dim ; ++j)
404 ss.
add_cst(name_back_cov, gamaBcov);
405 ss.
add_cst(name_back_con, gamaBcon);
406 ss.
add_cst(name_back_ricci, RicciB);
425 for (
int i(1) ; i <= dim ; ++i)
426 for (
int j(i) ; j <= dim ; ++j)
434 ind_type.
set(0) = COV; ind_type.
set(1) = COV; ind_type.
set(2) = CON;
437 for (
int i(1) ; i <= dim ; ++i)
438 for (
int j(1) ; j <= dim ; ++j)
439 for (
int k(1) ; k <= dim ; ++k)
445 for (
int i(1) ; i <= dim ; ++i)
446 for (
int j(1) ; j <= dim ; ++j)
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);
459 bool doder(so.
der_t !=
nullptr);
461 for (
int i(1) ; i <= n ; ++i)
466 (*res.
val_t).set(pos).set_domain(d) *= (1.0 +
m_rho2(d));
467 if (doder) (*res.
der_t).set(pos).set_domain(d) *= (1.0 +
m_rho2(d));
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));
483 if (
m_nd == 1) res = div_1mx2(res);
491 bool doder(so.
der_t !=
nullptr);
493 for (
int i(1) ; i <= n ; ++i)
499 if (doder) (*res.
der_t).set(pos).set_domain(d) *= (1.0 -
m_rho2(d)) / (1.0 +
m_rho2(d));
reference set(const Index &pos)
Read/write of an element.
Describes the tensorial basis used by the various tensors.
virtual Val_domain div_1mrsL(const Val_domain &so) const
Division by .
virtual double get_rmax() const
Returns the maximum radius.
Val_domain const & get_radius() const
Returns the generalized radius.
Val_domain const & get_cart(int i) const
Returns a Cartesian coordinates.
Class that gives the position inside a multi-dimensional Array.
int & set(int i)
Read/write of the position in a given dimension.
void set_start()
Sets the position to zero in all dimensions.
bool inc(int increm, int var=0)
Increments the position of the Index.
Class to manage anti de Sitter metrics.
int m_nd
number of physical domains (usually the last compaxtified domain is discarded).
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,...
virtual void compute_riemann(int d) const
Computes the Riemann tensor, in a given Domain.
Scalar m_rho2
Scalar containing
virtual void compute_ricci_scalar(int d) const
Computes the Ricci scalar, in a given Domain.
Metric_ADS(const Space &space)
Standard constructor.
virtual void compute_cov(int d) const
Computes the covariant representation, in a given Domain.
Scalar m_eps
Scalar containing the conformal factor .
virtual void set_system(System_of_eqs &syst, const char *name)
Associate the metric to a given system of equations.
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).
Term_eq mul_eps(Term_eq &so, int n) const
Multiplication by the conformal factor .
virtual void compute_ricci_tensor(int d) const
Computes the Ricci tensor, in a given Domain.
Term_eq div_eps(Term_eq &so, int n) const
Division by the conformal factor .
virtual void update()
Updates the derived quantities (Christoffels etc..) This is done only for the ones that are needed,...
Base_tensor * p_basis
Pointer on the tensorial basis (Cartesian basis only).
virtual void compute_con(int d) const
Computes the contravariant representation, in a given Domain.
virtual void compute_christo(int d) const
Computes the Christoffel symbols, in a given Domain.
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.
Term_eq derive_simple(const Term_eq &so) const
Computes the covariant derivative.
Particular type of Tensor, dedicated to the desription of metrics.
Purely abstract class for metric handling.
int type_tensor
States if one works in the CON or COV representation.
MMPtr_array< Term_eq > p_ricci_tensor
Array of pointers on various Term_eq.
const Space & espace
The associated Space.
MMPtr_array< Term_eq > p_met_cov
Array of pointers on various Term_eq.
MMPtr_array< Term_eq > p_met_con
Array of pointers on various Term_eq.
MMPtr_array< Term_eq > p_riemann
Array of pointers on various Term_eq.
MMPtr_array< Term_eq > p_christo
Array of pointers on various Term_eq.
MMPtr_array< Term_eq > p_ricci_scalar
Array of pointers on various Term_eq.
const System_of_eqs * syst
Pointer of the system of equations where the metric is used (only one for now).
The class Scalar does not really implements scalars in the mathematical sense but rather tensorial co...
Val_domain & set_domain(int)
Read/write of a particular Val_domain.
The Space class is an ensemble of domains describing the whole space of the computation.
const Domain * get_domain(int i) const
returns a pointer on the domain.
int get_ndim() const
Returns the number of dimensions.
int get_nbr_domains() const
Returns the number of Domains.
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.
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.
Scalar & set(const Array< int > &ind)
Returns the value of a component (read/write version).
int get_index_type(int i) const
Gives the type (covariant or contravariant) of a given index.
int get_valence() const
Returns the valence.
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.
Tensor * der_t
Pointer on the variation, if the Term_eq is a Tensor.
void set_der_zero()
Sets the variation of the approriate type to zero.
Tensor * val_t
Pointer on the value, if the Term_eq is a Tensor.
Class for storing the basis of decompositions of a field and its values on both the configuration and...
const Domain * get_domain() const