eos_incomp_newt.C

00001 /*
00002  * Methods of the class Eos_incomp_newt.
00003  *
00004  * (see file eos.h for documentation).
00005  */
00006 
00007 /*
00008  *   Copyright (c) 2000-2001 Eric Gourgoulhon
00009  *
00010  *   This file is part of LORENE.
00011  *
00012  *   LORENE is free software; you can redistribute it and/or modify
00013  *   it under the terms of the GNU General Public License as published by
00014  *   the Free Software Foundation; either version 2 of the License, or
00015  *   (at your option) any later version.
00016  *
00017  *   LORENE is distributed in the hope that it will be useful,
00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *   GNU General Public License for more details.
00021  *
00022  *   You should have received a copy of the GNU General Public License
00023  *   along with LORENE; if not, write to the Free Software
00024  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  */
00027 
00028 
00029 char Eos_incomp_newt_C[] = "$Header: /cvsroot/Lorene/C++/Source/Eos/eos_incomp_newt.C,v 1.3 2002/10/16 14:36:35 j_novak Exp $" ;
00030 
00031 /*
00032  * $Id: eos_incomp_newt.C,v 1.3 2002/10/16 14:36:35 j_novak Exp $
00033  * $Log: eos_incomp_newt.C,v $
00034  * Revision 1.3  2002/10/16 14:36:35  j_novak
00035  * Reorganization of #include instructions of standard C++, in order to
00036  * use experimental version 3 of gcc.
00037  *
00038  * Revision 1.2  2002/04/09 14:32:15  e_gourgoulhon
00039  * 1/ Added extra parameters in EOS computational functions (argument par)
00040  * 2/ New class MEos for multi-domain EOS
00041  *
00042  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00043  * LORENE
00044  *
00045  * Revision 2.5  2001/02/07  09:48:48  eric
00046  * Suppression de la fonction derent_ent_p.
00047  * Ajout des fonctions donnant les derivees de l'EOS:
00048  *      der_nbar_ent_p
00049  *      der_ener_ent_p
00050  *      der_press_ent_p
00051  *
00052  * Revision 2.4  2000/02/14  14:49:55  eric
00053  * Modif affichage.
00054  *
00055  * Revision 2.3  2000/02/14  14:34:02  eric
00056  * Ajout du constructeur par lecture de fichier formate.
00057  *
00058  * Revision 2.2  2000/01/21  15:18:30  eric
00059  * Ajout des operateurs de comparaison == et !=
00060  *
00061  * Revision 2.1  2000/01/19  08:53:39  eric
00062  * Ajout du set_name dans les constructeurs standards.
00063  *
00064  * Revision 2.0  2000/01/18  16:11:38  eric
00065  * *** empty log message ***
00066  *
00067  *
00068  * $Header: /cvsroot/Lorene/C++/Source/Eos/eos_incomp_newt.C,v 1.3 2002/10/16 14:36:35 j_novak Exp $
00069  *
00070  */
00071 
00072 
00073 // Headers C
00074 #include <stdlib.h>
00075 #include <string.h>
00076 #include <math.h>
00077 
00078 // Headers Lorene
00079 #include "eos.h"
00080 #include "cmp.h"
00081 
00082             //--------------//
00083             // Constructors //
00084             //--------------//
00085 
00086 // Standard constructor with ent0 = 1
00087 // ---------------------------------
00088 Eos_incomp_newt::Eos_incomp_newt(double rho_c) : Eos_incomp(rho_c) {
00089 
00090     set_name("Newtonian EOS for incompressible matter") ;
00091      
00092 }
00093 
00094 // Standard constructor with ent0 specified
00095 // ---------------------------------------
00096 Eos_incomp_newt::Eos_incomp_newt(double rho_c, double ent_c) : 
00097             Eos_incomp(rho_c, ent_c) {
00098 
00099     set_name("Newtonian EOS for incompressible matter") ;
00100      
00101 }
00102   
00103 // Copy constructor
00104 // ----------------
00105 Eos_incomp_newt::Eos_incomp_newt(const Eos_incomp_newt& eosi) : 
00106             Eos_incomp(eosi) {} 
00107   
00108 
00109 // Constructor from a binary file
00110 // ------------------------------
00111 Eos_incomp_newt::Eos_incomp_newt(FILE* fich) : Eos_incomp(fich) {}
00112 
00113 // Constructor from a formatted file
00114 // ---------------------------------
00115 Eos_incomp_newt::Eos_incomp_newt(ifstream& fich) : Eos_incomp(fich) {}
00116 
00117             //--------------//
00118             //  Destructor  //
00119             //--------------//
00120 
00121 Eos_incomp_newt::~Eos_incomp_newt(){
00122     
00123     // does nothing
00124         
00125 }
00126             //--------------//
00127             //  Assignment  //
00128             //--------------//
00129 
00130 void Eos_incomp_newt::operator=(const Eos_incomp_newt& eosi) {
00131     
00132     set_name(eosi.name) ; 
00133     
00134     rho0 = eosi.rho0 ; 
00135     ent0 = eosi.ent0 ; 
00136 
00137 }
00138 
00139             //------------------------//
00140             //  Comparison operators  //
00141             //------------------------//
00142 
00143 bool Eos_incomp_newt::operator==(const Eos& eos_i) const {
00144     
00145     bool resu = true ; 
00146     
00147     if ( eos_i.identify() != identify() ) {
00148     cout << "The second EOS is not of type Eos_incomp_newt !" << endl ; 
00149     resu = false ; 
00150     }
00151     else{
00152     
00153     const Eos_incomp_newt& eos = 
00154                 dynamic_cast<const Eos_incomp_newt&>( eos_i ) ; 
00155 
00156     if (eos.rho0 != rho0) {
00157         cout 
00158         << "The two Eos_incomp_newt have different rho0 : " << rho0 << " <-> " 
00159         << eos.rho0 << endl ; 
00160         resu = false ; 
00161     }
00162 
00163     if (eos.ent0 != ent0) {
00164         cout 
00165         << "The two Eos_incomp_newt have different ent0 : " << ent0 << " <-> " 
00166         << eos.ent0 << endl ; 
00167         resu = false ; 
00168     }
00169 
00170     }
00171     
00172     return resu ; 
00173     
00174 }
00175 
00176 bool Eos_incomp_newt::operator!=(const Eos& eos_i) const {
00177  
00178     return !(operator==(eos_i)) ; 
00179        
00180 }
00181 
00182 
00183 
00184             //------------//
00185             //  Outputs   //
00186             //------------//
00187 
00188 void Eos_incomp_newt::sauve(FILE* fich) const {
00189 
00190     Eos_incomp::sauve(fich) ; 
00191     
00192 }
00193 
00194 ostream& Eos_incomp_newt::operator>>(ostream & ost) const {
00195     
00196     ost << "EOS of class Eos_incomp_newt (Newtonian incompressible matter) : " 
00197     << endl ; 
00198     ost << "   Constant density : " << rho0 << " rho_nuc" << endl ; 
00199     ost << "   Log-enthalpy threshold for non-zero density : " << ent0 
00200     << " c^2" <<  endl ; 
00201     
00202     return ost ;
00203 
00204 }
00205 
00206 
00207             //------------------------------//
00208             //    Computational routines    //
00209             //------------------------------//
00210 
00211 // Baryon density from enthalpy 
00212 //------------------------------
00213 
00214 double Eos_incomp_newt::nbar_ent_p(double ent, const Param* ) const {
00215 
00216     if ( ent >= ent0 ) {
00217 
00218     return rho0 ;
00219     }
00220     else{
00221     return 0 ;
00222     }
00223 }
00224 
00225 // Energy density from enthalpy
00226 //------------------------------
00227 
00228 double Eos_incomp_newt::ener_ent_p(double ent, const Param* ) const {
00229 
00230     if ( ent >= ent0 ) {
00231 
00232     return rho0 ;
00233     }
00234     else{
00235     return 0 ;
00236     }
00237 }
00238 
00239 // Pressure from enthalpy
00240 //------------------------
00241 
00242 double Eos_incomp_newt::press_ent_p(double ent, const Param* ) const {
00243 
00244     if ( ent >= ent0 ) {
00245 
00246     return rho0 * ent ;
00247     }
00248     else{
00249     return 0 ;
00250     }
00251 }
00252 
00253 // dln(n)/ln(h) from enthalpy
00254 //---------------------------
00255 
00256 double Eos_incomp_newt::der_nbar_ent_p(double ent, const Param* ) const {
00257 
00258     if ( ent >= ent0 ) {
00259 
00260     return 0 ;
00261     }
00262     else{
00263     return 0 ;
00264     }
00265 }
00266 
00267 // dln(e)/ln(h) from enthalpy
00268 //---------------------------
00269 
00270 double Eos_incomp_newt::der_ener_ent_p(double ent, const Param* ) const {
00271 
00272     if ( ent >= ent0 ) {
00273 
00274     return 0 ;
00275     }
00276     else{
00277     return 0 ;
00278     }
00279 }
00280 
00281 // dln(p)/ln(h) from enthalpy
00282 //---------------------------
00283 
00284 double Eos_incomp_newt::der_press_ent_p(double ent, const Param* ) const {
00285     
00286     if ( ent >= ent0 ) {
00287 
00288     return double(1) ;
00289 
00290     }
00291     else{
00292     return 0 ;
00293     }
00294 }

Generated on Tue Feb 7 01:35:16 2012 for LORENE by  doxygen 1.4.6