LORENE
tenseur_pde_falloff.C
1/*
2 * Methods of the class tenseur for solving vectorial Poisson equations
3 * with a 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_falloff.C,v 1.4 2016/12/05 16:18:17 j_novak Exp $
33 * $Log: tenseur_pde_falloff.C,v $
34 * Revision 1.4 2016/12/05 16:18:17 j_novak
35 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
36 *
37 * Revision 1.3 2014/10/13 08:53:42 j_novak
38 * Lorene classes and functions now belong to the namespace Lorene.
39 *
40 * Revision 1.2 2004/12/22 18:25:59 k_taniguchi
41 * Cahnge an argument of poisson_vect_falloff.
42 *
43 * Revision 1.1 2004/11/30 20:55:33 k_taniguchi
44 * *** empty log message ***
45 *
46 *
47 * $Header: /cvsroot/Lorene/C++/Source/Tenseur/tenseur_pde_falloff.C,v 1.4 2016/12/05 16:18:17 j_novak Exp $
48 *
49 */
50
51// Header Lorene:
52#include "map.h"
53#include "cmp.h"
54#include "param.h"
55#include "tenseur.h"
56
57 //-----------------------------------//
58 // Vectorial Poisson equation //
59 //-----------------------------------//
60
61// Version avec parametres
62// -----------------------
63namespace Lorene {
64void Tenseur::poisson_vect_falloff(double lambda, Param& para, Tenseur& shift,
65 Tenseur& vecteur, Tenseur& scalaire,
66 int* k_falloff) const {
67 assert (lambda != -1) ;
68
69 // Verifications d'usage ...
70 assert (valence == 1) ;
71 assert (shift.get_valence() == 1) ;
72 assert (shift.get_type_indice(0) == type_indice(0)) ;
73 assert (vecteur.get_valence() == 1) ;
74 assert (vecteur.get_type_indice(0) == type_indice(0)) ;
75 assert (scalaire.get_valence() == 0) ;
76 assert (etat != ETATNONDEF) ;
77
78 // define int k_falloff[4] ;
79 // k_falloff[0,1,2] = falloff for vecteur_x,y,z
80 // k_falloff[3] = falloff for scalaire
81
82 // Nothing to do if the source is zero
83 if (etat == ETATZERO) {
84
85 shift.set_etat_zero() ;
86
87 vecteur.set_etat_qcq() ;
88 for (int i=0; i<3; i++) {
89 vecteur.set(i) = 0 ;
90 }
91
92 scalaire.set_etat_qcq() ;
93 scalaire.set() = 0 ;
94
95 return ;
96 }
97
98 // On construit le tableau contenant le terme P_i ...
99 for (int i=0 ; i<3 ; i++) {
100 Param* par = mp->donne_para_poisson_vect(para, i) ;
101
102 (*this)(i).poisson_falloff(*par, vecteur.set(i),k_falloff[i]) ;
103
104 if (par != 0x0)
105 delete par ;
106 }
107 vecteur.set_triad( *triad ) ;
108
109 // Equation de Poisson scalaire :
110 Tenseur source_scal (-skxk(*this)) ;
111
112 Param* par = mp->donne_para_poisson_vect(para, 3) ;
113
114 source_scal().poisson_falloff(*par, scalaire.set(), k_falloff[3]) ;
115
116 if (par !=0x0)
117 delete par ;
118
119 // On construit le tableau contenant le terme d xsi / d x_i ...
120 Tenseur auxiliaire(scalaire) ;
121 Tenseur dxsi (auxiliaire.gradient()) ;
122
123 // On construit le tableau contenant le terme x_k d P_k / d x_i
124 Tenseur dp (skxk(vecteur.gradient())) ;
125
126 // Il ne reste plus qu'a tout ranger dans P :
127 // The final computation is done component by component because
128 // d_khi and x_d_w are covariant comp. whereas w_shift is
129 // contravariant
130
131 shift.set_etat_qcq() ;
132
133 for (int i=0 ; i<3 ; i++)
134 shift.set(i) = (lambda+2)/2/(lambda+1) * vecteur(i)
135 - (lambda/2/(lambda+1)) * (dxsi(i) + dp(i)) ;
136
137 shift.set_triad( *(vecteur.triad) ) ;
138
139}
140
141
142// Version sans parametres
143// -----------------------
144Tenseur Tenseur::poisson_vect_falloff(double lambda, Tenseur& vecteur,
145 Tenseur& scalaire, int* k_falloff) const {
146
147 Param bidon ;
149 resu.set_etat_qcq() ;
150 poisson_vect_falloff(lambda, bidon, resu, vecteur, scalaire, k_falloff) ;
151 return resu ;
152}
153
154}
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