style(thermal): apply repository formatting to semantic additions
This commit is contained in:
@@ -64,7 +64,8 @@ inline const SourceEntityId& Ds4ThermalDefinition::SourceId() const noexcept {
|
|||||||
return source_id_;
|
return source_id_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string_view Ds4ThermalDefinition::SourceElementType() const noexcept {
|
inline std::string_view Ds4ThermalDefinition::SourceElementType()
|
||||||
|
const noexcept {
|
||||||
return "DS4";
|
return "DS4";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,10 @@ Result<IsotropicThermalMaterial> IsotropicThermalMaterial::Create(
|
|||||||
if (!std::isfinite(conductivity) || !(conductivity > 0.0) ||
|
if (!std::isfinite(conductivity) || !(conductivity > 0.0) ||
|
||||||
!std::isfinite(density) || !(density > 0.0) ||
|
!std::isfinite(density) || !(density > 0.0) ||
|
||||||
!std::isfinite(specific_heat) || !(specific_heat > 0.0)) {
|
!std::isfinite(specific_heat) || !(specific_heat > 0.0)) {
|
||||||
return Result<IsotropicThermalMaterial>::Failure(InvalidThermalMaterial(
|
return Result<IsotropicThermalMaterial>::Failure(
|
||||||
source_id, location,
|
InvalidThermalMaterial(source_id, location,
|
||||||
"Conductivity, density, and specific heat must be finite and positive."));
|
"Conductivity, density, and specific heat must "
|
||||||
|
"be finite and positive."));
|
||||||
}
|
}
|
||||||
return Result<IsotropicThermalMaterial>::Success(IsotropicThermalMaterial{
|
return Result<IsotropicThermalMaterial>::Success(IsotropicThermalMaterial{
|
||||||
std::move(source_id), std::move(name), conductivity, density,
|
std::move(source_id), std::move(name), conductivity, density,
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#include "fesa/model/domain.h"
|
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
@@ -11,6 +9,7 @@
|
|||||||
#include "fesa/analysis/analysis_model.h"
|
#include "fesa/analysis/analysis_model.h"
|
||||||
#include "fesa/elements/ds4_thermal.h"
|
#include "fesa/elements/ds4_thermal.h"
|
||||||
#include "fesa/materials/isotropic_thermal_material.h"
|
#include "fesa/materials/isotropic_thermal_material.h"
|
||||||
|
#include "fesa/model/domain.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -19,24 +18,31 @@ fesa::SourceLocation Location() { return {"models/thermal.inp", 10U}; }
|
|||||||
fesa::ModelDefinition ValidDefinition() {
|
fesa::ModelDefinition ValidDefinition() {
|
||||||
fesa::ModelDefinition definition{};
|
fesa::ModelDefinition definition{};
|
||||||
definition.source_path = "models/thermal.inp";
|
definition.source_path = "models/thermal.inp";
|
||||||
definition.nodes = {
|
definition.nodes = {{{"Plate", 1, "1"}, {0.0, 0.0, 0.0}, Location()},
|
||||||
{{"Plate", 1, "1"}, {0.0, 0.0, 0.0}, Location()},
|
{{"Plate", 2, "2"}, {1.0, 0.0, 0.0}, Location()},
|
||||||
{{"Plate", 2, "2"}, {1.0, 0.0, 0.0}, Location()},
|
{{"Plate", 3, "3"}, {1.0, 1.0, 0.0}, Location()},
|
||||||
{{"Plate", 3, "3"}, {1.0, 1.0, 0.0}, Location()},
|
{{"Plate", 4, "4"}, {0.0, 1.0, 0.0}, Location()},
|
||||||
{{"Plate", 4, "4"}, {0.0, 1.0, 0.0}, Location()},
|
{{"Plate", 5, "5"}, {2.0, 2.0, 0.0}, Location()}};
|
||||||
{{"Plate", 5, "5"}, {2.0, 2.0, 0.0}, Location()}};
|
definition.thermal_materials = {{{"", 1, "Thermal-Steel"},
|
||||||
definition.thermal_materials = {
|
"Thermal-Steel",
|
||||||
{{"", 1, "Thermal-Steel"}, "Thermal-Steel", 45.0, 7800.0, 500.0,
|
45.0,
|
||||||
Location()}};
|
7800.0,
|
||||||
|
500.0,
|
||||||
|
Location()}};
|
||||||
definition.thermal_sections = {
|
definition.thermal_sections = {
|
||||||
{{"", 1, "Section"}, "Section", 0.01, 0U, Location()}};
|
{{"", 1, "Section"}, "Section", 0.01, 0U, Location()}};
|
||||||
definition.thermal_elements = {{{"Plate", 8, "8"}, {0U, 1U, 2U, 3U},
|
definition.thermal_elements = {
|
||||||
0U, Location()}};
|
{{"Plate", 8, "8"}, {0U, 1U, 2U, 3U}, 0U, Location()}};
|
||||||
definition.thermal_initial_conditions = {{0U, 12.5, Location()}};
|
definition.thermal_initial_conditions = {{0U, 12.5, Location()}};
|
||||||
definition.thermal_model_boundaries = {{0U, 11, 10.0, Location()}};
|
definition.thermal_model_boundaries = {{0U, 11, 10.0, Location()}};
|
||||||
definition.thermal_step = {"Heat", 0.2, 1.0, 100U, false,
|
definition.thermal_step = {"Heat",
|
||||||
|
0.2,
|
||||||
|
1.0,
|
||||||
|
100U,
|
||||||
|
false,
|
||||||
{{0U, 11, 20.0, Location()}},
|
{{0U, 11, 20.0, Location()}},
|
||||||
{{0U, 15, -5.0, Location()}}, Location()};
|
{{0U, 15, -5.0, Location()}},
|
||||||
|
Location()};
|
||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,9 +72,9 @@ TEST(IsotropicThermalMaterial, RequiresFinitePositivePropertiesAndIdentity) {
|
|||||||
ASSERT_FALSE(invalid.HasValue());
|
ASSERT_FALSE(invalid.HasValue());
|
||||||
EXPECT_EQ(invalid.GetStatus().Category(), fesa::FailureCategory::kModel);
|
EXPECT_EQ(invalid.GetStatus().Category(), fesa::FailureCategory::kModel);
|
||||||
|
|
||||||
EXPECT_FALSE(fesa::IsotropicThermalMaterial::Create(
|
EXPECT_FALSE(fesa::IsotropicThermalMaterial::Create({"", 7, "Thermal-Steel"},
|
||||||
{"", 7, "Thermal-Steel"}, "Thermal-Steel", 45.0, 0.0,
|
"Thermal-Steel", 45.0,
|
||||||
500.0, Location())
|
0.0, 500.0, Location())
|
||||||
.HasValue());
|
.HasValue());
|
||||||
EXPECT_FALSE(fesa::IsotropicThermalMaterial::Create(
|
EXPECT_FALSE(fesa::IsotropicThermalMaterial::Create(
|
||||||
{"", 7, "Thermal-Steel"}, "Thermal-Steel", 45.0, 7800.0,
|
{"", 7, "Thermal-Steel"}, "Thermal-Steel", 45.0, 7800.0,
|
||||||
@@ -114,8 +120,7 @@ TEST(ThermalDomain, RejectsInactiveTargetsConflictsAndMixedElements) {
|
|||||||
EXPECT_EQ(conflicting.GetStatus().Category(), fesa::FailureCategory::kModel);
|
EXPECT_EQ(conflicting.GetStatus().Category(), fesa::FailureCategory::kModel);
|
||||||
|
|
||||||
invalid = ValidDefinition();
|
invalid = ValidDefinition();
|
||||||
invalid.elements.push_back(
|
invalid.elements.push_back({{"Plate", 9, "9"}, {0U, 1U}, 0U, 0U, Location()});
|
||||||
{{"Plate", 9, "9"}, {0U, 1U}, 0U, 0U, Location()});
|
|
||||||
const auto mixed = fesa::Domain::Create(std::move(invalid));
|
const auto mixed = fesa::Domain::Create(std::move(invalid));
|
||||||
ASSERT_FALSE(mixed.HasValue());
|
ASSERT_FALSE(mixed.HasValue());
|
||||||
EXPECT_EQ(mixed.GetStatus().Category(), fesa::FailureCategory::kModel);
|
EXPECT_EQ(mixed.GetStatus().Category(), fesa::FailureCategory::kModel);
|
||||||
@@ -189,20 +194,19 @@ TEST(ThermalAnalysisModel,
|
|||||||
KeepsThermalSectionMaterialIndicesSeparateFromDomainMaterials) {
|
KeepsThermalSectionMaterialIndicesSeparateFromDomainMaterials) {
|
||||||
auto definition = ValidDefinition();
|
auto definition = ValidDefinition();
|
||||||
definition.materials = {{"Unused-Structural", 210.0e9, 0.3, Location()}};
|
definition.materials = {{"Unused-Structural", 210.0e9, 0.3, Location()}};
|
||||||
definition.thermal_materials.push_back(
|
definition.thermal_materials.push_back({{"", 2, "Thermal-Aluminum"},
|
||||||
{{"", 2, "Thermal-Aluminum"}, "Thermal-Aluminum", 120.0, 2700.0,
|
"Thermal-Aluminum",
|
||||||
900.0, Location()});
|
120.0,
|
||||||
|
2700.0,
|
||||||
|
900.0,
|
||||||
|
Location()});
|
||||||
definition.thermal_sections = {
|
definition.thermal_sections = {
|
||||||
{{"", 1, "Section-A"}, "Section-A", 0.01, 1U, Location()},
|
{{"", 1, "Section-A"}, "Section-A", 0.01, 1U, Location()},
|
||||||
{{"", 2, "Section-B"}, "Section-B", 0.02, 0U, Location()}};
|
{{"", 2, "Section-B"}, "Section-B", 0.02, 0U, Location()}};
|
||||||
definition.nodes.push_back(
|
definition.nodes.push_back({{"Plate", 6, "6"}, {3.0, 0.0, 0.0}, Location()});
|
||||||
{{"Plate", 6, "6"}, {3.0, 0.0, 0.0}, Location()});
|
definition.nodes.push_back({{"Plate", 7, "7"}, {4.0, 0.0, 0.0}, Location()});
|
||||||
definition.nodes.push_back(
|
definition.nodes.push_back({{"Plate", 8, "8"}, {4.0, 1.0, 0.0}, Location()});
|
||||||
{{"Plate", 7, "7"}, {4.0, 0.0, 0.0}, Location()});
|
definition.nodes.push_back({{"Plate", 9, "9"}, {3.0, 1.0, 0.0}, Location()});
|
||||||
definition.nodes.push_back(
|
|
||||||
{{"Plate", 8, "8"}, {4.0, 1.0, 0.0}, Location()});
|
|
||||||
definition.nodes.push_back(
|
|
||||||
{{"Plate", 9, "9"}, {3.0, 1.0, 0.0}, Location()});
|
|
||||||
definition.thermal_elements = {
|
definition.thermal_elements = {
|
||||||
{{"Plate", 8, "8"}, {0U, 1U, 2U, 3U}, 0U, Location()},
|
{{"Plate", 8, "8"}, {0U, 1U, 2U, 3U}, 0U, Location()},
|
||||||
{{"Plate", 9, "9"}, {5U, 6U, 7U, 8U}, 1U, Location()}};
|
{{"Plate", 9, "9"}, {5U, 6U, 7U, 8U}, 1U, Location()}};
|
||||||
|
|||||||
Reference in New Issue
Block a user