et_rot_diff_hydro.C

00001 /*
00002  * Function Et_rot_diff::hydro_euler
00003  *
00004  * (see file et_rot_diff.h for documentation)
00005  *
00006  */
00007 
00008 /*
00009  *   Copyright (c) 2001 Eric Gourgoulhon
00010  *
00011  *   This file is part of LORENE.
00012  *
00013  *   LORENE is free software; you can redistribute it and/or modify
00014  *   it under the terms of the GNU General Public License as published by
00015  *   the Free Software Foundation; either version 2 of the License, or
00016  *   (at your option) any later version.
00017  *
00018  *   LORENE is distributed in the hope that it will be useful,
00019  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *   GNU General Public License for more details.
00022  *
00023  *   You should have received a copy of the GNU General Public License
00024  *   along with LORENE; if not, write to the Free Software
00025  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  *
00027  */
00028 
00029 
00030 char et_rot_diff_hydro_C[] = "$Header: /cvsroot/Lorene/C++/Source/Etoile/et_rot_diff_hydro.C,v 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon Exp $" ;
00031 
00032 /*
00033  * $Id: et_rot_diff_hydro.C,v 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon Exp $
00034  * $Log: et_rot_diff_hydro.C,v $
00035  * Revision 1.1.1.1  2001/11/20 15:19:28  e_gourgoulhon
00036  * LORENE
00037  *
00038  * Revision 1.1  2001/10/19  08:18:36  eric
00039  * Initial revision
00040  *
00041  *
00042  * $Header: /cvsroot/Lorene/C++/Source/Etoile/et_rot_diff_hydro.C,v 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon Exp $
00043  *
00044  */
00045 
00046 
00047 // Headers C
00048 #include <stdlib.h>
00049 
00050 // Headers Lorene
00051 #include "et_rot_diff.h"
00052 #include "utilitaires.h"
00053 
00054 void Et_rot_diff::hydro_euler(){
00055 
00056     int nz = mp.get_mg()->get_nzone() ; 
00057     int nzm1 = nz - 1 ; 
00058 
00059     // Computation of u_euler
00060     // ----------------------
00061     
00062     Cmp x(mp) ; 
00063     Cmp y(mp) ; 
00064     x = mp.x ; 
00065     y = mp.y ; 
00066     
00067     u_euler.set_etat_qcq() ; 
00068     
00069     // Cartesian components of differential rotation:
00070 
00071     u_euler.set(0) = - omega_field() * y ;
00072     u_euler.set(1) =   omega_field() * x ;
00073     u_euler.set(2) = 0 ;
00074     u_euler.annule(nzm1) ; 
00075     
00076     u_euler.set_triad( mp.get_bvect_cart() ) ;  // Triad = Cartesian triad
00077     
00078     u_euler.set_std_base() ;    // sets the standard bases for spectral expansions
00079 
00080     u_euler = ( u_euler - shift ) / nnn ; 
00081 
00082     u_euler.set_std_base() ;    // sets the standard bases for spectral expansions
00083 
00084 //## Test
00085     Tenseur utest(mp, 1, CON, mp.get_bvect_spher()) ; 
00086     utest.set_etat_qcq() ; 
00087     
00088     utest.set(0) = 0 ;      // Spherical components of differential rotation
00089     utest.set(1) = 0 ;
00090     utest.set(2) = ( omega_field() - nphi() ) / nnn();
00091 
00092     utest.set(2).annule(nzm1) ; 
00093     utest.set(2).std_base_scal() ;
00094     utest.set(2).mult_rsint() ;     //  Multiplication by r sin(theta)
00095     
00096     utest.set_triad( mp.get_bvect_spher() ) ; 
00097 
00098     utest.change_triad( mp.get_bvect_cart() ) ; 
00099     
00100     for (int i=0; i<3; i++) {
00101     Valeur& uu = u_euler.set(i).va ;
00102     Valeur& ut = utest.set(i).va ;
00103     
00104     if (uu.get_etat() != ETATZERO) {
00105         uu.coef() ; 
00106         
00107         if (ut.get_etat() == ETATZERO) {
00108         ut.set_etat_cf_qcq() ; 
00109         *(ut.c_cf) = 0 ; 
00110         ut.c_cf->base = uu.c_cf->base ; 
00111         }
00112         else {
00113         ut.coef() ; 
00114         }
00115         
00116         Mtbl_cf diff = *(uu.c_cf) - *(ut.c_cf) ;
00117         cout << "Et_rot_diff::hydro_euler: test u_euler(" << i << ") : " 
00118          << max( abs(diff) )(0) << endl ; 
00119     
00120     }
00121     }
00122 //##
00123 
00124     if ( (u_euler(0).get_etat() == ETATZERO) &&
00125      (u_euler(1).get_etat() == ETATZERO) &&
00126      (u_euler(2).get_etat() == ETATZERO) )    {
00127     
00128     u_euler = 0 ;    
00129     }
00130 
00131 
00132     // Computation of uuu (norme of u_euler)
00133     // ------------------
00134 
00135     // The scalar product is performed on the spherical components: 
00136 
00137     Tenseur us = u_euler ; 
00138     us.change_triad( mp.get_bvect_spher() ) ; 
00139 
00140     Cmp uuu2 =  a_car() * ( us(0) * us(0) + us(1) * us(1) ) 
00141          +  b_car() * us(2) * us(2) ; 
00142 
00143     uuu = sqrt( uuu2 ) ; 
00144     
00145     if (uuu.get_etat() == ETATQCQ) {
00146     ((uuu.set()).va).set_base( us(2).va.base ) ;   // Same basis as 
00147     }                          // (Omega -N^phi) r sin(theta)
00148 
00149 
00150     // Lorentz factor
00151     // --------------
00152     
00153     Tenseur u2(mp) ; 
00154     u2 = unsurc2 * uuu2 ; 
00155     
00156     Tenseur gam2 = 1 / (1 - u2) ; 
00157     
00158     gam_euler = sqrt(gam2) ; 
00159 
00160     gam_euler.set_std_base() ;  // sets the standard spectral bases for
00161                     // a scalar field
00162 
00163     //  Energy density E with respect to the Eulerian observer
00164     //------------------------------------
00165     
00166     ener_euler = gam2 * ( ener + press ) - press ; 
00167 
00168     ener_euler.set_std_base() ; 
00169     
00170     // Trace of the stress tensor with respect to the Eulerian observer
00171     //------------------------------------
00172     
00173     s_euler = 3 * press  +  ( ener_euler + press ) * u2  ;
00174 
00175     s_euler.set_std_base() ; 
00176     
00177     // The derived quantities are obsolete
00178     // -----------------------------------
00179     
00180     del_deriv() ;                
00181     
00182 
00183 }

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