fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / tutorials / incompressible / icoDyMFoam / movingBlockRBF / RBFMotionFunction / kinematicModel.H
bloba1426c43946afba03f4d19eff875c3df901bb62e
1     // Motion is a vectorField of all moving boundary points
2     vectorField motion(ms.movingPoints().size(), vector::zero);
4     vectorField oldPoints = ms.movingPoints();
6     scalar oldTime = time_.value() - time_.deltaT().value();
7     scalar curTime = time_.value();
9     scalar alphaOld   = 0.0;
10     scalar alphaCur   = 0.0;
12 //     scalar rotationAmplitude_(0.707);
13 //     scalar rotationFrequency_(0.0);
14 //     vector translationFrequency_(0.0,0.25,0.0);
15 //     vector translationAmplitude_(0.0,5.0,0.0);
16 //     vector initialRotationOrigin_(0.0,0.0,0.0);
18     scalar pi=3.141592;
20     alphaOld = rotationAmplitude_*Foam::sin(2*pi*rotationFrequency_*oldTime);
21     alphaCur = rotationAmplitude_*Foam::sin(2*pi*rotationFrequency_*curTime);
23     vector translationVector
24     (
25         translationAmplitude_[0]*
26         (
27             Foam::sin(2*pi*translationFrequency_[0]*curTime)
28           - Foam::sin(2*pi*translationFrequency_[0]*oldTime)
29         ),
30         translationAmplitude_[1]*
31         (
32             Foam::sin(2*pi*translationFrequency_[1]*curTime)
33           - Foam::sin(2*pi*translationFrequency_[1]*oldTime)
34         ),
35         0
36     );
38     tensor RzOld
39     (
40         Foam::cos(alphaOld), -Foam::sin(alphaOld), 0,
41         Foam::sin(alphaOld),  Foam::cos(alphaOld), 0,
42         0, 0, 1
43     );
45     tensor RzCur
46     (
47         Foam::cos(alphaCur), -Foam::sin(alphaCur), 0,
48         Foam::sin(alphaCur),  Foam::cos(alphaCur), 0,
49         0, 0, 1
50     );
52     vectorField rotationField
53     (
54         (RzCur - RzOld)
55       & (statPoints_ - initialRotationOrigin_)
56     );
58     motion = translationVector + rotationField;