Loading...
Searching...
No Matches
CylinderMotion.H
1//- Store the motion state at the beginning of the time-step
2const Time& t = mesh.time();
3bool firstIter = false;
4
5if (curTimeIndex_ != mesh.time().timeIndex())
6{
7 sDRBM.newTime();
8 curTimeIndex_ = mesh.time().timeIndex();
9 firstIter = true;
10}
11
12Foam::dimensionedVector g("g", dimAcceleration, Zero);
13
14if (mesh.time().foundObject<uniformDimensionedVectorField>("g"))
15{
16 g = mesh.time().lookupObject<uniformDimensionedVectorField>("g");
17}
18else
19{
20 dictCoeffs.readIfPresent("g", g);
21}
22
23const scalar ramp = 1.0;
24dictionary forcesDict;
25forcesDict.add("type", functionObjects::forces::typeName);
26forcesDict.add("patches", dictCoeffs.get<wordRes>("patches"));
27forcesDict.add("rhoInf", 1.0);
28forcesDict.add("rho", dictCoeffs.getOrDefault<word>("rho", "rho"));
29forcesDict.add("CofR", sDRBM.centreOfRotation());
30
31//Foam::functionObjects::forces romforces("romforces", mesh, forcesDict);
32romforces.calcForcesMoment(); //calcForcesMoments()
33//romforcex.append(romforces.forceEff().x());
34//romforcey.append(romforces.forceEff().y());
35// Solving the sixRigidMotion problem
36sDRBM.update
37(
38 firstIter,
39 ramp * (romforces.forceEff() + sDRBM.mass()*g.value()),
40 ramp
41 * (
42 romforces.momentEff()
43 + sDRBM.mass() * (sDRBM.momentArm() ^ g.value())
44 ),
45 t.deltaTValue(),
46 t.deltaT0Value()
47);
48
49muEval(0, 0) = sDRBM.centreOfMass().y();
50
51for (int i = 0; i < NmodesDproj; i++)
52{
53 //New value of the parameter
54 //pdCoeff(i, 0) = problem->rbfSplines[i]->eval(muEval);
55 pdCoeff(i, 0) = problem->rbfSplines[i]->eval(muEval);
56 // RedPdCoeff.append(pdCoeff(0, 0));
57}
58
59// Reconstruction of the pointdisplacement
60Dmodes.reconstruct(pointDisplacement, pdCoeff, "pointDisplacement");
61// update the new pointDisplacement
62problem->sDRBMS().pointDisplacement().primitiveFieldRef()
63 = pointDisplacement.primitiveFieldRef();
64// Displacement has changed. Update boundary conditions //
65pointConstraints::New
66(
67 pointDisplacement.mesh()
68
69).constrainDisplacement(problem->sDRBMS().pointDisplacement());
70
71mesh.movePoints(problem->sDRBMS().curPoints());