Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

sinflow.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001 The AUTHORS 
00003  *   Romeu Andre' Pieritz, Ph.D.        - romeu_pieritz@hotmail.com
00004  *   Rafael Mendes, Eng.                – mendes_rafael@yahoo.com
00005  *   Rodrigo Ferraz de Andrade, Eng.    – rferraz@iname.com 
00006  * All rights reserved.
00007  *
00008  * Permission to use, copy and distribute this software and its
00009  * documentation for educational and personal use, without fee is hereby granted, 
00010  * provided that the above copyright notice and the following
00011  * two paragraphs appear in all copies of this software.
00012  *
00013  * IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR
00014  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
00015  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS
00016  * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00017  *
00018  * THE AUTHORS SPECIFICALLY DISCLAIMS ANY WARRANTIES,
00019  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
00020  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HERE UNDER IS
00021  * ON AN "AS IS" BASIS, AND THE AUTHORS HAVE NO OBLIGATION TO
00022  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
00023  *
00024  * SINMEC Lab. - CFD Sinflow Project - http://www.sinmec.ufsc.br/cfd
00025  */
00026 
00027 
00028 // File Define
00029 #ifndef __CSFL_MATH_EQUATION_SINFLOW_H__
00030 #define __CSFL_MATH_EQUATION_SINFLOW_H__
00031 
00032 
00033 // Include
00034 #include <csfl/math/equation/eqparam/physical.h>
00035 #include <csfl/math/equation/eqparam/interpolparam.h>
00036 #include <csfl/math/equation/equation.h>
00037 #include <csfl/field/value/scalar.h>
00038 #include <csfl/field/value/vector.h>
00039 #include <csfl/field/value/vector_face.h>
00040 #include <csfl/field/value/scalar_face.h>
00041 #include <csfl/sys/math/linearsys9d.h>
00042 
00043 
00044 
00045 // Namespace
00046 namespace csfl {
00047 
00048 //==============================================================================
00049 //              Class IEquationSinflow
00050 //              Description: Base Class for Sinflow's Equations
00051 //==============================================================================
00052 
00053 class IEquationSinflow : 
00054         public IEquation
00055 
00059 
00060 {
00061         
00062 public:
00069         IEquationSinflow( 
00070                 const IString &_name,
00071                 IGrid *_grid, 
00072                 IContainerBCond *_contBCond, 
00073                 IContainerParameter *contParam,
00074         IFieldVector *_vel,
00075                 TEquationType _et = etNULL );
00076 
00077         IEquationSinflow( IEquationSinflow *_e );       
00078         ~IEquationSinflow();
00079 
00086         IParamInterpol * Interpol() { return interpol; }
00087         
00089         IGrid * Grid() { return grid; }
00090 
00092         IMetric * Metric() { return metric; }
00093 
00095         ILinearSystem * LinearSystem() { return lsys; }
00096  
00098         inline void  SetLinearSystem( ILinearSystem *_lsys ); 
00099 
00104         virtual void SetFieldVelocity( IFieldVector *_v );  
00105         
00110     inline IFieldVector * Velocity() { return vel; }   
00111 
00115     virtual void SetVelocity( Vector * ) {}
00116 
00119     virtual void SetBoundaryConditions();
00120         
00122     virtual void SetCoefficients( double = 1.0 ) {}
00123 
00125         virtual void SetCoefficientsSolidBlocks( double = 1.0 ) {}
00126 
00128     virtual void CalculateSourceTerm( double = 1.0 ) {}
00129 
00141     double VelU( IFieldVectorFace *_fvel, const IPoint & _p, TDirection _dir = diNULL );
00142  
00152         inline double VelU( IFieldVectorFace *_fvel, int _i, int _j, TDirection _dir = diNULL );
00153 
00165         double VelV( IFieldVectorFace *_fvel, const IPoint &_p, TDirection _dir = diNULL );
00166  
00176         inline double VelV( IFieldVectorFace *_fvel, int _i, int _j, TDirection _dir = diNULL );
00177 
00182         inline IFieldVectorFace * FaceVelocity() { return fvel; }
00183 
00187     inline void SetFaceVelocity( IFieldVectorFace *_fv );
00188 
00193         void InitFaceVelocity( IFieldVector *_vel );
00194 
00198         void SetInitialFieldVelocity( IFieldVector *_v );
00199 
00205         void SetFaceVelBCondPhi( IFieldVectorFace *_fvel, IFieldVector *_vel );
00206 
00212         void SetFaceVelBCondOutlet( IFieldVectorFace *_fvel, IFieldVector *_vel );
00213 
00219         void SetFaceVelBCondSymmetryX( IFieldVectorFace *_fvel, IFieldVector *_vel );
00220 
00225         void SetFaceVelBCondSymmetryY( IFieldVectorFace *_fvel, IFieldVector *_vel );
00226 
00230         void SetFaceVelSolidBlock( IFieldVectorFace *_fvel, IFieldVector *_vel  );
00231 
00236         void SetFaceVelBCondWall( IFieldVectorFace *_fvel, IFieldVector *_vel  );
00237         
00242         void SetFaceVelBCondOpenWall( IFieldVectorFace *_fvel, IFieldVector *_vel  );
00243 
00244 
00245 protected:
00246         IParamInterpol   *interpol;     
00247         ICoefficient     coef;      
00248     IFieldVector         *vel, *vel0;              
00249     IFieldVectorFace *fvel;    
00250         ILinearSystem9D  *lsys; 
00251         IGrid               *grid;
00252         IMetric             *metric;
00253 
00254         bool isOutlet, isInlet, isPhi, isSolidBlock, isWall;
00255         bool isOpenWall, isSymmetryX, isSymmetryY;
00256         bool isPressureN, isPressureS, isPressureE, isPressureW;
00257 
00258         double Pn, Ps, Pe, Pw;
00259          
00260     virtual void SetupParameters(){}
00261     virtual void SetupParametersSolidBlocks() {}
00262   
00263     virtual double GammaPhi( const IPoint &, TDirection = diNULL )
00264         { return 0.0; }
00265                 
00266         virtual void SetBCondEdges() {}
00267         virtual void SetBCondNorth() {}
00268         virtual void SetBCondSouth() {}
00269         virtual void SetBCondEast() {}
00270         virtual void SetBCondWest() {}
00271         
00272         void SetSolidBlockDomainRegionID();
00273   
00274 };
00275 
00276 // =============================================================================
00277 // Inline functions
00278 // =============================================================================
00279 
00280 inline void IEquationSinflow::SetFaceVelocity( IFieldVectorFace *_fv )
00281 {
00282         int i, j;
00283     IVector v;
00284     for( i=0; i<vel->Size().width+1; i++ )
00285         for( j=0; j<vel->Size().height+1; j++ ) {
00286                         v = _fv->Vector( i, j, diSouth );
00287             fvel->SetVector( i, j, diSouth, v );
00288                         v = _fv->Vector( i, j, diWest );
00289             fvel->SetVector( i, j, diWest, v );
00290         }   
00291 }    
00292     
00293 inline void  IEquationSinflow::SetLinearSystem( ILinearSystem * _lsys )
00294 {
00295         if(!_lsys)
00296                 return;
00297         
00298         ILinearSystem9D *l9d = dynamic_cast<ILinearSystem9D * >(_lsys);
00299         if (l9d){
00300                 if (lsys) 
00301                         delete lsys; 
00302                 lsys = new ILinearSystem9D( l9d ); 
00303         }
00304 }
00305 
00306 inline double IEquationSinflow::VelU( IFieldVectorFace *_fvel, int _i, int _j, TDirection _dir )
00307 {
00308     return VelU( _fvel, IPoint( _i, _j ), _dir );
00309 }
00310 
00311 inline double IEquationSinflow::VelV( IFieldVectorFace *_fvel, int _i, int _j, TDirection _dir )
00312 {
00313     return VelV( _fvel, IPoint( _i, _j ), _dir );
00314 }
00315 } // csfl namespace
00316 
00317 #endif// __CSFL_MATH_EQUATION_SINFLOW_H__
00318 

 

CFD Project | Documents | Downloads | Contact us | Use Terms

 

© SINMEC/EMC/UFSC, 2001.

All rights reserved.

Last Update: Jan. 18, 2002

 Webmaster