59double PrescribedGradient :: give(
Dof *dof, ValueModeType mode,
double time)
65 if ( mode == VM_Total ) {
67 }
else if ( mode == VM_Velocity ) {
69 }
else if ( mode == VM_Acceleration ) {
72 OOFEM_ERROR(
"Should not be called for value mode type then total, velocity, or acceleration.");
78 mGradient.resizeWithData(coords.giveSize(), coords.giveSize());
85 int pos = this->
dofs.findFirstIndexOf(
id);
87 if ( pos > 0 && pos <= u.
giveSize() ) {
96void PrescribedGradient :: updateCoefficientMatrix(
FloatMatrix &C)
110 int nsd =
domain->giveNumberOfSpatialDimensions();
112 C.
resize(npeq, nsd * nsd);
116 double xbar = cCoords.
at(1), ybar = cCoords.
at(2), zbar = 0.0;
118 zbar = cCoords.
at(3);
121 for (
auto &n :
domain->giveDofManagers() ) {
122 const auto &coords = n->giveCoordinates();
123 Dof *d1 = n->giveDofWithID( this->
dofs[0] );
124 Dof *d2 = n->giveDofWithID( this->
dofs[1] );
129 C.
at(k1, 1) = coords.at(1) - xbar;
130 C.
at(k1, 4) = coords.at(2) - ybar;
134 C.
at(k2, 2) = coords.at(2) - ybar;
135 C.
at(k2, 3) = coords.at(1) - xbar;
138 Dof *d3 = n->giveDofWithID( this->
dofs[2] );
142 C.
at(k1, 1) = coords.at(1) - xbar;
143 C.
at(k1, 6) = coords.at(2) - ybar;
144 C.
at(k1, 5) = coords.at(3) - zbar;
147 C.
at(k2, 2) = coords.at(2) - ybar;
148 C.
at(k2, 9) = coords.at(1) - xbar;
149 C.
at(k2, 4) = coords.at(3) - zbar;
152 C.
at(k3, 3) = coords.at(3) - zbar;
153 C.
at(k3, 8) = coords.at(1) - xbar;
154 C.
at(k3, 7) = coords.at(2) - ybar;
196 std :: unique_ptr< SparseLinearSystemNM >solver(
classFactory.createSparseLinSolver(
ST_Petsc, this->domain, this->domain->giveEngngModel() ) );
202 std :: unique_ptr< SparseMtrx >Kff(
classFactory.createSparseMtrx(stype) );
203 std :: unique_ptr< SparseMtrx >Kfp(
classFactory.createSparseMtrx(stype) );
204 std :: unique_ptr< SparseMtrx >Kpf(
classFactory.createSparseMtrx(stype) );
205 std :: unique_ptr< SparseMtrx >Kpp(
classFactory.createSparseMtrx(stype) );
207 OOFEM_ERROR(
"Couldn't create sparse matrix of type %d\n", stype);
209 Kff->buildInternalStructure(rve, 1, fnum);
210 Kfp->buildInternalStructure(rve, 1, fnum, pnum);
211 Kpf->buildInternalStructure(rve, 1, pnum, fnum);
212 Kpp->buildInternalStructure(rve, 1, pnum);
221 Kpf->timesT(C, KfpC);
222 solver->solve(*Kff, KfpC, a);
void assembleVector(FloatArray &answer, TimeStep *tStep, const VectorAssembler &va, ValueModeType mode, const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms=NULL)