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_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
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 #include <stdlib.h>
00075 #include <string.h>
00076 #include <math.h>
00077
00078
00079 #include "eos.h"
00080 #include "cmp.h"
00081
00082
00083
00084
00085
00086
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
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
00104
00105 Eos_incomp_newt::Eos_incomp_newt(const Eos_incomp_newt& eosi) :
00106 Eos_incomp(eosi) {}
00107
00108
00109
00110
00111 Eos_incomp_newt::Eos_incomp_newt(FILE* fich) : Eos_incomp(fich) {}
00112
00113
00114
00115 Eos_incomp_newt::Eos_incomp_newt(ifstream& fich) : Eos_incomp(fich) {}
00116
00117
00118
00119
00120
00121 Eos_incomp_newt::~Eos_incomp_newt(){
00122
00123
00124
00125 }
00126
00127
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
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
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
00209
00210
00211
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
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
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
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
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
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 }