/************************************************************************************* * * isothermalsphere.cpp: realizes isothermal sphere model * * Copyright (c) 2007 Jakub Schwarzmeier * University of West Bohemia, Department of General Physics * * This program 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. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ************************************************************************/ #include "../includes.h" #include "../../../inc/ics/isothermalsphere.h" #include <gsl/gsl_sf_erf.h> CIsothermalSphere::CIsothermalSphere(void) { m_name = "IsothermalSphere"; } double CIsothermalSphere::rho( double r ) { return m_rho0 * exp(-(r*r)/(m_rout * m_rout))/(r*r + m_rhcore * m_rhcore); } void CIsothermalSphere::SetParameters(double rhcore) { m_rout = m_rMax; m_rhcore = rhcore; double q = m_rhcore/m_rout; double alph = (1.0 - sqrt(M_PI)*q*exp(q*q)*(1.0 - gsl_sf_erf(q))); alph = 1.0 / alph; m_rho0 = (m_totalMass/(2.0*pow(M_PI,1.5))) * (alph/m_rout); return; }