LORENE
vector_etamu.C
1/*
2 * Methods of class Vector related to eta and mu
3 *
4 * (see file vector.h for documentation)
5 *
6 */
7
8/*
9 * Copyright (c) 2005 Eric Gourgoulhon & Jerome Novak
10 *
11 * This file is part of LORENE.
12 *
13 * LORENE is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
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
30char vector_etamu_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/vector_etamu.C,v 1.4 2014/10/13 08:53:45 j_novak Exp $" ;
31
32/*
33 * $Id: vector_etamu.C,v 1.4 2014/10/13 08:53:45 j_novak Exp $
34 * $Log: vector_etamu.C,v $
35 * Revision 1.4 2014/10/13 08:53:45 j_novak
36 * Lorene classes and functions now belong to the namespace Lorene.
37 *
38 * Revision 1.3 2014/10/06 15:13:21 j_novak
39 * Modified #include directives to use c++ syntax.
40 *
41 * Revision 1.2 2008/08/27 08:52:23 jl_cornou
42 * Added fonctions for angular potential A
43 *
44 * Revision 1.1 2005/02/14 13:01:50 j_novak
45 * p_eta and p_mu are members of the class Vector. Most of associated functions
46 * have been moved from the class Vector_divfree to the class Vector.
47 *
48 *
49 * $Header: /cvsroot/Lorene/C++/Source/Tensor/vector_etamu.C,v 1.4 2014/10/13 08:53:45 j_novak Exp $
50 *
51 */
52
53// Headers C
54#include <cstdlib>
55#include <cassert>
56
57// Headers Lorene
58#include "tensor.h"
59
60 //--------------//
61 // eta //
62 //--------------//
63
64
65namespace Lorene {
66const Scalar& Vector::eta() const {
67
68
69 if (p_eta == 0x0) { // a new computation is necessary
70
71 // All this has a meaning only for spherical components:
72#ifndef NDEBUG
73 const Base_vect_spher* bvs = dynamic_cast<const Base_vect_spher*>(triad) ;
74 assert(bvs != 0x0) ;
75#endif
76
77 // eta is computed from its definition:
78 Scalar sou_eta = *cmp[1] ; //V^th
79 sou_eta.div_tant() ;
80 sou_eta += cmp[1]->dsdt() + cmp[2]->stdsdp();
81
82 // Resolution of the angular Poisson equation for eta
83 // --------------------------------------------------
84 p_eta = new Scalar( sou_eta.poisson_angu() ) ;
85
86 }
87
88 return *p_eta ;
89
90}
91
92
93 //--------------//
94 // mu //
95 //--------------//
96
97
98const Scalar& Vector::mu() const {
99
100
101 if (p_mu == 0x0) { // a new computation is necessary
102
103 // All this has a meaning only for spherical components:
104#ifndef NDEBUG
105 const Base_vect_spher* bvs = dynamic_cast<const Base_vect_spher*>(triad) ;
106 assert(bvs != 0x0) ;
107#endif
108
109 Scalar tmp = *cmp[2] ; // V^ph
110 tmp.div_tant() ; // V^ph / tan(th)
111
112 // dV^ph/dth + V^ph/tan(th) - 1/sin(th) dV^th/dphi
113 tmp += cmp[2]->dsdt() - cmp[1]->stdsdp() ;
114
115 // Resolution of the angular Poisson equation for mu
116 // --------------------------------------------------
117 p_mu = new Scalar( tmp.poisson_angu() ) ;
118
119 }
120
121 return *p_mu ;
122
123}
124
125 //-----------//
126 // A //
127 //-----------//
128
129const Scalar& Vector::A() const {
130
131
132 if (p_A == 0x0) { // A new computation is necessary
133
134 // All this has a meaning only for spherical components :
135#ifndef NDEBUG
136 const Base_vect_spher* bvs = dynamic_cast<const Base_vect_spher*>(triad) ;
137 assert(bvs != 0x0) ;
138#endif
139
140 // p_eta doit ĂȘtre calculĂ©
141 if (p_eta == 0x0) { Scalar etatmp = this->eta(); }
142
143 Scalar tmp = -*cmp[0] ; // -V^r
144 tmp.div_r_dzpuis(2); // -V^r/r
145
147 Scalar etad = eta_tilde.dsdr() ;
148 eta_tilde.div_r_dzpuis(2);
149 etad.set_dzpuis(2);
150 tmp += etad + eta_tilde ; // d eta / dr + eta/r
151
152 p_A = new Scalar (tmp) ;
153 }
154
155 return *p_A ;
156}
157
158
159
160
161
162 //----------------//
163 // update_vtvp //
164 //----------------//
165
166
168
169 assert( (p_eta != 0x0) && (p_mu != 0x0) ) ;
170
171 // V^theta :
172 *cmp[1] = p_eta->dsdt() - p_mu->stdsdp() ;
173
174 // V^phi :
175 *cmp[2] = p_eta->stdsdp() + p_mu->dsdt() ;
176
177 Scalar* p_eta_tmp = p_eta ; //## in order not to delete p_eta and p_mu
178 p_eta = 0x0 ;
179 Scalar* p_mu_tmp = p_mu ;
180 p_mu = 0x0 ;
182
183 p_eta = p_eta_tmp ;
184 p_mu = p_mu_tmp ;
185
186}
187
188
190 const Scalar& mu_i) {
191
192 // All this has a meaning only for spherical components:
193 assert( dynamic_cast<const Base_vect_spher*>(triad) != 0x0 ) ;
194 assert(&vr_i.get_mp() == &eta_i.get_mp()) ;
195
196 del_deriv() ;
197
198 // V^r
199 *cmp[0] = vr_i ;
200
201 p_eta = new Scalar( eta_i ) ; // eta
202
203 p_mu = new Scalar( mu_i ) ; // mu
204
205 update_vtvp() ;
206
207 return ;
208}
209
210
211
212
213
214}
Spherical orthonormal vectorial bases (triads).
Definition base_vect.h:308
Time evolution with partial storage (*** under development ***).
Definition evolution.h:371
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:387
const Scalar & dsdt() const
Returns of *this .
const Scalar & stdsdp() const
Returns of *this .
virtual void del_deriv() const
Deletes the derived quantities.
Definition vector.C:219
virtual const Scalar & mu() const
Gives the field such that the angular components of the vector are written:
void update_vtvp()
Computes the components and from the potential and , according to:
Scalar * p_A
Field defined by.
Definition vector.h:241
virtual const Scalar & eta() const
Gives the field such that the angular components of the vector are written:
Scalar * p_mu
Field such that the angular components of the vector are written:
Definition vector.h:233
Scalar * p_eta
Field such that the angular components of the vector are written:
Definition vector.h:219
virtual const Scalar & A() const
Gives the field defined by.
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...
Scalar ** cmp
Array of size n_comp of pointers onto the components.
Definition tensor.h:315
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
Definition tensor.h:303
Lorene prototypes.
Definition app_hor.h:64