00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 char eos_incomp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Eos/eos_incomp.C,v 1.4 2002/10/16 14:36:35 j_novak Exp $" ;
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 #include <stdlib.h>
00078 #include <string.h>
00079 #include <math.h>
00080
00081
00082 #include "eos.h"
00083 #include "cmp.h"
00084 #include "utilitaires.h"
00085
00086
00087
00088
00089
00090
00091
00092 Eos_incomp::Eos_incomp(double rho_c) :
00093 Eos("EOS for relativistic incompressible matter"),
00094 rho0(rho_c), ent0( double(-1.e-6) ) {}
00095
00096
00097
00098 Eos_incomp::Eos_incomp(double rho_c, double ent_c) :
00099 Eos("EOS for relativistic incompressible matter"),
00100 rho0(rho_c), ent0( ent_c ) {
00101
00102 assert( ent_c <= double(0) ) ;
00103
00104 }
00105
00106
00107
00108 Eos_incomp::Eos_incomp(const Eos_incomp& eosi) :
00109 Eos(eosi),
00110 rho0(eosi.rho0), ent0(eosi.ent0) {}
00111
00112
00113
00114
00115 Eos_incomp::Eos_incomp(FILE* fich) :
00116 Eos(fich) {
00117
00118 fread_be(&rho0, sizeof(double), 1, fich) ;
00119 fread_be(&ent0, sizeof(double), 1, fich) ;
00120
00121 }
00122
00123
00124
00125 Eos_incomp::Eos_incomp(ifstream& fich) :
00126 Eos(fich) {
00127
00128 char blabla[80] ;
00129
00130 fich >> rho0 ; fich.getline(blabla, 80) ;
00131 fich >> ent0 ; fich.getline(blabla, 80) ;
00132
00133 }
00134
00135
00136
00137
00138 Eos_incomp::~Eos_incomp(){
00139
00140
00141
00142 }
00143
00144
00145
00146
00147 void Eos_incomp::operator=(const Eos_incomp& eosi) {
00148
00149 set_name(eosi.name) ;
00150
00151 rho0 = eosi.rho0 ;
00152 ent0 = eosi.ent0 ;
00153
00154 }
00155
00156
00157
00158
00159
00160 bool Eos_incomp::operator==(const Eos& eos_i) const {
00161
00162 bool resu = true ;
00163
00164 if ( eos_i.identify() != identify() ) {
00165 cout << "The second EOS is not of type Eos_incomp !" << endl ;
00166 resu = false ;
00167 }
00168 else{
00169
00170 const Eos_incomp& eos = dynamic_cast<const Eos_incomp&>( eos_i ) ;
00171
00172 if (eos.rho0 != rho0) {
00173 cout
00174 << "The two Eos_incomp have different rho0 : " << rho0 << " <-> "
00175 << eos.rho0 << endl ;
00176 resu = false ;
00177 }
00178
00179 if (eos.ent0 != ent0) {
00180 cout
00181 << "The two Eos_incomp have different ent0 : " << ent0 << " <-> "
00182 << eos.ent0 << endl ;
00183 resu = false ;
00184 }
00185
00186 }
00187
00188 return resu ;
00189
00190 }
00191
00192 bool Eos_incomp::operator!=(const Eos& eos_i) const {
00193
00194 return !(operator==(eos_i)) ;
00195
00196 }
00197
00198
00199
00200
00201
00202
00203
00204 void Eos_incomp::sauve(FILE* fich) const {
00205
00206 Eos::sauve(fich) ;
00207
00208 fwrite_be(&rho0, sizeof(double), 1, fich) ;
00209 fwrite_be(&ent0, sizeof(double), 1, fich) ;
00210
00211 }
00212
00213 ostream& Eos_incomp::operator>>(ostream & ost) const {
00214
00215 ost << "EOS of class Eos_incomp (relativistic incompressible matter) : "
00216 << endl ;
00217 ost << " Constant density : " << rho0 << " rho_nuc" << endl ;
00218 ost << " Log-enthalpy threshold for non-zero density : " << ent0
00219 << " c^2" << endl ;
00220
00221 return ost ;
00222
00223 }
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233 double Eos_incomp::nbar_ent_p(double ent, const Param* ) const {
00234
00235 if ( ent >= ent0 ) {
00236
00237 return rho0 ;
00238 }
00239 else{
00240 return 0 ;
00241 }
00242 }
00243
00244
00245
00246
00247 double Eos_incomp::ener_ent_p(double ent, const Param* ) const {
00248
00249 if ( ent >= ent0 ) {
00250
00251 return rho0 ;
00252 }
00253 else{
00254 return 0 ;
00255 }
00256 }
00257
00258
00259
00260
00261 double Eos_incomp::press_ent_p(double ent, const Param* ) const {
00262
00263 if ( ent >= ent0 ) {
00264
00265 return rho0 * (exp(ent) - double(1)) ;
00266 }
00267 else{
00268 return 0 ;
00269 }
00270 }
00271
00272
00273
00274
00275
00276 double Eos_incomp::der_nbar_ent_p(double ent, const Param* ) const {
00277
00278 if ( ent >= ent0 ) {
00279
00280 return 0 ;
00281 }
00282 else{
00283 return 0 ;
00284 }
00285 }
00286
00287
00288
00289
00290 double Eos_incomp::der_ener_ent_p(double ent, const Param* ) const {
00291
00292 if ( ent >= ent0 ) {
00293
00294 return 0 ;
00295 }
00296 else{
00297 return 0 ;
00298 }
00299 }
00300
00301
00302
00303
00304 double Eos_incomp::der_press_ent_p(double ent, const Param* ) const {
00305
00306 if ( ent >= ent0 ) {
00307
00308 return ent / (double(1) - exp(-ent)) ;
00309
00310 }
00311 else{
00312 return 0 ;
00313 }
00314 }
00315
00316
00317