Skip to content
Snippets Groups Projects
Commit 7c11fcc7 authored by Elias Pipping's avatar Elias Pipping
Browse files

IsotropicTensor: Avoid unnecessary arithmetic

parent a1173936
No related branches found
No related tags found
No related merge requests found
......@@ -6,18 +6,19 @@
template <int dim, typename field_type = double>
class IsotropicTensor : public ElasticityTensor<dim, field_type> {
public:
IsotropicTensor(field_type E, field_type nu) : E_(E), nu_(nu) {}
IsotropicTensor(field_type E, field_type nu)
: twoMu_(E / (1 + nu)), lambda_(nu * twoMu_ / (1 - 2 * nu)) {}
void virtual mv(SymmetricTensor<dim> const &x,
SymmetricTensor<dim> &y) const override {
y = x;
y *= E_ / (1 + nu_);
y.addToDiag(E_ * nu_ / (1.0 + nu_) / (1.0 - 2.0 * nu_) * x.trace());
y *= twoMu_;
y.addToDiag(lambda_ * x.trace());
}
private:
field_type const E_;
field_type const nu_;
field_type const twoMu_;
field_type const lambda_;
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment