LORENE
strot_cfc_metric.C
1 /*
2  * Solution of the metric Poisson equations for rotating stars in CFC.
3  *
4  * (see file star_rot_cfc.h for documentation).
5  *
6  */
7 
8 /*
9  * Copyright (c) 2024 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 version 2
15  * as published by the Free Software Foundation.
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 // Lorene headers
30 #include "star_rot_cfc.h"
31 #include "unites.h"
32 
33 namespace Lorene {
34 
35  //===================================================
36  // Equation for log(n) containing matter field terms
37  //===================================================
38 
39  void Star_rot_CFC::solve_logn_f(Scalar& ln_f_new) const {
40 
41  using namespace Unites ;
42 
43  Scalar source_logn = qpig* psi4* (ener_euler + s_euler) ;
44 
45  ln_f_new = source_logn.poisson() ;
46 
47 }
48 
49  //================================================
50  // Equation for log(n) containing quadratic terms
51  //================================================
52 
53 void Star_rot_CFC::solve_logn_q(Scalar& ln_q_new) const {
54 
55  Scalar ln_psi = log(psi) ;
56  ln_psi.std_spectral_base() ;
57  const Vector& dln_psi = ln_psi.derive_cov(flat) ; // D_i ln(Psi)
58  const Vector& dln = logn.derive_cov(flat) ; // D_i ln(N)
59 
60  Scalar source_logn = hatA_quad/(psi4*psi4)
61  - contract(dln.up_down(flat), 0, dln, 0)
62  - 2.* contract(dln_psi, 0, logn.derive_con(flat), 0) ;
63 
64  ln_q_new = source_logn.poisson() ;
65 
66 }
67 
68  //========================================
69  // Equation for the conformal factor psi
70  //========================================
71 
73 
74  using namespace Unites ;
75 
76  // Source for the equation for X^i
77  //---------------------------------
78 
79  Vector sou_Xi = 2*qpig*psi4*psi4*psi2*j_euler ;
80  double lambda = 1./3. ;
81  Vector Xi_new = sou_Xi.poisson(lambda) ;
82  // Xi_new.std_spectral_base() ;
83 
84  // Computation of \hat{A}^{ij} and its norm
85  //------------------------------------------
86  hatA = Xi_new.ope_killing_conf(flat) ;
87  hatA_quad = contract(hatA, 0, 1, hatA.up_down(flat), 0, 1) ;
88 
89 
90  // Source for conformal factor psi
91  // --------------------------------
92  Scalar source_psi = -0.5*qpig*psi4*psi*ener_euler
93  - 0.125*hatA_quad/(psi4*psi2*psi) ;
94  source_psi.std_spectral_base() ;
95 
96  psi_new = source_psi.poisson() + 1. ;
97 
98  if (psi_new.get_etat() == ETATUN) psi_new.std_spectral_base() ;
99 
100  }
101 
102  //========================
103  // Equation for the shift
104  //========================
105 
106  void Star_rot_CFC::solve_shift(Vector& beta_new) const {
107 
108  using namespace Unites ;
109 
110  double lambda = 1./3. ;
111 
112  Sym_tensor hatA_tmp = 2*nn*hatA/(psi4*psi2) ;
113  Vector sou_shift = hatA_tmp.divergence(flat) ;
114  sou_shift.inc_dzpuis(1) ;
115 
116  beta_new = sou_shift.poisson(lambda) ;
117  beta_new.set(1) = 0 ; //## these components are null
118  beta_new.set(2) = 0 ; //## in axial symmetry
119 
120  }
121 
122  //=========================================
123  // Update of the metric derived quantities
124  //=========================================
126 
127  nn = exp(logn) ;
129 
130  psi2 = psi*psi ;
131  psi4 = psi2*psi2 ;
132 
133  gamma = psi4*flat.cov() ;
134 
135  del_deriv() ;
136  }
137 
138 }
Cmp log(const Cmp &)
Neperian logarithm.
Definition: cmp_math.C:299
Cmp exp(const Cmp &)
Exponential.
Definition: cmp_math.C:273
void solve_logn_q(Scalar &ln_q_new) const
Solution of the quadratic part of the Poisson equation for the lapse for rotating stars in CFC...
Metric gamma
3-metric
Definition: star.h:235
Scalar psi
Conformal factor .
Definition: star_rot_cfc.h:65
Lorene prototypes.
Definition: app_hor.h:67
Standard units of space, time and mass.
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:393
Scalar poisson() const
Solves the scalar Poisson equation with *this as a source.
Definition: scalar_pde.C:139
virtual void del_deriv() const
Deletes all the derived quantities.
Definition: star_rot_cfc.C:164
Tensor up_down(const Metric &gam) const
Computes a new tensor by raising or lowering all the indices of *this .
Scalar psi4
Conformal factor .
Definition: star_rot_cfc.h:81
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
Definition: scalar.C:790
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
Definition: scalar.h:560
Scalar s_euler
Trace of the stress scalar in the Eulerian frame.
Definition: star.h:201
const Vector & derive_con(const Metric &gam) const
Returns the "contravariant" derivative of *this with respect to some metric , by raising the index of...
Definition: scalar_deriv.C:402
Tensor field of valence 1.
Definition: vector.h:188
Sym_tensor ope_killing_conf(const Metric &gam) const
Computes the conformal Killing operator associated with a given metric.
Definition: vector.C:468
const Vector & divergence(const Metric &) const
Returns the divergence of this with respect to a Metric .
Definition: sym_tensor.C:352
void solve_shift(Vector &shift_new) const
Solution of the shift equation for rotating stars in CFC.
Vector poisson(double lambda, int method=6) const
Solves the vector Poisson equation with *this as a source.
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
Scalar logn
Logarithm of the lapse N .
Definition: star.h:222
void solve_logn_f(Scalar &ln_f_new) const
Solution of the `‘matter’' part of the Poisson equation for the lapse for rotating stars in CFC...
virtual void inc_dzpuis(int inc=1)
Increases by inc units the value of dzpuis and changes accordingly the values in the compactified ext...
Definition: tensor.C:825
void solve_psi(Scalar &psi_new)
Solution of the equations for the conformal factor for rotating stars in CFC.
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
Definition: metric_flat.C:137
Scalar nn
Lapse function N .
Definition: star.h:225
Scalar & set(int)
Read/write access to a component.
Definition: vector.C:302
void update_metric()
Computes metric quantities from known potentials.
const Vector & derive_cov(const Metric &gam) const
Returns the gradient (1-form = covariant vector) of *this
Definition: scalar_deriv.C:390
Vector j_euler
Momentum density 3-vector with respect to the Eulerian observer.
Definition: star_rot_cfc.h:75
Scalar ener_euler
Total energy density in the Eulerian frame.
Definition: star.h:198
Class intended to describe valence-2 symmetric tensors.
Definition: sym_tensor.h:226
const Metric_flat & flat
flat metric (spherical components)
Definition: star_rot_cfc.h:85