| 1 |
/* |
| 2 |
* Methods for computing global quantities within the class Et_rot_diff |
| 3 |
* |
| 4 |
* (see file et_rot_diff.h for documentation) |
| 5 |
*/ |
| 6 |
|
| 7 |
/* |
| 8 |
* Copyright (c) 2001 Eric Gourgoulhon |
| 9 |
* |
| 10 |
* This file is part of LORENE. |
| 11 |
* |
| 12 |
* LORENE is free software; you can redistribute it and/or modify |
| 13 |
* it under the terms of the GNU General Public License as published by |
| 14 |
* the Free Software Foundation; either version 2 of the License, or |
| 15 |
* (at your option) any later version. |
| 16 |
* |
| 17 |
* LORENE is distributed in the hope that it will be useful, |
| 18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
* GNU General Public License for more details. |
| 21 |
* |
| 22 |
* You should have received a copy of the GNU General Public License |
| 23 |
* along with LORENE; if not, write to the Free Software |
| 24 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 |
* |
| 26 |
*/ |
| 27 |
|
| 28 |
|
| 29 |
char et_rot_diff_global_C[] = "$Header: /cvsroot/Lorene/C++/Source/Etoile/et_rot_diff_global.C,v 1.4 2014/10/13 08:52:57 j_novak Exp $" ; |
| 30 |
|
| 31 |
/* |
| 32 |
* $Id: et_rot_diff_global.C,v 1.4 2014/10/13 08:52:57 j_novak Exp $ |
| 33 |
* $Log: et_rot_diff_global.C,v $ |
| 34 |
* Revision 1.4 2014/10/13 08:52:57 j_novak |
| 35 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 36 |
* |
| 37 |
* Revision 1.3 2014/10/06 15:13:08 j_novak |
| 38 |
* Modified #include directives to use c++ syntax. |
| 39 |
* |
| 40 |
* Revision 1.2 2003/12/19 16:21:42 j_novak |
| 41 |
* Shadow hunt |
| 42 |
* |
| 43 |
* Revision 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon |
| 44 |
* LORENE |
| 45 |
* |
| 46 |
* Revision 1.2 2001/10/24 16:06:53 eric |
| 47 |
* fonction tsw(): correction erreur ener. cin. (facteur 0.5). |
| 48 |
* |
| 49 |
* Revision 1.1 2001/10/19 08:18:30 eric |
| 50 |
* Initial revision |
| 51 |
* |
| 52 |
* |
| 53 |
* $Header: /cvsroot/Lorene/C++/Source/Etoile/et_rot_diff_global.C,v 1.4 2014/10/13 08:52:57 j_novak Exp $ |
| 54 |
* |
| 55 |
*/ |
| 56 |
|
| 57 |
// Headers C |
| 58 |
#include <cmath> |
| 59 |
|
| 60 |
// Headers Lorene |
| 61 |
#include "et_rot_diff.h" |
| 62 |
//----------------------------// |
| 63 |
// T/W // |
| 64 |
//----------------------------// |
| 65 |
|
| 66 |
namespace Lorene { |
| 67 |
double Et_rot_diff::tsw() const { |
| 68 |
|
| 69 |
if (p_tsw == 0x0) { // a new computation is required |
| 70 |
|
| 71 |
Cmp dens = uuu() ; |
| 72 |
|
| 73 |
dens.mult_r() ; // Multiplication by |
| 74 |
dens.va = (dens.va).mult_st() ; // r sin(theta) |
| 75 |
|
| 76 |
if (relativistic) { |
| 77 |
dens = omega_field() * a_car() * b_car() * (ener_euler() + press()) |
| 78 |
* dens ; |
| 79 |
} |
| 80 |
else { // Newtonian case |
| 81 |
dens = omega_field() * nbar() * dens ; |
| 82 |
} |
| 83 |
|
| 84 |
dens.std_base_scal() ; |
| 85 |
|
| 86 |
double tcin = 0.5 * dens.integrale() ; |
| 87 |
|
| 88 |
if (relativistic) { |
| 89 |
|
| 90 |
Cmp dens2 = a_car() * bbb() * gam_euler() * ener() ; |
| 91 |
dens2.std_base_scal() ; |
| 92 |
double mass_p = dens2.integrale() ; |
| 93 |
|
| 94 |
p_tsw = new double( tcin / ( mass_p + tcin - mass_g() ) ) ; |
| 95 |
|
| 96 |
} |
| 97 |
else { // Newtonian case |
| 98 |
Cmp dens2 = 0.5 * nbar() * logn() ; |
| 99 |
dens2.std_base_scal() ; |
| 100 |
double wgrav = dens2.integrale() ; |
| 101 |
p_tsw = new double( tcin / fabs(wgrav) ) ; |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
} |
| 106 |
|
| 107 |
return *p_tsw ; |
| 108 |
|
| 109 |
} |
| 110 |
|
| 111 |
} |