map_et_lap.C
/*
* Computes the Laplacian of a scalar field (represented by a Cmp) when
* the mapping belongs to the Map_et class
*/
/*
* Copyright (c) 1999-2001 Eric Gourgoulhon
*
* 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 as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 map_et_lap_C[] = "$Header: /cvsroot/Lorene/C++/Source/Map/map_et_lap.C,v 1.4 2014/10/13 08:53:05 j_novak Exp $" ;
/*
* $Id: map_et_lap.C,v 1.4 2014/10/13 08:53:05 j_novak Exp $
* $Log: map_et_lap.C,v $
* Revision 1.4 2014/10/13 08:53:05 j_novak
* Lorene classes and functions now belong to the namespace Lorene.
*
* Revision 1.3 2005/11/24 09:25:07 j_novak
* Added the Scalar version for the Laplacian
*
* Revision 1.2 2003/10/15 16:03:37 j_novak
* Added the angular Laplace operator for Scalar.
*
* Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
* LORENE
*
* Revision 1.4 2000/02/25 09:02:18 eric
* Remplacement de (uu.get_dzpuis() == 0) par uu.check_dzpuis(0).
*
* Revision 1.3 2000/01/26 13:11:07 eric
* Reprototypage complet :
* le resultat est desormais suppose alloue a l'exterieur de la routine
* et est passe en argument (Cmp& resu).
* .
*
* Revision 1.2 2000/01/14 14:55:05 eric
* Suppression de l'assert(sauve_base == vresu.base)
* car sauve_base == vresu.base n'est pas necessairement vrai (cela
* depend de l'histoire du Cmp uu, notamment de si uu.p_dsdx est
* a jour).
*
* Revision 1.1 1999/12/20 17:27:30 eric
* Initial revision
*
*
* $Header: /cvsroot/Lorene/C++/Source/Map/map_et_lap.C,v 1.4 2014/10/13 08:53:05 j_novak Exp $
*
*/
// Header Lorene
#include "cmp.h"
#include "tensor.h"
// Laplacian: Scalar version
namespace Lorene {
void Map_et::laplacien(const Scalar& uu, int zec_mult_r, Scalar& resu) const {
assert (uu.get_etat() != ETATNONDEF) ;
assert (uu.get_mp().get_mg() == mg) ;
// Particular case of null value:
if ((uu.get_etat() == ETATZERO) || (uu.get_etat() == ETATUN)) {
resu.set_etat_zero() ;
return ;
}
assert( uu.get_etat() == ETATQCQ ) ;
assert( uu.check_dzpuis(0) ) ;
int nz = get_mg()->get_nzone() ;
int nzm1 = nz - 1 ;
// Indicator of existence of a compactified external domain
bool zec = false ;
if (mg->get_type_r(nzm1) == UNSURR) {
zec = true ;
}
if ( zec && (zec_mult_r != 4) ) {
cout << "Map_et::laplacien : the case zec_mult_r = " <<
zec_mult_r << " is not implemented !" << endl ;
abort() ;
}
//--------------------
// First operations
//--------------------
Valeur duudx = uu.get_spectral_va().dsdx() ; // d/dx
Valeur d2uudx2 = uu.get_spectral_va().d2sdx2() ; // d^2/dx^2
const Valeur& d2uudtdx = duudx.dsdt() ; // d^2/dxdtheta
const Valeur& std2uudpdx = duudx.stdsdp() ; // 1/sin(theta) d^2/dxdphi
//------------------
// Angular Laplacian
//------------------
Valeur sxlapang = uu.get_spectral_va() ;
sxlapang.ylm() ;
sxlapang = sxlapang.lapang() ;
sxlapang = sxlapang.sx() ; // 1/x in the nucleus
// Id in the shells
// 1/(x-1) in the ZEC
//------------------------------------
// (2 dx/dR d/dx + x/R 1/x Lap_ang)/x
//------------------------------------
Valeur varduudx = duudx ;
if (zec) {
varduudx.annule(nzm1) ; // term in d/dx set to zero in the ZEC
}
resu.set_etat_qcq() ;
Valeur& vresu = resu.set_spectral_va() ;
Base_val sauve_base = varduudx.base ;
vresu = double(2) * dxdr * varduudx + xsr * sxlapang ;
vresu.set_base(sauve_base) ;
vresu = vresu.sx() ;
//--------------
// Final result
//--------------
Mtbl unjj = double(1) + srdrdt*srdrdt + srstdrdp*srstdrdp ;
sauve_base = d2uudx2.base ;
// assert(sauve_base == vresu.base) ; // this is not necessary true
vresu = dxdr*dxdr * unjj * d2uudx2 + xsr * vresu
- double(2) * dxdr * ( sr2drdt * d2uudtdx
+ sr2stdrdp * std2uudpdx ) ;
vresu += - dxdr * ( lapr_tp + dxdr * (
dxdr* unjj * d2rdx2
- double(2) * ( sr2drdt * d2rdtdx + sr2stdrdp * sstd2rdpdx ) )
) * duudx ;
vresu.set_base(sauve_base) ;
if (zec == 1) {
resu.set_dzpuis(zec_mult_r) ;
}
}
// Laplacian: Cmp version
void Map_et::laplacien(const Cmp& uu, int zec_mult_r, Cmp& resu) const {
assert (uu.get_etat() != ETATNONDEF) ;
assert (uu.get_mp()->get_mg() == mg) ;
// Particular case of null value:
if (uu.get_etat() == ETATZERO) {
resu.set_etat_zero() ;
return ;
}
assert( uu.get_etat() == ETATQCQ ) ;
assert( uu.check_dzpuis(0) ) ;
int nz = get_mg()->get_nzone() ;
int nzm1 = nz - 1 ;
// Indicator of existence of a compactified external domain
bool zec = false ;
if (mg->get_type_r(nzm1) == UNSURR) {
zec = true ;
}
if ( zec && (zec_mult_r != 4) ) {
cout << "Map_et::laplacien : the case zec_mult_r = " <<
zec_mult_r << " is not implemented !" << endl ;
abort() ;
}
//--------------------
// First operations
//--------------------
Valeur duudx = (uu.va).dsdx() ; // d/dx
Valeur d2uudx2 = (uu.va).d2sdx2() ; // d^2/dx^2
const Valeur& d2uudtdx = duudx.dsdt() ; // d^2/dxdtheta
const Valeur& std2uudpdx = duudx.stdsdp() ; // 1/sin(theta) d^2/dxdphi
//------------------
// Angular Laplacian
//------------------
Valeur sxlapang = uu.va ;
sxlapang.ylm() ;
sxlapang = sxlapang.lapang() ;
sxlapang = sxlapang.sx() ; // 1/x in the nucleus
// Id in the shells
// 1/(x-1) in the ZEC
//------------------------------------
// (2 dx/dR d/dx + x/R 1/x Lap_ang)/x
//------------------------------------
Valeur varduudx = duudx ;
if (zec) {
varduudx.annule(nzm1) ; // term in d/dx set to zero in the ZEC
}
resu.set_etat_qcq() ;
Valeur& vresu = resu.va ;
Base_val sauve_base = varduudx.base ;
vresu = double(2) * dxdr * varduudx + xsr * sxlapang ;
vresu.set_base(sauve_base) ;
vresu = vresu.sx() ;
//--------------
// Final result
//--------------
Mtbl unjj = double(1) + srdrdt*srdrdt + srstdrdp*srstdrdp ;
sauve_base = d2uudx2.base ;
// assert(sauve_base == vresu.base) ; // this is not necessary true
vresu = dxdr*dxdr * unjj * d2uudx2 + xsr * vresu
- double(2) * dxdr * ( sr2drdt * d2uudtdx
+ sr2stdrdp * std2uudpdx ) ;
vresu += - dxdr * ( lapr_tp + dxdr * (
dxdr* unjj * d2rdx2
- double(2) * ( sr2drdt * d2rdtdx + sr2stdrdp * sstd2rdpdx ) )
) * duudx ;
vresu.set_base(sauve_base) ;
if (zec == 1) {
resu.set_dzpuis(zec_mult_r) ;
}
}
void Map_et::lapang(const Scalar& , Scalar& ) const {
cout << "Map_et::lapang : not implemented yet!" << endl ;
abort() ;
}
}
Lorene::Base_val
Bases of the spectral expansions.
Definition base_val.h:322
Lorene::Cmp
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition cmp.h:446
Lorene::Cmp::get_etat
int get_etat() const
Returns the logical state.
Definition cmp.h:899
Lorene::Cmp::va
Valeur va
The numerical value of the Cmp.
Definition cmp.h:464
Lorene::Cmp::set_etat_qcq
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition cmp.C:304
Lorene::Cmp::set_etat_zero
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition cmp.C:289
Lorene::Cmp::set_dzpuis
void set_dzpuis(int)
Set a value to dzpuis.
Definition cmp.C:654
Lorene::Cmp::check_dzpuis
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...
Definition cmp.C:715
Lorene::Cmp::get_mp
const Map * get_mp() const
Returns the mapping.
Definition cmp.h:901
Lorene::Map_et::lapang
virtual void lapang(const Scalar &uu, Scalar &lap) const
Computes the angular Laplacian of a scalar field.
Definition map_et_lap.C:283
Lorene::Map_et::laplacien
virtual void laplacien(const Scalar &uu, int zec_mult_r, Scalar &lap) const
Computes the Laplacian of a scalar field.
Definition map_et_lap.C:75
Lorene::Map_radial::d2rdx2
Coord d2rdx2
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1619
Lorene::Map_radial::sr2drdt
Coord sr2drdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1600
Lorene::Map_radial::srstdrdp
Coord srstdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1592
Lorene::Map_radial::d2rdtdx
Coord d2rdtdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1640
Lorene::Map_radial::sstd2rdpdx
Coord sstd2rdpdx
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1648
Lorene::Map_radial::lapr_tp
Coord lapr_tp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1631
Lorene::Map_radial::sr2stdrdp
Coord sr2stdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1608
Lorene::Map_radial::srdrdt
Coord srdrdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1584
Lorene::Map_radial::xsr
Coord xsr
in the nucleus; \ 1/R in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1549
Lorene::Map_radial::dxdr
Coord dxdr
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition map.h:1560
Lorene::Mg3d::get_nzone
int get_nzone() const
Returns the number of domains.
Definition grilles.h:448
Lorene::Mtbl
Multi-domain array.
Definition mtbl.h:118
Lorene::Scalar
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:387
Lorene::Scalar::set_etat_qcq
virtual void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition scalar.C:353
Lorene::Scalar::check_dzpuis
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...
Definition scalar.C:873
Lorene::Scalar::set_etat_zero
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition scalar.C:324
Lorene::Scalar::set_spectral_va
Valeur & set_spectral_va()
Returns va (read/write version).
Definition scalar.h:604
Lorene::Scalar::get_spectral_va
const Valeur & get_spectral_va() const
Returns va (read only version).
Definition scalar.h:601
Lorene::Scalar::get_etat
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
Definition scalar.h:554
Lorene::Scalar::set_dzpuis
void set_dzpuis(int)
Modifies the dzpuis flag.
Definition scalar.C:808
Lorene::Valeur
Values and coefficients of a (real-value) function.
Definition valeur.h:287
Lorene::Valeur::sx
const Valeur & sx() const
Returns (r -sampling = RARE ) \ Id (r sampling = FIN ) \ (r -sampling = UNSURR ).
Definition valeur_sx.C:110
Lorene::Valeur::stdsdp
const Valeur & stdsdp() const
Returns of *this.
Definition valeur_stdsdp.C:60
Lorene::Valeur::set_base
void set_base(const Base_val &)
Sets the bases for spectral expansions (member base ).
Definition valeur.C:810
Lorene::Valeur::ylm
void ylm()
Computes the coefficients of *this.
Definition valeur_ylm.C:138
Lorene::Valeur::dsdt
const Valeur & dsdt() const
Returns of *this.
Definition valeur_dsdt.C:112
Lorene::Valeur::annule
void annule(int l)
Sets the Valeur to zero in a given domain.
Definition valeur.C:744
Lorene::Valeur::dsdx
const Valeur & dsdx() const
Returns of *this.
Definition valeur_dsdx.C:111
Lorene::Valeur::d2sdx2
const Valeur & d2sdx2() const
Returns of *this.
Definition valeur_d2sdx2.C:114
Lorene::Valeur::base
Base_val base
Bases on which the spectral expansion is performed.
Definition valeur.h:305
Lorene::Valeur::lapang
const Valeur & lapang() const
Returns the angular Laplacian of *this.
Definition valeur_lapang.C:72
Lorene::Tensor::get_mp
const Map & get_mp() const
Returns the mapping.
Definition tensor.h:861
Lorene
Lorene prototypes.
Definition app_hor.h:64
Lorene::get_mg
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition map.h:765