eos_bifluid.h

00001 /*
00002  *  Definition of Lorene classes Eos_bifluid
00003  *               Eos_bf_poly
00004  *
00005  */
00006 
00007 /*
00008  *   Copyright (c) 2001-2002 Jerome Novak
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 #ifndef __EOS_BIFLUID_H_ 
00030 #define __EOS_BIFLUID_H_ 
00031 
00032 /*
00033  * $Id: eos_bifluid.h,v 1.17 2004/09/01 09:49:46 r_prix Exp $
00034  * $Log: eos_bifluid.h,v $
00035  * Revision 1.17  2004/09/01 09:49:46  r_prix
00036  * adapted to change in read_variable() for strings
00037  *
00038  * Revision 1.16  2004/03/22 13:12:41  j_novak
00039  * Modification of comments to use doxygen instead of doc++
00040  *
00041  * Revision 1.15  2004/01/30 13:21:29  r_prix
00042  * add documentation about 'special' 2-fluid typeos=5: == type0 + slow-rot style inversion
00043  *
00044  * Revision 1.14  2003/12/17 23:12:30  r_prix
00045  * replaced use of C++ <string> by standard ANSI char* to be backwards compatible
00046  * with broken compilers like MIPSpro Compiler 7.2 on SGI Origin200. ;-)
00047  *
00048  * Revision 1.13  2003/12/05 15:08:38  r_prix
00049  * - use read_variable() to read eos_bifluid from file
00050  * - changed 'contructor from file' to take filename as an argument instead of ifstream
00051  * - changed 'name' member of Eos_bifluid to C++-type string (for convenience&safety)
00052  *
00053  * Revision 1.12  2003/12/04 14:13:32  r_prix
00054  * added method get_typeos {return typeos}; and fixed some comments.
00055  *
00056  * Revision 1.11  2003/11/18 18:25:15  r_prix
00057  * moved particle-masses m_1, m_2 of the two fluids into class eos_bifluid (from eos_bf_poly)
00058  *
00059  * Revision 1.10  2002/10/16 14:36:29  j_novak
00060  * Reorganization of #include instructions of standard C++, in order to
00061  * use experimental version 3 of gcc.
00062  *
00063  * Revision 1.9  2002/09/13 09:17:31  j_novak
00064  * Modif. commentaires
00065  *
00066  * Revision 1.8  2002/06/17 14:05:16  j_novak
00067  * friend functions are now also declared outside the class definition
00068  *
00069  * Revision 1.7  2002/06/03 13:23:16  j_novak
00070  * The case when the mapping is not adapted is now treated
00071  *
00072  * Revision 1.6  2002/05/31 16:13:36  j_novak
00073  * better inversion for eos_bifluid
00074  *
00075  * Revision 1.5  2002/05/02 15:16:22  j_novak
00076  * Added functions for more general bi-fluid EOS
00077  *
00078  * Revision 1.4  2002/01/16 15:03:27  j_novak
00079  * *** empty log message ***
00080  *
00081  * Revision 1.3  2002/01/11 14:09:34  j_novak
00082  * Added newtonian version for 2-fluid stars
00083  *
00084  * Revision 1.2  2001/11/29 15:05:26  j_novak
00085  * The entrainment term in 2-fluid eos is modified
00086  *
00087  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00088  * LORENE
00089  *
00090  * Revision 1.6  2001/08/31  15:47:35  novak
00091  * The flag tronc has been added to nbar_ent.. functions
00092  *
00093  * Revision 1.5  2001/08/27 12:21:11  novak
00094  * The delta2 Cmp argument put to const
00095  *
00096  * Revision 1.4  2001/08/27 09:50:15  novak
00097  * New formula for "polytrope"
00098  *
00099  * Revision 1.3  2001/06/22 15:36:11  novak
00100  * Modification de Eos_bifluid::trans2Eos
00101  *
00102  * Revision 1.2  2001/06/22 11:52:44  novak
00103  * *** empty log message ***
00104  *
00105  * Revision 1.1  2001/06/21 15:21:22  novak
00106  * Initial revision
00107  *
00108  *
00109  * $Header: /cvsroot/Lorene/C++/Include/eos_bifluid.h,v 1.17 2004/09/01 09:49:46 r_prix Exp $
00110  *
00111  */
00112 
00113 // Standard C++
00114 #include "headcpp.h"
00115 
00116 // Headers C
00117 #include <stdio.h>
00118 
00119 // Lorene classes
00120 #include "param.h"
00121 class Tbl ;
00122 class Param ;
00123 class Cmp ;
00124 class Eos ;
00125 class Eos_poly ;
00126 
00127             //------------------------------------//
00128             //   base class Eos for two fluids    //
00129             //------------------------------------//
00130 
00131 #define MAX_EOSNAME 100
00132 
00157 class Eos_bifluid {
00158 
00159     // Data :
00160     // -----
00161 
00162     protected: 
00163     char *name;     
00164 
00168     double m_1 ; 
00169 
00173     double m_2 ; 
00174 
00175 
00176     // Constructors - Destructor
00177     // -------------------------
00178     protected:
00179     Eos_bifluid() ;         
00180 
00182     explicit Eos_bifluid(const char* name_i, double mass1, double mass2) ; 
00183 
00184     Eos_bifluid(const Eos_bifluid& ) ;  
00185 
00186     protected:
00193     Eos_bifluid(FILE* ) ; 
00194     
00205     Eos_bifluid (char *fname ) ; 
00206     
00207     
00208     public:
00209     virtual ~Eos_bifluid() ;            
00210 
00211     // Assignment
00212     // ----------
00214     void operator=(const Eos_bifluid& ) ;
00215 
00216 
00217     // Name manipulation
00218     // -----------------
00219     public:
00220     const char* get_name() const ;  
00221 
00223     void set_name(const char* name_i) ; 
00224 
00225     // Miscellaneous
00226     // -------------
00227     public:
00228 
00233     double get_m1() const {return m_1 ;}; 
00234 
00239     double get_m2() const {return m_2 ;}; 
00240 
00245     static Eos_bifluid* eos_from_file (FILE* ) ; 
00246     
00254     static Eos_bifluid* eos_from_file ( char *fname ) ; 
00255     
00257     virtual bool operator==(const Eos_bifluid& ) const = 0 ; 
00258 
00260     virtual bool operator!=(const Eos_bifluid& ) const = 0 ; 
00261     
00265     virtual int identify() const = 0 ; 
00266 
00267     // Outputs
00268     // -------
00269 
00270     public: 
00271     virtual void sauve(FILE* ) const ;  
00272 
00274     friend ostream& operator<<(ostream& , const Eos_bifluid& ) ;    
00275 
00276     protected: 
00277     virtual ostream& operator>>(ostream &) const = 0 ;    
00278 
00279 
00280     // Computational functions
00281     // -----------------------
00282     public:
00303     void calcule_tout(const Cmp& ent1, const Cmp& ent2, const Cmp& delta2,
00304               Cmp& nbar1, Cmp& nbar2, Cmp& ener, Cmp& press,
00305               int nzet, int l_min = 0) const ; 
00306 
00319         virtual bool nbar_ent_p(const double ent1, const double ent2, 
00320                 const double delta2, double& nbar1, 
00321                 double& nbar2) const = 0 ;
00322 
00329     virtual double nbar_ent_p1(const double ent1) const = 0 ;
00330 
00337     virtual double nbar_ent_p2(const double ent2) const = 0 ;
00338 
00359         void nbar_ent(const Cmp& ent1, const Cmp& ent2, const Cmp& delta2, 
00360               Cmp& nbar1, Cmp& nbar2, int nzet, int l_min = 0) 
00361       const  ; 
00362     
00375         virtual double ener_nbar_p(const double nbar1, const double nbar2, 
00376                    const double delta2) const = 0 ; 
00377        
00397         Cmp ener_ent(const Cmp& ent1, const Cmp& ent2, const Cmp& delta2, 
00398               int nzet, int l_min = 0) const ; 
00399     
00412         virtual double press_nbar_p(const double nbar1, const double nbar2, 
00413                     const double delta2) const = 0 ; 
00414        
00433         Cmp press_ent(const Cmp& ent1, const Cmp& ent2, const Cmp& delta2, 
00434               int nzet, int l_min = 0) const ; 
00435 
00452     virtual double get_K11(const double n1, const double n2, const
00453                    double x)  const = 0 ;
00454 
00471     virtual double get_K12(const double n1, const double n2,const
00472                    double x) const = 0 ;
00473 
00489     virtual double get_K22(const double n1, const double n2, const
00490                    double x) const = 0 ;
00491 
00514         Cmp get_Knn(const Cmp& nbar1, const Cmp& nbar2, const Cmp& x2,
00515             int nzet, int l_min = 0) const  ; 
00516 
00539         Cmp get_Kpp(const Cmp& nbar1, const Cmp& nbar2, const Cmp&
00540             x2, int nzet, int l_min = 0) const ; 
00541 
00565         Cmp get_Knp(const Cmp& nbar1, const Cmp& nbar2, const Cmp& x2,
00566             int nzet, int l_min = 0) const ; 
00567 
00590     void calcule(const Cmp& nbar1, const Cmp& nbar2, const Cmp&
00591              x2, int nzet, int l_min, double
00592              (Eos_bifluid::*fait)(double, double, double) const, 
00593              Cmp& resu)
00594       const ; 
00595     
00596    // Conversion functions
00597     // ---------------------
00598 
00607     virtual Eos* trans2Eos() const = 0 ;
00608     
00609 };
00610 ostream& operator<<(ostream& , const Eos_bifluid& ) ;   
00611 
00612 
00613             //------------------------------------//
00614             //        class Eos_bf_poly       //
00615             //------------------------------------//
00616 
00672 class Eos_bf_poly : public Eos_bifluid {
00673 
00674     // Data :
00675     // -----
00676 
00677     protected: 
00679     double gam1 ;
00680 
00682     double gam2 ;
00683 
00685     double gam3 ;
00686     
00688     double gam4 ;
00689 
00691     double gam5 ;
00692 
00694     double gam6 ;
00695     
00701     double kap1 ; 
00702 
00708     double kap2 ; 
00709 
00715     double kap3 ; 
00716     
00722     double beta ; 
00723 
00724     double gam1m1 ;     
00725     double gam2m1 ;     
00726     double gam34m1 ;    
00727     double gam56m1 ;    
00728 
00729  protected:
00751     int typeos ; 
00752 
00757     double relax ;
00758 
00759     double precis ; 
00760     
00762     double ecart ; 
00763 
00764     
00765     // Constructors - Destructor
00766     // -------------------------
00767     public:
00768     
00787     Eos_bf_poly(double kappa1, double kappa2, double kappa3, double beta) ;
00788 
00815     Eos_bf_poly(double gamma1, double gamma2, double gamma3,
00816             double gamma4, double gamma5, double gamma6,
00817             double kappa1, double kappa2, double kappa3,
00818             double beta, double mass1=1, double mass2=1, 
00819             double relax=0.5, double precis = 1.e-9,
00820             double ecart = 1.e-8) ; 
00821 
00822     Eos_bf_poly(const Eos_bf_poly& ) ;  
00823     
00824     protected:
00831     Eos_bf_poly(FILE* ) ; 
00832     
00839     Eos_bf_poly (char *fname) ; 
00840     
00842     friend Eos_bifluid* Eos_bifluid::eos_from_file(FILE* ) ; 
00843     friend Eos_bifluid* Eos_bifluid::eos_from_file(char *fname ) ; 
00844 
00845         public:
00846     virtual ~Eos_bf_poly() ;            
00847 
00848     // Assignment
00849     // ----------
00851     void operator=(const Eos_bf_poly& ) ;
00852 
00853 
00854     // Miscellaneous
00855     // -------------
00856     public : 
00858     virtual bool operator==(const Eos_bifluid& ) const ; 
00859 
00861     virtual bool operator!=(const Eos_bifluid& ) const ; 
00862     
00866     virtual int identify() const ; 
00867 
00869     double get_gam1() const {return gam1 ;};
00870 
00872     double get_gam2() const {return gam2 ;};
00873 
00875     double get_gam3() const {return gam3 ;};
00876     
00878     double get_gam4() const {return gam4 ;};
00879     
00881     double get_gam5() const {return gam5 ;};
00882     
00884     double get_gam6() const {return gam6 ;};
00885     
00890     double get_kap1() const {return kap1 ;}; 
00891 
00896     double get_kap2() const {return kap2 ;}; 
00897 
00902     double get_kap3() const {return kap3 ;}; 
00903 
00908     double get_beta() const {return beta ;}; 
00909 
00910     // Returns (sub)type of bifluid-eos (member \c typeos})
00911     int get_typeos() const {return typeos;};
00912 
00913     protected:
00917     void set_auxiliary() ; 
00918     
00920     void determine_type() ;
00921 
00922     // Outputs
00923     // -------
00924 
00925     public: 
00926     virtual void sauve(FILE* ) const ;  
00927 
00928     protected: 
00929     virtual ostream& operator>>(ostream &) const ;    
00930 
00931 
00932     // Computational functions
00933     // -----------------------
00934 
00935     public: 
00936 
00948         virtual bool nbar_ent_p(const double ent1, const double ent2, 
00949                 const double delta2, double& nbar1, 
00950                 double& nbar2) const ; 
00951        
00957     virtual double nbar_ent_p1(const double ent1) const  ;
00958 
00964     virtual double nbar_ent_p2(const double ent2) const  ;
00965 
00977         virtual double ener_nbar_p(const double nbar1, const double nbar2, 
00978                    const double delta2) const  ; 
00979        
00991         virtual double press_nbar_p(const double nbar1, const double nbar2, 
00992                     const double delta2) const ; 
00993      // Conversion functions
00994      // ---------------------
00995 
01002     virtual Eos* trans2Eos() const ;
01003        
01019     virtual double get_K11(const double n1, const double n2, const
01020                    double delta2)  const  ;
01021 
01037     virtual double get_K12(const double n1, const double n2,const
01038                    double delta2) const ;
01039 
01054     virtual double get_K22(const double n1, const double n2, const
01055                    double delta2) const ;
01056 
01057 };
01058 
01059             //------------------------------------//
01060             //        class Eos_bf_poly_newt      //
01061             //------------------------------------//
01062 
01116 class Eos_bf_poly_newt : public Eos_bf_poly {
01117 
01118     // Data :
01119     // -----
01120 
01121     // no new data with respect to Eos_bf_poly  
01122 
01123     // Constructors - Destructor
01124     // -------------------------
01125     public:
01126     
01145     Eos_bf_poly_newt(double kappa1, double kappa2, double kappa3,
01146             double beta) ;
01147 
01174     Eos_bf_poly_newt(double gamma1, double gamma2, double gamma3,
01175              double gamma4, double gamma5, double gamma6,
01176              double kappa1, double kappa2, double kappa3,
01177              double beta, double mass1, double mass2, 
01178              double relax=0.5, double precis = 1.e-9,
01179              double ecart = 1.e-8) ;    
01180 
01181 
01182     Eos_bf_poly_newt(const Eos_bf_poly_newt& ) ;    
01183     
01184     protected:
01191     Eos_bf_poly_newt(FILE* ) ; 
01192     
01198     Eos_bf_poly_newt(char *fname ) ; 
01199     
01201     friend Eos_bifluid* Eos_bifluid::eos_from_file(FILE* ) ; 
01202     friend Eos_bifluid* Eos_bifluid::eos_from_file(char *fname) ; 
01203 
01204     public:
01205     virtual ~Eos_bf_poly_newt() ;           
01206 
01207     // Assignment
01208     // ----------
01210     void operator=(const Eos_bf_poly_newt& ) ;
01211 
01212 
01213     // Miscellaneous
01214     // -------------
01215 
01216     public : 
01218     virtual bool operator==(const Eos_bifluid& ) const ; 
01219 
01221     virtual bool operator!=(const Eos_bifluid& ) const ; 
01222     
01226     virtual int identify() const ; 
01227 
01228     // Outputs
01229     // -------
01230 
01231     public: 
01232     virtual void sauve(FILE* ) const ;  
01233 
01234     protected: 
01235     virtual ostream& operator>>(ostream &) const ;    
01236 
01237 
01238     // Computational functions
01239     // -----------------------
01240 
01241     public: 
01242 
01254         virtual bool nbar_ent_p(const double ent1, const double ent2, 
01255                 const double delta2, double& nbar1, 
01256                 double& nbar2) const ; 
01257        
01264     virtual double nbar_ent_p1(const double ent1) const  ;
01265 
01271     virtual double nbar_ent_p2(const double ent2) const  ;
01272 
01284         virtual double ener_nbar_p(const double nbar1, const double nbar2, 
01285                    const double delta2) const  ; 
01286        
01298         virtual double press_nbar_p(const double nbar1, const double nbar2, 
01299                     const double delta2) const ; 
01300      // Conversion functions
01301      // ---------------------
01302 
01309     virtual Eos* trans2Eos() const ;
01310        
01326     virtual double get_K11(const double n1, const double n2, const
01327                    double delta2)  const  ;
01328 
01344     virtual double get_K12(const double n1, const double n2,const
01345                    double delta2) const ;
01346 
01361     virtual double get_K22(const double n1, const double n2, const
01362                    double delta2) const ;
01363 
01364 };
01365 
01366         
01367 
01368 #endif

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