/***********************************************************************************
Copyright 2006 Charles F. Gammie, Jonathan C. McKinney, Scott C. Noble,
Gabor Toth, and Luca Del Zanna
HARM version 1.0 (released May 1, 2006)
This file is part of HARM. HARM is a program that solves hyperbolic
partial differential equations in conservative form using high-resolution
shock-capturing techniques. This version of HARM has been configured to
solve the relativistic magnetohydrodynamic equations of motion on a
stationary black hole spacetime in Kerr-Schild coordinates to evolve
an accretion disk model.
You are morally obligated to cite the following two papers in his/her
scientific literature that results from use of any part of HARM:
[1] Gammie, C. F., McKinney, J. C., \& Toth, G.\ 2003,
Astrophysical Journal, 589, 444.
[2] Noble, S. C., Gammie, C. F., McKinney, J. C., \& Del Zanna, L. \ 2006,
Astrophysical Journal, 641, 626.
Further, we strongly encourage you to obtain the latest version of
HARM directly from our distribution website:
http://rainman.astro.uiuc.edu/codelib/
HARM 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.
HARM 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 HARM; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
***********************************************************************************/
#include "decs.h"
/**
*
* this file contains all the coordinate dependent
* parts of the code, except the initial and boundary
* conditions
*
**/
/* should return boyer-lindquist coordinte of point */
void bl_coord(double *X, double *r, double *th)
{
*r = exp(X[1]) + R0 ;
*th = M_PI*X[2] + ((1. - hslope)/2.)*sin(2.*M_PI*X[2]) ;
// avoid singularity at polar axis
#if(COORDSINGFIX)
if(fabs(*th)=0) *th = SINGSMALL;
if((*th)<0) *th = -SINGSMALL;
}
if(fabs(M_PI - (*th)) < SINGSMALL){
if((*th)>=M_PI) *th = M_PI+SINGSMALL;
if((*th)0) F1[0 ][j][RHO]=0;
if(F1[N1][j][RHO]<0) F1[N1][j][RHO]=0;
}
return;
}
void rescale(double *pr, int which, int dir, int ii, int jj, int face, struct of_geom *geom)
{
double scale[NPR], r, th, X[NDIM];
int k ;
coord(ii, jj, face, X);
bl_coord(X, &r, &th);
if (dir == 1) {
// optimized for pole
scale[RHO] = pow(r, 1.5);
scale[UU] = scale[RHO] * r;
scale[U1] = scale[RHO];
scale[U2] = 1.0;
scale[U3] = r * r;
scale[B1] = r * r;
scale[B2] = r * r;
scale[B3] = r * r;
} else if (dir == 2) {
scale[RHO] = 1.0;
scale[UU] = 1.0;
scale[U1] = 1.0;
scale[U2] = 1.0;
scale[U3] = 1.0;
scale[B1] = 1.0;
scale[B2] = 1.0;
scale[B3] = 1.0;
}
if (which == FORWARD) { // rescale before interpolation
PLOOP pr[k] *= scale[k];
} else if (which == REVERSE) { // unrescale after interpolation
PLOOP pr[k] /= scale[k];
} else {
fprintf(stderr,"no such rescale type!\n") ;
exit(100) ;
}
}