vector.h

00001  /*
00002  *  Definition of Lorene class Vector
00003  *
00004  */
00005 
00006 /*
00007  *   Copyright (c) 2003  Eric Gourgoulhon & Jerome Novak
00008  *
00009  *   This file is part of LORENE.
00010  *
00011  *   LORENE is free software; you can redistribute it and/or modify
00012  *   it under the terms of the GNU General Public License version 2
00013  *   as published by the Free Software Foundation.
00014  *
00015  *   LORENE is distributed in the hope that it will be useful,
00016  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *   GNU General Public License for more details.
00019  *
00020  *   You should have received a copy of the GNU General Public License
00021  *   along with LORENE; if not, write to the Free Software
00022  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  */
00025 
00026 #ifndef __VECTOR_H_ 
00027 #define __VECTOR_H_ 
00028 
00029 /*
00030  * $Id: vector.h,v 1.41 2008/12/03 10:18:56 j_novak Exp $
00031  * $Log: vector.h,v $
00032  * Revision 1.41  2008/12/03 10:18:56  j_novak
00033  * Method 6 is now the default for calls to vector Poisson solver.
00034  *
00035  * Revision 1.40  2008/10/29 08:19:08  jl_cornou
00036  * Typo in the doxygen documentation + spectral bases for pseudo vectors added
00037  * and curl
00038  *
00039  * Revision 1.39  2008/08/27 08:45:21  jl_cornou
00040  * Implemented routines to solve dirac systems for divergence-free vectors
00041  *
00042  * Revision 1.38  2007/12/21 16:06:16  j_novak
00043  * Methods to filter Tensor, Vector and Sym_tensor objects.
00044  *
00045  * Revision 1.37  2007/05/11 11:38:16  n_vasset
00046  * Added poisson_boundary2.C routine
00047  *
00048  * Revision 1.36  2007/01/16 15:05:59  n_vasset
00049  * New constructor (taking a Scalar in mono-domain angular grid for
00050  * boundary) for function sol_elliptic_boundary
00051  *
00052  * Revision 1.35  2005/06/09 07:56:25  f_limousin
00053  * Implement a new function sol_elliptic_boundary() and
00054  * Vector::poisson_boundary(...) which solve the vectorial poisson
00055  * equation (method 6) with an inner boundary condition.
00056  *
00057  * Revision 1.34  2005/02/16 15:00:05  m_forot
00058  * Add visu_streamlime function
00059  *
00060  * Revision 1.33  2005/02/14 13:01:48  j_novak
00061  * p_eta and p_mu are members of the class Vector. Most of associated functions
00062  * have been moved from the class Vector_divfree to the class Vector.
00063  *
00064  * Revision 1.32  2004/05/25 14:54:01  f_limousin
00065  * Change arguments of method poisson with parameters.
00066  *
00067  * Revision 1.31  2004/05/09 20:54:22  e_gourgoulhon
00068  * Added method flux (to compute the flux accross a sphere).
00069  *
00070  * Revision 1.30  2004/03/29 11:57:13  e_gourgoulhon
00071  * Added methods ope_killing and ope_killing_conf.
00072  *
00073  * Revision 1.29  2004/03/28 21:25:14  e_gourgoulhon
00074  * Minor modif comments (formula for V^\theta in Vector_divfree).
00075  *
00076  * Revision 1.28  2004/03/27 20:59:55  e_gourgoulhon
00077  * Slight modif comment (doxygen \ingroup).
00078  *
00079  * Revision 1.27  2004/03/22 13:12:44  j_novak
00080  * Modification of comments to use doxygen instead of doc++
00081  *
00082  * Revision 1.26  2004/03/10 12:52:19  f_limousin
00083  * Add a new argument "method" in poisson method.
00084  *
00085  * Revision 1.25  2004/03/03 09:07:02  j_novak
00086  * In Vector::poisson(double, int), the flat metric is taken from the mapping.
00087  *
00088  * Revision 1.24  2004/02/26 22:45:44  e_gourgoulhon
00089  * Added method derive_lie.
00090  *
00091  * Revision 1.23  2004/02/22 15:47:45  j_novak
00092  * Added 2 more methods to solve the vector Poisson equation. Method 1 is not
00093  * tested yet.
00094  *
00095  * Revision 1.22  2004/02/21 16:27:53  j_novak
00096  * Modif. comments
00097  *
00098  * Revision 1.21  2004/02/16 17:40:14  j_novak
00099  * Added a version of poisson with the flat metric as argument (avoids
00100  * unnecessary calculations by decompose_div)
00101  *
00102  * Revision 1.20  2003/12/14 21:47:24  e_gourgoulhon
00103  * Added method visu_arrows for visualization through OpenDX.
00104  *
00105  * Revision 1.19  2003/11/06 14:43:37  e_gourgoulhon
00106  * Gave a name to const arguments in certain method prototypes (e.g.
00107  * constructors) to correct a bug of DOC++.
00108  *
00109  * Revision 1.18  2003/11/03 22:31:02  e_gourgoulhon
00110  * Class Vector_divfree: parameters of methods set_vr_eta_mu and set_vr_mu
00111  * are now all references.
00112  *
00113  * Revision 1.17  2003/11/03 14:02:17  e_gourgoulhon
00114  * Class Vector_divfree: the members p_eta and p_mu are no longer declared
00115  * "const".
00116  *
00117  * Revision 1.16  2003/10/20 15:12:17  j_novak
00118  * New method Vector::poisson
00119  *
00120  * Revision 1.15  2003/10/20 14:44:49  e_gourgoulhon
00121  * Class Vector_divfree: added method poisson().
00122  *
00123  * Revision 1.14  2003/10/20 09:32:10  j_novak
00124  * Members p_potential and p_div_free of the Helmholtz decomposition
00125  * + the method decompose_div(Metric).
00126  *
00127  * Revision 1.13  2003/10/17 16:36:53  e_gourgoulhon
00128  * Class Vector_divfree: Added new methods set_vr_eta_mu and set_vr_mu.
00129  *
00130  * Revision 1.12  2003/10/16 21:36:01  e_gourgoulhon
00131  * Added method Vector_divfree::update_vtvp().
00132  *
00133  * Revision 1.11  2003/10/16 15:25:00  e_gourgoulhon
00134  * Changes in documentation.
00135  *
00136  * Revision 1.10  2003/10/16 14:21:33  j_novak
00137  * The calculation of the divergence of a Tensor is now possible.
00138  *
00139  * Revision 1.9  2003/10/13 20:49:26  e_gourgoulhon
00140  * Corrected typo in the comments.
00141  *
00142  * Revision 1.8  2003/10/13 13:52:39  j_novak
00143  * Better managment of derived quantities.
00144  *
00145  * Revision 1.7  2003/10/12 20:33:15  e_gourgoulhon
00146  * Added new derived class Vector_divfree (preliminary).
00147  *
00148  * Revision 1.6  2003/10/06 13:58:45  j_novak
00149  * The memory management has been improved.
00150  * Implementation of the covariant derivative with respect to the exact Tensor
00151  * type.
00152  *
00153  * Revision 1.5  2003/10/05 21:07:27  e_gourgoulhon
00154  * Method std_spectral_base() is now virtual.
00155  *
00156  * Revision 1.4  2003/10/03 14:08:03  e_gourgoulhon
00157  * Added constructor from Tensor.
00158  *
00159  * Revision 1.3  2003/09/29 13:48:17  j_novak
00160  * New class Delta.
00161  *
00162  * Revision 1.2  2003/09/29 12:52:56  j_novak
00163  * Methods for changing the triad are implemented.
00164  *
00165  * Revision 1.1  2003/09/26 08:07:32  j_novak
00166  * New class vector
00167  *
00168  *
00169  * $Header: /cvsroot/Lorene/C++/Include/vector.h,v 1.41 2008/12/03 10:18:56 j_novak Exp $
00170  *
00171  */
00172 
00173 class Vector_divfree ;
00174 
00175             //-------------------------//
00176             //       class Vector      //
00177             //-------------------------//
00178             
00179 
00184 class Vector: public Tensor {
00185 
00186     // Derived data : 
00187     // ------------
00188     protected:
00194         mutable Scalar* p_potential[N_MET_MAX] ;
00195 
00201     mutable Vector_divfree* p_div_free[N_MET_MAX] ;
00202 
00215     mutable Scalar* p_eta ;
00216     
00229     mutable Scalar* p_mu ;
00230 
00237     mutable Scalar* p_A ;
00238     
00239    // Constructors - Destructor
00240     // -------------------------
00241     public:
00250     Vector(const Map& map, int tipe, const Base_vect& triad_i) ;
00251 
00260     Vector(const Map& map, int tipe, const Base_vect* triad_i) ;
00261 
00262     Vector(const Vector& a) ;       
00263 
00267     Vector(const Tensor& a) ;   
00268 
00279     Vector(const Map& map, const Base_vect& triad_i, FILE* fich) ;
00280 
00281     virtual ~Vector() ;         
00282 
00283  
00284     // Memory management
00285     // -----------------
00286     protected:
00287     virtual void del_deriv() const; 
00288 
00290     void set_der_0x0() const ; 
00291 
00296     virtual void del_derive_met(int) const ;
00297 
00302     void set_der_met_0x0(int) const ;
00303 
00304 
00305     // Mutators / assignment
00306     // ---------------------
00307     public:
00311     virtual void change_triad(const Base_vect& ) ; 
00312 
00314     virtual void operator=(const Vector& a) ;   
00315     
00317     virtual void operator=(const Tensor& a) ;   
00318 
00328     void set_vr_eta_mu(const Scalar& vr_i, const Scalar& eta_i,
00329         const Scalar& mu_i) ; 
00330 
00335     void decompose_div(const Metric&) const ;
00336 
00344     const Scalar& potential(const Metric& ) const ;
00345     
00353     const Vector_divfree& div_free(const Metric& ) const;
00354 
00360     virtual void  exponential_filter_r(int lzmin, int lzmax, int p, 
00361                 double alpha= -16.) ;
00362 
00368     virtual void exponential_filter_ylm(int lzmin, int lzmax, int p, 
00369                 double alpha= -16.) ;
00370 
00371     
00372     // Accessors
00373     // ---------
00374     public:
00375     Scalar& set(int ) ; 
00376 
00377     const Scalar& operator()(int ) const; 
00378 
00388     virtual int position(const Itbl& idx) const {
00389       assert (idx.get_ndim() == 1) ;
00390       assert (idx.get_dim(0) == 1) ;
00391       assert ((idx(0) >= 1) && (idx(0) <= 3)) ;
00392 
00393       return (idx(0) - 1) ;
00394     
00395     } ;
00396 
00407     virtual Itbl indices(int place) const {
00408       assert((place>=0) && (place<3)) ;
00409       
00410       Itbl res(1) ;
00411       res = place + 1;
00412       return res ;
00413 
00414     };
00415     
00420     virtual void std_spectral_base() ; 
00421 
00426     virtual void pseudo_spectral_base() ; 
00427 
00440     virtual const Scalar& eta() const ;
00441     
00454     virtual const Scalar& mu() const ;
00455 
00456 
00463     virtual const Scalar& A() const ;
00464 
00465     
00478     void update_vtvp() ;
00479 
00480     
00481     // Differential operators/ PDE solvers
00482     // -----------------------------------
00483     public:
00487     const Scalar& divergence(const Metric&) const ; 
00488 
00492     const Vector_divfree curl() const ;
00493 
00497     Vector derive_lie(const Vector& v) const ; 
00498         
00506      Sym_tensor ope_killing(const Metric& gam) const ; 
00507      
00517      Sym_tensor ope_killing_conf(const Metric& gam) const ; 
00518 
00533     Vector poisson(double lambda, int method = 6) const ;
00534      
00564     Vector poisson(double lambda, const Metric_flat& met_f, int method = 6) const ;
00565     
00581     Vector poisson(const double lambda, Param& par,
00582            int method = 6) const ;
00583     
00596     void poisson_boundary(double lambda, const Mtbl_cf& limit_vr, 
00597               const Mtbl_cf& limit_eta, const Mtbl_cf& limit_mu, 
00598               int num_front, double fact_dir, double fact_neu,
00599               Vector& resu) const ;
00600  
00601 
00607     void poisson_boundary2(double lam, Vector& resu, Scalar boundvr, 
00608                Scalar boundeta, Scalar boundmu, double dir_vr, 
00609                double neum_vr, double dir_eta, double neum_eta, 
00610                double dir_mu, double neum_mu ) const ;
00611 
00612  
00613     Vector poisson_dirichlet(double lambda, const Valeur& limit_vr, 
00614               const Valeur& limit_vt, const Valeur& limit_vp, 
00615               int num_front) const ;
00616 
00629     Vector poisson_neumann(double lambda, const Valeur& limit_vr, 
00630               const Valeur& limit_vt, const Valeur& limit_vp, 
00631               int num_front) const ;
00632 
00645     Vector poisson_robin(double lambda, const Valeur& limit_vr, 
00646              const Valeur& limit_vt, const Valeur& limit_vp, 
00647              double fact_dir, double fact_neu, 
00648              int num_front) const ;
00649  
00650 
00664     double flux(double radius, const Metric& met) const ; 
00665 
00666     void poisson_block(double lambda, Vector& resu) const ;
00667 
00668         // Graphics
00669         // --------
00670  public:
00690     void visu_arrows(double xmin, double xmax, double ymin, double ymax,
00691     double zmin, double zmax, const char* title0 = 0x0, 
00692     const char* filename0 = 0x0, bool start_dx = true, int nx = 8, int ny = 8, 
00693     int nz = 8) const ;    
00694 
00695     void visu_streamline(double xmin, double xmax, double ymin, double ymax,
00696     double zmin, double zmax, const char* title0 = 0x0, 
00697     const char* filename0 = 0x0, bool start_dx = true, int nx = 8, int ny = 8, 
00698     int nz = 8) const ;   
00699         
00700      
00701  
00702 };
00703 
00704 
00705 
00706             //---------------------------------//
00707             //       class Vector_divfree      //
00708             //---------------------------------//
00709             
00710 
00720 class Vector_divfree: public Vector {
00721 
00722     // Data : 
00723     // -----
00724     protected:
00726     const Metric* const met_div ; 
00727     
00728     // Constructors - Destructor
00729     // -------------------------
00730     public:
00738     Vector_divfree(const Map& map, const Base_vect& triad_i, 
00739         const Metric& met) ;
00740 
00741     Vector_divfree(const Vector_divfree& ) ;       
00742 
00754     Vector_divfree(const Map& map, const Base_vect& triad_i, 
00755         const Metric& met, FILE* fich) ;
00756 
00757     virtual ~Vector_divfree() ;         
00758 
00759  
00760     // Memory management
00761     // -----------------
00762     protected:
00763     virtual void del_deriv() const; 
00764 
00766     void set_der_0x0() const ; 
00767 
00768 
00769     // Mutators / assignment
00770     // ---------------------
00771 
00772     public:
00774     void operator=(const Vector_divfree& a) ;   
00775     
00777     virtual void operator=(const Vector& a) ;   
00778     
00780     virtual void operator=(const Tensor& a) ;   
00781     
00793     void set_vr_mu(const Scalar& vr_i, const Scalar& mu_i) ; 
00794     
00803     void set_vr_eta_mu(const Scalar& vr_i, const Scalar& eta_i, const Scalar& mu_i) ;
00804 
00812     void set_A_mu(const Scalar& A_i, const Scalar& mu_i, const Param* par_bc) ; 
00813     
00814     // Computational methods
00815     // ---------------------
00816     public:
00829     virtual const Scalar& eta() const ;
00830     
00840     Vector_divfree poisson() const ; 
00841 
00853     void update_etavr() ;
00854     
00864     Vector_divfree poisson(Param& par) const ; 
00865     protected:
00866     
00878     void sol_Dirac_A(const Scalar& aaa, Scalar& eta, Scalar& vr,
00879               const Param* par_bc = 0x0) const ;    
00880 
00892     void sol_Dirac_A_tau(const Scalar& aaa, Scalar& eta, Scalar& vr,
00893               const Param* par_bc = 0x0) const ;
00894 
00906     void sol_Dirac_A_poisson(const Scalar& aaa, Scalar& eta, Scalar& vr,
00907               const Param* par_bc = 0x0) const ;
00908 
00920     void sol_Dirac_A_1z(const Scalar& aaa, Scalar& eta, Scalar& vr,
00921               const Param* par_bc = 0x0) const ;    
00922     
00923 };
00924 
00925 
00926 
00927 
00928 
00929 #endif

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