Files
FESADev/tests/unit/analysis/solid_hht_test_fixture.h
T

53 lines
2.0 KiB
C++

#ifndef FESA_TESTS_SOLID_HHT_TEST_FIXTURE_H_
#define FESA_TESTS_SOLID_HHT_TEST_FIXTURE_H_
#include <array>
#include <string>
#include "fesa/elements/hex8_definition.h"
#include "fesa/model/domain.h"
#include "fesa/properties/solid_section.h"
namespace solid_hht_test {
inline fesa::ModelDefinition Brick(double h = 0.01, unsigned count = 20,
bool nonlinear = false) {
fesa::ModelDefinition d;
d.source_path = "solid-hht-test.inp";
const std::array<std::array<double, 3>, 8> x{{{0, 0, 0},
{1, 0, 0},
{1, 1, 0},
{0, 1, 0},
{0, 0, 1},
{1, 0, 1},
{1, 1, 1},
{0, 1, 1}}};
for (unsigned i = 0; i < 8; ++i) {
d.nodes.push_back({{"I", i + 1, std::to_string(i + 1)}, x[i], {}});
d.node_sets.push_back({"N" + std::to_string(i), {}, {i}, {}});
}
d.node_sets.push_back({"ALL", {}, {0, 1, 2, 3, 4, 5, 6, 7}, {}});
d.materials = {{"M", 12.0, 0.25, {}}};
d.densities = {{0, 2.0, {}}};
d.solid_sections.emplace_back(fesa::SourceEntityId{"I", 1, "1"}, "E", 0,
fesa::SourceLocation{});
d.solid_elements.emplace_back(
fesa::SourceEntityId{"I", 8, "8"},
std::array<fesa::EntityIndex, 8>{0, 1, 2, 3, 4, 5, 6, 7}, 0, 0,
fesa::SourceLocation{});
fesa::DynamicStepDefinition step;
step.source_step_name_raw = "Dynamic";
step.source_step_name_canonical = "DYNAMIC";
step.initial_increment = h;
step.time_period = static_cast<double>(count) * h;
step.increment_count = count;
step.maximum_increments = count;
step.nlgeom = nonlinear;
d.dynamic_step = step;
return d;
}
inline std::string Message(const fesa::Status& s) {
return s.Diagnostics().empty() ? "" : s.Diagnostics()[0].message;
}
} // namespace solid_hht_test
#endif