CG  Version 25
PistonMotion.h
Go to the documentation of this file.
1 #ifndef PISTON_MOTION
2 #define PISTON_MOTION
3 
4 // =======================================================================================
5 //
6 // The PistonMotion class is used to define the motion of a piston for rigid body
7 // and FSI computations. This class can treat pistons with specified motions and
8 // pistons whose motion is driven by a fluid pressure. In some cases the piston
9 // motion is knwon analytically and in other cases the motion is computed by solving
10 // some ODEs (and saving the result as a Nurbs that can be subsequently evaluated).
11 //
12 // =======================================================================================
13 
14 #include "Overture.h"
15 
16 class NurbsMapping;
17 class GenericGraphicsInterface;
18 
20 {
21 public:
22 
24 {
28 };
29 
30 
31 PistonMotion();
33 
34 // copy constructor
35 PistonMotion( const PistonMotion & x );
36 
37 // Return piston position:
38 real getPosition( const real t ) const;
39 
40 // Return piston velocity:
41 real getVelocity( const real t ) const;
42 
43 // get the flow solution at a point (t,x)
44 int
45 getFlow( const real t, const real x, real & rhoTrue, real & uTrue, real & pTrue ) const;
46 
47 // Get piston position and velocity
48 int
49 getPiston( const real t, real & g, real & gt ) const;
50 
51 int update( GenericGraphicsInterface & gi );
52 
53 protected:
54 
55 int
57 
58 int
59 dirkImplicitSolve( const real dt, const real aii, const real tc, const RealArray & yv, const RealArray &yv0,
60  RealArray & kv );
61 
62 void
63 setGlobalConstants() const;
64 
65 int
66 timeStep( RealArray & yNew, RealArray & y, real t, real dt );
67 
69 
70 real mass; // mass of the piston
71 real rho0, u0, p0, gamma, a0; // fluid properties
72 
73 real bf[4]; // body force on the piston: bf[0]+bf[1]*t+bf[2]*t^2+bf[3]*t^3
74 real area; // cross-sectional area of the piston
75 
76 real rtol; // tolerance for the ODE solver
77 
78 real newtonTol; // tolerance for Newton solve
80 int debug;
81 
82 real dt0, cfl, tFinal;
83 
84 real ag,pg; // for specified motion
85 
86 NurbsMapping *nurbs;
87 
88 };
89 
90 #endif