#pragma once // Manufactured solutions used to validate the numerical model. #include #include #include #include #include #include "Elasticity.h" struct MeshSize { size_t bottom_x; size_t bottom_y; size_t top_x; size_t top_y; size_t lambda_nodes; }; struct TestCase { std::function exact_solution; double E; double nu; Point bottom_a; Point bottom_b; Point top_a; Point top_b; MeshSize mesh; std::array bottom_dirichlet_sides; std::array top_dirichlet_sides; }; const std::map TESTS = { { "axisymmetric_inverse_r", TestCase{ [](double, double) { return [](const Point& p) { return Point{ 5.0 / p.x, 0.0 }; }; }, 21e10, 0.3, Point{ 1.0, 0.0 }, Point{ 3.0, 0.5 }, Point{ 1.0, 0.5 }, Point{ 3.0, 3.0 }, MeshSize{ 18, 18, 18, 18, 18 }, std::array{ 'W', 'E', 'S' }, std::array{ 'W', 'N', 'E' } } }, { "axisymmetric_linear", TestCase{ [](double, double) { return [](const Point& p) { return Point{ 2.0 * p.x + 5.0 / p.x, 34.0 * p.y }; }; }, 21e10, 0.3, Point{ 1.0, 0.0 }, Point{ 3.0, 0.5 }, Point{ 1.0, 0.5 }, Point{ 3.0, 3.0 }, MeshSize{ 10, 10, 10, 10, 10 }, std::array{ 'W', 'E', 'S' }, std::array{ 'W', 'N', 'E' } } }, { "cartesian_exp", TestCase{ [](double, double) { return [](const Point& p) { return Point{ std::exp(p.x) * std::cos(p.y - 0.5), -std::exp(p.x) * std::sin(p.y - 0.5) }; }; }, 21e10, 0.3, Point{ 0.0, 0.0 }, Point{ 1.0, 0.5 }, Point{ 0.0, 0.5 }, Point{ 1.0, 1.0 }, MeshSize{ 6, 6, 10, 10, 10 }, std::array{ 'W', 'E', 'S' }, std::array{ 'W', 'N', 'E' } } }, { "cartesian_linear", TestCase{ [](double, double) { return [](const Point& p) { return Point{ -21.0 * p.x, 13.0 * p.y }; }; }, 21e10, 0.3, Point{ 0.0, 0.0 }, Point{ 3.0, 1.0 }, Point{ 0.0, 1.0 }, Point{ 2.0, 4.0 }, MeshSize{ 5, 5, 10, 10, 10 }, std::array{ 'W', 'E', 'S' }, std::array{ 'W', 'N', 'E' } } } };