sym_tensor_decomp.C
/*
* Methods transverse( ) and longit_pot( ) of class Sym_tensor
*
* (see file sym_tensor.h for documentation).
*
*/
/*
* Copyright (c) 2003-2004 Eric Gourgoulhon & Jerome Novak
*
* This file is part of LORENE.
*
* LORENE is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* LORENE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LORENE; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
char sym_tensor_decomp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/sym_tensor_decomp.C,v 1.14 2014/10/13 08:53:43 j_novak Exp $" ;
/*
* $Id: sym_tensor_decomp.C,v 1.14 2014/10/13 08:53:43 j_novak Exp $
* $Log: sym_tensor_decomp.C,v $
* Revision 1.14 2014/10/13 08:53:43 j_novak
* Lorene classes and functions now belong to the namespace Lorene.
*
* Revision 1.13 2008/12/05 08:45:12 j_novak
* Modified dzpuis treatment.
*
* Revision 1.12 2008/12/03 10:20:00 j_novak
* Modified output.
*
* Revision 1.11 2004/06/17 06:56:42 e_gourgoulhon
* Simplified code for method transverse (use of Vector::ope_killing).
* Slight modif. of output in method longit_pot.
*
* Revision 1.10 2004/06/14 20:45:41 e_gourgoulhon
* Added argument method_poisson to methods longit_pot and transverse.
*
* Revision 1.9 2004/05/25 15:05:57 f_limousin
* Add parameters in argument of the functions transverse, longit_pot
* for the case of Map_et.
*
* Revision 1.8 2004/03/30 14:01:19 j_novak
* Copy constructors and operator= now copy the "derived" members.
*
* Revision 1.7 2004/03/30 08:01:16 j_novak
* Better treatment of dzpuis in mutators.
*
* Revision 1.6 2004/03/29 16:13:07 j_novak
* New methods set_longit_trans and set_tt_trace .
*
* Revision 1.5 2004/02/09 12:56:27 e_gourgoulhon
* Method longit_pot: added test of the vector Poisson equation.
*
* Revision 1.4 2004/02/02 09:18:11 e_gourgoulhon
* Method longit_pot: treatment of case divergence dzpuis = 5.
*
* Revision 1.3 2003/12/10 10:17:54 e_gourgoulhon
* First operational version.
*
* Revision 1.2 2003/11/27 16:01:47 e_gourgoulhon
* First implmentation.
*
* Revision 1.1 2003/11/26 21:57:03 e_gourgoulhon
* First version; not ready yet.
*
*
* $Header: /cvsroot/Lorene/C++/Source/Tensor/sym_tensor_decomp.C,v 1.14 2014/10/13 08:53:43 j_novak Exp $
*
*/
// Lorene headers
#include "metric.h"
#include "param.h"
namespace Lorene {
void Sym_tensor::set_longit_trans(const Vector& v_pot,
const Sym_tensor_trans& ht ) {
assert ( v_pot.get_index_type(0) == CON ) ;
const Metric& metre = ht.get_met_div() ;
*this = ht + v_pot.ope_killing(metre) ; // this has dzpuis = 2, if v_pot not 0
if ((*this)(1,1).get_dzpuis() == 2)
dec_dzpuis(2) ; // which is decreased so to add *this to a flat metric
del_deriv() ;
set_dependance(metre) ;
int jp = get_place_met(metre) ;
assert ((jp>=0) && (jp<N_MET_MAX)) ;
p_transverse[jp] = new Sym_tensor_trans(ht) ;
p_longit_pot[jp] = new Vector( v_pot ) ;
}
const Sym_tensor_trans& Sym_tensor::transverse(const Metric& metre, Param* par,
int method_poisson) const {
set_dependance(metre) ;
int jp = get_place_met(metre) ;
assert ((jp>=0) && (jp<N_MET_MAX)) ;
if (p_transverse[jp] == 0x0) { // a new computation is necessary
assert( (type_indice(0) == CON) && (type_indice(1) == CON) ) ;
for (int ic=0; ic<n_comp; ic++) {
assert(cmp[ic]->check_dzpuis(4)) ; // dzpuis=4 is assumed
}
const Vector& ww = longit_pot(metre, par, method_poisson) ;
Sym_tensor lww = ww.ope_killing(metre) ; // D^i W^j + D^j W^i
lww.inc_dzpuis(2) ;
p_transverse[jp] = new Sym_tensor_trans(*mp, *triad, metre) ;
*(p_transverse[jp]) = *this - lww ;
}
return *p_transverse[jp] ;
}
const Vector& Sym_tensor::longit_pot(const Metric& metre, Param* par,
int method_poisson) const {
set_dependance(metre) ;
int jp = get_place_met(metre) ;
assert ((jp>=0) && (jp<N_MET_MAX)) ;
if (p_longit_pot[jp] == 0x0) { // a new computation is necessary
const Metric_flat* metf = dynamic_cast<const Metric_flat*>(&metre) ;
if (metf == 0x0) {
cout << "Sym_tensor::longit_pot : the case of a non flat metric"
<< endl <<" is not treated yet !" << endl ;
abort() ;
}
Vector hhh = divergence(metre) ;
// If dpzuis is 5, it should be decreased to 4 for the Poisson equation:
bool dzp5 = false ;
for (int i=1; i<=3; i++) {
dzp5 = dzp5 || hhh(i).check_dzpuis(5) ;
}
if (dzp5) hhh.dec_dzpuis() ;
if (dynamic_cast<const Map_af*>(mp) != 0x0)
p_longit_pot[jp] = new Vector( hhh.poisson(double(1),
method_poisson) ) ;
else
p_longit_pot[jp] = new Vector( hhh.poisson(double(1), *par,
method_poisson) ) ;
// Test of resolution of the vector Poisson equation:
const Vector& ww = *(p_longit_pot[jp]) ;
hhh.dec_dzpuis() ;
Vector lapw = ww.derive_con(metre).divergence(metre)
+ (ww.divergence(metre)).derive_con(metre) ;
#ifndef NDEBUG
cout << "## Sym_tensor::longit_pot : test of Poisson : \n" ;
cout <<
" Max absolute error in each domain on the vector Poisson equation:\n" ;
maxabs(lapw - hhh) ;
int nz = mp->get_mg()->get_nzone() ; // total number of domains
cout << " Relative error in each domain on the vector Poisson equation:\n" ;
for (int i=1; i<=3; i++){
cout << " Comp. " << i << " : " ;
for (int l=0; l<nz; l++){
cout << diffrel(lapw(i),hhh(i) )(l) << " " ;
}
cout << endl ;
}
cout << endl ;
#endif
}
return *p_longit_pot[jp] ;
}
}
Lorene::Map_af
Affine radial mapping.
Definition map.h:2027
Lorene::Metric_flat
Flat metric for tensor calculation.
Definition metric.h:261
Lorene::Param
Parameter storage.
Definition param.h:125
Lorene::Sym_tensor_trans
Transverse symmetric tensors of rank 2.
Definition sym_tensor.h:608
Lorene::Sym_tensor_trans::get_met_div
const Metric & get_met_div() const
Returns the metric with respect to which the divergence and the trace are defined.
Definition sym_tensor.h:669
Lorene::Sym_tensor::set_longit_trans
void set_longit_trans(const Vector &v, const Sym_tensor_trans &a)
Assigns the derived members p_longit_pot and p_transverse and updates the components accordingly.
Definition sym_tensor_decomp.C:88
Lorene::Sym_tensor::transverse
const Sym_tensor_trans & transverse(const Metric &gam, Param *par=0x0, int method_poisson=6) const
Computes the transverse part of the tensor with respect to a given metric, transverse meaning diverg...
Definition sym_tensor_decomp.C:110
Lorene::Sym_tensor::longit_pot
const Vector & longit_pot(const Metric &gam, Param *par=0x0, int method_poisson=6) const
Computes the vector potential of longitudinal part of the tensor (see documentation of method transv...
Definition sym_tensor_decomp.C:143
Lorene::Sym_tensor::p_transverse
Sym_tensor_trans * p_transverse[N_MET_MAX]
Array of the transverse part of the tensor with respect to various metrics, transverse meaning diver...
Definition sym_tensor.h:239
Lorene::Sym_tensor::del_deriv
virtual void del_deriv() const
Deletes the derived quantities.
Definition sym_tensor.C:286
Lorene::Sym_tensor::Sym_tensor
Sym_tensor(const Map &map, const Itbl &tipe, const Base_vect &triad_i)
Standard constructor.
Definition sym_tensor.C:142
Lorene::Sym_tensor::p_longit_pot
Vector * p_longit_pot[N_MET_MAX]
Array of the vector potential of the longitudinal part of the tensor with respect to various metrics ...
Definition sym_tensor.h:246
Lorene::Sym_tensor::divergence
const Vector & divergence(const Metric &) const
Returns the divergence of this with respect to a Metric .
Definition sym_tensor.C:349
Lorene::Vector
Tensor field of valence 1.
Definition vector.h:188
Lorene::Vector::ope_killing
Sym_tensor ope_killing(const Metric &gam) const
Computes the Killing operator associated with a given metric.
Definition vector.C:438
Lorene::Vector::poisson
Vector poisson(double lambda, int method=6) const
Solves the vector Poisson equation with *this as a source.
Definition vector_poisson.C:518
Lorene::Vector::divergence
const Scalar & divergence(const Metric &) const
The divergence of this with respect to a Metric .
Definition vector.C:381
Lorene::diffrel
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
Definition cmp_math.C:504
Lorene::Tensor::get_index_type
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
Definition tensor.h:886
Lorene::Tensor::dec_dzpuis
virtual void dec_dzpuis(int dec=1)
Decreases by dec units the value of dzpuis and changes accordingly the values in the compactified ext...
Definition tensor.C:808
Lorene::Tensor::mp
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
Definition tensor.h:295
Lorene::Tensor::get_place_met
int get_place_met(const Metric &) const
Returns the position of the pointer on metre in the array met_depend .
Definition tensor.C:443
Lorene::Tensor::derive_con
const Tensor & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of this with respect to some metric , by raising the last inde...
Definition tensor.C:1014
Lorene::Tensor::inc_dzpuis
virtual void inc_dzpuis(int inc=1)
Increases by inc units the value of dzpuis and changes accordingly the values in the compactified ext...
Definition tensor.C:816
Lorene::Tensor::set_dependance
void set_dependance(const Metric &) const
To be used to describe the fact that the derivatives members have been calculated with met .
Definition tensor.C:453
Lorene::Tensor::cmp
Scalar ** cmp
Array of size n_comp of pointers onto the components.
Definition tensor.h:315
Lorene::Tensor::n_comp
int n_comp
Number of stored components, depending on the symmetry.
Definition tensor.h:312
Lorene::Tensor::divergence
const Tensor & divergence(const Metric &gam) const
Computes the divergence of this with respect to some metric .
Definition tensor.C:1055
Lorene::Tensor::type_indice
Itbl type_indice
1D array of integers (class Itbl ) of size valence containing the type of each index: COV for a cov...
Definition tensor.h:310
Lorene::Tensor::triad
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
Definition tensor.h:303
Lorene::maxabs
Tbl maxabs(const Tensor &aa, const char *comment=0x0, ostream &ost=cout, bool verb=true)
Maxima in each domain of the absolute values of the tensor components.
Definition tensor_calculus_ext.C:606
Lorene
Lorene prototypes.
Definition app_hor.h:64
Lorene::dec_dzpuis
virtual void dec_dzpuis(Scalar &) const =0
Decreases by 1 the value of dzpuis of a Scalar and changes accordingly its values in the compacti...