205 int nsd = this->
domain->giveNumberOfSpatialDimensions();
209 std :: unique_ptr< SparseLinearSystemNM > solver(
classFactory.createSparseLinSolver(
ST_Petsc, this->domain, this->domain->giveEngngModel() ) );
211 std :: unique_ptr< SparseMtrx > Kff(
classFactory.createSparseMtrx( stype ) );
212 std :: unique_ptr< SparseMtrx > Kfp(
classFactory.createSparseMtrx( stype ) );
213 std :: unique_ptr< SparseMtrx > Kpp(
classFactory.createSparseMtrx( stype ) );
215 Kff->buildInternalStructure(rve, this->
domain->giveNumber(), fnum);
216 int neq = Kff->giveNumberOfRows();
217 Kfp->buildInternalStructure(rve, this->
domain->giveNumber(), fnum, pnum);
218 Kpp->buildInternalStructure(rve, this->
domain->giveNumber(), pnum);
230 int nelem =
domain->giveNumberOfElements();
232 #pragma omp parallel for shared(Kff, Kfp, Kpp) private(mat, R, floc, ploc)
234 for (
int ielem = 1; ielem <= nelem; ielem++ ) {
243 ma.matrixFromElement(mat, *element, tStep);
246 ma.locationFromElement(floc, *element, fnum);
247 ma.locationFromElement(ploc, *element, pnum);
257 Kff->assemble(floc, mat);
258 Kfp->assemble(floc, ploc, mat);
259 Kpp->assemble(ploc, mat);
263 Kff->assembleBegin();
264 Kfp->assembleBegin();
265 Kpp->assembleBegin();
272 FloatMatrix grad_pert(nsd, nsd), rhs, sol(neq, nsd);
273 grad_pert.resize(nsd, nsd);
274 grad_pert.beUnitMatrix();
277 this->
grad->giveLocationArray(this->
grad_ids, grad_loc, pnum);
279 pert.
assemble(grad_pert, grad_loc, {1,2,3});
287 Kfp->times(pert, rhs);
291 for (
auto &n :
domain->giveDofManagers() ) {
292 int k1 = n->giveDofWithID( this->
dofs[0] )->__giveEquationNumber();
294 const auto &coords = n->giveCoordinates();
295 for (
int i = 1; i <= nsd; ++i ) {
308 Kpp->
times(pert, tmpMat);
int giveNextFreeDofID(int increment=1)
Element * giveElement(int n)
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
void assembleVector(FloatArray &answer, TimeStep *tStep, const VectorAssembler &va, ValueModeType mode, const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms=NULL)