feat(linear-static-mitc4-shell): step 12 - shell-linear-static-flow

This commit is contained in:
KOKO\Mimi
2026-08-12 21:54:14 +09:00
parent 86bf19504a
commit 775602860f
3 changed files with 347 additions and 2 deletions
@@ -154,6 +154,38 @@ Tip, 1, 10.
)inp";
}
std::string allConstrainedShellDeck() {
return R"inp(*Part, name=ShellPart
*Node
1, 0., 0., 0.
2, 1., 0., 0.
3, 1., 1., 0.
4, 0., 1., 0.
*Element, type=S4
1, 1, 2, 3, 4
*Elset, elset=ShellSet
1
*Shell Section, elset=ShellSet, material=Steel
0.1
*End Part
*Assembly, name=Assembly
*Instance, name=Shell-1, part=ShellPart
*End Instance
*Nset, nset=All, instance=Shell-1
1, 2, 3, 4
*End Assembly
*Material, name=Steel
*Elastic
1000., 0.25
*Boundary
All, 1, 6
*Step, name=Load, nlgeom=NO
*Static
0.1, 1., 0.01, 1.
*End Step
)inp";
}
Hdf5Handle openFile(const std::filesystem::path& path) {
const hid_t file = H5Fopen(
path.string().c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
@@ -259,6 +291,37 @@ void expectFesaHdf5Identity(
0U);
}
void expectShellHdf5Identity(
const std::filesystem::path& output,
const std::filesystem::path& input) {
ASSERT_TRUE(std::filesystem::exists(output));
ASSERT_GT(H5Fis_hdf5(output.string().c_str()), 0);
const auto file = openFile(output);
Hdf5Handle metadata{
H5Gopen2(file.get(), "/metadata", H5P_DEFAULT), H5Gclose};
ASSERT_GE(metadata.get(), 0);
EXPECT_EQ(
readStringAttribute(metadata.get(), "feature_id"),
"linear-static-mitc4-shell");
EXPECT_GT(
H5Lexists(
file.get(),
"/steps/Step-1/frames/0/element/shell/generalized_strain",
H5P_DEFAULT),
0);
EXPECT_EQ(
datasetDimensions(
file.get(),
"/steps/Step-1/frames/0/nodal/displacement"),
(std::vector<hsize_t>{4U, 6U}));
const std::string normalizedInput =
std::filesystem::absolute(input).lexically_normal().generic_u8string();
EXPECT_EQ(
readStringAttribute(metadata.get(), "source_input_identity").find(
"path=" + normalizedInput + ";content_identity="),
0U);
}
struct AppRun {
int exitCode;
std::string standardError;
@@ -407,3 +470,15 @@ TEST(LinearStaticCli, OutputRequestsDoNotFilterMandatoryResults) {
ASSERT_EQ(requestedDiagnostics.size(), 1U);
EXPECT_GT(requestedDiagnostics[0U], 0U);
}
// MITC4-FLOW-001: shell input uses the unchanged application route and syntax.
TEST(Mitc4ShellCli, WritesShellHdf5ThroughTheExistingApplicationRoute) {
TempDirectory directory{"shell-route"};
const auto input = directory.path() / "shell.inp";
const auto output = directory.path() / "shell-results.h5";
writeText(input, allConstrainedShellDeck());
const auto result = runApplication(explicitOutputArguments(input, output));
ASSERT_EQ(result.exitCode, 0) << result.standardError;
expectShellHdf5Identity(output, input);
}