From 6ae15429daec3a47a8218b72de3787b182d6de7e Mon Sep 17 00:00:00 2001 From: wolf Date: Sun, 10 Apr 2005 18:08:39 +0000 Subject: [PATCH] Resolve one of the TODOs. Docs still missing. git-svn-id: https://svn.dealii.org/trunk@10466 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-18/step-18.cc | 129 +++++----------------------- 1 file changed, 23 insertions(+), 106 deletions(-) diff --git a/deal.II/examples/step-18/step-18.cc b/deal.II/examples/step-18/step-18.cc index d55b5b2089..4016d22861 100644 --- a/deal.II/examples/step-18/step-18.cc +++ b/deal.II/examples/step-18/step-18.cc @@ -11,6 +11,8 @@ /* to the file deal.II/doc/license.html for the text and */ /* further information on this license. */ +//TODO: +#define deal_II_dimension 2 // First the usual list of header files that // have already been used in previous example @@ -109,100 +111,27 @@ namespace QuasiStaticElasticity { SymmetricTensor<2,dim> old_stress; }; - - -//TODO: - namespace MaterialModel - { - template - class Base - { - public: - virtual - ~Base (); - - virtual - SymmetricTensor<4,dim> - stress_strain_tensor (const PointHistory &point_history) const = 0; - }; - - - template - Base::~Base () - {} - - template - class LinearElasticity : public Base - { - public: - LinearElasticity (const double lambda, - const double mu); - - virtual - SymmetricTensor<4,dim> - stress_strain_tensor (const PointHistory &point_history) const; - - protected: - const SymmetricTensor<4,dim> linear_stress_strain_tensor; - - private: - static - SymmetricTensor<4,dim> - get_linear_tensor (const double lambda, - const double mu); - }; - - - template - LinearElasticity::LinearElasticity (const double lambda, - const double mu) - : - linear_stress_strain_tensor (get_linear_tensor (lambda, - mu)) - {} - - - template - inline - SymmetricTensor<4,dim> - LinearElasticity:: - stress_strain_tensor (const PointHistory &/*point_history*/) const - { - // note that this model is independent of - // the point's history, i.e. prior - // deformation does not play a role - return linear_stress_strain_tensor; - } - - - - template - SymmetricTensor<4,dim> - LinearElasticity:: - get_linear_tensor (const double lambda, - const double mu) - { - SymmetricTensor<4,dim> tmp; - for (unsigned int i=0; i + SymmetricTensor<4,dim> + get_stress_strain_tensor (const double lambda, const double mu) + { + SymmetricTensor<4,dim> tmp; + for (unsigned int i=0; i - material_model (/*lambda=*/9.695e10, - /*mu =*/7.617e10); + const SymmetricTensor<4,deal_II_dimension> stress_strain_tensor + = get_stress_strain_tensor (/*lambda = */ 9.695e10, + /*mu = */ 7.617e10); // @sect3{Auxiliary functions} @@ -1406,17 +1335,10 @@ namespace QuasiStaticElasticity eps_phi_i = get_strain (fe_values, i, q_point), eps_phi_j = get_strain (fe_values, j, q_point); - const PointHistory &point_history - = reinterpret_cast*> - (cell->user_pointer())[q_point]; - cell_matrix(i,j) - += - (eps_phi_i * - material_model.stress_strain_tensor(point_history) * - eps_phi_j) - * - fe_values.JxW(q_point); + += (eps_phi_i * stress_strain_tensor * eps_phi_j + * + fe_values.JxW(q_point)); } @@ -2505,11 +2427,6 @@ namespace QuasiStaticElasticity // points of this cell: for (unsigned int q=0; q &point_history - = reinterpret_cast*> - (cell->user_pointer())[q]; - // On each quadrature point, // compute the strain increment // from the gradients, and @@ -2522,7 +2439,7 @@ namespace QuasiStaticElasticity const SymmetricTensor<2,dim> new_stress = (local_quadrature_points_history[q].old_stress + - (material_model.stress_strain_tensor(point_history) * + (stress_strain_tensor * get_strain (displacement_increment_grads[q]))); // Finally, we have to rotate -- 2.39.5