strot_dirac_diff_faitomeg.C
/*
* Functions Star_rot_Dirac_diff::fait_omega_field
* Star_rot_Dirac_diff::fait_prim_field
*
* (see file star_rot_dirac_diff.h for documentation).
*
*/
/*
* Copyright (c) 2005 Motoyuki Saijo
*
* This file is part of LORENE.
*
* LORENE is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* LORENE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LORENE; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
char strot_dirac_diff_faitomeg_C[] = "$Header: /cvsroot/Lorene/C++/Source/Star/strot_dirac_diff_faitomeg.C,v 1.2 2014/10/13 08:53:39 j_novak Exp $" ;
/*
* $Header: /cvsroot/Lorene/C++/Source/Star/strot_dirac_diff_faitomeg.C,v 1.2 2014/10/13 08:53:39 j_novak Exp $
*
*/
// Headers Lorene
#include "star_rot_dirac_diff.h"
#include "utilitaires.h"
#include "param.h"
namespace Lorene {
double strot_dirac_diff_fzero(double omeg, const Param& par) ;
//-----------------------------------//
// fait_omega_field //
//-----------------------------------//
void Star_rot_Dirac_diff::fait_omega_field(double omeg_min, double omeg_max,
double precis, int nitermax) {
const Mg3d& mg = *(mp.get_mg()) ;
int nz = mg.get_nzone() ;
int nzm1 = nz - 1 ;
Scalar brst2 = gamma.cov()(3,3) ;
brst2.annule(nzm1, nzm1) ;
brst2.mult_rsint() ;
brst2.mult_rsint() ;
Scalar nnn2 = qqq * qqq / psi4 ;
Scalar betp = beta(3) ;
betp.div_rsint() ;
Param par ;
par.add_scalar(nnn2, 0) ;
par.add_scalar(brst2, 1) ;
par.add_scalar(betp, 2) ;
int l, k, j, i ;
par.add_int(l, 0) ;
par.add_int(k, 1) ;
par.add_int(j, 2) ;
par.add_int(i, 3) ;
par.add_star(*this) ;
// Loop on the grid points
// -----------------------
int niter ;
bool prev_zero = (omega_field.get_etat() == ETATZERO) ;
omega_field.allocate_all() ;
// cout << "Star_rot_Dirac_diff::fait_omega_field: niter : " << '\n' ;
for (l=0; l<nzet+1; l++) {
Tbl& tom = omega_field.set_domain(l) ;
for (k=0; k<mg.get_np(l); k++) {
for (j=0; j<mg.get_nt(l); j++) {
for (i=0; i<mg.get_nr(l); i++) {
double& omeg = tom.set(k, j, i) ;
double omeg_min1, omeg_max1 ;
if ( prev_zero || omeg == double(0)) {
omeg_min1 = omeg_min ;
omeg_max1 = omeg_max ;
}
else{
omeg_min1 = 0.8 * omeg ;
omeg_max1 = 1.2 * omeg ;
}
omeg = zerosec(strot_dirac_diff_fzero, par, omeg_min1,
omeg_max1, precis, nitermax, niter) ;
// cout << " " << niter ;
}
}
}
// cout << '\n' ;
}
// omega_field is set to 0 far from the star:
// ---------------------------------------------------
for (l=nzet+1; l<nz; l++) {
omega_field.set_domain(l) = 0 ;
}
omega_field.std_spectral_base() ;
// Min and Max of Omega
// --------------------
omega_min = min( omega_field.domain(0) ) ;
for (l=1; l<nzet; l++) {
double xx = min( omega_field.domain(l) ) ;
omega_min = (xx < omega_min) ? xx : omega_min ;
}
omega_max = max( max( omega_field ) ) ;
// Update of prim_field
// --------------------
fait_prim_field() ;
}
//----------------------------------------//
// strot_dirac_diff_fzero //
//----------------------------------------//
double strot_dirac_diff_fzero(double omeg, const Param& par) {
const Scalar& nnn2 = par.get_scalar(0) ;
const Scalar& brst2 = par.get_scalar(1) ;
const Scalar& betp = par.get_scalar(2) ;
int l = par.get_int(0) ;
int k = par.get_int(1) ;
int j = par.get_int(2) ;
int i = par.get_int(3) ;
const Star_rot_Dirac_diff* star =
dynamic_cast<const Star_rot_Dirac_diff*>(&par.get_star()) ;
double fom = star->funct_omega(omeg) ;
double omnp = omeg + betp.val_grid_point(l, k, j, i) ;
return fom - brst2.val_grid_point(l, k, j, i) * omnp /
( nnn2.val_grid_point(l, k, j, i) -
brst2.val_grid_point(l, k, j, i) * omnp * omnp ) ;
}
//-----------------------------------//
// fait_prim_field //
//-----------------------------------//
void Star_rot_Dirac_diff::fait_prim_field() {
const Mg3d& mg = *(mp.get_mg()) ;
int nz = mg.get_nzone() ;
// Loop on the grid points in the vicinity of the star
// ---------------------------------------------------
prim_field.allocate_all() ;
for (int l=0; l<nzet+1; l++) {
Tbl& tprim = prim_field.set_domain(l) ;
for (int k=0; k<mg.get_np(l); k++) {
for (int j=0; j<mg.get_nt(l); j++) {
for (int i=0; i<mg.get_nr(l); i++) {
tprim.set(k, j, i) =
primfrot( omega_field.val_grid_point(l, k, j, i),
par_frot ) ;
}
}
}
}
// prim_field is set to 0 far from the star:
// -----------------------------------------
for (int l=nzet+1; l<nz; l++) {
prim_field.set_domain(l) = 0 ;
}
prim_field.std_spectral_base() ;
}
}
Lorene::Mg3d
Multi-domain grid.
Definition grilles.h:273
Lorene::Mg3d::get_np
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition grilles.h:462
Lorene::Mg3d::get_nt
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition grilles.h:457
Lorene::Mg3d::get_nzone
int get_nzone() const
Returns the number of domains.
Definition grilles.h:448
Lorene::Mg3d::get_nr
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition grilles.h:452
Lorene::Param
Parameter storage.
Definition param.h:125
Lorene::Param::get_int
const int & get_int(int position=0) const
Returns the reference of a int stored in the list.
Definition param.C:292
Lorene::Param::add_star
void add_star(const Star &eti, int position=0)
Adds the address of a new Star to the list.
Definition param.C:1690
Lorene::Param::get_star
const Star & get_star(int position=0) const
Returns the reference of a Star stored in the list.
Definition param.C:1735
Lorene::Param::get_scalar
const Scalar & get_scalar(int position=0) const
Returns the reference of a Scalar stored in the list.
Definition param.C:1393
Lorene::Param::add_scalar
void add_scalar(const Scalar &ti, int position=0)
Adds the address of a new Scalar to the list.
Definition param.C:1348
Lorene::Param::add_int
void add_int(const int &n, int position=0)
Adds the address of a new int to the list.
Definition param.C:246
Lorene::Scalar
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:387
Lorene::Scalar::val_grid_point
double val_grid_point(int l, int k, int j, int i) const
Returns the value of the field at a specified grid point.
Definition scalar.h:637
Lorene::Scalar::annule
virtual void annule(int l_min, int l_max)
Sets the Scalar to zero in several domains.
Definition scalar.C:391
Lorene::Scalar::mult_rsint
void mult_rsint()
Multiplication by everywhere; dzpuis is not changed.
Definition scalar_r_manip.C:281
Lorene::Scalar::div_rsint
void div_rsint()
Division by everywhere; dzpuis is not changed.
Definition scalar_r_manip.C:348
Lorene::Star_rot_Dirac_diff
Class for relativistic differentially rotating stars in Dirac gauge and maximal slicing.
Definition star_rot_dirac_diff.h:49
Lorene::Star_rot_Dirac_diff::fait_omega_field
void fait_omega_field(double omeg_min, double omeg_max, double precis, int nitermax)
Computes (member omega_field ).
Definition strot_dirac_diff_faitomeg.C:52
Lorene::Star_rot_Dirac_diff::omega_field
Scalar omega_field
Field .
Definition star_rot_dirac_diff.h:84
Lorene::Star_rot_Dirac_diff::funct_omega
double funct_omega(double omeg) const
Evaluates , where F is the function defining the rotation profile.
Definition star_rot_dirac_diff.C:250
Lorene::Star_rot_Dirac_diff::fait_prim_field
void fait_prim_field()
Computes the member prim_field from omega_field .
Definition strot_dirac_diff_faitomeg.C:176
Lorene::Star_rot_Dirac_diff::omega_min
double omega_min
Minimum value of .
Definition star_rot_dirac_diff.h:86
Lorene::Star_rot_Dirac_diff::primfrot
double(* primfrot)(double, const Tbl &)
Primitive of the function , which vanishes at the stellar center.
Definition star_rot_dirac_diff.h:72
Lorene::Star_rot_Dirac_diff::prim_field
Scalar prim_field
Field .
Definition star_rot_dirac_diff.h:90
Lorene::Star_rot_Dirac_diff::par_frot
Tbl par_frot
Parameters of the function .
Definition star_rot_dirac_diff.h:81
Lorene::Star_rot_Dirac_diff::omega_max
double omega_max
Maximum value of .
Definition star_rot_dirac_diff.h:87
Lorene::Star_rot_Dirac::qqq
Scalar qqq
Definition star_rot_dirac.h:66
Lorene::Star_rot_Dirac::psi4
Scalar psi4
Conformal factor .
Definition star_rot_dirac.h:64
Lorene::Star::gamma
Metric gamma
3-metric
Definition star.h:235
Lorene::Star::mp
Map & mp
Mapping associated with the star.
Definition star.h:180
Lorene::Star::nzet
int nzet
Number of domains of *mp occupied by the star.
Definition star.h:183
Lorene::Star::beta
Vector beta
Shift vector.
Definition star.h:228
Lorene::Tbl
Basic array class.
Definition tbl.h:161
Lorene::Tbl::set
double & set(int i)
Read/write of a particular element (index i) (1D case).
Definition tbl.h:281
Lorene::min
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
Definition cmp_math.C:458
Lorene::max
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
Definition cmp_math.C:435
Lorene::zerosec
double zerosec(double(*f)(double, const Param &), const Param &par, double a, double b, double precis, int nitermax, int &niter, bool abort=true)
Finding the zero a function.
Definition zerosec.C:89
Lorene
Lorene prototypes.
Definition app_hor.h:64