180 int numNodes = this->numNodesVelocity_;
181 std::string FEType = this->FETypeVelocity_;
184 vec3D_dbl_ptr_Type dPhi;
185 vec_dbl_ptr_Type weights = Teuchos::rcp(
new vec_dbl_Type(0));
190 UN deg = (degGradPhi + extraDeg) + degGradPhi + degGradPhi;
201 detB = B.computeInverse(Binv);
202 absDetB = std::fabs(detB);
206 vec3D_dbl_Type dPhiTrans(dPhi->size(), vec2D_dbl_Type(dPhi->at(0).size(), vec_dbl_Type(dim, 0.)));
209 TEUCHOS_TEST_FOR_EXCEPTION(dim == 1, std::logic_error,
"AssemblyStress Not implemented for dim=1");
216 vec_dbl_ptr_Type gammaDot(
new vec_dbl_Type(weights->size(), 0.0));
221 double v11, v12, v21, v22, value1_j, value2_j, value1_i, value2_i, viscosity_atw;
225 for (UN i = 0; i < numNodes; i++)
228 for (UN j = 0; j < numNodes; j++)
237 for (UN w = 0; w < dPhiTrans.size(); w++)
240 value1_j = dPhiTrans[w][j][0];
241 value2_j = dPhiTrans[w][j][1];
243 value1_i = dPhiTrans[w][i][0];
244 value2_i = dPhiTrans[w][i][1];
247 this->viscosityModel->evaluateMapping(this->params_, gammaDot->at(w), viscosity_atw);
249 v11 = v11 + viscosity_atw * weights->at(w) * (2.0 * value1_i * value1_j + value2_i * value2_j);
250 v12 = v12 + viscosity_atw * weights->at(w) * (value2_i * value1_j);
251 v21 = v21 + viscosity_atw * weights->at(w) * (value1_i * value2_j);
252 v22 = v22 + viscosity_atw * weights->at(w) * (2.0 * value2_i * value2_j + value1_i * value1_j);
265 (*elementMatrix)[i * dofs][j * dofs] = v11;
266 (*elementMatrix)[i * dofs][j * dofs + 1] = v12;
267 (*elementMatrix)[i * dofs + 1][j * dofs] = v21;
268 (*elementMatrix)[i * dofs + 1][j * dofs + 1] = v22;
282 vec_dbl_ptr_Type gammaDot(
new vec_dbl_Type(weights->size(), 0.0));
286 double v11, v12, v13, v21, v22, v23, v31, v32, v33, value1_j, value2_j, value3_j, value1_i, value2_i, value3_i, viscosity_atw;
291 for (UN i = 0; i < numNodes; i++)
295 for (UN j = 0; j < numNodes; j++)
309 for (UN w = 0; w < dPhiTrans.size(); w++)
312 value1_j = dPhiTrans.at(w).at(j).at(0);
313 value2_j = dPhiTrans.at(w).at(j).at(1);
314 value3_j = dPhiTrans.at(w).at(j).at(2);
316 value1_i = dPhiTrans.at(w).at(i).at(0);
317 value2_i = dPhiTrans.at(w).at(i).at(1);
318 value3_i = dPhiTrans.at(w).at(i).at(2);
320 this->viscosityModel->evaluateMapping(this->params_, gammaDot->at(w), viscosity_atw);
323 v11 = v11 + viscosity_atw * weights->at(w) * (2.0 * value1_j * value1_i + value2_j * value2_i + value3_j * value3_i);
324 v12 = v12 + viscosity_atw * weights->at(w) * (value2_i * value1_j);
325 v13 = v13 + viscosity_atw * weights->at(w) * (value3_i * value1_j);
327 v21 = v21 + viscosity_atw * weights->at(w) * (value1_i * value2_j);
328 v22 = v22 + viscosity_atw * weights->at(w) * (value1_i * value1_j + 2.0 * value2_j * value2_i + value3_j * value3_i);
329 v23 = v23 + viscosity_atw * weights->at(w) * (value3_i * value2_j);
331 v31 = v31 + viscosity_atw * weights->at(w) * (value1_i * value3_j);
332 v32 = v32 + viscosity_atw * weights->at(w) * (value2_i * value3_j);
333 v33 = v33 + viscosity_atw * weights->at(w) * (value1_i * value1_j + value2_i * value2_j + 2.0 * value3_i * value3_j);
352 (*elementMatrix)[i * dofs][j * dofs] = v11;
353 (*elementMatrix)[i * dofs][j * dofs + 1] = v12;
354 (*elementMatrix)[i * dofs][j * dofs + 2] = v13;
355 (*elementMatrix)[i * dofs + 1][j * dofs] = v21;
356 (*elementMatrix)[i * dofs + 1][j * dofs + 1] = v22;
357 (*elementMatrix)[i * dofs + 1][j * dofs + 2] = v23;
358 (*elementMatrix)[i * dofs + 2][j * dofs] = v31;
359 (*elementMatrix)[i * dofs + 2][j * dofs + 1] = v32;
360 (*elementMatrix)[i * dofs + 2][j * dofs + 2] = v33;
375 int numNodes = this->numNodesVelocity_;
376 std::string FEType = this->FETypeVelocity_;
379 vec3D_dbl_ptr_Type dPhi;
380 vec_dbl_ptr_Type weights = Teuchos::rcp(
new vec_dbl_Type(0));
385 UN deg = 3*degGradPhi + (degGradPhi + extraDegree);
395 detB = B.computeInverse(Binv);
396 absDetB = std::fabs(detB);
398 vec3D_dbl_Type dPhiTrans(dPhi->size(), vec2D_dbl_Type(dPhi->at(0).size(), vec_dbl_Type(dim, 0.)));
401 TEUCHOS_TEST_FOR_EXCEPTION(dim == 1, std::logic_error,
"AssemblyStress Not implemented for dim=1");
409 vec_dbl_Type u11(dPhiTrans.size(), -1.);
410 vec_dbl_Type u12(dPhiTrans.size(), -1.);
411 vec_dbl_Type u21(dPhiTrans.size(), -1.);
412 vec_dbl_Type u22(dPhiTrans.size(), -1.);
413 vec_dbl_ptr_Type gammaDot(
new vec_dbl_Type(weights->size(), 0.0));
415 vec_dbl_ptr_Type mixed_term_xy(
new vec_dbl_Type(weights->size(), 0.0));
416 for (UN w = 0; w < dPhiTrans.size(); w++)
423 for (UN i = 0; i < dPhiTrans[0].size(); i++)
425 LO index1 = dim * i + 0;
426 LO index2 = dim * i + 1;
428 u11[w] += (*this->solution_)[index1] * dPhiTrans[w][i][0];
429 u12[w] += (*this->solution_)[index1] * dPhiTrans[w][i][1];
430 u21[w] += (*this->solution_)[index2] * dPhiTrans[w][i][0];
431 u22[w] += (*this->solution_)[index2] * dPhiTrans[w][i][1];
433 gammaDot->at(w) = std::sqrt(2.0 * u11[w] * u11[w] + 2.0 * u22[w] * u22[w] + (u12[w] + u21[w]) * (u12[w] + u21[w]));
434 mixed_term_xy->at(w) = 0.5 * (u12[w] + u21[w]);
439 double v11, v12, v21, v22, value1_j, value2_j, value1_i, value2_i, deta_dgamma_dgamma_dtau;
441 deta_dgamma_dgamma_dtau = 0.;
444 for (UN i = 0; i < numNodes; i++)
448 for (UN j = 0; j < numNodes; j++)
458 for (UN w = 0; w < dPhiTrans.size(); w++)
461 value1_j = dPhiTrans[w][j][0];
462 value2_j = dPhiTrans[w][j][1];
464 value1_i = dPhiTrans[w][i][0];
465 value2_i = dPhiTrans[w][i][1];
467 this->viscosityModel->evaluateDerivative(this->params_, gammaDot->at(w), deta_dgamma_dgamma_dtau);
474 v11 = v11 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value1_j * u11[w] + value2_j * mixed_term_xy->at(w)) * (value1_i * u11[w] + value2_i * mixed_term_xy->at(w)));
475 v12 = v12 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value1_j * mixed_term_xy->at(w) + u22[w] * value2_j) * (value1_i * u11[w] + value2_i * mixed_term_xy->at(w)));
477 v21 = v21 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value1_j * u11[w] + value2_j * mixed_term_xy->at(w)) * (value1_i * mixed_term_xy->at(w) + value2_i * u22[w]));
478 v22 = v22 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value1_j * mixed_term_xy->at(w) + u22[w] * value2_j) * (value1_i * mixed_term_xy->at(w) + value2_i * u22[w]));
491 (*elementMatrix)[i * dofs][j * dofs] = v11;
492 (*elementMatrix)[i * dofs][j * dofs + 1] = v12;
493 (*elementMatrix)[i * dofs + 1][j * dofs] = v21;
494 (*elementMatrix)[i * dofs + 1][j * dofs + 1] = v22;
508 vec_dbl_Type u11(dPhiTrans.size(), -1.);
509 vec_dbl_Type u12(dPhiTrans.size(), -1.);
510 vec_dbl_Type u13(dPhiTrans.size(), -1.);
512 vec_dbl_Type u21(dPhiTrans.size(), -1.);
513 vec_dbl_Type u22(dPhiTrans.size(), -1.);
514 vec_dbl_Type u23(dPhiTrans.size(), -1.);
516 vec_dbl_Type u31(dPhiTrans.size(), -1.);
517 vec_dbl_Type u32(dPhiTrans.size(), -1.);
518 vec_dbl_Type u33(dPhiTrans.size(), -1.);
520 vec_dbl_ptr_Type gammaDot(
new vec_dbl_Type(weights->size(), 0.0));
522 vec_dbl_ptr_Type mixed_term_xy(
new vec_dbl_Type(weights->size(), 0.0));
523 vec_dbl_ptr_Type mixed_term_xz(
new vec_dbl_Type(weights->size(), 0.0));
524 vec_dbl_ptr_Type mixed_term_yz(
new vec_dbl_Type(weights->size(), 0.0));
526 for (UN w = 0; w < dPhiTrans.size(); w++)
539 for (UN i = 0; i < dPhiTrans[0].size(); i++)
541 LO index1 = dim * i + 0;
542 LO index2 = dim * i + 1;
543 LO index3 = dim * i + 2;
545 u11[w] += (*this->solution_)[index1] * dPhiTrans[w][i][0];
546 u12[w] += (*this->solution_)[index1] * dPhiTrans[w][i][1];
547 u13[w] += (*this->solution_)[index1] * dPhiTrans[w][i][2];
548 u21[w] += (*this->solution_)[index2] * dPhiTrans[w][i][0];
549 u22[w] += (*this->solution_)[index2] * dPhiTrans[w][i][1];
550 u23[w] += (*this->solution_)[index2] * dPhiTrans[w][i][2];
551 u31[w] += (*this->solution_)[index3] * dPhiTrans[w][i][0];
552 u32[w] += (*this->solution_)[index3] * dPhiTrans[w][i][1];
553 u33[w] += (*this->solution_)[index3] * dPhiTrans[w][i][2];
555 gammaDot->at(w) = std::sqrt(2.0 * u11[w] * u11[w] + 2.0 * u22[w] * u22[w] + 2.0 * u33[w] * u33[w] + (u12[w] + u21[w]) * (u12[w] + u21[w]) + (u13[w] + u31[w]) * (u13[w] + u31[w]) + (u23[w] + u32[w]) * (u23[w] + u32[w]));
557 mixed_term_xy->at(w) = 0.5 * (u12[w] + u21[w]);
558 mixed_term_xz->at(w) = 0.5 * (u31[w] + u13[w]);
559 mixed_term_yz->at(w) = 0.5 * (u32[w] + u23[w]);
563 double v11, v12, v13, v21, v22, v23, v31, v32, v33, value1_j, value2_j, value3_j, value1_i, value2_i, value3_i, deta_dgamma_dgamma_dtau;
565 deta_dgamma_dgamma_dtau = 0.;
568 for (UN i = 0; i < numNodes; i++)
572 for (UN j = 0; j < numNodes; j++)
586 for (UN w = 0; w < dPhiTrans.size(); w++)
589 value1_j = dPhiTrans.at(w).at(j).at(0);
590 value2_j = dPhiTrans.at(w).at(j).at(1);
591 value3_j = dPhiTrans.at(w).at(j).at(2);
593 value1_i = dPhiTrans.at(w).at(i).at(0);
594 value2_i = dPhiTrans.at(w).at(i).at(1);
595 value3_i = dPhiTrans.at(w).at(i).at(2);
597 this->viscosityModel->evaluateDerivative(this->params_, gammaDot->at(w), deta_dgamma_dgamma_dtau);
600 v11 = v11 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value1_j * u11[w] + value2_j * mixed_term_xy->at(w) + value3_j * mixed_term_xz->at(w)) * (value1_i * u11[w] + value2_i * mixed_term_xy->at(w) + value3_i * mixed_term_xz->at(w)));
601 v12 = v12 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value1_j * mixed_term_xy->at(w) + u22[w] * value2_j + mixed_term_yz->at(w) * value3_j) * (value1_i * u11[w] + value2_i * mixed_term_xy->at(w) + value3_i * mixed_term_xz->at(w)));
602 v13 = v13 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value3_j * mixed_term_xz->at(w) + value2_j * mixed_term_yz->at(w) + value3_j * u33[w]) * (value1_i * u11[w] + value2_i * mixed_term_xy->at(w) + value3_i * mixed_term_xz->at(w)));
604 v21 = v21 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value1_j * u11[w] + value2_j * mixed_term_xy->at(w) + value3_j * mixed_term_xz->at(w)) * (value1_i * mixed_term_xy->at(w) + value2_i * u22[w] + value3_i * mixed_term_yz->at(w)));
605 v22 = v22 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value1_j * mixed_term_xy->at(w) + u22[w] * value2_j + mixed_term_yz->at(w) * value3_j) * (value1_i * mixed_term_xy->at(w) + value2_i * u22[w] + value3_i * mixed_term_yz->at(w)));
606 v23 = v23 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value3_j * mixed_term_xz->at(w) + value2_j * mixed_term_yz->at(w) + value3_j * u33[w]) * (value1_i * mixed_term_xy->at(w) + value2_i * u22[w] + value3_i * mixed_term_yz->at(w)));
608 v31 = v31 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value1_j * u11[w] + value2_j * mixed_term_xy->at(w) + value3_j * mixed_term_xz->at(w)) * (value1_i * mixed_term_xz->at(w) + mixed_term_yz->at(w) * value2_i + u33[w] * value3_i));
609 v32 = v32 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value1_j * mixed_term_xy->at(w) + u22[w] * value2_j + mixed_term_yz->at(w) * value3_j) * (value1_i * mixed_term_xz->at(w) + mixed_term_yz->at(w) * value2_i + u33[w] * value3_i));
610 v33 = v33 + (-2.0) * deta_dgamma_dgamma_dtau * weights->at(w) * ((value3_j * mixed_term_xz->at(w) + value2_j * mixed_term_yz->at(w) + value3_j * u33[w]) * (value1_i * mixed_term_xz->at(w) + mixed_term_yz->at(w) * value2_i + u33[w] * value3_i));
629 (*elementMatrix)[i * dofs][j * dofs] = v11;
630 (*elementMatrix)[i * dofs][j * dofs + 1] = v12;
631 (*elementMatrix)[i * dofs][j * dofs + 2] = v13;
632 (*elementMatrix)[i * dofs + 1][j * dofs] = v21;
633 (*elementMatrix)[i * dofs + 1][j * dofs + 1] = v22;
634 (*elementMatrix)[i * dofs + 1][j * dofs + 2] = v23;
635 (*elementMatrix)[i * dofs + 2][j * dofs] = v31;
636 (*elementMatrix)[i * dofs + 2][j * dofs + 1] = v32;
637 (*elementMatrix)[i * dofs + 2][j * dofs + 2] = v33;
721 vec_dbl_ptr_Type &gammaDot,
int dim)
728 vec_dbl_Type u11(dPhiTrans.size(), -1.);
729 vec_dbl_Type u12(dPhiTrans.size(), -1.);
730 vec_dbl_Type u21(dPhiTrans.size(), -1.);
731 vec_dbl_Type u22(dPhiTrans.size(), -1.);
733 for (UN w = 0; w < dPhiTrans.size(); w++)
740 for (UN i = 0; i < dPhiTrans[0].size(); i++)
742 LO index1 = dim * i + 0;
743 LO index2 = dim * i + 1;
745 u11[w] += (*this->solution_)[index1] * dPhiTrans[w][i][0];
746 u12[w] += (*this->solution_)[index1] * dPhiTrans[w][i][1];
747 u21[w] += (*this->solution_)[index2] * dPhiTrans[w][i][0];
748 u22[w] += (*this->solution_)[index2] * dPhiTrans[w][i][1];
750 gammaDot->at(w) = std::sqrt(2.0 * u11[w] * u11[w] + 2.0 * u22[w] * u22[w] + (u12[w] + u21[w]) * (u12[w] + u21[w]));
757 vec_dbl_Type u11(dPhiTrans.size(), -1.);
758 vec_dbl_Type u12(dPhiTrans.size(), -1.);
759 vec_dbl_Type u13(dPhiTrans.size(), -1.);
761 vec_dbl_Type u21(dPhiTrans.size(), -1.);
762 vec_dbl_Type u22(dPhiTrans.size(), -1.);
763 vec_dbl_Type u23(dPhiTrans.size(), -1.);
765 vec_dbl_Type u31(dPhiTrans.size(), -1.);
766 vec_dbl_Type u32(dPhiTrans.size(), -1.);
767 vec_dbl_Type u33(dPhiTrans.size(), -1.);
769 for (UN w = 0; w < dPhiTrans.size(); w++)
782 for (UN i = 0; i < dPhiTrans[0].size(); i++)
784 LO index1 = dim * i + 0;
785 LO index2 = dim * i + 1;
786 LO index3 = dim * i + 2;
788 u11[w] += (*this->solution_)[index1] * dPhiTrans[w][i][0];
789 u12[w] += (*this->solution_)[index1] * dPhiTrans[w][i][1];
790 u13[w] += (*this->solution_)[index1] * dPhiTrans[w][i][2];
791 u21[w] += (*this->solution_)[index2] * dPhiTrans[w][i][0];
792 u22[w] += (*this->solution_)[index2] * dPhiTrans[w][i][1];
793 u23[w] += (*this->solution_)[index2] * dPhiTrans[w][i][2];
794 u31[w] += (*this->solution_)[index3] * dPhiTrans[w][i][0];
795 u32[w] += (*this->solution_)[index3] * dPhiTrans[w][i][1];
796 u33[w] += (*this->solution_)[index3] * dPhiTrans[w][i][2];
798 gammaDot->at(w) = std::sqrt(2.0 * u11[w] * u11[w] + 2.0 * u22[w] * u22[w] + 2.0 * u33[w] * u33[w] + (u12[w] + u21[w]) * (u12[w] + u21[w]) + (u13[w] + u31[w]) * (u13[w] + u31[w]) + (u23[w] + u32[w]) * (u23[w] + u32[w]));