62 const std::vector<Real>& JxW = fe->get_JxW();
63 const std::vector<std::vector<Real> >& phi = fe->get_phi();
67 n2 = fe->n_shape_functions()*n1,
68 nphi = fe->n_shape_functions();
71 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
72 mat2_n1n1 = RealMatrixX::Zero( n1, n1),
73 mat3_n1n2 = RealMatrixX::Zero( n1, n2),
74 mat4_n2n2 = RealMatrixX::Zero( n2, n2),
75 AiBi_adv = RealMatrixX::Zero( n1, n2),
76 A_sens = RealMatrixX::Zero( n1, n2),
77 LS = RealMatrixX::Zero( n1, n2),
78 LS_sens = RealMatrixX::Zero( n2, n2),
79 stress = RealMatrixX::Zero( dim, dim),
80 dprim_dcons = RealMatrixX::Zero( n1, n1),
81 dcons_dprim = RealMatrixX::Zero( n1, n1);
84 vec1_n1 = RealVectorX::Zero(n1),
85 vec2_n1 = RealVectorX::Zero(n1),
86 vec3_n2 = RealVectorX::Zero(n2),
87 dc = RealVectorX::Zero(dim),
88 temp_grad = RealVectorX::Zero(dim);
91 std::vector<RealMatrixX>
94 std::vector<std::vector<RealMatrixX> >
98 for (
unsigned int i=0; i<
dim; i++) {
99 Ai_sens [i].resize(n1);
100 Ai_adv [i].setZero(n1, n1);
101 for (
unsigned int j=0; j<n1; j++)
102 Ai_sens[i][j].setZero(n1, n1);
106 std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
107 std::vector<std::vector<MAST::FEMOperatorMatrix>> d2Bmat(dim);
110 for (
unsigned int i=0; i<
dim; i++) d2Bmat[i].resize(dim);
113 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
121 primitive_sol.
zero();
122 primitive_sol.
init(dim,
147 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
151 (i_dim, primitive_sol, Ai_sens[i_dim]);
153 dBmat[i_dim].left_multiply(mat3_n1n2, Ai_adv[i_dim]);
154 AiBi_adv += mat3_n1n2;
181 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
185 dBmat[i_dim].vector_mult_transpose(vec3_n2, vec1_n1);
186 f -= JxW[qp] * vec3_n2;
196 dBmat[i_dim].vector_mult_transpose(vec3_n2, vec1_n1);
197 f += JxW[qp] * vec3_n2;
202 dBmat[i_dim].vector_mult(vec1_n1,
_sol);
203 dBmat[i_dim].vector_mult_transpose(vec3_n2, vec1_n1);
204 f += JxW[qp] * dc(i_dim) * vec3_n2;
208 f += JxW[qp] * LS.transpose() * (AiBi_adv *
_sol);
211 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
212 for (
unsigned int j_dim=0; j_dim<
dim; j_dim++) {
220 d2Bmat[i_dim][j_dim].vector_mult(vec1_n1,
_sol);
221 f -= JxW[qp] * LS.transpose() * (mat1_n1n1 * vec1_n1);
226 if (request_jacobian) {
231 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
234 dBmat[i_dim].right_multiply_transpose(mat4_n2n2, mat3_n1n2);
235 jac -= JxW[qp]*mat4_n2n2;
238 dBmat[i_dim].vector_mult(vec1_n1,
_sol);
239 for (
unsigned int i_cvar=0; i_cvar<n1; i_cvar++) {
241 vec2_n1 = Ai_sens[i_dim][i_cvar] * vec1_n1;
242 for (
unsigned int i_phi=0; i_phi<nphi; i_phi++)
243 A_sens.col(nphi*i_cvar+i_phi) += phi[i_phi][qp] *vec2_n1;
249 for (
unsigned int j_dim=0; j_dim<
dim; j_dim++) {
256 dBmat[j_dim].left_multiply(mat3_n1n2, mat1_n1n1);
257 dBmat[i_dim].right_multiply_transpose(mat4_n2n2, mat3_n1n2);
258 jac += JxW[qp]*mat4_n2n2;
263 dBmat[i_dim].right_multiply_transpose(mat4_n2n2, dBmat[i_dim]);
264 jac += JxW[qp] * dc(i_dim) * mat4_n2n2;
268 jac += JxW[qp] * LS.transpose() * AiBi_adv;
271 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
272 for (
unsigned int j_dim=0; j_dim<
dim; j_dim++) {
280 d2Bmat[i_dim][j_dim].left_multiply(mat3_n1n2, mat1_n1n1);
281 jac -= JxW[qp] * LS.transpose() * mat3_n1n2;
286 jac += JxW[qp] * LS.transpose() * A_sens;
288 jac += JxW[qp] * LS_sens;
293 return request_jacobian;
312 f_jac_x = RealMatrixX::Zero( n2, n2),
313 fm_jac_xdot = RealMatrixX::Zero( n2, n2);
316 local_f = RealVectorX::Zero(n2);
322 if (request_jacobian)
327 return request_jacobian;
340 const std::vector<Real>& JxW = fe->get_JxW();
344 n2 = fe->n_shape_functions()*n1;
347 tau = RealMatrixX::Zero(n1, n1),
348 mat1_n1n1 = RealMatrixX::Zero(n1, n1),
349 mat2_n1n2 = RealMatrixX::Zero(n1, n2),
350 mat3_n2n2 = RealMatrixX::Zero(n2, n2),
351 mat4_n2n1 = RealMatrixX::Zero(n2, n1),
352 AiBi_adv = RealMatrixX::Zero(n1, n2),
353 A_sens = RealMatrixX::Zero(n1, n2),
354 LS = RealMatrixX::Zero(n1, n2),
355 LS_sens = RealMatrixX::Zero(n2, n2);
357 vec1_n1 = RealVectorX::Zero(n1),
358 vec2_n1 = RealVectorX::Zero(n1),
359 vec3_n2 = RealVectorX::Zero(n2);
361 std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
365 std::vector<RealMatrixX>
368 std::vector<std::vector<RealMatrixX> >
372 for (
unsigned int i=0; i<
dim; i++) {
373 Ai_sens [i].resize(n1);
374 Ai_adv [i].setZero(n1, n1);
375 for (
unsigned int j=0; j<n1; j++)
376 Ai_sens[i][j].setZero(n1, n1);
380 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
387 primitive_sol.
zero();
388 primitive_sol.
init(dim,
398 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
401 dBmat[i_dim].left_multiply(mat2_n1n2, Ai_adv[i_dim]);
402 AiBi_adv += mat2_n1n2;
421 f += JxW[qp] * vec3_n2;
424 f += JxW[qp] * LS.transpose() * vec1_n1;
426 if (request_jacobian) {
430 jac_xdot += JxW[qp] * mat3_n2n2;
434 mat4_n2n1 = LS.transpose();
436 jac_xdot += JxW[qp]*mat3_n2n2;
441 return request_jacobian;
460 fm_jac_x = RealMatrixX::Zero( n2, n2),
461 fm_jac_xdot = RealMatrixX::Zero( n2, n2);
464 local_f = RealVectorX::Zero(n2);
470 if (request_jacobian) {
472 jac_xdot += fm_jac_xdot;
480 return request_jacobian;
490 std::multimap<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>& bc) {
492 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>> loads;
495 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>>::const_iterator
499 for ( ; it != end; it++) {
501 std::vector<MAST::BoundaryConditionBase*>::const_iterator
502 bc_it = it->second.begin(),
503 bc_end = it->second.end();
505 for ( ; bc_it != bc_end; bc_it++) {
508 switch ((*bc_it)->type()) {
549 return request_jacobian;
560 std::multimap<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>& bc) {
571 f_jac_x = RealMatrixX::Zero(n2, n2);
574 local_f = RealVectorX::Zero(n2);
577 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>> loads;
580 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>>::const_iterator
584 for ( ; it != end; it++) {
586 std::vector<MAST::BoundaryConditionBase*>::const_iterator
587 bc_it = it->second.begin(),
588 bc_end = it->second.end();
590 for ( ; bc_it != bc_end; bc_it++) {
593 switch ((*bc_it)->type()) {
611 if (request_jacobian)
647 if (request_jacobian)
666 return request_jacobian;
675 bool request_jacobian,
678 std::multimap<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>& bc) {
681 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>> loads;
684 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>>::const_iterator
688 for ( ; it != end; it++) {
690 std::vector<MAST::BoundaryConditionBase*>::const_iterator
691 bc_it = it->second.begin(),
692 bc_end = it->second.end();
694 for ( ; bc_it != bc_end; bc_it++) {
697 switch ((*bc_it)->type()) {
737 return request_jacobian;
748 bool request_jacobian,
752 return request_jacobian;
760 bool request_jacobian,
765 return request_jacobian;
780 const std::vector<Real> &JxW = fe->get_JxW();
781 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
786 n2 = fe->n_shape_functions()*n1;
789 temp_grad = RealVectorX::Zero(dim),
790 dpdX = RealVectorX::Zero(n1),
791 vec1_n1 = RealVectorX::Zero(n1),
792 vec2_n2 = RealVectorX::Zero(n2);
795 stress = RealMatrixX::Zero( dim, dim),
796 dprim_dcons = RealMatrixX::Zero( n1, n1),
797 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
798 mat1_n1n1 = RealMatrixX::Zero( n1, n1);
802 std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
808 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
815 primitive_sol.
zero();
816 primitive_sol.
init(dim,
825 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
826 f(i_dim) += JxW[qp] * primitive_sol.
p * normals[qp](i_dim);
845 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
846 f.topRows(dim) -= JxW[qp] * stress.col(i_dim) * normals[qp](i_dim);
855 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
858 dfdX->row(i_dim) += JxW[qp] * vec2_n2 * normals[qp](i_dim);
863 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
864 for (
unsigned int j_dim=0; j_dim<
dim; j_dim++) {
871 dBmat[j_dim].left_multiply(mat2_n1n2, mat1_n1n1);
872 dfdX->topRows(dim) -= JxW[qp] * mat2_n1n2.middleRows(1,dim) * normals[qp](i_dim);
883 const unsigned int s,
889 const std::vector<Real> &JxW = fe->get_JxW();
890 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
895 n2 = fe->n_shape_functions()*n1;
898 temp_grad_sens = RealVectorX::Zero(dim),
899 dpdX = RealVectorX::Zero(n1),
900 vec1_n1 = RealVectorX::Zero(n1),
901 vec2_n2 = RealVectorX::Zero(n2);
904 stress_sens = RealMatrixX::Zero( dim, dim),
905 dprim_dcons = RealMatrixX::Zero( n1, n1),
906 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
907 mat1_n1n1 = RealMatrixX::Zero( n1, n1);
911 std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
918 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
925 primitive_sol.
zero();
926 primitive_sol.
init(dim,
934 linearized_primitive_sol.
zero();
935 linearized_primitive_sol.
init(primitive_sol, vec1_n1,
if_viscous());
940 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
941 f(i_dim) += JxW[qp] * linearized_primitive_sol.
dp * normals[qp](i_dim);
958 linearized_primitive_sol,
962 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
963 f.topRows(dim) -= JxW[qp] * stress_sens.col(i_dim) * normals[qp](i_dim);
979 const unsigned int s,
985 const std::vector<Real> &JxW = fe->get_JxW();
986 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
991 n2 = fe->n_shape_functions()*n1;
994 vec1_n1 = RealVectorX::Zero(n1),
995 vec2_n2 = RealVectorX::Zero(n2),
996 dnormal = RealVectorX::Zero(dim);
999 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
1000 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
1001 mat3_n2n2 = RealMatrixX::Zero( n2, n2);
1009 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
1016 primitive_sol.
zero();
1017 primitive_sol.
init(dim,
1027 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1028 vec1_n1(i_dim+1) += primitive_sol.
p * normals[qp](i_dim);
1031 f += JxW[qp] * vec2_n2;
1033 if (request_jacobian) {
1044 jac += JxW[qp] * mat3_n2n2;
1062 bool request_jacobian,
1065 const unsigned int s,
1080 const unsigned int s,
1092 const std::vector<Real> &JxW = fe->get_JxW();
1093 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
1094 const std::vector<libMesh::Point>& qpoint = fe->get_xyz();
1099 n2 = fe->n_shape_functions()*n1;
1102 vec1_n1 = RealVectorX::Zero(n1),
1103 vec2_n2 = RealVectorX::Zero(n2),
1104 flux = RealVectorX::Zero(n1),
1105 dnormal = RealVectorX::Zero(dim),
1106 uvec = RealVectorX::Zero(3),
1107 ni = RealVectorX::Zero(3),
1108 vel_fe = RealVectorX::Zero(6),
1109 dwdot_i = RealVectorX::Zero(3),
1110 dni = RealVectorX::Zero(3);
1113 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
1114 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
1115 mat3_n2n2 = RealMatrixX::Zero( n2, n2);
1136 if (bc.
contains(
"normal_rotation")) {
1144 if (vel) libmesh_assert(n_rot);
1146 for (
unsigned int qp=0; qp<JxW.size(); qp++)
1153 primitive_sol.
zero();
1154 primitive_sol.
init(dim,
1168 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1169 ni(i_dim) = normals[qp](i_dim);
1180 (*vel)(qpoint[qp],
_time, vel_fe);
1181 dwdot_i = vel_fe.topRows(3);
1185 (*n_rot)(qpoint[qp], normals[qp],
_time, dni);
1187 ui_ni = dwdot_i.dot(ni+dni) - uvec.dot(dni);
1191 flux += ui_ni * vec1_n1;
1192 flux(n1-1) += ui_ni * primitive_sol.
p;
1193 flux.segment(1,dim) += primitive_sol.
p * ni.segment(0,dim);
1196 f += JxW[qp] * vec2_n2;
1198 if ( request_jacobian ) {
1209 jac += JxW[qp] * mat3_n2n2;
1224 const unsigned int s,
1236 const std::vector<Real> &JxW = fe->get_JxW();
1237 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
1238 const std::vector<libMesh::Point>& qpoint = fe->get_xyz();
1243 n2 = fe->n_shape_functions()*n1;
1246 vec1_n1 = RealVectorX::Zero(n1),
1247 uvec = RealVectorX::Zero(3),
1248 dwdot_i = RealVectorX::Zero(3),
1249 ni = RealVectorX::Zero(3),
1250 dni = RealVectorX::Zero(3),
1251 Dw_i = RealVectorX::Zero(3),
1252 Dni = RealVectorX::Zero(3),
1253 Duvec = RealVectorX::Zero(3),
1254 vec2_n1 = RealVectorX::Zero(n1),
1255 vec2_n2 = RealVectorX::Zero(n2),
1256 tmp = RealVectorX::Zero(6),
1257 flux = RealVectorX::Zero(n1);
1260 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
1261 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
1262 mat3_n2n2 = RealMatrixX::Zero( n2, n2);
1284 if (bc.
contains(
"normal_rotation")) {
1292 if (vel) libmesh_assert(n_rot);
1294 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
1302 primitive_sol.
zero();
1303 primitive_sol.
init(dim,
1310 sd_primitive_sol.
zero();
1337 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1338 ni(i_dim) = normals[qp](i_dim);
1351 (*vel)(qpoint[qp],
_time, tmp);
1352 dwdot_i = tmp.topRows(3);
1356 Dw_i = tmp.topRows(3);
1362 (*n_rot)(qpoint[qp], normals[qp],
_time, dni);
1365 n_rot->
perturbation(qpoint[qp], normals[qp], _time, Dni);
1369 ui_ni_steady = dwdot_i.dot(ni+dni) - uvec.dot(dni);
1370 flux += ui_ni_steady * vec2_n1;
1371 flux(n1-1) += ui_ni_steady * sd_primitive_sol.
dp;
1374 Dvi_ni = (Dw_i.dot(ni+dni) +
1378 flux += Dvi_ni * vec1_n1;
1379 flux(n1-1) += Dvi_ni * primitive_sol.
p;
1382 flux.segment(1, dim) += (sd_primitive_sol.
dp * ni.segment(0,dim));
1385 f += JxW[qp] * vec2_n2;
1387 if ( request_jacobian ) {
1400 jac += JxW[qp] * mat3_n2n2;
1404 return request_jacobian;
1412 bool request_jacobian,
1415 const unsigned int s,
1427 const unsigned int s,
1439 const std::vector<Real> &JxW = fe->get_JxW();
1440 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
1445 n2 = fe->n_shape_functions()*n1;
1448 vec1_n1 = RealVectorX::Zero(n1),
1449 vec2_n2 = RealVectorX::Zero(n2),
1450 flux = RealVectorX::Zero(n1),
1451 dnormal = RealVectorX::Zero(dim),
1452 uvec = RealVectorX::Zero(3),
1453 ni = RealVectorX::Zero(3),
1454 dwdot_i = RealVectorX::Zero(3),
1455 dni = RealVectorX::Zero(3),
1456 temp_grad = RealVectorX::Zero(dim);
1459 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
1460 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
1461 mat3_n2n2 = RealMatrixX::Zero( n2, n2),
1462 stress = RealMatrixX::Zero( dim, dim),
1463 dprim_dcons = RealMatrixX::Zero( n1, n1),
1464 dcons_dprim = RealMatrixX::Zero( n1, n1);
1472 std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
1486 if (bc.
contains(
"normal_rotation")) {
1494 for (
unsigned int qp=0; qp<JxW.size(); qp++)
1503 primitive_sol.
zero();
1504 primitive_sol.
init(dim,
1511 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1512 ni(i_dim) = normals[qp](i_dim);
1542 flux += ui_ni * vec1_n1;
1543 flux(n1-1) += ui_ni * primitive_sol.
p;
1544 flux.segment(1,dim) += primitive_sol.
p * ni.segment(0,dim);
1559 temp_grad.setZero();
1561 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
1564 flux.segment(1, dim) -= ni(i_dim) * stress.col(i_dim);
1565 flux(n1-1) -= ni(i_dim) * stress.col(i_dim).dot(uvec.segment(0,dim));
1569 flux(n1-1) -= primitive_sol.
k_thermal * temp_grad.dot(ni.segment(0,dim));
1573 f += JxW[qp] * vec2_n2;
1575 if ( request_jacobian ) {
1586 jac += JxW[qp] * mat3_n2n2;
1588 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
1590 for (
unsigned int j_dim=0; j_dim<
dim; j_dim++) {
1598 mat1_n1n1 *= dprim_dcons;
1599 dBmat[j_dim].left_multiply(mat2_n1n2, mat1_n1n1);
1601 jac -= JxW[qp] * mat3_n2n2 * ni(i_dim);
1616 bool request_jacobian,
1619 const unsigned int s,
1632 const unsigned int s,
1642 const std::vector<Real> &JxW = fe->get_JxW();
1643 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
1644 const std::vector<libMesh::Point>& qpoint = fe->get_xyz();
1649 n2 = fe->n_shape_functions()*n1;
1652 vec1_n1 = RealVectorX::Zero(n1),
1653 vec2_n1 = RealVectorX::Zero(n1),
1654 vec3_n2 = RealVectorX::Zero(n2),
1655 flux = RealVectorX::Zero(n1),
1656 eig_val = RealVectorX::Zero(n1),
1657 dnormal = RealVectorX::Zero(dim);
1660 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
1661 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
1662 mat3_n2n2 = RealMatrixX::Zero( n2, n2),
1663 leig_vec = RealMatrixX::Zero( n1, n1),
1664 leig_vec_inv_tr = RealMatrixX::Zero( n1, n1);
1673 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
1682 primitive_sol.
zero();
1683 primitive_sol.
init(dim,
1698 mat1_n1n1 = leig_vec_inv_tr;
1699 for (
unsigned int j=0; j<n1; j++)
1701 mat1_n1n1.col(j) *= eig_val(j);
1703 mat1_n1n1.col(j) *= 0.0;
1705 mat1_n1n1 *= leig_vec.transpose();
1711 flux = mat1_n1n1 * vec2_n1;
1714 f += JxW[qp] * vec3_n2;
1719 mat1_n1n1 = leig_vec_inv_tr;
1720 for (
unsigned int j=0; j<n1; j++)
1722 mat1_n1n1.col(j) *= eig_val(j);
1724 mat1_n1n1.col(j) *= 0.0;
1726 mat1_n1n1 *= leig_vec.transpose();
1727 flux = mat1_n1n1 * vec1_n1;
1730 f += JxW[qp] * vec3_n2;
1733 if ( request_jacobian)
1740 mat1_n1n1 = leig_vec_inv_tr;
1741 for (
unsigned int j=0; j<n1; j++)
1743 mat1_n1n1.col(j) *= eig_val(j);
1745 mat1_n1n1.col(j) *= 0.0;
1746 mat1_n1n1 *= leig_vec.transpose();
1750 jac += JxW[qp] * mat3_n2n2;
1763 bool request_jacobian,
1766 const unsigned int s,
1777 const std::vector<Real> &JxW = fe->get_JxW();
1778 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
1783 n2 = fe->n_shape_functions()*n1;
1786 vec1_n1 = RealVectorX::Zero(n1),
1787 vec2_n1 = RealVectorX::Zero(n1),
1788 vec3_n2 = RealVectorX::Zero(n2),
1789 flux = RealVectorX::Zero(n1),
1790 eig_val = RealVectorX::Zero(n1),
1791 dnormal = RealVectorX::Zero(dim);
1794 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
1795 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
1796 mat3_n2n2 = RealMatrixX::Zero( n2, n2),
1797 leig_vec = RealMatrixX::Zero( n1, n1),
1798 leig_vec_inv_tr = RealMatrixX::Zero( n1, n1);
1807 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
1816 primitive_sol.
zero();
1817 primitive_sol.
init(dim,
1832 mat1_n1n1 = leig_vec_inv_tr;
1833 for (
unsigned int j=0; j<n1; j++)
1835 mat1_n1n1.col(j) *= eig_val(j);
1837 mat1_n1n1.col(j) *= 0.0;
1839 mat1_n1n1 *= leig_vec.transpose();
1853 flux = mat1_n1n1 * vec2_n1;
1855 f += JxW[qp] * vec3_n2;
1869 const unsigned int s,
1875 const std::vector<Real> &JxW = fe->get_JxW();
1876 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
1881 n2 = fe->n_shape_functions()*n1;
1884 vec1_n1 = RealVectorX::Zero(n1),
1885 vec2_n2 = RealVectorX::Zero(n2),
1886 load = RealVectorX::Zero(3),
1887 load_sens = RealVectorX::Zero(3);
1890 dload_dX = RealMatrixX::Zero( 3, n1);
1899 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
1906 primitive_sol.
zero();
1907 primitive_sol.
init(dim,
1914 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1915 load(i_dim) += JxW[qp] * primitive_sol.
p * normals[qp](i_dim);
1919 if (request_derivative) {
1922 (primitive_sol, vec1_n1);
1925 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1926 dload_dX.row(i_dim) += JxW[qp] * vec2_n2 * normals[qp](i_dim);
1939 primitive_sol_sens.
zero();
1942 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1943 load_sens(i_dim) += JxW[qp] *
1944 (primitive_sol_sens.
dp * normals[qp](i_dim) +
1945 primitive_sol.
p * 0.);
1956 const unsigned int dim,
1960 const std::vector<std::vector<Real> >& phi_fe = fe.
get_phi();
1962 const unsigned int n_phi = (
unsigned int)phi_fe.size();
1968 for (
unsigned int i_nd=0; i_nd<n_phi; i_nd++ )
1969 phi(i_nd) = phi_fe[i_nd][qp];
1980 const unsigned int dim,
1982 std::vector<MAST::FEMOperatorMatrix>& dBmat) {
1984 libmesh_assert(dBmat.size() ==
dim);
1986 const std::vector<std::vector<libMesh::RealVectorValue> >& dphi = fe.
get_dphi();
1988 const unsigned int n_phi = (
unsigned int)dphi.size();
1992 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
1994 for (
unsigned int i_nd=0; i_nd<n_phi; i_nd++ )
1995 phi(i_nd) = dphi[i_nd][qp](i_dim);
1996 dBmat[i_dim].reinit(dim+2, phi);
2004 const unsigned int dim,
2006 std::vector<std::vector<MAST::FEMOperatorMatrix>>& d2Bmat) {
2008 libmesh_assert(d2Bmat.size() ==
dim);
2009 for (
unsigned int i=0; i<
dim; i++)
2010 libmesh_assert(d2Bmat[i].size() ==
dim);
2012 const std::vector<std::vector<libMesh::RealTensorValue> >& d2phi = fe.
get_d2phi();
2014 const unsigned int n_phi = (
unsigned int)d2phi.size();
2018 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
2019 for (
unsigned int j_dim=0; j_dim<
dim; j_dim++) {
2021 for (
unsigned int i_nd=0; i_nd<n_phi; i_nd++ )
2022 phi(i_nd) = d2phi[i_nd][qp](i_dim, j_dim);
2023 d2Bmat[i_dim][j_dim].reinit(dim+2, phi);
void vector_mult_transpose(T &res, const T &v) const
res = v^T * [this]
void _initialize_fem_gradient_operator(const unsigned int qp, const unsigned int dim, const MAST::FEBase &fe, std::vector< MAST::FEMOperatorMatrix > &dBmat)
For mass = true, the FEM operator matrix is initilized to the weak form of the Laplacian ...
Class defines basic operations and calculation of the small disturbance primitive variables...
void calculate_advection_flux(const unsigned int calculate_dim, const MAST::PrimitiveSolution &sol, RealVectorX &flux)
virtual bool linearized_velocity_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac)
inertial force contribution to system residual of the linearized problem
bool enable_shock_capturing
flag to turn on/off artificial dissipation for shock capturing terms in fluid flow analysis...
const MAST::GeomElem & _elem
geometric element for which the computations are performed
void calculate_advection_flux_jacobian_for_moving_solid_wall_boundary(const MAST::PrimitiveSolution &sol, const Real ui_ni, const libMesh::Point &nvec, const RealVectorX &dnvec, RealMatrixX &mat)
This class provides the necessary functions to evaluate the flux vectors and their Jacobians for both...
RealVectorX _delta_vel
local velocity
void reinit(unsigned int n_interpolated_vars, unsigned int n_discrete_vars, unsigned int n_discrete_dofs_per_var)
this initializes the operator for number of rows and variables, assuming that all variables has the s...
virtual bool noslip_wall_surface_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
void calculate_diffusion_tensors_sensitivity(const RealVectorX &elem_sol, const RealVectorX &elem_sol_sens, const std::vector< MAST::FEMOperatorMatrix > &dB_mat, const RealMatrixX &dprim_dcons, const MAST::PrimitiveSolution &psol, const MAST::SmallPerturbationPrimitiveSolution< Real > &dsol, RealMatrixX &stress_tensor_sens, RealVectorX &temp_gradient_sens)
calculates and returns the stress tensor in stress_tensor.
Class defines the conversion and some basic operations on primitive fluid variables used in calculati...
void init(const MAST::PrimitiveSolution &sol, const typename VectorType< ValType >::return_type &delta_sol, bool if_viscous)
void calculate_conservative_variable_jacobian(const MAST::PrimitiveSolution &sol, RealMatrixX &dcons_dprim, RealMatrixX &dprim_dcons)
virtual void side_integrated_force_sensitivity(const MAST::FunctionBase &p, const unsigned int s, RealVectorX &f)
This provides the base class for definitin of element level contribution of output quantity in an ana...
RealVectorX _vel
local velocity
virtual bool linearized_internal_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac)
internal force contribution to system residual of the linearized problem.
void right_multiply(T &r, const T &m) const
[R] = [this] * [M]
virtual bool velocity_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac)
inertial force contribution to system residual
Real rho_e_sens_rho() const
void calculate_advection_flux_jacobian_sensitivity_for_conservative_variable(const unsigned int calculate_dim, const MAST::PrimitiveSolution &sol, std::vector< RealMatrixX > &mat)
bool side_external_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc)
side external force contribution to system residual
Real rho_sens_rho() const
void calculate_diffusion_flux(const unsigned int calculate_dim, const MAST::PrimitiveSolution &sol, const RealMatrixX &stress_tensor, const RealVectorX &temp_gradient, RealVectorX &flux)
ConservativeFluidElementBase(MAST::SystemInitialization &sys, MAST::AssemblyBase &assembly, const MAST::GeomElem &elem, const MAST::FlightCondition &f)
bool side_external_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc)
sensitivity of the side external force contribution to system residual
void calculate_diffusion_tensors(const RealVectorX &elem_sol, const std::vector< MAST::FEMOperatorMatrix > &dB_mat, const RealMatrixX &dprim_dcons, const MAST::PrimitiveSolution &psol, RealMatrixX &stress_tensor, RealVectorX &temp_gradient)
calculates and returns the stress tensor in stress_tensor.
void calculate_diffusion_flux_jacobian(const unsigned int flux_dim, const unsigned int deriv_dim, const MAST::PrimitiveSolution &sol, RealMatrixX &mat)
virtual void perturbation(const libMesh::Point &p, const libMesh::Point &n, const Real t, ValType &dn_rot) const =0
virtual bool slip_wall_surface_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
virtual bool slip_wall_surface_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
virtual void side_integrated_force(const unsigned int s, RealVectorX &f, RealMatrixX *dfdX=nullptr)
surface integrated force
const MAST::FlightCondition * flight_condition
This defines the surface motion for use with the nonlinear fluid solver.
virtual bool symmetry_surface_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
virtual bool linearized_slip_wall_surface_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
RealVectorX _delta_sol
local solution used for linearized analysis
virtual void perturbation(ValType &v) const
calculates the perturbation and returns it in v.
Real rho_u2_sens_rho() const
void calculate_advection_flux_jacobian(const unsigned int calculate_dim, const MAST::PrimitiveSolution &sol, RealMatrixX &mat)
virtual bool velocity_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac)
sensitivity of the damping force contribution to system residual
bool linearized_side_external_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc)
side external force contribution to system residual
Matrix< Real, Dynamic, Dynamic > RealMatrixX
void calculate_aliabadi_discontinuity_operator(const unsigned int qp, const MAST::FEBase &fe, const MAST::PrimitiveSolution &sol, const RealVectorX &elem_solution, const std::vector< MAST::FEMOperatorMatrix > &dB_mat, const RealMatrixX &Ai_Bi_advection, RealVectorX &discontinuity_val)
void _calculate_surface_integrated_load(bool request_derivative, const MAST::FunctionBase *p, const unsigned int s, MAST::OutputAssemblyElemOperations &output)
calculates the surface integrated force vector
void get_uvec(RealVectorX &u) const
Matrix< Real, Dynamic, 1 > RealVectorX
void calculate_differential_operator_matrix(const unsigned int qp, const MAST::FEBase &fe, const RealVectorX &elem_solution, const MAST::PrimitiveSolution &sol, const MAST::FEMOperatorMatrix &B_mat, const std::vector< MAST::FEMOperatorMatrix > &dB_mat, const std::vector< RealMatrixX > &Ai_advection, const RealMatrixX &Ai_Bi_advection, const std::vector< std::vector< RealMatrixX > > &Ai_sens, RealMatrixX &LS_operator, RealMatrixX &LS_sens)
virtual bool noslip_wall_surface_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
RealVectorX _sol_sens
local solution sensitivity
void get_duvec(typename VectorType< ValType >::return_type &du) const
virtual std::unique_ptr< MAST::FEBase > init_side_fe(unsigned int s, bool init_grads, int extra_quadrature_order=0) const
initializes the finite element shape function and quadrature object for the side with the order of qu...
RealVectorX _sol
local solution
virtual bool internal_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac)
internal force contribution to system residual
std::unique_ptr< MAST::FieldFunction< RealVectorX > > inf_sol
void init(const unsigned int dim, const RealVectorX &conservative_sol, const Real cp_val, const Real cv_val, bool if_viscous)
void calculate_pressure_derivative_wrt_conservative_variables(const MAST::PrimitiveSolution &sol, RealVectorX &dpdX)
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
void _initialize_fem_interpolation_operator(const unsigned int qp, const unsigned int dim, const MAST::FEBase &fe, MAST::FEMOperatorMatrix &Bmat)
virtual const std::vector< std::vector< libMesh::RealVectorValue > > & get_dphi() const
virtual bool internal_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac)
sensitivity of the internal force contribution to system residual
GasProperty gas_property
Ambient air properties.
Real rho_u1_sens_rho() const
virtual void external_side_loads_for_quadrature_elem(std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc, std::map< unsigned int, std::vector< MAST::BoundaryConditionBase * >> &loads) const
From the given list of boundary loads, this identifies the sides of the quadrature element and the lo...
void right_multiply_transpose(T &r, const T &m) const
[R] = [this]^T * [M]
void left_multiply(T &r, const T &m) const
[R] = [M] * [this]
virtual const std::vector< std::vector< libMesh::RealTensorValue > > & get_d2phi() const
virtual bool far_field_surface_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
virtual const std::vector< std::vector< Real > > & get_phi() const
void _initialize_fem_second_derivative_operator(const unsigned int qp, const unsigned int dim, const MAST::FEBase &fe, std::vector< std::vector< MAST::FEMOperatorMatrix >> &d2Bmat)
d2Bmat[i][j] is the derivative d2B/dxi dxj
void calculate_diffusion_flux_jacobian_primitive_vars(const unsigned int flux_dim, const unsigned int deriv_dim, const RealVectorX &uvec, const bool zero_kth, const MAST::PrimitiveSolution &sol, RealMatrixX &mat)
const ValType & get(const std::string &nm) const
returns a constant reference to the specified function
virtual std::unique_ptr< MAST::FEBase > init_fe(bool init_grads, bool init_second_order_derivative, int extra_quadrature_order=0) const
initializes the finite element shape function and quadrature object with the order of quadrature rule...
virtual bool symmetry_surface_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
const Real & _time
time for which system is being assembled
void calculate_advection_left_eigenvector_and_inverse_for_normal(const MAST::PrimitiveSolution &sol, const libMesh::Point &normal, RealVectorX &eig_vals, RealMatrixX &l_eig_mat, RealMatrixX &l_eig_mat_inv_tr)
virtual bool far_field_surface_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
virtual ~ConservativeFluidElementBase()
void get_infinity_vars(RealVectorX &vars_inf) const
bool contains(const std::string &nm) const
checks if the card contains the specified property value
This is the base class for elements that implement calculation of finite element quantities over the ...