MAST
level_set_elem_base.cpp
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2019 Manav Bhatia
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 // MAST includes
25 #include "base/parameter.h"
28 #include "base/nonlinear_system.h"
29 #include "base/assembly_base.h"
30 #include "mesh/fe_base.h"
31 #include "mesh/geom_elem.h"
34 
35 
38  MAST::AssemblyBase& assembly,
39  const MAST::GeomElem& elem):
40 MAST::ElementBase(sys, assembly, elem),
41 _phi_vel (nullptr),
42 _if_propagation (true) {
43 
44 }
45 
46 
47 
49 
50 }
51 
52 
53 
54 void
57 
58  libmesh_assert(!_if_propagation);
59  _ref_sol = sol;
60 }
61 
62 
63 
64 bool
66  RealVectorX& f,
67  RealMatrixX& jac) {
68 
69  libmesh_assert(_phi_vel);
70 
71  std::unique_ptr<MAST::FEBase> fe(_elem.init_fe(true, false));
72 
73  const std::vector<Real>& JxW = fe->get_JxW();
74  const std::vector<libMesh::Point>& xyz = fe->get_xyz();
75  const unsigned int
76  n_phi = fe->n_shape_functions(),
77  dim = _elem.dim();
78 
80  eye = RealMatrixX::Identity(1, 1),
81  tau = RealMatrixX::Zero( 1, 1),
82  mat1_n1n2 = RealMatrixX::Zero( 1, n_phi),
83  mat2_n1n2 = RealMatrixX::Zero( 1, n_phi),
84  mat_n2n2 = RealMatrixX::Zero(n_phi, n_phi);
86  vec1_n1 = RealVectorX::Zero(1),
87  vec2_n1 = RealVectorX::Zero(1),
88  vec2_n2 = RealVectorX::Zero(n_phi),
89  flux = RealVectorX::Zero(1),
90  vel = RealVectorX::Zero(dim);
91  Real
92  dc = 0.,
93  source = 0.;
94 
95  std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
97 
98 
99  for (unsigned int qp=0; qp<JxW.size(); qp++) {
100 
101  // initialize the Bmat operator for this term
102  _initialize_fem_operators(qp, *fe, Bmat, dBmat);
103 
104  _velocity_and_source(qp, xyz[qp], _time, Bmat, dBmat, vel, source);
105  _tau(*fe, qp, Bmat, dBmat, vel, tau);
106  _dc_operator(*fe, qp, dBmat, vel, dc);
107 
108  // calculate the flux for each dimension and add its weighted
109  // component to the residual
110  flux.setZero();
111  mat2_n1n2.setZero();
112  for (unsigned int j=0; j<dim; j++) {
113 
114  dBmat[j].right_multiply(vec1_n1, _sol); // dphi_dx_j
115  flux += vel(j) * vec1_n1; // v_j dphi_dx_j
116  dBmat[j].left_multiply(mat1_n1n2, eye); // dBmat
117  mat2_n1n2 += mat1_n1n2 * vel(j); // dBmat V_j
118  }
119 
120  // add to the residual vector
121  flux(0) -= source; // V.grad(phi) - s
122  Bmat.vector_mult_transpose(vec2_n2, flux);
123  f += JxW[qp] * vec2_n2; // int_omega u (V.grad(phi)-s)
124  f += JxW[qp] * mat2_n1n2.transpose() * tau * flux; // int_omega V.grad(u) tau (V.grad(phi)-s)
125 
126  // discontinuity capturing
127  for (unsigned int j=0; j<dim; j++) {
128 
129  dBmat[j].vector_mult(vec1_n1, _sol);
130  dBmat[j].vector_mult_transpose(vec2_n2, vec1_n1);
131  f += JxW[qp] * dc * vec2_n2;
132  }
133 
134 
135  if (request_jacobian) {
136 
137  for (unsigned int j=0; j<dim; j++) {
138 
139  Bmat.right_multiply_transpose(mat_n2n2, dBmat[j]);
140  jac += JxW[qp] * vel(j) * mat_n2n2; // int_omega u V.grad(phi)
141 
142  // discontinuity capturing term
143  dBmat[j].right_multiply_transpose(mat_n2n2, dBmat[j]); // dB_i^T dc dB_i
144  jac += JxW[qp] * dc * mat_n2n2;
145  }
146 
147  jac += JxW[qp] * mat2_n1n2.transpose() * tau * mat2_n1n2; // int_omega V.grad(u) tau (V.grad(phi))
148  }
149  }
150 
151  return request_jacobian;
152 }
153 
154 
155 
156 
157 
158 bool
160  RealVectorX& f,
161  RealMatrixX& jac_xdot,
162  RealMatrixX& jac) {
163 
164  libmesh_assert(_phi_vel);
165 
166  std::unique_ptr<MAST::FEBase> fe(_elem.init_fe(true, false));
167 
168  const std::vector<Real>& JxW = fe->get_JxW();
169  const std::vector<libMesh::Point>& xyz = fe->get_xyz();
170  const unsigned int
171  n_phi = fe->n_shape_functions(),
172  dim = _elem.dim();
173 
175  eye = RealMatrixX::Identity(1, 1),
176  tau = RealMatrixX::Zero( 1, 1),
177  mat1_n1n2 = RealMatrixX::Zero( 1, n_phi),
178  mat2_n1n2 = RealMatrixX::Zero( 1, n_phi),
179  mat_n2n1 = RealMatrixX::Zero(n_phi, 1),
180  mat_n2n2 = RealMatrixX::Zero(n_phi, n_phi);
182  vec1_n1 = RealVectorX::Zero(1),
183  vec2_n2 = RealVectorX::Zero(n_phi),
184  flux = RealVectorX::Zero(1),
185  vel = RealVectorX::Zero(dim);
186  Real
187  source = 0.;
188 
189  std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
191 
192 
193  for (unsigned int qp=0; qp<JxW.size(); qp++) {
194 
195  // initialize the Bmat operator for this term
196  _initialize_fem_operators(qp, *fe, Bmat, dBmat);
197 
198  _velocity_and_source(qp, xyz[qp], _time, Bmat, dBmat, vel, source);
199  _tau(*fe, qp, Bmat, dBmat, vel, tau);
200 
201  // calculate the flux for each dimension and add its weighted
202  // component to the residual
203  mat2_n1n2.setZero();
204  for (unsigned int j=0; j<dim; j++) {
205 
206  dBmat[j].left_multiply(mat1_n1n2, eye); // dBmat
207  mat2_n1n2 += mat1_n1n2 * vel(j); // dBmat_j V_j
208  }
209 
210  // add to the residual vector
211  Bmat.right_multiply(vec1_n1, _vel); // dphi/dt
212  Bmat.vector_mult_transpose(vec2_n2, vec1_n1);
213  f += JxW[qp] * vec2_n2; // int_omega u dphi/dt
214  f += JxW[qp] * mat2_n1n2.transpose() * tau * vec1_n1; // int_omega V.grad(u) tau dphi/dt
215 
216  if (request_jacobian) {
217 
218  Bmat.right_multiply_transpose(mat_n2n2, Bmat);
219  jac_xdot += JxW[qp] * mat_n2n2; // int_omega u dphi/dt
220 
221  mat_n2n1 = mat2_n1n2.transpose()*tau;
222  Bmat.left_multiply(mat_n2n2, mat_n2n1);
223  jac_xdot += JxW[qp] * mat_n2n2; // int_omega V.grad(u) tau dphi/dt
224  }
225  }
226 
227  return request_jacobian;
228 }
229 
230 
231 
232 
233 bool
235 side_external_residual (bool request_jacobian,
236  RealVectorX& f,
237  RealMatrixX& jac,
238  std::multimap<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>& bc) {
239 
240  libmesh_assert(false);
241  return false;
242 }
243 
244 
245 
246 
247 
248 bool
250 volume_external_residual (bool request_jacobian,
251  RealVectorX& f,
252  RealMatrixX& jac,
253  std::multimap<libMesh::subdomain_id_type, MAST::BoundaryConditionBase*>& bc) {
254 
255  libmesh_assert(false);
256  return false;
257 }
258 
259 
260 
261 bool
263 side_external_residual_sensitivity (bool request_jacobian,
264  RealVectorX& f,
265  RealMatrixX& jac,
266  std::multimap<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>& bc) {
267 
268  libmesh_assert(false);
269  return false;
270 }
271 
272 
273 
274 
275 bool
278  RealVectorX& f,
279  RealMatrixX& jac,
280  std::multimap<libMesh::subdomain_id_type, MAST::BoundaryConditionBase*>& bc) {
281 
282  libmesh_assert(false);
283  return false;
284 }
285 
286 
287 
288 
289 bool
291 internal_residual_sensitivity (bool request_jacobian,
292  RealVectorX& f,
293  RealMatrixX& jac) {
294 
295  libmesh_assert(false); // should not get called
296  return request_jacobian;
297 }
298 
299 
300 
301 bool
303 velocity_residual_sensitivity (bool request_jacobian,
304  RealVectorX& f,
305  RealMatrixX& jac) {
306 
307  libmesh_assert(false); // should not get called.
308  return request_jacobian;
309 }
310 
311 
312 
313 Real
315 
316  std::unique_ptr<MAST::FEBase> fe(_elem.init_fe(true, false));
317 
318  const std::vector<Real>& JxW = fe->get_JxW();
319  const unsigned int
320  dim = _elem.dim();
321 
323  phi = RealVectorX::Zero(1);
324 
325  Real
326  vol = 0.;
327 
328  std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
330 
331 
332  for (unsigned int qp=0; qp<JxW.size(); qp++) {
333 
334  // initialize the Bmat operator for this term
335  _initialize_fem_operators(qp, *fe, Bmat, dBmat);
336  Bmat.right_multiply(phi, _sol);
337  if (phi(0) > 0.) vol += JxW[qp];
338  }
339 
340  return vol;
341 }
342 
343 
344 Real
346 
347  std::unique_ptr<MAST::FEBase> fe(_elem.init_fe(true, false));
348 
349  const std::vector<Real>& JxW = fe->get_JxW();
350  const unsigned int
351  dim = _elem.dim();
352 
354  phi = RealVectorX::Zero(1);
355 
356  Real
357  d = 1.e-1,
358  pi = acos(-1.),
359  per = 0.;
360 
361  std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
363 
364 
365  for (unsigned int qp=0; qp<JxW.size(); qp++) {
366 
367  // initialize the Bmat operator for this term
368  _initialize_fem_operators(qp, *fe, Bmat, dBmat);
369  Bmat.right_multiply(phi, _sol);
370  per += 1./pi/d/(1.+pow(phi(0)/d, 2)) * JxW[qp];
371  }
372 
373  return per;
374 }
375 
376 
377 Real
379 
380  std::unique_ptr<MAST::FEBase> fe(_elem.init_fe(true, false));
381 
382  const std::vector<Real>& JxW = fe->get_JxW();
383  const unsigned int
384  dim = _elem.dim();
385 
387  phi = RealVectorX::Zero(1),
388  dphidp = RealVectorX::Zero(1);
389 
390  Real
391  d = 1.e-1,
392  pi = acos(-1.),
393  dper_dp = 0.;
394 
395  std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
397 
398 
399  for (unsigned int qp=0; qp<JxW.size(); qp++) {
400 
401  // initialize the Bmat operator for this term
402  _initialize_fem_operators(qp, *fe, Bmat, dBmat);
403  Bmat.right_multiply(phi, _sol);
404  Bmat.right_multiply(dphidp, _sol_sens);
405  dper_dp -= 2.*phi(0)/pi/pow(d,3)/pow(1.+pow(phi(0)/d, 2),2) * dphidp(0) * JxW[qp];
406  }
407 
408  return dper_dp;
409 }
410 
411 
412 
413 
414 Real
416 
417  std::unique_ptr<MAST::FEBase> fe(_elem.init_side_fe(s, true));
418 
419  const std::vector<Real>& JxW = fe->get_JxW();
420  const unsigned int
421  dim = _elem.dim();
422 
424  phi = RealVectorX::Zero(1),
425  gradphi = RealVectorX::Zero(dim),
426  dphidp = RealVectorX::Zero(1),
427  vel = RealVectorX::Zero(dim);
428 
429  Real
430  vn = 0.,
431  dvoldp = 0.;
432 
433  std::vector<MAST::FEMOperatorMatrix> dBmat(dim);
435 
436 
437  for (unsigned int qp=0; qp<JxW.size(); qp++) {
438 
439  // initialize the Bmat operator for this term
440  _initialize_fem_operators(qp, *fe, Bmat, dBmat);
441 
442  // first calculate gradient of phi
443  for (unsigned int i=0; i<dim; i++) {
444  dBmat[i].right_multiply(phi, _sol);
445  gradphi(i) = phi(0);
446  }
447 
448  // initialize the Bmat operator for this term
449  _initialize_fem_operators(qp, *fe, Bmat, dBmat);
450  Bmat.right_multiply(phi, _sol);
451  Bmat.right_multiply(dphidp, _sol_sens);
452 
453  // at boundary, phi(x) = 0
454  // so, dphi/dp + grad(phi) . V = 0
455  // dphi/dp + grad(phi) . (-grad(phi)/|grad(phi)| Vn) = 0 [since V = -grad(phi)/|grad(phi)| Vn]
456  // dphi/dp -(grad(phi) . grad(phi))/|grad(phi)| Vn = 0
457  // Vn = (dphi/dp) |grad(phi)| / |grad(phi)|^2 = (dphi/dp) / |grad(phi)|
458  vn = dphidp(0) / gradphi.norm();
459 
460  // vol = int_omega dOmega
461  // dvol/dp = int_Gamma Vn dGamma
462  dvoldp += vn * JxW[qp];
463  }
464 
465  return dvoldp;
466 }
467 
468 
469 
470 void
472  const libMesh::Point& p,
473  const Real t,
474  const MAST::FEMOperatorMatrix& Bmat,
475  const std::vector<MAST::FEMOperatorMatrix>& dBmat,
476  RealVectorX& vel,
477  Real& source) {
478 
479  const unsigned int
480  dim = _elem.dim();
481 
483  v = RealVectorX::Zero(1),
484  grad_phi = RealVectorX::Zero(dim);
485 
486  // first initialize grad(phi)
487  for (unsigned int i=0; i<dim; i++) {
488 
489  dBmat[i].right_multiply(v, _sol);
490  grad_phi(i) = v(0);
491  }
492 
493  if (_if_propagation) {
494 
495  // now, initialize the velocity vector
496  Real
497  Vn = 0.;
498 
499  (*_phi_vel)(p, t, Vn);
500  vel = grad_phi * (-Vn/grad_phi.norm());
501  source = 0.;
502  }
503  else {
504 
505  libmesh_assert_equal_to(_ref_sol.size(), _sol.size());
506 
507  Bmat.right_multiply(v, _ref_sol);
508 
509  Real
510  tol = 1.e-6,
511  ref_phi = v(0),
512  grad_phi_norm = grad_phi.norm();
513 
514  source = ref_phi/pow(pow(ref_phi,2)+ tol*pow(grad_phi_norm,2), 0.5);
515 
516  if (grad_phi_norm > tol)
517  vel = grad_phi * source/grad_phi.norm();
518  else
519  vel.setZero();
520  }
521 }
522 
523 
524 void
526  unsigned int qp,
527  const MAST::FEMOperatorMatrix& Bmat,
528  const std::vector<MAST::FEMOperatorMatrix>& dBmat,
529  const RealVectorX& vel,
530  RealMatrixX& tau) {
531 
532  const std::vector<std::vector<libMesh::RealVectorValue> >& dphi = fe.get_dphi();
533  const unsigned int n_phi = (unsigned int)fe.n_shape_functions();
535  phi = RealVectorX::Zero(n_phi);
536 
537  Real
538  tol = 1.e-6,
539  val1 = 0.,
540  val2 = 0.,
541  vel_l2 = vel.norm();
542 
543  libMesh::Point
544  nvec;
545 
546  if (vel_l2 > tol) {
547  for ( unsigned int i_nd=0; i_nd<n_phi; i_nd++ ) {
548 
549  nvec = dphi[i_nd][qp];
550  val2 = 0.;
551  for (unsigned int i_dim=0; i_dim<_elem.dim(); i_dim++)
552  val2 += nvec(i_dim) * vel(i_dim);
553 
554  val1 += std::fabs(val2);
555  }
556 
557  tau(0,0) = 1./val1;
558  }
559  else
560  tau(0,0) = 0.;
561 }
562 
563 
564 
565 
566 void
568  const unsigned int qp,
569  const std::vector<MAST::FEMOperatorMatrix>& dB_mat,
570  const RealVectorX& vel,
571  Real& dc) {
572 
573  unsigned int
574  dim = _elem.dim();
575 
577  dphi = RealVectorX::Zero(dim),
578  vec1 = RealVectorX::Zero(1),
579  dflux = RealVectorX::Zero(1);
580 
582  dxi_dX = RealMatrixX::Zero(dim, dim);
583 
584 
585  _calculate_dxidX(fe, qp, dxi_dX);
586 
587  for (unsigned int i=0; i<dim; i++) {
588 
589  dB_mat[i].vector_mult(vec1, _sol); // dphi/dx_i
590  dflux(0) += vel(i) * vec1(0); // V.grad(phi)
591  dphi(i) = vec1(0); // grad(phi)
592  }
593 
594  Real
595  val1 = 1.0e-6;
596 
597  for (unsigned int i=0; i<dim; i++) {
598 
599  vec1.setZero();
600 
601  for (unsigned int j=0; j<dim; j++)
602  vec1(0) += dxi_dX(i, j) * dphi(j);
603 
604  // calculate the value of denominator
605  val1 += pow(vec1.norm(), 2);
606  }
607 
608  dc = 0.5*dflux.norm()/pow(val1, 0.5);
609 }
610 
611 
612 
613 void
616  const unsigned int qp,
617  RealMatrixX& dxi_dX) {
618 
619 
620  // initialize dxi_dX and dX_dxi
621  unsigned int
622  dim = _elem.dim();
623  Real
624  val = 0.;
625  dxi_dX.setZero();
626 
627  for (unsigned int i_dim=0; i_dim<dim; i_dim++)
628  for (unsigned int j_dim=0; j_dim<dim; j_dim++)
629  {
630  switch (i_dim)
631  {
632  case 0:
633  {
634  switch (j_dim)
635  {
636  case 0:
637  val = fe.get_dxidx()[qp];
638  break;
639  case 1:
640  val = fe.get_dxidy()[qp];
641  break;
642  case 2:
643  val = fe.get_dxidz()[qp];
644  break;
645  }
646  }
647  break;
648  case 1:
649  {
650  switch (j_dim)
651  {
652  case 0:
653  val = fe.get_detadx()[qp];
654  break;
655  case 1:
656  val = fe.get_detady()[qp];
657  break;
658  case 2:
659  val = fe.get_detadz()[qp];
660  break;
661  }
662  }
663  break;
664  case 2:
665  {
666  switch (j_dim)
667  {
668  case 0:
669  val = fe.get_dzetadx()[qp];
670  break;
671  case 1:
672  val = fe.get_dzetady()[qp];
673  break;
674  case 2:
675  val = fe.get_dzetadz()[qp];
676  break;
677  }
678  }
679  break;
680  }
681  dxi_dX(i_dim, j_dim) = val;
682  }
683 }
684 
685 
686 
687 void
689 _initialize_fem_operators(const unsigned int qp,
690  const MAST::FEBase& fe,
692  std::vector<MAST::FEMOperatorMatrix>& dBmat) {
693 
694  const std::vector<std::vector<Real> >& phi_fe = fe.get_phi();
695  const std::vector<std::vector<libMesh::RealVectorValue> >& dphi = fe.get_dphi();
696 
697  const unsigned int n_phi = (unsigned int)phi_fe.size();
698 
700  phi = RealVectorX::Zero(n_phi);
701 
702  // shape function values
703  // N
704  for ( unsigned int i_nd=0; i_nd<n_phi; i_nd++ )
705  phi(i_nd) = phi_fe[i_nd][qp];
706 
707  Bmat.reinit(1, phi);
708 
709  // now set the shape function derivatives
710  for (unsigned int i_dim=0; i_dim<_elem.dim(); i_dim++) {
711 
712  phi.setZero();
713  for ( unsigned int i_nd=0; i_nd<n_phi; i_nd++ )
714  phi(i_nd) = dphi[i_nd][qp](i_dim);
715  dBmat[i_dim].reinit(1, phi); // dT/dx_i
716  }
717 
718 }
719 
720 
virtual bool internal_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac)
internal force contribution to system residual
void _calculate_dxidX(const MAST::FEBase &fe, const unsigned int qp, RealMatrixX &dxi_dX)
virtual const std::vector< Real > & get_detadz() const
Definition: fe_base.cpp:311
void vector_mult_transpose(T &res, const T &v) const
res = v^T * [this]
virtual const std::vector< Real > & get_dzetadx() const
Definition: fe_base.cpp:319
const RealVectorX & sol(bool if_sens=false) const
Definition: elem_base.cpp:53
const MAST::GeomElem & _elem
geometric element for which the computations are performed
Definition: elem_base.h:218
const MAST::FieldFunction< Real > * _phi_vel
element property
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 const std::vector< Real > & get_dxidy() const
Definition: fe_base.cpp:279
virtual const std::vector< Real > & get_dxidz() const
Definition: fe_base.cpp:287
virtual const std::vector< Real > & get_detadx() const
Definition: fe_base.cpp:295
virtual bool velocity_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac)
inertial force contribution to system residual
void _tau(const MAST::FEBase &fe, unsigned int qp, const MAST::FEMOperatorMatrix &Bmat, const std::vector< MAST::FEMOperatorMatrix > &dBmat, const RealVectorX &vel, RealMatrixX &tau)
initializes the tau operator
RealVectorX _vel
local velocity
Definition: elem_base.h:273
void right_multiply(T &r, const T &m) const
[R] = [this] * [M]
Real perimeter()
Approximates the integral of the Dirac delta function to approximate the perimeter.
Real perimeter_sensitivity()
computes the partial derivative of the integral of the Dirac delta function using the solution and se...
libMesh::Real Real
RealVectorX _ref_sol
reference solution for reinitialization of the level set
virtual const std::vector< Real > & get_dzetady() const
Definition: fe_base.cpp:327
Real volume_boundary_velocity_on_side(unsigned int s)
void set_reference_solution_for_initialization(const RealVectorX &sol)
For reinitialization to , the solution before initialization is used to calculate the source and velo...
virtual const std::vector< Real > & get_dzetadz() const
Definition: fe_base.cpp:335
bool volume_external_residual_sensitivity(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, std::multimap< libMesh::subdomain_id_type, MAST::BoundaryConditionBase * > &bc)
sensitivity of the volume external force contribution to system residual
Matrix< Real, Dynamic, Dynamic > RealMatrixX
bool side_external_residual_sensitivity(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 unsigned int n_shape_functions() const
Definition: fe_base.cpp:239
virtual bool velocity_residual_sensitivity(bool request_jacobian, RealVectorX &f, RealMatrixX &jac)
sensitivity of the damping force contribution to system residual
Matrix< Real, Dynamic, 1 > RealVectorX
RealVectorX _sol_sens
local solution sensitivity
Definition: elem_base.h:244
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...
Definition: geom_elem.cpp:159
RealVectorX _sol
local solution
Definition: elem_base.h:238
virtual const std::vector< Real > & get_detady() const
Definition: fe_base.cpp:303
virtual const std::vector< Real > & get_dxidx() const
Definition: fe_base.cpp:271
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
Definition: geom_elem.h:59
virtual const std::vector< std::vector< libMesh::RealVectorValue > > & get_dphi() const
Definition: fe_base.cpp:255
unsigned int dim() const
Definition: geom_elem.cpp:91
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]
bool _if_propagation
this can operate in one of two modes: propagation of level set given Vn, or reinitialization of level...
virtual const std::vector< std::vector< Real > > & get_phi() const
Definition: fe_base.cpp:247
void _initialize_fem_operators(const unsigned int qp, const MAST::FEBase &fe, MAST::FEMOperatorMatrix &Bmat, std::vector< MAST::FEMOperatorMatrix > &dBmat)
When mass = false, initializes the FEM operator matrix to the shape functions as ...
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...
Definition: geom_elem.cpp:142
const Real & _time
time for which system is being assembled
Definition: elem_base.h:232
bool volume_external_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, std::multimap< libMesh::subdomain_id_type, MAST::BoundaryConditionBase * > &bc)
volume external force contribution to system residual
void _velocity_and_source(const unsigned int qp, const libMesh::Point &p, const Real t, const MAST::FEMOperatorMatrix &Bmat, const std::vector< MAST::FEMOperatorMatrix > &dBmat, RealVectorX &vel, Real &source)
calculates the velocity at the quadrature point
LevelSetElementBase(MAST::SystemInitialization &sys, MAST::AssemblyBase &assembly, const MAST::GeomElem &elem)
Constructor.
virtual bool internal_residual_sensitivity(bool request_jacobian, RealVectorX &f, RealMatrixX &jac)
sensitivity of the internal force contribution to system residual
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
void _dc_operator(const MAST::FEBase &fe, const unsigned int qp, const std::vector< MAST::FEMOperatorMatrix > &dB_mat, const RealVectorX &vel, Real &dc)
This is the base class for elements that implement calculation of finite element quantities over the ...
Definition: elem_base.h:72