61 const std::vector<Real>& JxW = fe->get_JxW();
62 const std::vector<std::vector<Real> >& phi = fe->get_phi();
66 n2 = fe->n_shape_functions()*n1,
67 nphi = fe->n_shape_functions();
70 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
71 mat2_n1n1 = RealMatrixX::Zero( n1, n1),
72 mat3_n1n2 = RealMatrixX::Zero( n1, n2),
73 mat4_n2n2 = RealMatrixX::Zero( n2, n2),
74 AiBi_adv = RealMatrixX::Zero( n1, n2),
75 A_sens = RealMatrixX::Zero( n1, n2),
76 LS = RealMatrixX::Zero( n1, n2),
77 LS_sens = RealMatrixX::Zero( n2, n2),
78 stress = RealMatrixX::Zero( dim, dim),
79 dprim_dcons = RealMatrixX::Zero( n1, n1),
80 dcons_dprim = RealMatrixX::Zero( n1, n1);
83 vec1_n1 = RealVectorX::Zero(n1),
84 vec2_n1 = RealVectorX::Zero(n1),
85 vec3_n2 = RealVectorX::Zero(n2),
86 dc = RealVectorX::Zero(dim),
87 temp_grad = RealVectorX::Zero(dim);
90 std::vector<RealMatrixX>
93 std::vector<std::vector<RealMatrixX> >
97 for (
unsigned int i=0; i<
dim; i++) {
98 Ai_sens [i].resize(n1);
99 Ai_adv [i].setZero(n1, n1);
100 for (
unsigned int j=0; j<n1; j++)
101 Ai_sens[i][j].setZero(n1, n1);
105 std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
106 std::vector<std::vector<MAST::FEMOperatorMatrix>> d2Bmat(dim);
109 for (
unsigned int i=0; i<
dim; i++) d2Bmat[i].resize(dim);
112 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
120 primitive_sol.
zero();
121 primitive_sol.
init(dim,
146 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
150 (i_dim, primitive_sol, Ai_sens[i_dim]);
152 dBmat[i_dim].left_multiply(mat3_n1n2, Ai_adv[i_dim]);
153 AiBi_adv += mat3_n1n2;
180 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
184 dBmat[i_dim].vector_mult_transpose(vec3_n2, vec1_n1);
185 f -= JxW[qp] * vec3_n2;
195 dBmat[i_dim].vector_mult_transpose(vec3_n2, vec1_n1);
196 f += JxW[qp] * vec3_n2;
201 dBmat[i_dim].vector_mult(vec1_n1,
_sol);
202 dBmat[i_dim].vector_mult_transpose(vec3_n2, vec1_n1);
203 f += JxW[qp] * dc(i_dim) * vec3_n2;
207 f += JxW[qp] * LS.transpose() * (AiBi_adv *
_sol);
210 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
211 for (
unsigned int j_dim=0; j_dim<
dim; j_dim++) {
219 d2Bmat[i_dim][j_dim].vector_mult(vec1_n1,
_sol);
220 f -= JxW[qp] * LS.transpose() * (mat1_n1n1 * vec1_n1);
225 if (request_jacobian) {
230 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
233 dBmat[i_dim].right_multiply_transpose(mat4_n2n2, mat3_n1n2);
234 jac -= JxW[qp]*mat4_n2n2;
237 dBmat[i_dim].vector_mult(vec1_n1,
_sol);
238 for (
unsigned int i_cvar=0; i_cvar<n1; i_cvar++) {
240 vec2_n1 = Ai_sens[i_dim][i_cvar] * vec1_n1;
241 for (
unsigned int i_phi=0; i_phi<nphi; i_phi++)
242 A_sens.col(nphi*i_cvar+i_phi) += phi[i_phi][qp] *vec2_n1;
248 for (
unsigned int j_dim=0; j_dim<
dim; j_dim++) {
255 dBmat[j_dim].left_multiply(mat3_n1n2, mat1_n1n1);
256 dBmat[i_dim].right_multiply_transpose(mat4_n2n2, mat3_n1n2);
257 jac += JxW[qp]*mat4_n2n2;
262 dBmat[i_dim].right_multiply_transpose(mat4_n2n2, dBmat[i_dim]);
263 jac += JxW[qp] * dc(i_dim) * mat4_n2n2;
267 jac += JxW[qp] * LS.transpose() * AiBi_adv;
270 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
271 for (
unsigned int j_dim=0; j_dim<
dim; j_dim++) {
279 d2Bmat[i_dim][j_dim].left_multiply(mat3_n1n2, mat1_n1n1);
280 jac -= JxW[qp] * LS.transpose() * mat3_n1n2;
285 jac += JxW[qp] * LS.transpose() * A_sens;
287 jac += JxW[qp] * LS_sens;
292 return request_jacobian;
311 f_jac_x = RealMatrixX::Zero( n2, n2),
312 fm_jac_xdot = RealMatrixX::Zero( n2, n2);
315 local_f = RealVectorX::Zero(n2);
321 if (request_jacobian)
326 return request_jacobian;
339 const std::vector<Real>& JxW = fe->get_JxW();
343 n2 = fe->n_shape_functions()*n1;
346 tau = RealMatrixX::Zero(n1, n1),
347 mat1_n1n1 = RealMatrixX::Zero(n1, n1),
348 mat2_n1n2 = RealMatrixX::Zero(n1, n2),
349 mat3_n2n2 = RealMatrixX::Zero(n2, n2),
350 mat4_n2n1 = RealMatrixX::Zero(n2, n1),
351 AiBi_adv = RealMatrixX::Zero(n1, n2),
352 A_sens = RealMatrixX::Zero(n1, n2),
353 LS = RealMatrixX::Zero(n1, n2),
354 LS_sens = RealMatrixX::Zero(n2, n2);
356 vec1_n1 = RealVectorX::Zero(n1),
357 vec2_n1 = RealVectorX::Zero(n1),
358 vec3_n2 = RealVectorX::Zero(n2);
360 std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
364 std::vector<RealMatrixX>
367 std::vector<std::vector<RealMatrixX> >
371 for (
unsigned int i=0; i<
dim; i++) {
372 Ai_sens [i].resize(n1);
373 Ai_adv [i].setZero(n1, n1);
374 for (
unsigned int j=0; j<n1; j++)
375 Ai_sens[i][j].setZero(n1, n1);
379 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
386 primitive_sol.
zero();
387 primitive_sol.
init(dim,
397 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
400 dBmat[i_dim].left_multiply(mat2_n1n2, Ai_adv[i_dim]);
401 AiBi_adv += mat2_n1n2;
420 f += JxW[qp] * vec3_n2;
423 f += JxW[qp] * LS.transpose() * vec1_n1;
425 if (request_jacobian) {
429 jac_xdot += JxW[qp] * mat3_n2n2;
433 mat4_n2n1 = LS.transpose();
435 jac_xdot += JxW[qp]*mat3_n2n2;
440 return request_jacobian;
459 fm_jac_x = RealMatrixX::Zero( n2, n2),
460 fm_jac_xdot = RealMatrixX::Zero( n2, n2);
463 local_f = RealVectorX::Zero(n2);
469 if (request_jacobian) {
471 jac_xdot += fm_jac_xdot;
479 return request_jacobian;
489 std::multimap<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>& bc) {
491 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>> loads;
494 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>>::const_iterator
498 for ( ; it != end; it++) {
500 std::vector<MAST::BoundaryConditionBase*>::const_iterator
501 bc_it = it->second.begin(),
502 bc_end = it->second.end();
504 for ( ; bc_it != bc_end; bc_it++) {
507 switch ((*bc_it)->type()) {
548 return request_jacobian;
559 std::multimap<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>& bc) {
570 f_jac_x = RealMatrixX::Zero(n2, n2);
573 local_f = RealVectorX::Zero(n2);
576 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>> loads;
579 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>>::const_iterator
583 for ( ; it != end; it++) {
585 std::vector<MAST::BoundaryConditionBase*>::const_iterator
586 bc_it = it->second.begin(),
587 bc_end = it->second.end();
589 for ( ; bc_it != bc_end; bc_it++) {
592 switch ((*bc_it)->type()) {
610 if (request_jacobian)
646 if (request_jacobian)
665 return request_jacobian;
674 bool request_jacobian,
677 std::multimap<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>& bc) {
680 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>> loads;
683 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>>::const_iterator
687 for ( ; it != end; it++) {
689 std::vector<MAST::BoundaryConditionBase*>::const_iterator
690 bc_it = it->second.begin(),
691 bc_end = it->second.end();
693 for ( ; bc_it != bc_end; bc_it++) {
696 switch ((*bc_it)->type()) {
736 return request_jacobian;
747 bool request_jacobian,
751 return request_jacobian;
759 bool request_jacobian,
764 return request_jacobian;
779 const std::vector<Real> &JxW = fe->get_JxW();
780 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
785 n2 = fe->n_shape_functions()*n1;
788 temp_grad = RealVectorX::Zero(dim),
789 dpdX = RealVectorX::Zero(n1),
790 vec1_n1 = RealVectorX::Zero(n1),
791 vec2_n2 = RealVectorX::Zero(n2);
794 stress = RealMatrixX::Zero( dim, dim),
795 dprim_dcons = RealMatrixX::Zero( n1, n1),
796 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
797 mat1_n1n1 = RealMatrixX::Zero( n1, n1);
801 std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
807 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
814 primitive_sol.
zero();
815 primitive_sol.
init(dim,
824 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
825 f(i_dim) += JxW[qp] * primitive_sol.
p * normals[qp](i_dim);
844 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
845 f.topRows(dim) -= JxW[qp] * stress.col(i_dim) * normals[qp](i_dim);
854 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
857 dfdX->row(i_dim) += JxW[qp] * vec2_n2 * normals[qp](i_dim);
862 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
863 for (
unsigned int j_dim=0; j_dim<
dim; j_dim++) {
870 dBmat[j_dim].left_multiply(mat2_n1n2, mat1_n1n1);
871 dfdX->topRows(dim) -= JxW[qp] * mat2_n1n2.middleRows(1,dim) * normals[qp](i_dim);
882 const unsigned int s,
888 const std::vector<Real> &JxW = fe->get_JxW();
889 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
894 n2 = fe->n_shape_functions()*n1;
897 temp_grad_sens = RealVectorX::Zero(dim),
898 dpdX = RealVectorX::Zero(n1),
899 vec1_n1 = RealVectorX::Zero(n1),
900 vec2_n2 = RealVectorX::Zero(n2);
903 stress_sens = RealMatrixX::Zero( dim, dim),
904 dprim_dcons = RealMatrixX::Zero( n1, n1),
905 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
906 mat1_n1n1 = RealMatrixX::Zero( n1, n1);
910 std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
917 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
924 primitive_sol.
zero();
925 primitive_sol.
init(dim,
933 linearized_primitive_sol.
zero();
934 linearized_primitive_sol.
init(primitive_sol, vec1_n1,
if_viscous());
939 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
940 f(i_dim) += JxW[qp] * linearized_primitive_sol.
dp * normals[qp](i_dim);
957 linearized_primitive_sol,
961 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
962 f.topRows(dim) -= JxW[qp] * stress_sens.col(i_dim) * normals[qp](i_dim);
978 const unsigned int s,
984 const std::vector<Real> &JxW = fe->get_JxW();
985 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
990 n2 = fe->n_shape_functions()*n1;
993 vec1_n1 = RealVectorX::Zero(n1),
994 vec2_n2 = RealVectorX::Zero(n2),
995 dnormal = RealVectorX::Zero(dim);
998 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
999 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
1000 mat3_n2n2 = RealMatrixX::Zero( n2, n2);
1008 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
1015 primitive_sol.
zero();
1016 primitive_sol.
init(dim,
1026 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1027 vec1_n1(i_dim+1) += primitive_sol.
p * normals[qp](i_dim);
1030 f += JxW[qp] * vec2_n2;
1032 if (request_jacobian) {
1043 jac += JxW[qp] * mat3_n2n2;
1061 bool request_jacobian,
1064 const unsigned int s,
1079 const unsigned int s,
1091 const std::vector<Real> &JxW = fe->get_JxW();
1092 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
1093 const std::vector<libMesh::Point>& qpoint = fe->get_xyz();
1098 n2 = fe->n_shape_functions()*n1;
1101 vec1_n1 = RealVectorX::Zero(n1),
1102 vec2_n2 = RealVectorX::Zero(n2),
1103 flux = RealVectorX::Zero(n1),
1104 dnormal = RealVectorX::Zero(dim),
1105 uvec = RealVectorX::Zero(3),
1106 ni = RealVectorX::Zero(3),
1107 vel_fe = RealVectorX::Zero(6),
1108 dwdot_i = RealVectorX::Zero(3),
1109 dni = RealVectorX::Zero(3);
1112 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
1113 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
1114 mat3_n2n2 = RealMatrixX::Zero( n2, n2);
1135 if (bc.
contains(
"normal_rotation")) {
1143 if (vel) libmesh_assert(n_rot);
1145 for (
unsigned int qp=0; qp<JxW.size(); qp++)
1152 primitive_sol.
zero();
1153 primitive_sol.
init(dim,
1167 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1168 ni(i_dim) = normals[qp](i_dim);
1179 (*vel)(qpoint[qp],
_time, vel_fe);
1180 dwdot_i = vel_fe.topRows(3);
1184 (*n_rot)(qpoint[qp], normals[qp],
_time, dni);
1186 ui_ni = dwdot_i.dot(ni+dni) - uvec.dot(dni);
1190 flux += ui_ni * vec1_n1;
1191 flux(n1-1) += ui_ni * primitive_sol.
p;
1192 flux.segment(1,dim) += primitive_sol.
p * ni.segment(0,dim);
1195 f += JxW[qp] * vec2_n2;
1197 if ( request_jacobian ) {
1208 jac += JxW[qp] * mat3_n2n2;
1223 const unsigned int s,
1235 const std::vector<Real> &JxW = fe->get_JxW();
1236 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
1237 const std::vector<libMesh::Point>& qpoint = fe->get_xyz();
1242 n2 = fe->n_shape_functions()*n1;
1245 vec1_n1 = RealVectorX::Zero(n1),
1246 uvec = RealVectorX::Zero(3),
1247 dwdot_i = RealVectorX::Zero(3),
1248 ni = RealVectorX::Zero(3),
1249 dni = RealVectorX::Zero(3),
1250 Dw_i = RealVectorX::Zero(3),
1251 Dni = RealVectorX::Zero(3),
1252 Duvec = RealVectorX::Zero(3),
1253 vec2_n1 = RealVectorX::Zero(n1),
1254 vec2_n2 = RealVectorX::Zero(n2),
1255 tmp = RealVectorX::Zero(6),
1256 flux = RealVectorX::Zero(n1);
1259 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
1260 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
1261 mat3_n2n2 = RealMatrixX::Zero( n2, n2);
1283 if (bc.
contains(
"normal_rotation")) {
1291 if (vel) libmesh_assert(n_rot);
1293 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
1301 primitive_sol.
zero();
1302 primitive_sol.
init(dim,
1309 sd_primitive_sol.
zero();
1336 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1337 ni(i_dim) = normals[qp](i_dim);
1350 (*vel)(qpoint[qp],
_time, tmp);
1351 dwdot_i = tmp.topRows(3);
1355 Dw_i = tmp.topRows(3);
1361 (*n_rot)(qpoint[qp], normals[qp],
_time, dni);
1364 n_rot->
perturbation(qpoint[qp], normals[qp], _time, Dni);
1368 ui_ni_steady = dwdot_i.dot(ni+dni) - uvec.dot(dni);
1369 flux += ui_ni_steady * vec2_n1;
1370 flux(n1-1) += ui_ni_steady * sd_primitive_sol.
dp;
1373 Dvi_ni = (Dw_i.dot(ni+dni) +
1377 flux += Dvi_ni * vec1_n1;
1378 flux(n1-1) += Dvi_ni * primitive_sol.
p;
1381 flux.segment(1, dim) += (sd_primitive_sol.
dp * ni.segment(0,dim));
1384 f += JxW[qp] * vec2_n2;
1386 if ( request_jacobian ) {
1399 jac += JxW[qp] * mat3_n2n2;
1403 return request_jacobian;
1411 bool request_jacobian,
1414 const unsigned int s,
1426 const unsigned int s,
1438 const std::vector<Real> &JxW = fe->get_JxW();
1439 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
1444 n2 = fe->n_shape_functions()*n1;
1447 vec1_n1 = RealVectorX::Zero(n1),
1448 vec2_n2 = RealVectorX::Zero(n2),
1449 flux = RealVectorX::Zero(n1),
1450 dnormal = RealVectorX::Zero(dim),
1451 uvec = RealVectorX::Zero(3),
1452 ni = RealVectorX::Zero(3),
1453 dwdot_i = RealVectorX::Zero(3),
1454 dni = RealVectorX::Zero(3),
1455 temp_grad = RealVectorX::Zero(dim);
1458 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
1459 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
1460 mat3_n2n2 = RealMatrixX::Zero( n2, n2),
1461 stress = RealMatrixX::Zero( dim, dim),
1462 dprim_dcons = RealMatrixX::Zero( n1, n1),
1463 dcons_dprim = RealMatrixX::Zero( n1, n1);
1471 std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
1485 if (bc.
contains(
"normal_rotation")) {
1493 for (
unsigned int qp=0; qp<JxW.size(); qp++)
1502 primitive_sol.
zero();
1503 primitive_sol.
init(dim,
1510 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1511 ni(i_dim) = normals[qp](i_dim);
1541 flux += ui_ni * vec1_n1;
1542 flux(n1-1) += ui_ni * primitive_sol.
p;
1543 flux.segment(1,dim) += primitive_sol.
p * ni.segment(0,dim);
1558 temp_grad.setZero();
1560 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
1563 flux.segment(1, dim) -= ni(i_dim) * stress.col(i_dim);
1564 flux(n1-1) -= ni(i_dim) * stress.col(i_dim).dot(uvec.segment(0,dim));
1568 flux(n1-1) -= primitive_sol.
k_thermal * temp_grad.dot(ni.segment(0,dim));
1572 f += JxW[qp] * vec2_n2;
1574 if ( request_jacobian ) {
1585 jac += JxW[qp] * mat3_n2n2;
1587 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
1589 for (
unsigned int j_dim=0; j_dim<
dim; j_dim++) {
1597 mat1_n1n1 *= dprim_dcons;
1598 dBmat[j_dim].left_multiply(mat2_n1n2, mat1_n1n1);
1600 jac -= JxW[qp] * mat3_n2n2 * ni(i_dim);
1615 bool request_jacobian,
1618 const unsigned int s,
1631 const unsigned int s,
1641 const std::vector<Real> &JxW = fe->get_JxW();
1642 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
1643 const std::vector<libMesh::Point>& qpoint = fe->get_xyz();
1648 n2 = fe->n_shape_functions()*n1;
1651 vec1_n1 = RealVectorX::Zero(n1),
1652 vec2_n1 = RealVectorX::Zero(n1),
1653 vec3_n2 = RealVectorX::Zero(n2),
1654 flux = RealVectorX::Zero(n1),
1655 eig_val = RealVectorX::Zero(n1),
1656 dnormal = RealVectorX::Zero(dim);
1659 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
1660 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
1661 mat3_n2n2 = RealMatrixX::Zero( n2, n2),
1662 leig_vec = RealMatrixX::Zero( n1, n1),
1663 leig_vec_inv_tr = RealMatrixX::Zero( n1, n1);
1672 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
1681 primitive_sol.
zero();
1682 primitive_sol.
init(dim,
1697 mat1_n1n1 = leig_vec_inv_tr;
1698 for (
unsigned int j=0; j<n1; j++)
1700 mat1_n1n1.col(j) *= eig_val(j);
1702 mat1_n1n1.col(j) *= 0.0;
1704 mat1_n1n1 *= leig_vec.transpose();
1710 flux = mat1_n1n1 * vec2_n1;
1713 f += JxW[qp] * vec3_n2;
1718 mat1_n1n1 = leig_vec_inv_tr;
1719 for (
unsigned int j=0; j<n1; j++)
1721 mat1_n1n1.col(j) *= eig_val(j);
1723 mat1_n1n1.col(j) *= 0.0;
1725 mat1_n1n1 *= leig_vec.transpose();
1726 flux = mat1_n1n1 * vec1_n1;
1729 f += JxW[qp] * vec3_n2;
1732 if ( request_jacobian)
1739 mat1_n1n1 = leig_vec_inv_tr;
1740 for (
unsigned int j=0; j<n1; j++)
1742 mat1_n1n1.col(j) *= eig_val(j);
1744 mat1_n1n1.col(j) *= 0.0;
1745 mat1_n1n1 *= leig_vec.transpose();
1749 jac += JxW[qp] * mat3_n2n2;
1762 bool request_jacobian,
1765 const unsigned int s,
1776 const std::vector<Real> &JxW = fe->get_JxW();
1777 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
1782 n2 = fe->n_shape_functions()*n1;
1785 vec1_n1 = RealVectorX::Zero(n1),
1786 vec2_n1 = RealVectorX::Zero(n1),
1787 vec3_n2 = RealVectorX::Zero(n2),
1788 flux = RealVectorX::Zero(n1),
1789 eig_val = RealVectorX::Zero(n1),
1790 dnormal = RealVectorX::Zero(dim);
1793 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
1794 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
1795 mat3_n2n2 = RealMatrixX::Zero( n2, n2),
1796 leig_vec = RealMatrixX::Zero( n1, n1),
1797 leig_vec_inv_tr = RealMatrixX::Zero( n1, n1);
1806 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
1815 primitive_sol.
zero();
1816 primitive_sol.
init(dim,
1831 mat1_n1n1 = leig_vec_inv_tr;
1832 for (
unsigned int j=0; j<n1; j++)
1834 mat1_n1n1.col(j) *= eig_val(j);
1836 mat1_n1n1.col(j) *= 0.0;
1838 mat1_n1n1 *= leig_vec.transpose();
1852 flux = mat1_n1n1 * vec2_n1;
1854 f += JxW[qp] * vec3_n2;
1868 const unsigned int s,
1874 const std::vector<Real> &JxW = fe->get_JxW();
1875 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
1880 n2 = fe->n_shape_functions()*n1;
1883 vec1_n1 = RealVectorX::Zero(n1),
1884 vec2_n2 = RealVectorX::Zero(n2),
1885 load = RealVectorX::Zero(3),
1886 load_sens = RealVectorX::Zero(3);
1889 dload_dX = RealMatrixX::Zero( 3, n1);
1898 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
1905 primitive_sol.
zero();
1906 primitive_sol.
init(dim,
1913 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1914 load(i_dim) += JxW[qp] * primitive_sol.
p * normals[qp](i_dim);
1918 if (request_derivative) {
1921 (primitive_sol, vec1_n1);
1924 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1925 dload_dX.row(i_dim) += JxW[qp] * vec2_n2 * normals[qp](i_dim);
1938 primitive_sol_sens.
zero();
1941 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
1942 load_sens(i_dim) += JxW[qp] *
1943 (primitive_sol_sens.
dp * normals[qp](i_dim) +
1944 primitive_sol.
p * 0.);
1955 const unsigned int dim,
1959 const std::vector<std::vector<Real> >& phi_fe = fe.
get_phi();
1961 const unsigned int n_phi = (
unsigned int)phi_fe.size();
1967 for (
unsigned int i_nd=0; i_nd<n_phi; i_nd++ )
1968 phi(i_nd) = phi_fe[i_nd][qp];
1979 const unsigned int dim,
1981 std::vector<MAST::FEMOperatorMatrix>& dBmat) {
1983 libmesh_assert(dBmat.size() ==
dim);
1985 const std::vector<std::vector<libMesh::RealVectorValue> >& dphi = fe.
get_dphi();
1987 const unsigned int n_phi = (
unsigned int)dphi.size();
1991 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++) {
1993 for (
unsigned int i_nd=0; i_nd<n_phi; i_nd++ )
1994 phi(i_nd) = dphi[i_nd][qp](i_dim);
1995 dBmat[i_dim].reinit(dim+2, phi);
2003 const unsigned int dim,
2005 std::vector<std::vector<MAST::FEMOperatorMatrix>>& d2Bmat) {
2007 libmesh_assert(d2Bmat.size() ==
dim);
2008 for (
unsigned int i=0; i<
dim; i++)
2009 libmesh_assert(d2Bmat[i].size() ==
dim);
2011 const std::vector<std::vector<libMesh::RealTensorValue> >& d2phi = fe.
get_d2phi();
2013 const unsigned int n_phi = (
unsigned int)d2phi.size();
2017 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
2018 for (
unsigned int j_dim=0; j_dim<
dim; j_dim++) {
2020 for (
unsigned int i_nd=0; i_nd<n_phi; i_nd++ )
2021 phi(i_nd) = d2phi[i_nd][qp](i_dim, j_dim);
2022 d2Bmat[i_dim][j_dim].reinit(dim+2, phi);
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
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...
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)
Real rho_u2_sens_rho() const
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)
Real rho_sens_rho() const
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 get_uvec(RealVectorX &u) const
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
virtual bool velocity_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac)
inertial force contribution to system residual
virtual const std::vector< std::vector< libMesh::RealTensorValue > > & get_d2phi() const
void calculate_advection_flux_jacobian_sensitivity_for_conservative_variable(const unsigned int calculate_dim, const MAST::PrimitiveSolution &sol, std::vector< RealMatrixX > &mat)
void calculate_diffusion_flux(const unsigned int calculate_dim, const MAST::PrimitiveSolution &sol, const RealMatrixX &stress_tensor, const RealVectorX &temp_gradient, RealVectorX &flux)
virtual const std::vector< std::vector< libMesh::RealVectorValue > > & get_dphi() const
virtual const std::vector< std::vector< Real > > & get_phi() const
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 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 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
bool contains(const std::string &nm) const
checks if the card contains the specified property value
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
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
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
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
Real rho_e_sens_rho() const
void right_multiply(T &r, const T &m) const
[R] = [this] * [M]
void get_duvec(typename VectorType< ValType >::return_type &du) const
void vector_mult_transpose(T &res, const T &v) const
res = v^T * [this]
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 right_multiply_transpose(T &r, const T &m) const
[R] = [this]^T * [M]
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 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.
const ValType & get(const std::string &nm) const
returns a constant reference to the specified function
virtual std::unique_ptr< MAST::FEBase > init_side_fe(unsigned int s, bool init_grads, bool init_second_order_derivative, int extra_quadrature_order=0) const
initializes the finite element shape function and quadrature object for the side with the order of qu...
virtual bool far_field_surface_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
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 left_multiply(T &r, const T &m) const
[R] = [M] * [this]
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)
Real rho_u1_sens_rho() const
virtual void perturbation(ValType &v) const
calculates the perturbation and returns it in v.
void get_infinity_vars(RealVectorX &vars_inf) const
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)
ConservativeFluidElementBase(MAST::SystemInitialization &sys, const MAST::GeomElem &elem, const MAST::FlightCondition &f)
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()
This is the base class for elements that implement calculation of finite element quantities over the ...