163 :
Tensor(map, 1, tipe, triad_i) {
172 :
Tensor(map, 1, tipe, *triad_i) {
201 Tensor(mapping, triad_i, fd) {
227 for (
int i=0; i<N_MET_MAX; i++)
230 if (
p_A != 0x0)
delete p_A ;
240 for (
int i=0; i<N_MET_MAX; i++)
250 assert( (j>=0) && (j<N_MET_MAX) ) ;
266 assert( (i>=0) && (i<N_MET_MAX) ) ;
279 for (
int i=0 ; i<3 ; i++) {
293 for (
int i=0 ; i<3 ; i++) {
304 assert ( (index>=1) && (index<=3) ) ;
308 return *
cmp[index - 1] ;
313 assert ( (index>=1) && (index<=3) ) ;
315 return *
cmp[index - 1] ;
338 for (
int i=0 ; i<3 ; i++) {
342 for (
int i=0 ; i<3 ; i++) {
368 for (
int i=0 ; i<3 ; i++) {
372 for (
int i=0 ; i<3 ; i++) {
392 assert(pscal != 0x0) ;
416 resu.pseudo_spectral_base();
435 resu.set(3) = tmp.dsdr() -
cmp[0]->
dsdt() ;
437 resu.pseudo_spectral_base();
449 for (
int i=1; i<=3; i++) {
450 for (
int j=i; j<=3; j++) {
456 for (
int i=1; i<=3; i++) {
457 for (
int j=i; j<=3; j++) {
473 for (
int i=1; i<=3; i++) {
474 for (
int j=i; j<=3; j++) {
482 for (
int i=1; i<=3; i++) {
483 for (
int j=i; j<=3; j++) {
502 assert ((j>=0) && (j<N_MET_MAX)) ;
514 assert ((j>=0) && (j<N_MET_MAX)) ;
528 assert ((ind>=0) && (ind<N_MET_MAX)) ;
547 assert( dz_zero || dz_four) ;
548 assert (
cmp[1]->check_dzpuis(dzp)) ;
549 assert (
cmp[2]->check_dzpuis(dzp)) ;
566 assert (mapping != 0x0) ;
574 for (
int lz=0; lz<nz; lz++) {
575 assert (mmg->
get_np(lz) == np) ;
576 assert (mmg->
get_nt(lz) == nt) ;
580 for (
int k=0; k<np+1; k++)
581 for (
int j=0; j<nt; j++)
582 if ( nullite_plm(j, nt, k, np, val.
base)) {
583 int m_quant, l_quant, base_r ;
584 donne_lm (nz, 0, j, k, val.
base, m_quant,
586 lmax = (l_quant > lmax ? l_quant : lmax) ;
592 for (
int l=0; l<=lmax; l++) {
595 if (l == 0) *(ri[l]) = 1. ;
596 else *(ri[l]) =
pow(erre, l) ;
599 if (l==2) *(rmi[l]) = 1 ;
600 else *(rmi[l]) =
pow(erre, 2-l) ;
610 for (
int k=0; k<np+1; k++) {
611 for (
int j=0; j<nt; j++) {
612 if ( nullite_plm(j, nt, k, np, val.
base)) {
613 int m_quant, l_quant, base_r, l, c ;
614 donne_lm (nz, 0, j, k, val.
base, m_quant, l_quant, base_r) ;
615 bool lzero = (l_quant == 0) || (l_quant == 1) ;
616 int nb_hom_ced = (l_quant < 2 ? 0 : 1) ;
618 int taille = 2*(nz-1) - 1 + nb_hom_ced ;
621 Matrice systeme(taille,taille) ;
623 for (l=0; l<taille; l++)
624 for (c=0; c<taille; c++) systeme.
set(l,c) = 0 ;
625 for (l=0; l<taille; l++) deuz.
set(l) = 0 ;
634 double alpha = mapping->get_alpha()[0] ;
638 for (
int i=0; i<nr; i++)
639 partn.
set(i) = mtc(0, k, j, i) ;
642 systeme.
set(l,c) +=
pow(alpha,
double(l_quant)) ;
644 deuz.
set(l) -= val1_dern_1d(0, partn, base_r) ;
648 systeme.
set(l,c) += l_quant *
pow(alpha,
double(l_quant - 1)) ;
650 deuz.
set(l) -= val1_dern_1d(1, partn, base_r) / alpha ;
657 for (
int lz=1; lz<nz-1; lz++) {
658 alpha = mapping->get_alpha()[lz] ;
659 double beta = mapping->get_beta()[lz] ;
660 double xm1 = beta - alpha ;
661 double xp1 = alpha + beta ;
665 for (
int i=0; i<nr; i++)
666 parts.
set(i) = mtc(lz, k, j, i) ;
671 systeme.
set(l,c) -=
pow(xm1,
double(l_quant)) ;
673 systeme.
set(l,c) -=
pow(xm1,
double(-l_quant-1)) ;
675 deuz.
set(l) += valm1_dern_1d(0, parts,
R_CHEB) ;
677 if ((lz>1) || (!lzero)) {
681 systeme.
set(l,c) -= l_quant*
pow(xm1,
double(l_quant - 1)) ;
683 systeme.
set(l,c) -= (-l_quant - 1)*
684 pow(xm1,
double(-l_quant - 2)) ;
686 deuz.
set(l) += valm1_dern_1d(1, parts,
R_CHEB) / alpha ;
692 systeme.
set(l,c) +=
pow(xp1,
double(l_quant)) ;
694 systeme.
set(l,c) +=
pow(xp1,
double(-l_quant-1)) ;
696 deuz.
set(l) -= val1_dern_1d(0, parts,
R_CHEB) ;
701 systeme.
set(l,c) += l_quant*
pow(xp1,
double(l_quant - 1)) ;
703 systeme.
set(l,c) += (-l_quant - 1)*
704 pow(xp1,
double(-l_quant - 2)) ;
706 deuz.
set(l) -= val1_dern_1d(1, parts,
R_CHEB) / alpha ;
717 for (
int i=0; i<nr; i++)
718 partc.
set(i) = mtc(nz-1, k, j, i) ;
720 alpha = mapping->get_alpha()[nz-1] ;
721 double beta = mapping->get_beta()[nz-1] ;
722 double xm1 = beta - alpha ;
723 double part0, part1 ;
724 part0 = valm1_dern_1d(0, partc,
R_CHEB) ;
725 part1 = xm1*valm1_dern_1d(1, partc,
R_CHEB) / alpha ;
732 systeme.
set(l,c) -=
pow(xm1,
double(l_quant+1)) ;
734 deuz.
set(l) += part0*xm1*xm1*xm1 ;
739 systeme.
set(l,c) -= (-l_quant - 1)*
740 pow(xm1,
double(l_quant + 2)) ;
742 if ( (nz > 2) || (!lzero))
743 deuz.
set(l) += -xm1*xm1*xm1*xm1*(3*part0 + part1) ;
749 int inf = 1 + nb_hom_ced;
750 int sup = 3 - nb_hom_ced;
759 for (
int i=0; i<nr; i++)
760 mtc.
set(0, k, j, i) +=
764 for (
int lz=1; lz<nz-1; lz++) {
766 for (
int i=0; i<nr; i++)
767 mtc.
set(lz, k, j, i) += facteur(2*lz - 1)*
769 for (
int i=0; i<nr; i++)
770 mtc.
set(lz, k, j, i) += facteur(2*lz)*
777 for (
int i=0; i<nr; i++)
778 mtc.
set(nz-1, k, j, i) +=
787 for (
int l=0; l<=lmax; l++) {
820 "Vector::flux : the case of a mapping outside the class Map_af\n" 821 <<
" is not implemented yet !" << endl ;
828 "Vector::flux : the case of a non flat metric is not implemented yet !" 836 vspher =
new Vector(*
this) ;
839 else assert( dynamic_cast<const Base_vect_spher*>(
triad) != 0x0 ) ;
841 const Vector* vv = (bcart != 0x0) ? vspher :
this ;
843 const Scalar& vr = vv->operator()(1) ;
846 if (radius == __infinity) {
859 for (
int i=0; i<
n_comp; i++)
864 vr_tmp.exponential_filter_r(lzmin, lzmax, p, alpha) ;
876 for (
int i=0; i<
n_comp; i++)
881 vr_tmp.exponential_filter_ylm(lzmin, lzmax, p, alpha) ;
void annule_domain(int l)
Sets the Tensor to zero in a given domain.
Base_val ** std_base_vect_cart() const
Returns the standard spectral bases for the Cartesian components of a vector.
Metric for tensor calculation.
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
double flux(double radius, const Metric &met) const
Computes the flux of the vector accross a sphere r = const.
double integrale_surface(const Cmp &ci, double rayon) const
Performs the surface integration of ci on the sphere of radius rayon .
void mult_r()
Multiplication by r everywhere; dzpuis is not changed.
Scalar * p_potential[N_MET_MAX]
The potential giving the gradient part in the Helmholtz decomposition of any 3D vector ...
Sym_tensor ope_killing(const Metric &gam) const
Computes the Killing operator associated with a given metric.
void ylm_i()
Inverse of ylm()
int n_comp
Number of stored components, depending on the symmetry.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
void coef() const
Computes the coeffcients of *this.
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
const Vector_divfree & div_free(const Metric &) const
Returns the div-free vector in the Helmholtz decomposition.
double integrale_surface_infini(const Cmp &ci) const
Performs the surface integration of ci at infinity.
virtual void annule(int l_min, int l_max)
Sets the Scalar to zero in several domains.
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
void set_lu() const
Calculate the LU-representation, assuming the band-storage has been done.
virtual void del_derive_met(int) const
Logical destructor of the derivatives depending on the i-th element of met_depend ...
Tbl & set(int l)
Read/write of the Tbl containing the coefficients in a given domain.
void set_dependance(const Metric &) const
To be used to describe the fact that the derivatives members have been calculated with met ...
Tbl inverse(const Tbl &sec_membre) const
Solves the linear system represented by the matrix.
void ylm()
Computes the coefficients of *this.
const Scalar & dsdt() const
Returns of *this .
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
double & set(int i)
Read/write of a particular element (index i) (1D case)
Flat metric for tensor calculation.
const Scalar & dsdz() const
Returns of *this , where .
Tensor field of valence 0 (or component of a tensorial field).
Scalar poisson() const
Solves the scalar Poisson equation with *this as a source.
Vector_divfree * p_div_free[N_MET_MAX]
The divergence-free vector of the Helmholtz decomposition of any 3D vector .
Scalar * p_A
Field defined by Insensitive to the longitudinal part of the vector, related to the curl...
Base class for coordinate mappings.
const Scalar & dsdx() const
Returns of *this , where .
virtual void exponential_filter_r(int lzmin, int lzmax, int p, double alpha=-16.)
Applies an exponential filter to the spectral coefficients in the radial direction.
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
Values and coefficients of a (real-value) function.
virtual void change_triad(const Base_vect &)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
void set_der_0x0() const
Sets the pointers on derived quantities to 0x0.
int get_place_met(const Metric &) const
Returns the position of the pointer on metre in the array met_depend .
const Vector & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of *this with respect to some metric , by raising the index of...
Tensor field of valence 1.
Vectorial bases (triads) with respect to which the tensorial components are defined.
Vector(const Map &map, int tipe, const Base_vect &triad_i)
Standard constructor.
const Metric_flat & flat_met_cart() const
Returns the flat metric associated with the Cartesian coordinates and with components expressed in th...
Base_val ** pseudo_base_vect_cart() const
Returns the standard spectral bases for the Cartesian components of a pseudo-vector.
void set_dzpuis(int)
Modifies the dzpuis flag.
virtual void std_spectral_base()
Sets the standard spectal bases of decomposition for each component.
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values in the compactified ext...
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Sym_tensor ope_killing_conf(const Metric &gam) const
Computes the conformal Killing operator associated with a given metric.
virtual void exponential_filter_r(int lzmin, int lzmax, int p, double alpha=-16.)
Applies exponential filters to all components (see Scalar::exponential_filter_r ).
Base_val ** pseudo_base_vect_spher() const
Returns the standard spectral bases for the spherical components of a pseudo-vector.
void div_r()
Division by r everywhere; dzpuis is not changed.
Itbl type_indice
1D array of integers (class Itbl ) of size valence containing the type of each index: COV for a cova...
virtual void exponential_filter_ylm(int lzmin, int lzmax, int p, double alpha=-16.)
Applies exponential filters to all components (see Scalar::exponential_filter_ylm )...
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define R_CHEBP
base de Cheb. paire (rare) seulement
virtual void del_derive_met(int) const
Logical destructor of the derivatives depending on the i-th element of met_depend in the class Vector...
void compute_derive_lie(const Vector &v, Tensor &resu) const
Computes the Lie derivative of this with respect to some vector field v (protected method; the public...
virtual const Scalar & eta() const
Gives the field such that the angular components of the vector are written: .
const Scalar & dsdy() const
Returns of *this , where .
virtual void del_deriv() const
Deletes the derived quantities.
Base_val base
Bases on which the spectral expansion is performed.
void set_vr_eta_mu(const Scalar &vr_i, const Scalar &eta_i, const Scalar &mu_i)
Defines the components through potentials and (see members p_eta and p_mu ), as well as the compon...
int get_dzpuis() const
Returns dzpuis.
Scalar ** cmp
Array of size n_comp of pointers onto the components.
Base_val ** std_base_vect_spher() const
Returns the standard spectral bases for the spherical components of a vector.
int get_nzone() const
Returns the number of domains.
const Scalar & divergence(const Metric &) const
The divergence of this with respect to a Metric .
virtual int identify() const =0
Returns a number to identify the sub-classe of Base_vect the object belongs to.
Scalar * p_mu
Field such that the angular components of the vector are written: .
Cmp pow(const Cmp &, int)
Power .
void decompose_div(const Metric &) const
Makes the Helmholtz decomposition (see documentation of p_potential ) of this with respect to a given...
const Tensor & derive_cov(const Metric &gam) const
Returns the covariant derivative of this with respect to some metric .
double & set(int j, int i)
Read/write of a particuliar element.
const Tensor & divergence(const Metric &gam) const
Computes the divergence of this with respect to some metric .
virtual void del_deriv() const
Deletes the derived quantities.
Cartesian vectorial bases (triads).
void set_band(int up, int low) const
Calculate the band storage of *std.
void set_der_met_0x0(int) const
Sets all the i-th components of met_depend in the class Vector (p_potential , etc...) to 0x0.
void set_spectral_base(const Base_val &)
Sets the spectral bases of the Valeur va
int valence
Valence of the tensor (0 = scalar, 1 = vector, etc...)
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
virtual void operator=(const Vector &a)
Assignment from a Vector.
const Tensor & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
Vector derive_lie(const Vector &v) const
Computes the Lie derivative of this with respect to some vector field v.
Bases of the spectral expansions.
void set_base_r(int l, int base_r)
Sets the expansion basis for r ( ) functions in a given domain.
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
const Metric * met_depend[N_MET_MAX]
Array on the Metric 's which were used to compute derived quantities, like p_derive_cov ...
Scalar & set(const Itbl &ind)
Returns the value of a component (read/write version).
const Vector_divfree curl() const
The curl of this with respect to a (flat) Metric .
const Scalar & potential(const Metric &) const
Returns the potential in the Helmholtz decomposition.
Coefficients storage for the multi-domain spectral method.
virtual const Scalar & mu() const
Gives the field such that the angular components of the vector are written: .
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Valeur & set_spectral_va()
Returns va (read/write version)
Scalar * p_eta
Field such that the angular components of the vector are written: .
Scalar & set(int)
Read/write access to a component.
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
bool check_dzpuis(int dzi) const
Returns false if the last domain is compactified and *this is not zero in this domain and dzpuis is n...
virtual void exponential_filter_ylm(int lzmin, int lzmax, int p, double alpha=-16.)
Applies an exponential filter to the spectral coefficients in the angular directions.
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
const Scalar & operator()(int) const
Readonly access to a component.
void div_tant()
Division by .
const Metric_flat & flat_met_spher() const
Returns the flat metric associated with the spherical coordinates and with components expressed in th...
virtual ~Vector()
Destructor.
Class intended to describe valence-2 symmetric tensors.
const Valeur & get_spectral_va() const
Returns va (read only version)
const Scalar & srstdsdp() const
Returns of *this .
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.
Coord r
r coordinate centered on the grid
virtual void pseudo_spectral_base()
Sets the standard spectal bases of decomposition for each component for a pseudo_vector.
#define R_CHEB
base de Chebychev ordinaire (fin)