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

pv.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_NUM_SEQUENCER_PV_H__
00030 #define __CSFL_NUM_SEQUENCER_PV_H__
00031 
00032 // Include =====================================================================
00033 #include <csfl/num/sequencer/sequencer.h>
00034 #include <csfl/sys/container/equation.h>
00035 #include <csfl/math/equation/momentum_u.h>
00036 #include <csfl/math/equation/momentum_v.h>
00037 #include <csfl/field/value/scalar_face.h>
00038 
00039 
00040 // Namespace
00041 namespace csfl {
00042 
00043 //==============================================================================
00044 //              Class ISequencerPV
00045 //              Description: Class for the Pressure-Velocity sequence objects
00046 //==============================================================================
00047 
00048 class ISequencerPV : 
00049         virtual public ISequencer
00050 
00055 
00056 {
00057 
00058 public:
00059         
00067         ISequencerPV(
00068         const IString &_id ,
00069                 IContainerEquation *_contEquation,
00070                 ISolver *_solver,
00071                 double _starttime = 0.0, 
00072                 double _finaltime = 1.0, 
00073                 double _steptime = 0.5 );
00074         ISequencerPV( ISequencerPV *_s );
00075         ~ISequencerPV();
00076 
00082     IEquationMomentumU * EquationMomU()   { return eqU; }
00083 
00089     IEquationMomentumV * EquationMomV()   { return eqV; }
00090  
00096         IFieldVector* VelocityMesh( bool _reCalculate );
00097 
00102     IFieldVector * Velocity() { return V; }
00103         
00109         IFieldScalar* PressureMesh( bool _reCalculate );
00110         
00115     IFieldScalar * Pressure() { return P; }
00116 
00118         IFieldVectorFace * FaceVelocity() { return fuv; }
00119 
00121         IFieldScalar *StreamLines( bool _reCalculate = true );
00122         
00124         IFieldScalar *StreamLinesMesh( bool _reCalculate = true );
00125 
00126         
00129         void CheckSteadyStateMerror( bool _b ){ checkSSMerror = _b; }
00130         
00133         void CheckSteadyStatePerror( bool _b ){ checkSSPerror = _b; }
00134         
00137         void CheckSteadyStateVerror( bool _b ){ checkSSVerror = _b; }
00138         
00141         void CheckPVMerror( bool _b ){ checkPVMerror = _b; }
00142         
00145         void CheckPVPerror( bool _b ){ checkPVPerror = _b; }
00146         
00149         void CheckPVVerror( bool _b ){ checkPVVerror = _b; }    
00150         
00155         void SetSteadyStateMassError( double _v ) 
00156                 { toleranceM = _v; checkSSMerror = true; }
00157     
00162         void SetSteadyStatePressureError( double _v ) 
00163                 { toleranceP = _v; checkSSPerror = true; }
00164         
00169         void SetSteadyStateVelocityError( double _v )
00170                 { toleranceV = _v; checkSSVerror = true; }
00171         
00177         void SetSteadyStateError( double _v )
00178         { 
00179                 toleranceV = _v; checkSSVerror = true; 
00180                 toleranceP = _v; checkSSPerror = true;
00181                 toleranceM = _v; checkSSMerror = true; 
00182         }
00183         
00184         
00187         double SteadyStateMassError() { return toleranceM; }
00188         
00191         double SteadyStatePressureError() { return toleranceP; }
00192         
00195         double SteadyStateVelocityError() { return toleranceV; }
00196 
00201     void SetPressureError( double _v )
00202                 { pError = _v; checkPVPerror = true;}
00203     
00208         void SetVelocityError( double _v )
00209                 { vError = _v; checkPVVerror = true; }
00210     
00214         void SetMassError( double _v ) 
00215                 { mError = _v; checkPVMerror = true;}
00216         
00218         double MassError() { return mError; }
00219 
00221         double PressureError() { return pError; }
00222 
00224         double VelocityError() { return vError; }
00225         
00227         void SetPressureRelaxation( double _v ) { relaxationP = _v; }
00228         
00230         double PressureRelaxation() { return relaxationP; }
00231                 
00233         void SetVelocityRelaxation( double _v ) { relaxationV = _v; }
00234         
00236         double VelocityRelaxation() { return relaxationV; }
00237 
00239         int IteratorPV() { return itPV; }
00240         
00245         void SetMaximumIteratorPV( int _v ) { itPVMax = _v; }
00246 
00248         double RunTimeErrorMass() { return mdif; }
00249         
00251         double RunTimeErrorPressure() { return pdif; }
00252         
00254         double RunTimeErrorVelocity() { return vdif; }
00255 
00256 
00258         double SteadyStateErrorMass() { return smdif; }
00259 
00261         double SteadyStateErrorPressure() { return spdif; }
00262         
00264         double SteadyStateErrorVelocity() { return svdif; }
00265 
00266 
00271         void SetReferecePressure( bool _v ) { fixPressure = _v; }
00272         
00277         void SetFixedPressure( double _v ) { fixedPressure = _v; }
00278         
00280         void SetVolumeWithFixedPressure( IPoint _v ) { volumeFixedPressure = _v; }
00281 
00283         bool IsReferencePressure() { return fixPressure; }
00284         
00286         double GetFixedPressure() { return fixedPressure; }
00287         
00289         IPoint GetVolumeWithFixedPressure() { return volumeFixedPressure; }
00290 
00291 
00292 public:
00293 
00295         virtual void Write( ostream &_os );
00296 
00298         virtual void Read ( istream &_is );
00299         
00305         virtual void WritePV( ostream &_is );
00306         
00312         virtual void ReadPV( istream &_os );
00313 
00314 
00315 public: 
00316  
00322     IAction ActionRequestSolutionPV, ActionSolutionPV, 
00323                         ActionRequestIteractPV;
00324         IAction ActionCalculateUVelocity,
00325                         ActionCalculateVVelocity, ActionCalculateFaceVelocity,
00326                         ActionCalculatePLine;   
00327  
00328         IAction ActionIteractPV, ActionPVError, ActionSolutionPVError;
00329         IAction ActionUpDateVelocity, ActionUpDatePressure, ActionUpDateFaceVelocity;
00330 
00331 protected:
00332         IEquationMomentumU  *eqU;
00333         IEquationMomentumV  *eqV;
00334     IFieldVector                *V, *VAnt, *Ver, *Vnode;
00335     IFieldScalar                *P, *PAnt, *Per, *Pl, *Pnode;   
00336     IFieldVectorFace    *fuv, *fuvAnt;                     // Interface velocities fvel(u and v)
00337     IFieldScalarFace    *db;
00338     IFieldScalar                *dbu, *dbv;
00339         IFieldScalar            *streamLines, *ppSLines;
00340 
00341 
00342     int ni, nj; 
00343         int itPV, itPVMax;
00344 
00345         int nitprob;
00346 
00347         double  toleranceM, toleranceP, toleranceV;
00348 
00349         double mError, vError, pError;                                  // mass, u, v, pressure
00350         double vdif, pdif, mdif;
00351         double spdif, svdif, smdif;
00352         double relaxationP, relaxationV;
00353         
00354         bool checkSSMerror, checkSSPerror, checkSSVerror;
00355         bool checkPVMerror, checkPVPerror, checkPVVerror;
00356 
00357         bool fixPressure;
00358         IPoint volumeFixedPressure;
00359         double fixedPressure;
00360 
00361 
00362         virtual void Begin();
00363     virtual void Solution( double );
00364         virtual void End();
00365         
00366         virtual bool IteractError();
00367 
00368         virtual bool SolutionError();
00369         virtual void ActualizeVariables();
00370 
00371         virtual void PVCoupling();
00372     virtual void SetPressureCoefficients();
00373         inline virtual void SetDbCoeficients(){}
00374 
00375         virtual void Find(); 
00376 
00377 
00378         void CalcVMesh();
00379         void CalcPMesh();
00380         void CalcStrLines();
00381         void CalcStrLinesMesh();
00382 
00383     void CalcVelEst();
00384     void CalcPLine();
00385     void CorrectionVel();
00386     void CorrectionPres();              
00387      
00388         bool PVError();
00389         double VariableErrorMass( IFieldVectorFace * );
00390         double VariableErrorMassEdges( IFieldVectorFace * );
00391         
00392  
00393     void SetPLine( Vector * );
00394 
00395     virtual void InitVariables();
00396   
00397 
00398         void SetPVCouplingVariables();
00399   
00400     void CalculateVelFace_uv();
00401 
00402     double SumNeighbors_u( int, int );
00403     double SumNeighbors_v( int, int );
00404 
00405     double PressGrad_u_Ksi( int, int );
00406     double PressGrad_u_Eta( int, int );
00407     double PressGrad_v_Ksi( int, int );
00408     double PressGrad_v_Eta( int, int );
00409 
00410         friend class ISequencerIO;
00411 
00412 };
00413 } // csfl namespace
00414 
00415 #endif // __CSFL_NUM_SEQUENCER_PV_H__

 

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

 

© SINMEC/EMC/UFSC, 2001.

All rights reserved.

Last Update: Jan. 18, 2002

 Webmaster