Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F68635069
test_material_thermal.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jun 28, 06:46
Size
2 KB
Mime Type
text/x-c++
Expires
Sun, Jun 30, 06:46 (2 d)
Engine
blob
Format
Raw Data
Handle
18374941
Attached To
rAKA akantu
test_material_thermal.cc
View Options
/* -------------------------------------------------------------------------- */
#include "material_thermal.hh"
#include "solid_mechanics_model.hh"
#include "test_material_fixtures.hh"
/* -------------------------------------------------------------------------- */
#include <gtest/gtest.h>
#include <type_traits>
/* -------------------------------------------------------------------------- */
using namespace akantu;
using types = ::testing::Types<
Traits<MaterialThermal, 1>, Traits<MaterialThermal, 2>,
Traits<MaterialThermal, 3>>;
/* -------------------------------------------------------------------------- */
template <> void FriendMaterial<MaterialThermal<3>>::testComputeStress() {
Real E = 1.;
Real nu = .3;
Real alpha = 2;
setParam("E", E);
setParam("nu", nu);
setParam("alpha", alpha);
Real deltaT = 1;
Real sigma = 0;
this->computeStressOnQuad(sigma, deltaT);
Real solution = -E / (1 - 2*nu) * alpha * deltaT;
auto error = std::abs(sigma - solution);
ASSERT_NEAR(error, 0, 1e-14);
}
template <> void FriendMaterial<MaterialThermal<2>>::testComputeStress() {
Real E = 1.;
Real nu = .3;
Real alpha = 2;
setParam("E", E);
setParam("nu", nu);
setParam("alpha", alpha);
Real deltaT = 1;
Real sigma = 0;
this->computeStressOnQuad(sigma, deltaT);
Real solution = -E / (1 - 2*nu) * alpha * deltaT;
auto error = std::abs(sigma - solution);
ASSERT_NEAR(error, 0, 1e-14);
}
template <> void FriendMaterial<MaterialThermal<1>>::testComputeStress() {
Real E = 1.;
Real nu = .3;
Real alpha = 2;
setParam("E", E);
setParam("nu", nu);
setParam("alpha", alpha);
Real deltaT = 1;
Real sigma = 0;
this->computeStressOnQuad(sigma, deltaT);
Real solution = -E * alpha * deltaT;
auto error = std::abs(sigma - solution);
ASSERT_NEAR(error, 0, 1e-14);
}
namespace {
template <typename T>
class TestMaterialThermalFixture : public ::TestMaterialFixture<T> {};
TYPED_TEST_CASE(TestMaterialThermalFixture, types);
TYPED_TEST(TestMaterialThermalFixture, ThermalComputeStress) {
this->material->testComputeStress();
}
}
Event Timeline
Log In to Comment