Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shear and compression wave velocities to Linear Elastic Material Properties for #692 #705

Merged
merged 19 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/materials/linear_elastic.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ class LinearElastic : public Material<Tdim> {
double poisson_ratio_{std::numeric_limits<double>::max()};
//! Bulk modulus
double bulk_modulus_{std::numeric_limits<double>::max()};
//! Compressional Wave Velocity
double vp_{std::numeric_limits<double>::max()};
//! Shear Wave Velocity
double vs_{std::numeric_limits<double>::max()};
}; // LinearElastic class
} // namespace mpm

Expand Down
14 changes: 14 additions & 0 deletions include/materials/linear_elastic.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,24 @@ mpm::LinearElastic<Tdim>::LinearElastic(unsigned id,
material_properties.at("youngs_modulus").template get<double>();
poisson_ratio_ =
material_properties.at("poisson_ratio").template get<double>();

// Calculate bulk modulus
bulk_modulus_ = youngs_modulus_ / (3.0 * (1. - 2. * poisson_ratio_));

// Calculate constrained and shear modulus
double constrained_modulus =
youngs_modulus_ * (1. - poisson_ratio_) /
((1. + poisson_ratio_) * (1. - 2. * poisson_ratio_));
double shear_modulus = youngs_modulus_ / (2.0 * (1. + poisson_ratio_));

// Calculate wave velocities
vp_ = sqrt(constrained_modulus / density_);
vs_ = sqrt(shear_modulus / density_);

properties_ = material_properties;
properties_["pwave_velocity"] = vp_;
properties_["swave_velocity"] = vs_;

// Set elastic tensor
this->compute_elastic_tensor();
} catch (Json::exception& except) {
Expand Down
30 changes: 28 additions & 2 deletions tests/materials/linear_elastic_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ TEST_CASE("LinearElastic is checked in 2D", "[material][linear_elastic][2D]") {
Approx(jmaterial["density"]).epsilon(Tolerance));
REQUIRE(material->template property<double>("youngs_modulus") ==
Approx(jmaterial["youngs_modulus"]).epsilon(Tolerance));
REQUIRE(material->template property<double>("poisson_ratio") ==
Approx(jmaterial["poisson_ratio"]).epsilon(Tolerance));

// Check if state variable is initialised
SECTION("State variable is initialised") {
Expand Down Expand Up @@ -147,6 +145,20 @@ TEST_CASE("LinearElastic is checked in 2D", "[material][linear_elastic][2D]") {
REQUIRE(stress(4) == Approx(0.00000000000000e+00).epsilon(Tolerance));
REQUIRE(stress(5) == Approx(0.00000000000000e+00).epsilon(Tolerance));
}

SECTION("LinearElastic check properties earthquake") {
unsigned id = 0;

auto material =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check in 3D too

Factory<mpm::Material<Dim>, unsigned, const Json&>::instance()->create(
"LinearElastic2D", std::move(id), jmaterial);

// Get P-Wave and S-Wave Velocities
REQUIRE(material->template property<double>("pwave_velocity") ==
Approx(116.023870223).epsilon(Tolerance));
REQUIRE(material->template property<double>("swave_velocity") ==
Approx(62.0173672946).epsilon(Tolerance));
}
}

//! Check linearelastic class in 3D
Expand Down Expand Up @@ -289,4 +301,18 @@ TEST_CASE("LinearElastic is checked in 3D", "[material][linear_elastic][3D]") {
REQUIRE(stress(4) == Approx(7.69230769230769e+01).epsilon(Tolerance));
REQUIRE(stress(5) == Approx(1.15384615384615e+02).epsilon(Tolerance));
}

SECTION("LinearElastic check properties earthquake") {
unsigned id = 0;

auto material =
Factory<mpm::Material<Dim>, unsigned, const Json&>::instance()->create(
"LinearElastic3D", std::move(id), jmaterial);

// Get P-Wave and S-Wave Velocities
REQUIRE(material->template property<double>("pwave_velocity") ==
Approx(116.023870223).epsilon(Tolerance));
REQUIRE(material->template property<double>("swave_velocity") ==
Approx(62.0173672946).epsilon(Tolerance));
}
}