41 const dictionary& options,
60 MatSetFromOptions(jacMat);
62 MatSeqAIJSetPreallocation(jacMat,
nActDVs_, NULL);
65 MatZeroEntries(jacMat);
66 Info <<
"Partial derivative matrix created. " <<
mesh_.time().elapsedClockTime() <<
" s" << endl;
70 const dictionary& options,
91 word actuatorName = options.getWord(
"actuatorName");
96 MatZeroEntries(jacMat);
99 Vec resVecRef, resVec;
100 VecDuplicate(wVec, &resVec);
101 VecDuplicate(wVec, &resVecRef);
102 VecZeroEntries(resVec);
103 VecZeroEntries(resVecRef);
106 mOptions.set(
"updateState", 1);
107 mOptions.set(
"updateMesh", 0);
108 mOptions.set(
"setResVec", 1);
109 mOptions.set(
"isPC", options.getLabel(
"isPC"));
113 scalar rDelta = 1.0 / delta;
114 PetscScalar rDeltaValue = 0.0;
118 VecDuplicate(xvVec, &xvVecNew);
119 VecZeroEntries(xvVecNew);
121 dictionary& pointModelSubDict =
const_cast<dictionary&
>(
125 pointModelSubDict.readEntry<scalarList>(
"center", center);
126 scalar innerRadius = pointModelSubDict.getScalar(
"innerRadius");
127 scalar outerRadius = pointModelSubDict.getScalar(
"outerRadius");
128 scalar rpm = pointModelSubDict.getScalar(
"rpm");
129 scalar phase = pointModelSubDict.getScalar(
"phase");
130 scalar scale = pointModelSubDict.getScalar(
"scale");
131 scalar POD = pointModelSubDict.getScalar(
"POD");
132 scalar expM = pointModelSubDict.getScalar(
"expM");
133 scalar expN = pointModelSubDict.getScalar(
"expN");
135 for (label i = 0; i <
nActDVs_; i++)
143 pointModelSubDict.set(
"center", center);
149 pointModelSubDict.set(
"center", center);
155 pointModelSubDict.set(
"center", center);
160 innerRadius += delta;
161 pointModelSubDict.set(
"innerRadius", innerRadius);
166 outerRadius += delta;
167 pointModelSubDict.set(
"outerRadius", outerRadius);
173 pointModelSubDict.set(
"rpm", rpm);
179 pointModelSubDict.set(
"phase", phase);
185 pointModelSubDict.set(
"scale", scale);
191 pointModelSubDict.set(
"POD", POD);
197 pointModelSubDict.set(
"expM", expM);
203 pointModelSubDict.set(
"expN", expN);
216 pointModelSubDict.set(
"center", center);
222 pointModelSubDict.set(
"center", center);
228 pointModelSubDict.set(
"center", center);
233 innerRadius -= delta;
234 pointModelSubDict.set(
"innerRadius", innerRadius);
239 outerRadius -= delta;
240 pointModelSubDict.set(
"outerRadius", outerRadius);
246 pointModelSubDict.set(
"rpm", rpm);
252 pointModelSubDict.set(
"phase", phase);
258 pointModelSubDict.set(
"scale", scale);
264 pointModelSubDict.set(
"POD", POD);
270 pointModelSubDict.set(
"expM", expM);
276 pointModelSubDict.set(
"expN", expN);
282 VecAXPY(resVec, -1.0, resVecRef);
283 VecScale(resVec, rDeltaValue);
286 PetscInt Istart, Iend;
287 VecGetOwnershipRange(resVec, &Istart, &Iend);
289 const PetscScalar* resVecArray;
290 VecGetArrayRead(resVec, &resVecArray);
291 for (label j = Istart; j < Iend; j++)
293 label relIdx = j - Istart;
294 PetscScalar val = resVecArray[relIdx];
295 MatSetValue(jacMat, j, i, val, INSERT_VALUES);
297 VecRestoreArrayRead(resVec, &resVecArray);
300 label eTime =
mesh_.time().elapsedClockTime();
301 Info <<
modelType_ <<
" ExecutionTime: " << eTime <<
" s" << endl;
306 MatAssemblyBegin(jacMat, MAT_FINAL_ASSEMBLY);
307 MatAssemblyEnd(jacMat, MAT_FINAL_ASSEMBLY);