CG
Version 25
Main Page
Namespaces
Classes
Files
File List
File Members
cg.v25
common
moving
src
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
19
class
PistonMotion
20
{
21
public
:
22
23
enum
PistonOptionsEnum
24
{
25
specifiedPistonMotion
=0,
26
pressureDrivenPistonMotion
,
27
pressureAndBodyForcedPistonMotion
28
};
29
30
31
PistonMotion
();
32
~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
56
computePistonMotion
();
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
68
PistonOptionsEnum
pistonOption
;
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
79
int
orderOfAccuracy
;
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
Generated on Fri Jan 4 2013 10:19:25 for CG by
1.8.3