22 #include "metric_nophi.hpp"
23 #include "term_eq.hpp"
25 #include "tensor_impl.hpp"
26 #include "system_of_eqs.hpp"
27 #include "metric_tensor.hpp"
28 #include "name_tools.hpp"
32 Metric(met.get_space()), p_met(&met), basis(met.get_basis()), fmet(met.get_space(), basis), conformal(ome), der_conf (conformal.der_r()) {
34 for (
int d=0 ; d<met.
get_space().get_nbr_domains() ; d++)
36 cerr <<
"Metric_nophi_AADS only defined wrt spherical tensorial coordinates" << endl ;
43 Metric (so), p_met(so.p_met), basis(so.basis), fmet(so.fmet), conformal(so.conformal), der_conf(conformal.der_r()), place_syst(so.place_syst) {
46 Metric_nophi_AADS::~Metric_nophi_AADS() {
68 bool doder = (
syst->
term[place]->der_t==0x0) ?
false :
true ;
76 detval = (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
84 detder = (*
syst->
term[place]->der_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
107 cmpval = (*
syst->
term[place]->val_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
108 -(*
syst->
term[place]->val_t)(2,3)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd) ;
111 cmpder = (*
syst->
term[place]->der_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
114 - (*
syst->
term[place]->val_t)(2,3)(dd)*(*
syst->
term[place]->der_t)(2,3)(dd) ;
115 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
116 res[0] =
new Term_eq (dd, val, der) ;
119 res[0] =
new Term_eq (dd, val) ;
123 cmpval = (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
124 -(*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd) ;
127 cmpder = (*
syst->
term[place]->der_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
130 - (*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->der_t)(3,3)(dd) ;
131 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
132 res[1] =
new Term_eq (dd, val, der) ;
135 res[1] =
new Term_eq (dd, val) ;
139 cmpval = (*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
140 -(*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd) ;
143 cmpder = (*
syst->
term[place]->der_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
146 - (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->der_t)(2,2)(dd) ;
147 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
148 res[2] =
new Term_eq (dd, val, der) ;
151 res[2] =
new Term_eq (dd, val) ;
155 cmpval = (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
156 -(*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(1,3)(dd) ;
159 cmpder = (*
syst->
term[place]->der_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
162 - (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->der_t)(1,3)(dd) ;
163 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
164 res[3] =
new Term_eq (dd, val, der) ;
167 res[3] =
new Term_eq (dd, val) ;
171 cmpval = (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(1,2)(dd)
172 -(*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd) ;
175 cmpder = (*
syst->
term[place]->der_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(1,2)(dd)
178 - (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->der_t)(2,3)(dd) ;
179 der.
set_domain(dd) = cmpder/ detval - cmpval * detder / detval/detval ;
180 res[4] =
new Term_eq (dd, val, der) ;
183 res[4] =
new Term_eq (dd, val) ;
187 cmpval = (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)
188 -(*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(1,2)(dd) ;
191 cmpder = (*
syst->
term[place]->der_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)
194 - (*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->der_t)(1,2)(dd) ;
195 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
196 res[5] =
new Term_eq (dd, val, der) ;
199 res[5] =
new Term_eq (dd, val) ;
252 bool doder = (
syst->
term[place]->der_t==0x0) ?
false :
true ;
262 detval = (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
270 detder = (*
syst->
term[place]->der_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
291 cmpval = (*
syst->
term[place]->val_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
292 -(*
syst->
term[place]->val_t)(2,3)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd) ;
295 cmpder = (*
syst->
term[place]->der_t)(2,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
298 - (*
syst->
term[place]->val_t)(2,3)(dd)*(*
syst->
term[place]->der_t)(2,3)(dd) ;
299 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
300 res[0] =
new Term_eq (dd, val, der) ;
303 res[0] =
new Term_eq (dd, val) ;
307 cmpval = (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
308 -(*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd) ;
311 cmpder = (*
syst->
term[place]->der_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
314 - (*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->der_t)(3,3)(dd) ;
315 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
316 res[1] =
new Term_eq (dd, val, der) ;
319 res[1] =
new Term_eq (dd, val) ;
323 cmpval = (*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
324 -(*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd) ;
327 cmpder = (*
syst->
term[place]->der_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd)
330 - (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->der_t)(2,2)(dd) ;
331 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
332 res[2] =
new Term_eq (dd, val, der) ;
335 res[2] =
new Term_eq (dd, val) ;
339 cmpval = (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
340 -(*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(1,3)(dd) ;
343 cmpder = (*
syst->
term[place]->der_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(3,3)(dd)
346 - (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->der_t)(1,3)(dd) ;
347 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
348 res[3] =
new Term_eq (dd, val, der) ;
351 res[3] =
new Term_eq (dd, val) ;
355 cmpval = (*
syst->
term[place]->val_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(1,2)(dd)
356 -(*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,3)(dd) ;
359 cmpder = (*
syst->
term[place]->der_t)(1,3)(dd)*(*
syst->
term[place]->val_t)(1,2)(dd)
362 - (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->der_t)(2,3)(dd) ;
363 der.
set_domain(dd) = cmpder/ detval - cmpval * detder / detval/detval ;
364 res[4] =
new Term_eq (dd, val, der) ;
367 res[4] =
new Term_eq (dd, val) ;
371 cmpval = (*
syst->
term[place]->val_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)
372 -(*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->val_t)(1,2)(dd) ;
375 cmpder = (*
syst->
term[place]->der_t)(1,1)(dd)*(*
syst->
term[place]->val_t)(2,2)(dd)
378 - (*
syst->
term[place]->val_t)(1,2)(dd)*(*
syst->
term[place]->der_t)(1,2)(dd) ;
379 der.
set_domain(dd) = cmpder / detval - cmpval * detder / detval/detval;
380 res[5] =
new Term_eq (dd, val, der) ;
383 res[5] =
new Term_eq (dd, val) ;
439 type_ind.
set(0) = COV ; type_ind.
set(1) = COV ; type_ind.
set(2) = CON ;
444 bool doder = (flat_der.
der_t==0x0) ?
false :
true ;
446 Index pos (res_val) ;
452 cmpval +=
conformal(dd) * (0.5*(*
p_met_con[dd]->val_t)(pos(2)+1,l)(dd)*((*flat_der.
val_t)(pos(0)+1, pos(1)+1, l)(dd) +
453 (*flat_der.
val_t)(pos(1)+1, pos(0)+1, l)(dd) - (*flat_der.
val_t)(l, pos(0)+1, pos(1)+1)(dd))) ;
457 if ((pos(1)==pos(2)) && (pos(0)==0))
459 if ((pos(0)==pos(2)) && (pos(1)==0))
468 cmpder +=
conformal(dd) * (0.5*(*
p_met_con[dd]->der_t)(pos(2)+1,l)(dd)*((*flat_der.
val_t)(pos(0)+1, pos(1)+1, l)(dd) +
469 (*flat_der.
val_t)(pos(1)+1, pos(0)+1, l)(dd) - (*flat_der.
val_t)(l, pos(0)+1, pos(1)+1)(dd))
470 + 0.5*(*
p_met_con[dd]->val_t)(pos(2)+1,l)(dd)*((*flat_der.
der_t)(pos(0)+1, pos(1)+1, l)(dd) +
471 (*flat_der.
der_t)(pos(1)+1, pos(0)+1, l)(dd) - (*flat_der.
der_t)(l, pos(0)+1, pos(1)+1)(dd))) ;
474 cmpder += ((*
p_met_con[dd]->der_t)(pos(2)+1,1)(dd)*(*
p_met_cov[dd]->val_t)(pos(0)+1,pos(1)+1)(dd)
506 indices.
set(0) = CON ; indices.
set(1) = COV ; indices.
set(2) = COV ; indices.
set(3) = COV ;
511 bool doder = (flat_der.
der_t==0x0) ?
false :
true ;
513 Index pos (res_val) ;
517 - (*flat_der.
val_t)(pos(3)+1, pos(1)+1, pos(2)+1, pos(0)+1)(dd))) ;
521 cmpval -= (*
p_christo[dd]->val_t)(pos(1)+1, pos(3)+1, pos(0)+1)(dd)*
der_conf(dd) ;
523 cmpval += (*
p_christo[dd]->val_t)(pos(1)+1, pos(2)+1, pos(0)+1)(dd)*
der_conf(dd) ;
526 cmpval += (*
p_christo[dd]->val_t)(pos(2)+1,m, pos(0)+1)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,pos(3)+1,m)(dd)
527 - (*
p_christo[dd]->val_t)(pos(3)+1,m,pos(0)+1)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,pos(2)+1,m)(dd) ;
535 - (*flat_der.
der_t)(pos(3)+1, pos(1)+1, pos(2)+1, pos(0)+1)(dd))) ;
538 cmpder -= (*
p_christo[dd]->der_t)(pos(1)+1, pos(3)+1, pos(0)+1)(dd)*
der_conf(dd) ;
540 cmpder += (*
p_christo[dd]->der_t)(pos(1)+1, pos(2)+1, pos(0)+1)(dd)*
der_conf(dd) ;
544 cmpder += (*
p_christo[dd]->der_t)(pos(2)+1,m, pos(0)+1)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,pos(3)+1,m)(dd)
545 + (*
p_christo[dd]->val_t)(pos(2)+1,m, pos(0)+1)(dd)*(*
p_christo[dd]->der_t)(pos(1)+1,pos(3)+1,m)(dd)
546 - (*
p_christo[dd]->der_t)(pos(3)+1,m,pos(0)+1)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,pos(2)+1,m)(dd)
547 - (*
p_christo[dd]->val_t)(pos(3)+1,m,pos(0)+1)(dd)*(*
p_christo[dd]->der_t)(pos(1)+1,pos(2)+1,m)(dd);
576 indices.
set(0) = COV ; indices.
set(1) = COV ;
581 bool doder = (flat_der.
der_t==0x0) ?
false :
true ;
583 Index pos (res_val) ;
590 cmpval +=
conformal(dd)*((*flat_der.
val_t)(l, pos(1)+1,pos(0)+1,l)(dd)
591 - (*flat_der.
val_t)(pos(1)+1, pos(0)+1,l ,l)(dd)) ;
598 cmpval += (*
p_christo[dd]->val_t)(l,m, l)(dd)*(*
p_christo[dd]->val_t)(pos(0)+1,pos(1)+1,m)(dd)
599 - (*
p_christo[dd]->val_t)(pos(0)+1,l, m)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,m,l)(dd) ;
609 cmpder +=
conformal(dd)*((*flat_der.
der_t)(l, pos(1)+1,pos(0)+1,l)(dd)
610 - (*flat_der.
der_t)(pos(1)+1, pos(0)+1,l ,l)(dd)) ;
619 cmpder += (*
p_christo[dd]->der_t)(l,m, l)(dd)*(*
p_christo[dd]->val_t)(pos(0)+1,pos(1)+1,m)(dd)
620 + (*
p_christo[dd]->val_t)(l,m, l)(dd)*(*
p_christo[dd]->der_t)(pos(0)+1,pos(1)+1,m)(dd)
621 - (*
p_christo[dd]->der_t)(pos(0)+1,l, m)(dd)*(*
p_christo[dd]->val_t)(pos(1)+1,m,l)(dd)
622 - (*
p_christo[dd]->val_t)(pos(0)+1,l, m)(dd)*(*
p_christo[dd]->der_t)(pos(1)+1,m,l)(dd);
676 if (ind_der==
char(start))
686 while ((!found) && (start<123)) ;
688 cerr <<
"Trouble with indices in derive (you are not using tensors of order > 24, are you ?)" << endl ;
691 char name_sum = char(start) ;
693 bool doder = ((so.
der_t==0x0) || (
p_christo[dd]->der_t==0x0)) ?
false :
true ;
701 p_christo[dd]->val_t->set_name_affected() ;
702 p_christo[dd]->val_t->set_name_ind(0, ind_der) ;
703 if (genre_indice==COV) {
705 p_christo[dd]->val_t->set_name_ind(2, name_sum) ;
709 p_christo[dd]->val_t->set_name_ind(1, name_sum) ;
713 p_christo[dd]->der_t->set_name_affected() ;
714 p_christo[dd]->der_t->set_name_ind(0, ind_der) ;
715 if (genre_indice==COV) {
717 p_christo[dd]->der_t->set_name_ind(2, name_sum) ;
721 p_christo[dd]->der_t->set_name_ind(1, name_sum) ;
731 bool need_sum = false ;
732 char const * ind =
p_christo[dd]->val_t->get_name_ind() ;
733 if ((ind[0]==ind[2]) || (ind[1]==ind[2]) || (ind[0]==ind[1]))
744 christ =
new Term_eq (auxi_christ) ;
763 Term_eq part_christo ((*christ)*copie) ;
766 if (genre_indice==CON)
767 res = res + part_christo ;
769 res = res - part_christo ;
785 cerr <<
"Metric already set for the system" << endl ;
791 trim_spaces (ss.
name_met, name_met) ;
reference set(const Index &pos)
Read/write of an element.
int get_basis(int nd) const
Read only the basis in a given domain.
Class that gives the position inside a multi-dimensional Array.
bool inc(int increm, int var=0)
Increments the position of the Index.
virtual Term_eq derive(int, char, const Term_eq &) const
Computes the covariant derivative of a Term_eq (assumes Cartesian basis of decomposition).
Term_eq derive_with_other(int tder, char indder, const Term_eq &so, const Metric *othermet) const
Computes the flat covariant derivative.
Class to deal with a metric independant of with a conformal decomposition (mainly used for AADS spac...
Metric_nophi_AADS(Metric_tensor &, const Scalar &conf)
Constructor from a Metric_tensor and a conformal factor.
Metric_tensor * p_met
Pointer on the Metric_tensor describing the coformal metric.
Metric_flat_nophi fmet
Associated flat metric.
virtual void compute_christo(int) const
Computes the Christoffel symbols, in a given Domain.
virtual void compute_ricci_tensor(int) const
Computes the Ricci tensor, in a given Domain.
virtual int give_type(int) const
Returns the type of tensorial basis of the covariant representation, in a given Domain.
virtual Term_eq derive_flat(int, char, const Term_eq &) const
Computes the covariant flat derivative of a Term_eq.
Scalar der_conf
Radial derivative of the conformal factor.
virtual void set_system(System_of_eqs &syst, const char *name)
Associate the metric to a given system of equations.
const Base_tensor & basis
The tensorial basis used.
virtual void compute_con(int) const
Computes the contravariant representation, in a given Domain.
virtual void compute_cov(int) const
Computes the covariant representation, in a given Domain.
virtual Term_eq derive(int, char, const Term_eq &) const
Computes the covariant derivative of a Term_eq (assumes Cartesian basis of decomposition).
virtual void compute_riemann(int) const
Computes the Riemann tensor, in a given Domain.
int place_syst
Gives the location of the metric amongst the various unknowns of the associated System_of_eqs.
Scalar conformal
The conformal factor (must be a purely radial function)
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.
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.
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.
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.
const Domain * get_domain(int i) const
returns a pointer on the domain.
int get_ndim() const
Returns the number of dimensions.
Class used to describe and solve a system of equations.
virtual void add_var(const char *name, double &var)
Addition of a variable (number case)
int ndom
Number of domains used.
char * name_met
Name by which the metric is recognized.
MMPtr_array< Term_eq > term
Pointers on the Term_eq corresponding to the unknown fields.
int dom_min
Smallest domain number.
Metric * met
Pointer on the associated Metric, if defined.
int nvar
Number of unknown fields.
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).
char const * get_name_ind() const
int get_index_type(int i) const
Gives the type (covariant or contravariant) of a given index.
int get_n_comp() const
Returns the number of stored components.
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.
const Space & get_space() const
Returns the Space.
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.
Tensor const & get_val_t() const
Tensor const & get_der_t() const
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...