93 forAll(fvSourceSubDict.toc(), idxI)
97 word pointName = fvSourceSubDict.toc()[idxI];
100 dictionary pointSubDict = fvSourceSubDict.subDict(pointName);
102 word smoothFunction = pointSubDict.get<word>(
"smoothFunction");
104 if (smoothFunction ==
"hyperbolic")
110 pointSubDict.readEntry<scalarList>(
"center", center1);
111 pointSubDict.readEntry<scalarList>(
"size", size1);
112 pointSubDict.readEntry<scalarList>(
"amplitude", amp1);
113 vector center = {center1[0], center1[1], center1[2]};
114 vector size = {size1[0], size1[1], size1[2]};
115 vector amp = {amp1[0], amp1[1], amp1[2]};
116 scalar period = pointSubDict.get<scalar>(
"periodicity");
117 scalar eps = pointSubDict.get<scalar>(
"eps");
118 scalar scale = pointSubDict.get<scalar>(
"scale");
119 label thrustDirIdx = pointSubDict.get<label>(
"thrustDirIdx");
120 scalar phase = pointSubDict.get<scalar>(
"phase");
122 scalar t =
mesh_.time().timeOutputValue();
123 center += amp * sin(constant::mathematical::twoPi * t / period + phase);
125 scalar xTerm, yTerm, zTerm, s;
126 scalar thrustTotal = 0.0;
129 const vector& meshC =
mesh_.C()[cellI];
130 xTerm = (tanh(eps * (meshC[0] + 0.5 * size[0] - center[0])) - tanh(eps * (meshC[0] - 0.5 * size[0] - center[0])));
131 yTerm = (tanh(eps * (meshC[1] + 0.5 * size[1] - center[1])) - tanh(eps * (meshC[1] - 0.5 * size[1] - center[1])));
132 zTerm = (tanh(eps * (meshC[2] + 0.5 * size[2] - center[2])) - tanh(eps * (meshC[2] - 0.5 * size[2] - center[2])));
134 s = xTerm * yTerm * zTerm;
136 fvSource[cellI][thrustDirIdx] += s * scale;
138 thrustTotal += s * scale *
mesh_.V()[cellI];
140 reduce(thrustTotal, sumOp<scalar>());
146 Info <<
"Actuator point source: " << pointName << endl;
147 Info <<
"Total thrust source: " << thrustTotal << endl;
151 else if (smoothFunction ==
"gaussian")
156 pointSubDict.readEntry<scalarList>(
"center", center1);
157 pointSubDict.readEntry<scalarList>(
"amplitude", amp1);
158 vector center = {center1[0], center1[1], center1[2]};
159 vector amp = {amp1[0], amp1[1], amp1[2]};
160 scalar period = pointSubDict.get<scalar>(
"periodicity");
161 scalar eps = pointSubDict.get<scalar>(
"eps");
162 scalar scale = pointSubDict.get<scalar>(
"scale");
163 label thrustDirIdx = pointSubDict.get<label>(
"thrustDirIdx");
164 scalar phase = pointSubDict.get<scalar>(
"phase");
166 scalar t =
mesh_.time().timeOutputValue();
167 center += amp * sin(constant::mathematical::twoPi * t / period + phase);
169 scalar thrustTotal = 0.0;
170 scalar coeff = 1.0 / constant::mathematical::twoPi / eps / eps;
173 const vector& meshC =
mesh_.C()[cellI];
174 scalar d = mag(meshC - center);
175 scalar s = coeff * exp(-d * d / 2.0 / eps / eps);
177 fvSource[cellI][thrustDirIdx] += s * scale;
178 thrustTotal += s * scale *
mesh_.V()[cellI];
180 reduce(thrustTotal, sumOp<scalar>());
186 Info <<
"Actuator point source: " << pointName << endl;
187 Info <<
"Total thrust source: " << thrustTotal << endl;
193 FatalErrorIn(
"") <<
"smoothFunction should be either hyperbolic or gaussian" << abort(FatalError);
197 fvSource.correctBoundaryConditions();