File: geodesics.C

package info (click to toggle)
lorene 0.0.0~cvs20161116%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 26,472 kB
  • sloc: cpp: 212,946; fortran: 21,645; makefile: 1,750; sh: 4
file content (125 lines) | stat: -rw-r--r-- 4,916 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

/*
 *   Copyright (c) 2003 CHABBERT Jean-Philippe
 *
 *   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 version 2
 *   as published by the Free Software Foundation.
 *
 *   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 geodesics_C[] = "$Header: /cvsroot/Lorene/Codes/Rot_star/Geodesics/geodesics.C,v 1.2 2014/10/06 15:12:51 j_novak Exp $" ;

/*
 * $Id: geodesics.C,v 1.2 2014/10/06 15:12:51 j_novak Exp $
 * $Log: geodesics.C,v $
 * Revision 1.2  2014/10/06 15:12:51  j_novak
 * Modified #include directives to use c++ syntax.
 *
 * Revision 1.1  2003/02/07 17:31:52  jp_chabbert
 * First version with rotstar input data
 *
 *
 *
 *
 * $Header: /cvsroot/Lorene/Codes/Rot_star/Geodesics/geodesics.C,v 1.2 2014/10/06 15:12:51 j_novak Exp $
 *
 */

// C++ headers

// C headers
#include <cstdio>
#include <cmath>

// Lorene headers
#include "etoile.h"

#include "main.h"

void geodesics( double x, double *y, double *dydx , const Etoile_rot& star )
     /* Null geodesics equations in RNS metric */
     /* re = rayon de l'toile                 */
{
  /* coordonnes et leurs drives */
  double t,r,theta,phi,tp,rp,thetap,phip,tpp,rpp,thetapp,phipp;
  /* Potentiels */
  double alpha,rho,gamma,omega;
  /* Drives des potentiels */
  double dalphadr,drhodr,dgammadr,domegadr;
  double dalphadtheta,drhodtheta,dgammadtheta,domegadtheta;
  point p;

  #ifdef DEBUG
  printf("Entre dans geodesics ... ");
  #endif

  /* noms de variables lisibles */ 
  t     = y[1];
  r     = y[2];
  theta = y[3];
  phi   = y[4];
  tp    = y[5];
  rp    = y[6];
  thetap= y[7];
  phip  = y[8];

  /* Pour se ramener  systme du premier ordre */
  dydx[1] = tp;
  dydx[2] = rp;
  dydx[3] = thetap;
  dydx[4] = phip;

  /* chargement des coefs de la metrique */
  p=interpol2(r,theta,star);

  rho=p.rho;
  gamma=p.gamma;
  alpha=p.alpha;
  omega=p.omega;

  drhodr=p.drhodr;
  dgammadr=p.dgammadr;
  dalphadr=p.dalphadr;
  domegadr=p.domegadr;

  drhodtheta=p.drhodtheta;
  dgammadtheta=p.dgammadtheta;
  dalphadtheta=p.dalphadtheta;
  domegadtheta=p.domegadtheta;


  /* Equation en t     */
  tpp=-dgammadr-drhodr-dgammadtheta-drhodtheta-exp(-2.*rho)*r*r*sin(theta)*sin(theta)*(-omega*domegadr*tp*rp-omega*domegadtheta*tp*thetap+domegadr*rp*thetap+domegadtheta*thetap*phip);

  /* Equation en r     */
  rpp=0.5*(-dgammadr*exp(gamma+rho)-drhodr*exp(gamma+rho)+2*omega*exp(gamma-rho)*r*r*sin(theta)*sin(theta)*domegadr+omega*omega*exp(gamma-rho)*r*r*sin(theta)*sin(theta)*(dgammadr-drhodr)+2*omega*omega*exp(gamma-rho)*r*sin(theta)*sin(theta))*tp*tp*exp(-2.*alpha)-exp(gamma-rho-2.*alpha)*r*sin(theta)*sin(theta)*tp*phip*(r*domegadr+omega*r*dgammadr-omega*r*drhodr+2*omega)-dalphadr*rp*rp-2.*dalphadtheta*rp*thetap+r*(1.+r*dalphadr)*thetap*thetap+0.5*exp(gamma-rho-2.*alpha)*r*sin(theta)*sin(theta)*(r*dgammadr-r*drhodr+2.)*phip*phip;

  /* Equation en theta */
  thetapp=0.5*(-dgammadtheta*exp(gamma+rho)-drhodtheta*exp(gamma+rho)+2*omega*exp(gamma-rho)*r*r*sin(theta)*sin(theta)*domegadtheta+omega*omega*exp(gamma-rho)*r*r*sin(theta)*sin(theta)*(dgammadtheta-drhodtheta)+2*omega*omega*exp(gamma-rho)*r*r*sin(theta)*cos(theta))*tp*tp*exp(-2.*alpha)*1/(r*r)-exp(gamma-rho-2.*alpha)*sin(theta)*tp*phip*(domegadtheta*sin(theta)+omega*sin(theta)*dgammadtheta-omega*sin(theta)*drhodtheta+2.*omega*cos(theta))+dalphadtheta*rp*rp/(r*r)-2./r*(1.+r*dalphadr)*rp*thetap-dalphadtheta*thetap*thetap+0.5*exp(gamma-rho-2*alpha)*sin(theta)*(sin(theta)*dgammadtheta-sin(theta)*drhodtheta+2.*cos(theta))*phip*phip;

  /* Equation en phi   */
  phipp=(-2*omega*r*exp(gamma+rho)*drhodr+omega*omega*r*r*r*exp(gamma-rho)*sin(theta)*sin(theta)*domegadr+exp(gamma+rho)*domegadr*r+2*omega*exp(gamma+rho))*tp*rp/(r*exp(gamma+rho))+(-2*omega*sin(theta)*exp(gamma+rho)*drhodtheta+omega*omega*r*r*exp(gamma-rho)*sin(theta)*sin(theta)*sin(theta)*domegadtheta+exp(gamma+rho)*domegadtheta*sin(theta)+2*omega*cos(theta)*exp(gamma+rho))*tp*thetap/(sin(theta)*exp(gamma+rho))-(omega*r*r*r*sin(theta)*sin(theta)*exp(gamma-rho)*domegadr+exp(gamma+rho)*(2+r*dgammadr-r*drhodr))*rp*phip/(r*exp(gamma+rho))-(omega*r*r*sin(theta)*sin(theta)*sin(theta)*exp(gamma-rho)*domegadtheta+exp(gamma+rho)*(2*cos(theta)+sin(theta)*dgammadtheta-sin(theta)*drhodtheta))*thetap*phip/(sin(theta)*exp(gamma+rho));

  dydx[5] = tpp;
  dydx[6] = rpp;
  dydx[7] = thetapp;
  dydx[8] = phipp;

  #ifdef DEBUG
  printf("Fin de geodesics \n");
  #endif


}