41 const dictionary& options,
60 MatSetFromOptions(jacMat);
61 MatMPIAIJSetPreallocation(jacMat, 1, NULL, 1, NULL);
62 MatSeqAIJSetPreallocation(jacMat, 1, NULL);
65 MatZeroEntries(jacMat);
66 Info <<
"Partial derivative matrix created. " <<
mesh_.time().elapsedClockTime() <<
" s" << endl;
70 const dictionary& options,
104 word objFuncName, objFuncPart;
105 dictionary objFuncSubDictPart = options.subDict(
"objFuncSubDictPart");
106 options.readEntry<word>(
"objFuncName", objFuncName);
107 options.readEntry<word>(
"objFuncPart", objFuncPart);
109 autoPtr<DAObjFunc> daObjFunc(
122 MatZeroEntries(jacMat);
125 mOptions.set(
"updateState", 1);
126 mOptions.set(
"updateMesh", 0);
127 scalar fRef = daObjFunc->masterFunction(mOptions, xvVec, wVec);
130 scalar rDelta = 1.0 / delta;
136 scalar fNew = daObjFunc->masterFunction(mOptions, xvVec, wVec);
138 scalar partDeriv = (fNew - fRef) * rDelta;
139 PetscScalar partDerivValue = 0.0;
142 MatSetValue(jacMat, 0, 0, partDerivValue, INSERT_VALUES);
147 fRef = daObjFunc->masterFunction(mOptions, xvVec, wVec);
151 Info << objFuncName <<
": " << fRef << endl;
154 MatAssemblyBegin(jacMat, MAT_FINAL_ASSEMBLY);
155 MatAssemblyEnd(jacMat, MAT_FINAL_ASSEMBLY);