LORENE
vector_divfree_aux.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 
30 char vector_divfree_aux[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/vector_divfree_aux.C,v 1.3 2014/10/13 08:53:45 j_novak Exp $" ;
31 
32 /*
33  * $Id: vector_divfree_aux.C,v 1.3 2014/10/13 08:53:45 j_novak Exp $
34  * $Log: vector_divfree_aux.C,v $
35  * Revision 1.3 2014/10/13 08:53:45 j_novak
36  * Lorene classes and functions now belong to the namespace Lorene.
37  *
38  * Revision 1.2 2014/10/06 15:13:21 j_novak
39  * Modified #include directives to use c++ syntax.
40  *
41  * Revision 1.1 2008/08/27 09:01:27 jl_cornou
42  * Methods for solving Dirac systems for divergence free vectors
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_divfree_aux.C,v 1.3 2014/10/13 08:53:45 j_novak Exp $
50  *
51  */
52 
53 // C++ headers
54 #include "headcpp.h"
55 
56 // C headers
57 #include <cstdlib>
58 
59 // Lorene headers
60 #include "metric.h"
61 #include "nbr_spx.h"
62 #include "utilitaires.h"
63 
64 // Headers C
65 #include <cstdlib>
66 #include <cassert>
67 
68 // Headers Lorene
69 #include "tensor.h"
70 
71  //----------------//
72  // update_etavr //
73  //----------------//
74 
75 namespace Lorene {
77 
78  assert(p_A != 0x0) ;
79 
80  Scalar eta_tilde(*mp) ;
81  Scalar vr(*mp) ;
82  sol_Dirac_A(*p_A, eta_tilde, vr, 0x0) ;
83 
84  *cmp[0] = vr ;
85  p_eta = &eta_tilde ;
86 
87  Scalar* p_eta_tmp = p_eta ; //## in order not to delete p_eta
88  p_eta = 0x0 ;
90 
91  p_eta = p_eta_tmp ;
92 
93 }
94 
95  //---------------//
96  // set_vr_eta_mu //
97  //---------------//
98 
99  void Vector_divfree::set_vr_eta_mu(const Scalar& vr_i, const Scalar& eta_i,
100  const Scalar& mu_i) {
101 
102  // All this has a meaning only for spherical components:
103  assert( dynamic_cast<const Base_vect_spher*>(triad) != 0x0 ) ;
104  assert(&vr_i.get_mp() == &eta_i.get_mp()) ;
105 
106  // V^r
107  *cmp[0] = vr_i ;
108 
109  p_eta = new Scalar( eta_i ) ; // eta
110 
111  p_mu = new Scalar( mu_i ) ; // mu
112 
113  update_vtvp() ;
114 
115  return ;
116  }
117 
118 
119  //--------------//
120  // set_A_mu //
121  //--------------//
122 
123 void Vector_divfree::set_A_mu(const Scalar& A_i, const Scalar& mu_i, const Param* par_bc) {
124 
125  // All this has a meaning only for spherical components:
126  assert( dynamic_cast<const Base_vect_spher*>(triad) != 0x0 ) ;
127  assert(&A_i.get_mp() == &mu_i.get_mp()) ;
128 
129  del_deriv() ;
130 
131 
132  p_A = new Scalar (A_i) ;
133  p_mu = new Scalar (mu_i) ;
134 
135  Scalar eta_tilde(*mp) ;
136  Scalar vr(*mp) ;
137  sol_Dirac_A(*p_A, vr, eta_tilde, par_bc) ;
138  *cmp[0] = vr ;
139  p_eta = new Scalar(eta_tilde) ;
140  p_eta->set_dzpuis(2);
141 
142 //update_etavr();
143 //set_vr_eta_mu(*cmp[0], *p_eta, *p_mu) ;
144 
145  update_vtvp();
146 
147  return ;
148 }
149 
150 }
virtual void del_deriv() const
Deletes the derived quantities.
Lorene prototypes.
Definition: app_hor.h:67
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:393
Scalar * p_A
Field defined by Insensitive to the longitudinal part of the vector, related to the curl...
Definition: vector.h:241
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
Definition: tensor.h:309
void update_vtvp()
Computes the components and from the potential and , according to: .
Definition: vector_etamu.C:176
void set_dzpuis(int)
Modifies the dzpuis flag.
Definition: scalar.C:814
void update_etavr()
Computes the components and from the potential A and the divergence-free condition, according to : .
virtual void del_deriv() const
Deletes the derived quantities.
Definition: vector.C:225
Scalar ** cmp
Array of size n_comp of pointers onto the components.
Definition: tensor.h:321
void sol_Dirac_A(const Scalar &aaa, Scalar &eta, Scalar &vr, const Param *par_bc=0x0) const
Solves a system of two-coupled first-order PDEs obtained from the divergence-free condition and the r...
Parameter storage.
Definition: param.h:125
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
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
Definition: tensor.h:301
const Map & get_mp() const
Returns the mapping.
Definition: tensor.h:874
void set_vr_eta_mu(const Scalar &vr_i, const Scalar &eta_i, const Scalar &mu_i)
Defines the components through , and .
void set_A_mu(const Scalar &A_i, const Scalar &mu_i, const Param *par_bc)
Defines the components through potentials and .