mbsimhydraulics  3.2.0
elastic_line_galerkin.h
00001 /* Copyright (C) 2004-2009 MBSim Development Team
00002  *
00003  * This library is free software; you can redistribute it and/or 
00004  * modify it under the terms of the GNU Lesser General Public 
00005  * License as published by the Free Software Foundation; either 
00006  * version 2.1 of the License, or (at your option) any later version. 
00007  *  
00008  * This library is distributed in the hope that it will be useful, 
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00011  * Lesser General Public License for more details. 
00012  *  
00013  * You should have received a copy of the GNU Lesser General Public 
00014  * License along with this library; if not, write to the Free Software 
00015  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
00016  *
00017  * Contact: markus.ms.schneider@gmail.com
00018  */
00019 
00020 #ifndef  _ELASTIC_LINE_GALERKIN_H_
00021 #define  _ELASTIC_LINE_GALERKIN_H_
00022 
00023 #include "hline.h"
00024 
00025 class ansatz_function;
00026 
00027 namespace MBSimHydraulics {
00028 
00030   class ElasticLineGalerkin : public HLine {
00031 
00032     public:
00033       
00034       enum AnsatzTypes {
00035         BSplineOrd4,
00036         BSplineOrd3,
00037         Polynom,
00038         Harmonic
00039       };
00040 
00042       ElasticLineGalerkin(const std::string &name="");
00043       virtual std::string getType() const { return "ElasticLineGalerkin"; }
00044 
00046       void setp0(double p0_) {p0=p0_; }
00048       void setFracAir(double fracAir_) {fracAir=fracAir_; }
00050       void setdh(double dh_) {delta_h=dh_; }
00052       void setDLehr(double DLehr_) {DLehr=DLehr_; }
00054       //void setAnsatzFunction(std::string method_, int nAnsatz_);
00055       void setAnsatzFunction(AnsatzTypes method_, int nAnsatz_);
00057       void setFlow2D(bool flow2d=true){Flow2D=flow2d; }
00059       void setRelativePlotPoints(const fmatvec::Vec &rPP) {relPlotPoints=rPP; }
00060       void setDiameter(double d_) {d=d_; }
00061       void setLength(double l_) {l=l_; }
00062 
00063       void setQ0(double Q0_) {Q0=Q0_; }
00064 
00065       fmatvec::Vec getQIn() {return QIn; }
00066       fmatvec::Vec getQOut() {return QOut; }
00067       fmatvec::Vec getInflowFactor() {return -Area*wE; }
00068       fmatvec::Vec getOutflowFactor() {return Area*wA; }
00069 
00070       void init(MBSim::InitStage stage);
00071       void calcqSize() {qSize=mdim; }
00072       void calcuSize(int j) {uSize[j]=mdim; }
00073 
00074       void updateStateDependentVariables(double t);
00075       void updateh(double t, int j=0);
00076       void updateT(double t);
00077       void updateM(double t, int j=0);
00078 
00079       void plot(double t, double dt);
00080       void plotParameters();
00081 
00082       void initializeUsingXML(MBXMLUtils::TiXmlElement * element);
00083     
00084     private:
00085       int mdim, plotdim;
00086       double nu, g, E, k;
00087       fmatvec::Vec WInt, wA, wE, lambda;
00088       fmatvec::SymMat MatIntWWT, MatIntWSWST, K, D, N, Omega, MFac;
00089       fmatvec::SqrMat phi;
00090       ansatz_function * ansatz;
00091       fmatvec::Mat plotVecW, plotVecWS;
00092       fmatvec::Vec QIn, QOut;
00093       double l, d, Area;
00094 
00095     protected:
00096       AnsatzTypes ansatzType;
00097       bool Flow2D;
00098       int nAnsatz;
00099       double p0, Q0, fracAir, delta_h, DLehr;
00100       fmatvec::Vec relPlotPoints;
00101   };
00102 }
00103 
00104 
00105 #endif   /* ----- #ifndef _HYDLINEGALERKIN_H_  ----- */
00106