LORENE
tenseur_pde_ylm.C
1/*
2 * Methods of the class tenseur for solving vectorial Poisson equations
3 * with a multipole falloff condition at the outer boundary
4 *
5 * (see file tenseur.h for documentation).
6 *
7 */
8
9/*
10 * Copyright (c) 2004 Joshua A. Faber
11 *
12 * This file is part of LORENE.
13 *
14 * LORENE is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2
16 * as published by the Free Software Foundation.
17 *
18 * LORENE is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with LORENE; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 *
27 */
28
29
30
31/*
32 * $Id: tenseur_pde_ylm.C,v 1.3 2016/12/05 16:18:17 j_novak Exp $
33 * $Log: tenseur_pde_ylm.C,v $
34 * Revision 1.3 2016/12/05 16:18:17 j_novak
35 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
36 *
37 * Revision 1.2 2014/10/13 08:53:42 j_novak
38 * Lorene classes and functions now belong to the namespace Lorene.
39 *
40 * Revision 1.1 2004/12/29 16:32:33 k_taniguchi
41 * *** empty log message ***
42 *
43 *
44 * $Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_pde_ylm.C,v 1.3 2016/12/05 16:18:17 j_novak Exp $
45 *
46 */
47
48// Lorene headers
49#include "map.h"
50#include "cmp.h"
51#include "param.h"
52#include "tenseur.h"
53
54 //-----------------------------------//
55 // Vectorial Poisson equation //
56 //-----------------------------------//
57
58// Version avec parametres
59// -----------------------
60namespace Lorene {
61void Tenseur::poisson_vect_ylm(double lambda, Param& para, Tenseur& shift,
62 Tenseur& vecteur, Tenseur& scalaire, int nylm,
63 double* intvec) const {
64 assert (lambda != -1) ;
65
66 // Verifications d'usage ...
67 assert (valence == 1) ;
68 assert (shift.get_valence() == 1) ;
69 assert (shift.get_type_indice(0) == type_indice(0)) ;
70 assert (vecteur.get_valence() == 1) ;
71 assert (vecteur.get_type_indice(0) == type_indice(0)) ;
72 assert (scalaire.get_valence() == 0) ;
73 assert (etat != ETATNONDEF) ;
74
75 Map_af mapping (*mp);
76
77 // Nothing to do if the source is zero
78 if (etat == ETATZERO) {
79
80 shift.set_etat_zero() ;
81
82 vecteur.set_etat_qcq() ;
83 for (int i=0; i<3; i++) {
84 vecteur.set(i) = 0 ;
85 }
86
87 scalaire.set_etat_qcq() ;
88 scalaire.set() = 0 ;
89
90 return ;
91 }
92
93 // On construit le tableau contenant le terme P_i ...
94 for (int i=0 ; i<3 ; i++) {
95 Param* par = mp->donne_para_poisson_vect(para, i) ;
96
97 double* intvec2=new double [nylm];
98 for (int j=0; j<nylm; j++) {
99 intvec2[j]=intvec[i*nylm+j];
100 }
101
102 (*this)(i).poisson_ylm(*par, vecteur.set(i),nylm,intvec2) ;
103
104 delete [] intvec2;
105
106 if (par != 0x0)
107 delete par ;
108 }
109 vecteur.set_triad( *triad ) ;
110
111 // Equation de Poisson scalaire :
112 Tenseur source_scal (-skxk(*this)) ;
113
114 Param* par = mp->donne_para_poisson_vect(para, 3) ;
115
116 double* intvec2=new double[nylm];
117 for (int j=0; j<nylm; j++) {
118 intvec2[j]=intvec[3*nylm+j];
119 }
120
121 source_scal().poisson_ylm(*par, scalaire.set(), nylm, intvec2) ;
122
123 delete [] intvec2;
124 if (par !=0x0)
125 delete par ;
126
127 // On construit le tableau contenant le terme d xsi / d x_i ...
128 Tenseur auxiliaire(scalaire) ;
129 Tenseur dxsi (auxiliaire.gradient()) ;
130
131 // On construit le tableau contenant le terme x_k d P_k / d x_i
132 Tenseur dp (skxk(vecteur.gradient())) ;
133
134 // Il ne reste plus qu'a tout ranger dans P :
135 // The final computation is done component by component because
136 // d_khi and x_d_w are covariant comp. whereas w_shift is
137 // contravariant
138
139 shift.set_etat_qcq() ;
140
141 for (int i=0 ; i<3 ; i++)
142 shift.set(i) = (lambda+2)/2/(lambda+1) * vecteur(i)
143 - (lambda/2/(lambda+1)) * (dxsi(i) + dp(i)) ;
144
145 shift.set_triad( *(vecteur.triad) ) ;
146
147}
148
149
150// Version sans parametres
151// -----------------------
152Tenseur Tenseur::poisson_vect_ylm(double lambda, Tenseur& vecteur,
153 Tenseur& scalaire, int nylm, double* intvec) const {
154
155 Param bidon ;
157 resu.set_etat_qcq() ;
158 poisson_vect_ylm(lambda, bidon, resu, vecteur, scalaire, nylm, intvec) ;
159 return resu ;
160}
161
162}
Parameter storage.
Definition param.h:125
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Definition tenseur.h:304
const Metrique * metric
For tensor densities: the metric defining the conformal factor.
Definition tenseur.h:328
const Map *const mp
Reference mapping.
Definition tenseur.h:309
Tenseur(const Map &map, const Metrique *met=0x0, double weight=0)
Constructor for a scalar field.
Definition tenseur.C:215
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
Definition tenseur.h:315
Itbl type_indice
Array of size valence contening the type of each index, COV for a covariant one and CON for a contrav...
Definition tenseur.h:321
int valence
Valence.
Definition tenseur.h:310
int etat
Logical state ETATZERO , ETATQCQ or ETATNONDEF.
Definition tenseur.h:324
double poids
For tensor densities: the weight.
Definition tenseur.h:326
friend Tenseur skxk(const Tenseur &)
Contraction of the last index of (*this) with or , depending on the type of S .
Lorene prototypes.
Definition app_hor.h:67