Time dependent part(s) of physics for element interiors.
71 &libMesh::FEMContext::interior_rate,
72 &libMesh::DiffContext::get_elem_solution_rate_derivative,
76 const unsigned int n_u_dofs = context.get_dof_indices(this->
_disp_vars.
u()).size();
78 const std::vector<libMesh::Real> &JxW =
79 this->
get_fe(context)->get_JxW();
82 libMesh::DenseSubVector<libMesh::Number> &Fu = context.get_elem_residual(this->
_disp_vars.
u());
83 libMesh::DenseSubVector<libMesh::Number> &Fv = context.get_elem_residual(this->
_disp_vars.
v());
84 libMesh::DenseSubVector<libMesh::Number>* Fw = NULL;
86 libMesh::DenseSubMatrix<libMesh::Number>& Kuu = context.get_elem_jacobian(this->
_disp_vars.
u(),this->
_disp_vars.
u());
87 libMesh::DenseSubMatrix<libMesh::Number>& Kuv = context.get_elem_jacobian(this->
_disp_vars.
u(),this->
_disp_vars.
v());
89 libMesh::DenseSubMatrix<libMesh::Number>& Kvu = context.get_elem_jacobian(this->
_disp_vars.
v(),this->
_disp_vars.
u());
90 libMesh::DenseSubMatrix<libMesh::Number>& Kvv = context.get_elem_jacobian(this->
_disp_vars.
v(),this->
_disp_vars.
v());
92 libMesh::DenseSubMatrix<libMesh::Number>* Kuw = NULL;
93 libMesh::DenseSubMatrix<libMesh::Number>* Kvw = NULL;
95 libMesh::DenseSubMatrix<libMesh::Number>* Kwu = NULL;
96 libMesh::DenseSubMatrix<libMesh::Number>* Kwv = NULL;
97 libMesh::DenseSubMatrix<libMesh::Number>* Kww = NULL;
101 Fw = &context.get_elem_residual(this->
_disp_vars.
w());
110 unsigned int n_qpoints = context.get_element_qrule().n_points();
113 const std::vector<std::vector<libMesh::Real> >& dphi_dxi =
114 this->
get_fe(context)->get_dphidxi();
116 const std::vector<std::vector<libMesh::Real> >& dphi_deta =
117 this->
get_fe(context)->get_dphideta();
119 const libMesh::DenseSubVector<libMesh::Number>& u_coeffs = context.get_elem_solution( this->
_disp_vars.
u() );
120 const libMesh::DenseSubVector<libMesh::Number>& v_coeffs = context.get_elem_solution( this->
_disp_vars.
v() );
121 const libMesh::DenseSubVector<libMesh::Number>* w_coeffs = NULL;
123 const libMesh::DenseSubVector<libMesh::Number>& dudt_coeffs = context.get_elem_solution_rate( this->
_disp_vars.
u() );
124 const libMesh::DenseSubVector<libMesh::Number>& dvdt_coeffs = context.get_elem_solution_rate( this->
_disp_vars.
v() );
125 const libMesh::DenseSubVector<libMesh::Number>* dwdt_coeffs = NULL;
129 w_coeffs = &context.get_elem_solution( this->
_disp_vars.
w() );
130 dwdt_coeffs = &context.get_elem_solution_rate( this->
_disp_vars.
w() );
134 const std::vector<libMesh::RealGradient>& dxdxi = this->
get_fe(context)->get_dxyzdxi();
135 const std::vector<libMesh::RealGradient>& dxdeta = this->
get_fe(context)->get_dxyzdeta();
137 for (
unsigned int qp=0; qp != n_qpoints; qp++)
140 libMesh::Gradient grad_u, grad_v, grad_w;
141 libMesh::Gradient dgradu_dt, dgradv_dt, dgradw_dt;
143 for(
unsigned int d = 0; d < n_u_dofs; d++ )
145 libMesh::RealGradient u_gradphi( dphi_dxi[d][qp], dphi_deta[d][qp] );
146 grad_u += u_coeffs(d)*u_gradphi;
147 grad_v += v_coeffs(d)*u_gradphi;
149 dgradu_dt += dudt_coeffs(d)*u_gradphi;
150 dgradv_dt += dvdt_coeffs(d)*u_gradphi;
154 grad_w += (*w_coeffs)(d)*u_gradphi;
155 dgradw_dt += (*dwdt_coeffs)(d)*u_gradphi;
159 libMesh::RealGradient grad_x( dxdxi[qp](0), dxdeta[qp](0) );
160 libMesh::RealGradient grad_y( dxdxi[qp](1), dxdeta[qp](1) );
161 libMesh::RealGradient grad_z( dxdxi[qp](2), dxdeta[qp](2) );
165 libMesh::Real lambda_sq = 0;
168 grad_u, grad_v, grad_w,
169 a_cov, a_contra, A_cov, A_contra,
172 const unsigned int manifold_dim = 2;
179 libMesh::Real jac = JxW[qp];
181 for (
unsigned int i=0; i != n_u_dofs; i++)
183 libMesh::RealGradient u_gradphi( dphi_dxi[i][qp], dphi_deta[i][qp] );
185 for(
unsigned int alpha = 0; alpha < manifold_dim; alpha++ )
187 for(
unsigned int beta = 0; beta < manifold_dim; beta++ )
190 const libMesh::Real factor = common_factor*tau(alpha,beta);
192 libMesh::Real u_diagterm = dgradu_dt(beta)*u_gradphi(alpha) + dgradu_dt(alpha)*u_gradphi(beta);
193 libMesh::Real v_diagterm = dgradv_dt(beta)*u_gradphi(alpha) + dgradv_dt(alpha)*u_gradphi(beta);
194 libMesh::Real w_diagterm = dgradw_dt(beta)*u_gradphi(alpha) + dgradw_dt(alpha)*u_gradphi(beta);
196 Fu(i) += factor*u_diagterm;
197 Fv(i) += factor*v_diagterm;
200 (*Fw)(i) += factor*w_diagterm;
202 for(
unsigned int lambda = 0; lambda < manifold_dim; lambda++ )
204 for(
unsigned int mu = 0; mu < manifold_dim; mu++ )
206 const libMesh::Real C1 = common_factor*C(alpha,beta,lambda,mu);
208 const libMesh::Real gamma_u = 0.5*( dgradu_dt(lambda)*(grad_x(mu)+grad_u(mu)) +
209 (grad_x(lambda)+grad_u(lambda))*dgradu_dt(mu) );
211 const libMesh::Real gamma_v = 0.5*( dgradv_dt(lambda)*(grad_y(mu)+grad_v(mu)) +
212 (grad_y(lambda)+grad_v(lambda))*dgradv_dt(mu) );
214 const libMesh::Real x_term = C1*( (grad_x(beta)+grad_u(beta))*u_gradphi(alpha) +
215 (grad_x(alpha)+grad_u(alpha))*u_gradphi(beta) );
217 const libMesh::Real y_term = C1*( (grad_y(beta)+grad_v(beta))*u_gradphi(alpha) +
218 (grad_y(alpha)+grad_v(alpha))*u_gradphi(beta) );
220 libMesh::Real gamma_sum = gamma_u + gamma_v;
223 const libMesh::Real gamma_w = 0.5*( dgradw_dt(lambda)*(grad_z(mu)+grad_w(mu)) +
224 (grad_z(lambda)+grad_w(lambda))*dgradw_dt(mu) );
225 gamma_sum += gamma_w;
228 Fu(i) += x_term*gamma_sum;
230 Fv(i) += y_term*gamma_sum;
234 const libMesh::Real z_term = C1*( (grad_z(beta)+grad_w(beta))*u_gradphi(alpha) +
235 (grad_z(alpha)+grad_w(alpha))*u_gradphi(beta) );
237 (*Fw)(i) += z_term*gamma_sum;
245 if( compute_jacobian )
247 for (
unsigned int i=0; i != n_u_dofs; i++)
249 libMesh::RealGradient u_gradphi_i( dphi_dxi[i][qp], dphi_deta[i][qp] );
251 for (
unsigned int j=0; j != n_u_dofs; j++)
253 libMesh::RealGradient u_gradphi_j( dphi_dxi[j][qp], dphi_deta[j][qp] );
255 for(
unsigned int alpha = 0; alpha < manifold_dim; alpha++ )
257 for(
unsigned int beta = 0; beta < manifold_dim; beta++ )
261 const libMesh::Real factor = common_factor*tau(alpha,beta);
263 const libMesh::Real ddiagterm = u_gradphi_j(beta)*u_gradphi_i(alpha) + u_gradphi_j(alpha)*u_gradphi_i(beta);
265 Kuu(i,j) += factor*ddiagterm*context.get_elem_solution_rate_derivative();
266 Kvv(i,j) += factor*ddiagterm*context.get_elem_solution_rate_derivative();
269 (*Kww)(i,j) += factor*ddiagterm*context.get_elem_solution_rate_derivative();
271 libMesh::Real u_diagterm = dgradu_dt(beta)*u_gradphi_i(alpha) + dgradu_dt(alpha)*u_gradphi_i(beta);
272 libMesh::Real v_diagterm = dgradv_dt(beta)*u_gradphi_i(alpha) + dgradv_dt(alpha)*u_gradphi_i(beta);
273 libMesh::Real w_diagterm = 0.0;
275 w_diagterm = dgradw_dt(beta)*u_gradphi_i(alpha) + dgradw_dt(alpha)*u_gradphi_i(beta);
277 for(
unsigned int lambda = 0; lambda < manifold_dim; lambda++ )
279 for(
unsigned int mu = 0; mu < manifold_dim; mu++ )
281 const libMesh::Real dgamma_du = 0.5*( u_gradphi_j(lambda)*(grad_x(mu)+grad_u(mu)) +
282 (grad_x(lambda)+grad_u(lambda))*u_gradphi_j(mu) );
284 const libMesh::Real dgamma_dv = 0.5*( u_gradphi_j(lambda)*(grad_y(mu)+grad_v(mu)) +
285 (grad_y(lambda)+grad_v(lambda))*u_gradphi_j(mu) );
287 const libMesh::Real C1 = common_factor*C(alpha,beta,lambda,mu);
289 const libMesh::Real dfactor_du = C1*dgamma_du*context.get_elem_solution_derivative();
290 const libMesh::Real dfactor_dv = C1*dgamma_dv*context.get_elem_solution_derivative();
292 Kuu(i,j) += u_diagterm*dfactor_du;
293 Kuv(i,j) += u_diagterm*dfactor_dv;
295 Kvu(i,j) += v_diagterm*dfactor_du;
296 Kvv(i,j) += v_diagterm*dfactor_dv;
300 const libMesh::Real dgamma_dw = 0.5*( u_gradphi_j(lambda)*(grad_z(mu)+grad_w(mu)) +
301 (grad_z(lambda)+grad_w(lambda))*u_gradphi_j(mu) );
303 const libMesh::Real dfactor_dw = C1*dgamma_dw*context.get_elem_solution_derivative();
305 (*Kuw)(i,j) += u_diagterm*dfactor_dw;
307 (*Kvw)(i,j) += v_diagterm*dfactor_dw;
309 (*Kwu)(i,j) += w_diagterm*dfactor_du;
310 (*Kwv)(i,j) += w_diagterm*dfactor_dv;
311 (*Kww)(i,j) += w_diagterm*dfactor_dw;
314 const libMesh::Real gamma_u = 0.5*( dgradu_dt(lambda)*(grad_x(mu)+grad_u(mu)) +
315 (grad_x(lambda)+grad_u(lambda))*dgradu_dt(mu) );
317 const libMesh::Real gamma_v = 0.5*( dgradv_dt(lambda)*(grad_y(mu)+grad_v(mu)) +
318 (grad_y(lambda)+grad_v(lambda))*dgradv_dt(mu) );
320 const libMesh::Real x_term = C1*( (grad_x(beta)+grad_u(beta))*u_gradphi_i(alpha) +
321 (grad_x(alpha)+grad_u(alpha))*u_gradphi_i(beta) );
323 const libMesh::Real y_term = C1*( (grad_y(beta)+grad_v(beta))*u_gradphi_i(alpha) +
324 (grad_y(alpha)+grad_v(alpha))*u_gradphi_i(beta) );
326 libMesh::Real gamma_sum = gamma_u + gamma_v;
329 const libMesh::Real gamma_w = 0.5*( dgradw_dt(lambda)*(grad_z(mu)+grad_w(mu)) +
330 (grad_z(lambda)+grad_w(lambda))*dgradw_dt(mu) );
331 gamma_sum += gamma_w;
336 const libMesh::Real dxterm_du = C1*( u_gradphi_j(beta)*u_gradphi_i(alpha)
337 + u_gradphi_j(alpha)*u_gradphi_i(beta) )*context.get_elem_solution_derivative();
339 const libMesh::Real dyterm_dv = dxterm_du;
341 Kuu(i,j) += gamma_sum*dxterm_du;
343 Kvv(i,j) += gamma_sum*dyterm_dv;
345 libMesh::Real z_term = 0.0;
349 z_term = C1*( (grad_z(beta)+grad_w(beta))*u_gradphi_i(alpha) +
350 (grad_z(alpha)+grad_w(alpha))*u_gradphi_i(beta) );
354 const libMesh::Real dzterm_dw = dxterm_du;
356 (*Kww)(i,j) += gamma_sum*dzterm_dw;
359 const libMesh::Real dgamma_sum_du = 0.5*( u_gradphi_j(lambda)*(grad_x(mu)+grad_u(mu))*context.get_elem_solution_rate_derivative()
360 + dgradu_dt(lambda)*u_gradphi_j(mu)*context.get_elem_solution_derivative()
361 + u_gradphi_j(mu)*(grad_x(lambda)+grad_u(lambda))*context.get_elem_solution_rate_derivative()
362 + dgradu_dt(mu)*u_gradphi_j(lambda)*context.get_elem_solution_derivative() );
364 const libMesh::Real dgamma_sum_dv = 0.5*( u_gradphi_j(lambda)*(grad_y(mu)+grad_v(mu))*context.get_elem_solution_rate_derivative()
365 + dgradv_dt(lambda)*u_gradphi_j(mu)*context.get_elem_solution_derivative()
366 + u_gradphi_j(mu)*(grad_y(lambda)+grad_v(lambda))*context.get_elem_solution_rate_derivative()
367 + dgradv_dt(mu)*u_gradphi_j(lambda)*context.get_elem_solution_derivative() );
369 Kuu(i,j) += x_term*dgamma_sum_du;
370 Kuv(i,j) += x_term*dgamma_sum_dv;
372 Kvu(i,j) += y_term*dgamma_sum_du;
373 Kvv(i,j) += y_term*dgamma_sum_dv;
377 const libMesh::Real dgamma_sum_dw = 0.5*( u_gradphi_j(lambda)*(grad_z(mu)+grad_w(mu))*context.get_elem_solution_rate_derivative()
378 + dgradw_dt(lambda)*u_gradphi_j(mu)*context.get_elem_solution_derivative()
379 + u_gradphi_j(mu)*(grad_z(lambda)+grad_w(lambda))*context.get_elem_solution_rate_derivative()
380 + dgradw_dt(mu)*u_gradphi_j(lambda)*context.get_elem_solution_derivative() );
382 (*Kuw)(i,j) += x_term*dgamma_sum_dw;
383 (*Kvw)(i,j) += y_term*dgamma_sum_dw;
384 (*Kwu)(i,j) += z_term*dgamma_sum_du;
385 (*Kwv)(i,j) += z_term*dgamma_sum_dv;
386 (*Kww)(i,j) += z_term*dgamma_sum_dw;
DisplacementVariable & _disp_vars
void mass_residual_impl(bool compute_jacobian, AssemblyContext &context, InteriorFuncType interior_solution, VarDerivType get_solution_deriv, libMesh::Real mu=1.0)
Implementation of mass_residual.
void compute_metric_tensors(unsigned int qp, const libMesh::FEBase &elem, const AssemblyContext &context, const libMesh::Gradient &grad_u, const libMesh::Gradient &grad_v, const libMesh::Gradient &grad_w, libMesh::TensorValue< libMesh::Real > &a_cov, libMesh::TensorValue< libMesh::Real > &a_contra, libMesh::TensorValue< libMesh::Real > &A_cov, libMesh::TensorValue< libMesh::Real > &A_contra, libMesh::Real &lambda_sq)
void compute_stress_and_elasticity(unsigned int dim, const libMesh::TensorValue< libMesh::Real > &g_contra, const libMesh::TensorValue< libMesh::Real > &g_cov, const libMesh::TensorValue< libMesh::Real > &G_contra, const libMesh::TensorValue< libMesh::Real > &G_cov, libMesh::TensorValue< libMesh::Real > &stress, ElasticityTensor &C)
StressStrainLaw _stress_strain_law
libMesh::Real _lambda_factor
unsigned int dim() const
Number of components.
libMesh::Real _h0
Membrane thickness.
const libMesh::FEGenericBase< libMesh::Real > * get_fe(const AssemblyContext &context)