LORENE
eos_compose.h
1/*
2 * Definition of Lorene classes Eos_CompOSE
3 * Eos_consistent
4 */
5
6/*
7 * Copyright (c) 2014-2015 Jerome Novak
8 *
9 * This file is part of LORENE.
10 *
11 * LORENE is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * LORENE is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with LORENE; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27
28#ifndef __EOS_COMPOSE_H_
29#define __EOS_COMPOSE_H_
30
31/*
32 * $Id: eos_compose.h,v 1.6 2021/05/31 11:31:23 g_servignat Exp $
33 * $Log: eos_compose.h,v $
34 * Revision 1.6 2021/05/31 11:31:23 g_servignat
35 * Added csound_square_ent routine to calculate the sound speed from enthalpy to Eos_consistent and corrected error outputs
36 *
37 * Revision 1.5 2021/05/14 15:39:22 g_servignat
38 * Added sound speed computation from enthalpy to Eos class and tabulated+polytropic derived classes
39 *
40 * Revision 1.4 2021/05/06 14:33:17 j_novak
41 * New conversion function from Eos to Dyn_eos.
42 *
43 * Revision 1.3 2019/04/09 12:50:22 j_novak
44 * Improved documentation
45 *
46 * Revision 1.2 2019/03/28 13:41:01 j_novak
47 * Improved managed of saved EoS (functions sauve and constructor form FILE*)
48 *
49 * Revision 1.1 2015/08/04 14:41:28 j_novak
50 * Back to previous version for Eos_CompOSE. Enthalpy-consistent EoS can be accessed using Eos_consistent class (derived from Eos_CompOSE).
51 *
52 *
53 *
54 * $Header: /cvsroot/Lorene/C++/Include/eos_compose.h,v 1.6 2021/05/31 11:31:23 g_servignat Exp $
55 *
56 */
57
58// Standard C++
59#include <string>
60#include "headcpp.h"
61
62// Headers C
63#include <cstdio>
64
65// Lorene classes
66namespace Lorene {
67class Tbl ;
68
69
70 //------------------------------------//
71 // class Eos_CompOSE //
72 //------------------------------------//
73
74
93class Eos_CompOSE : public Eos_tabul {
94
95 // Data
96 //--------
97
98 protected:
99 int format ;
100
101 // Constructors - Destructor
102 // -------------------------
103 public:
104
114 Eos_CompOSE(const string& files_path) ;
115
134 Eos_CompOSE(const char* file_name) ;
135
136
137 protected:
144 Eos_CompOSE(FILE* ) ;
145
151 Eos_CompOSE(ifstream&) ;
152
153 private:
158
159
161 friend Eos* Eos::eos_from_file(FILE* ) ;
162 friend Eos* Eos::eos_from_file(ifstream& ) ;
163
164 public:
165 virtual ~Eos_CompOSE() ;
166
167 // Miscellaneous
168 // -------------
169public:
170 int get_format() const {return format ;} ;
171
172 protected:
176 virtual void read_compose_data() ;
177
178 public :
180 virtual bool operator==(const Eos& ) const ;
181
183 virtual bool operator!=(const Eos& ) const ;
184
188 virtual int identify() const ;
189
190 // Outputs
191 // -------
192 public:
193
194 virtual void sauve(FILE* ) const ;
195
196 protected:
197
198 virtual ostream& operator>>(ostream &) const ;
199
200
201};
202
203 //------------------------------------//
204 // class Eos_consistent //
205 //------------------------------------//
206
207
228
229 // Constructors - Destructor
230 // -------------------------
231 public:
232
242 Eos_consistent(const string& files_path) ;
243
262 Eos_consistent(const char* file_name) ;
263
264
265 protected:
272 Eos_consistent(FILE* ) ;
273
279 Eos_consistent(ifstream&) ;
280
281 private:
286
287
289 friend Eos* Eos::eos_from_file(FILE* ) ;
290 friend Eos* Eos::eos_from_file(ifstream& ) ;
291
292 public:
293 virtual ~Eos_consistent() ;
294
295 // Miscellaneous
296 // -------------
297
298 public :
300 virtual bool operator==(const Eos& ) const ;
301
303 virtual bool operator!=(const Eos& ) const ;
304
308 virtual int identify() const ;
309
310 protected:
314 virtual void read_table() ;
315
319 virtual void read_compose_data() ;
320
321 // Outputs
322 // -------
323
324 protected:
325 virtual ostream& operator>>(ostream &) const ;
326
327 // Computational functions
328 // -----------------------
329
330 public:
338 virtual double nbar_ent_p(double ent, const Param* par=0x0) const ;
339
347 virtual double ener_ent_p(double ent, const Param* par=0x0) const ;
348
356 virtual double press_ent_p(double ent, const Param* par=0x0) const ;
357
368 virtual double csound_square_ent_p(double, const Param*) const ;
369};
370
371
372
373}
374#endif
375
int format
0 for standard (old) LORENE format, 1 for CompOSE format
Definition eos_compose.h:99
Eos_CompOSE(const Eos_CompOSE &)
Copy constructor (private to make Eos_CompOSE a non-copiable class).
virtual void read_compose_data()
Reads the files containing the table and initializes in the arrays logh , logp and dlpsdlh (CompOSE f...
virtual ~Eos_CompOSE()
Destructor.
virtual bool operator==(const Eos &) const
Comparison operator (egality).
virtual bool operator!=(const Eos &) const
Comparison operator (difference).
Eos_CompOSE(const string &files_path)
Constructor from CompOSE data.
virtual ostream & operator>>(ostream &) const
Operator >>.
virtual void sauve(FILE *) const
Save in a file.
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
virtual double csound_square_ent_p(double, const Param *) const
Computes the sound speed squared from the enthapy with extra parameters (virtual function implemente...
Eos_consistent(const Eos_consistent &)
Copy constructor (private to make Eos_consistent a non-copiable class).
virtual bool operator==(const Eos &) const
Comparison operator (egality).
virtual double press_ent_p(double ent, const Param *par=0x0) const
Computes the pressure from the log-enthalpy.
virtual bool operator!=(const Eos &) const
Comparison operator (difference).
virtual ostream & operator>>(ostream &) const
Operator >>.
Eos_consistent(const string &files_path)
Constructor from CompOSE data.
virtual double nbar_ent_p(double ent, const Param *par=0x0) const
Computes the baryon density from the log-enthalpy.
virtual void read_compose_data()
Reads the files containing the table and initializes in the arrays logh , logp and dlpsdlh (CompOSE f...
virtual int identify() const
Returns a number to identify the sub-classe of Eos the object belongs to.
virtual ~Eos_consistent()
Destructor.
virtual void read_table()
Reads the file containing the table and initializes in the arrays logh , logp and dlpsdlh .
virtual double ener_ent_p(double ent, const Param *par=0x0) const
Computes the total energy density from the log-enthalpy.
Eos_tabul(const char *name_i, const char *table, const char *path)
Standard constructor.
Definition eos_tabul.C:164
Equation of state base class.
Definition eos.h:206
static Eos * eos_from_file(FILE *)
Construction of an EOS from a binary file.
Parameter storage.
Definition param.h:125
Basic array class.
Definition tbl.h:161
Lorene prototypes.
Definition app_hor.h:67