https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Protected Types | Protected Member Functions | Protected Attributes | List of all members
ContactRelationshipManagerTest Class Reference
Inheritance diagram for ContactRelationshipManagerTest:
[legend]

Protected Types

enum class  GhostWholeInterfaceInput { Default , False , True }
 

Protected Member Functions

void SetUp () override
 
void buildMooseMesh ()
 
std::shared_ptr< ContactActionbuildContactAction (const GhostWholeInterfaceInput ghost_whole_interface=GhostWholeInterfaceInput::Default, const std::string &formulation="kinematic")
 
void testContactActionRelationshipManager (const bool enabled)
 
void testMortarContactActionRejectsGhostWholeInterface (const std::string &formulation)
 

Protected Attributes

std::shared_ptr< MooseApp_app
 
Factory_factory
 

Detailed Description

Definition at line 22 of file ContactRelationshipManagerTest.C.

Member Enumeration Documentation

◆ GhostWholeInterfaceInput

Member Function Documentation

◆ buildContactAction()

std::shared_ptr< ContactAction > ContactRelationshipManagerTest::buildContactAction ( const GhostWholeInterfaceInput  ghost_whole_interface = GhostWholeInterfaceInput::Default,
const std::string &  formulation = "kinematic" 
)
inlineprotected

Definition at line 50 of file ContactRelationshipManagerTest.C.

53 {
54 auto params = _app->getActionFactory().getValidParams("ContactAction");
55 params.set<std::string>("task") = "add_constraint";
56 params.set<std::string>("registered_identifier") = "Contact/*";
57 params.set<std::vector<BoundaryName>>("primary") = {"primary"};
58 params.set<std::vector<BoundaryName>>("secondary") = {"secondary"};
59 // Mark this programmatic assignment as user-set so the action sees the
60 // same parameter metadata it would get from parsed input.
61 params.set_attributes("formulation", false);
62 params.set<MooseEnum>("formulation") = formulation;
63 // The mortar validation specifically checks isParamSetByUser(), so only
64 // explicit test inputs should be marked as user-set.
65 switch (ghost_whole_interface)
66 {
68 break;
70 params.set_attributes("ghost_whole_interface", false);
71 params.set<bool>("ghost_whole_interface") = false;
72 break;
74 params.set_attributes("ghost_whole_interface", false);
75 params.set<bool>("ghost_whole_interface") = true;
76 break;
77 }
78
79 auto action = _app->getActionFactory().create("ContactAction", "Contact/test", params);
80 return std::dynamic_pointer_cast<ContactAction>(action);
81 }

Referenced by testContactActionRelationshipManager(), and testMortarContactActionRejectsGhostWholeInterface().

◆ buildMooseMesh()

void ContactRelationshipManagerTest::buildMooseMesh ( )
inlineprotected

Definition at line 40 of file ContactRelationshipManagerTest.C.

41 {
42 auto params = _factory->getValidParams("MeshGeneratorMesh");
43 auto moose_mesh =
44 _factory->create<MeshGeneratorMesh>("MeshGeneratorMesh", "moose_mesh", params);
45 moose_mesh->setMeshBase(moose_mesh->buildMeshBaseObject(2));
46 moose_mesh->buildMesh();
47 _app->actionWarehouse().mesh() = moose_mesh;
48 }
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
InputParameters getValidParams(const std::string &name) const
void setMeshBase(std::unique_ptr< MeshBase > mesh_base)

Referenced by SetUp().

◆ SetUp()

void ContactRelationshipManagerTest::SetUp ( )
inlineoverrideprotected

Definition at line 32 of file ContactRelationshipManagerTest.C.

33 {
34 const char * argv[2] = {"foo", "\0"};
35 _app = Moose::createMooseApp("ContactApp", 1, (char **)argv);
36 _factory = &_app->getFactory();
38 }
std::unique_ptr< MooseApp > createMooseApp(const std::string &default_app_type, int argc, char *argv[])

◆ testContactActionRelationshipManager()

void ContactRelationshipManagerTest::testContactActionRelationshipManager ( const bool  enabled)
inlineprotected

Definition at line 83 of file ContactRelationshipManagerTest.C.

84 {
85 const auto action = buildContactAction(enabled ? GhostWholeInterfaceInput::True
87 ASSERT_TRUE(action);
88
89 action->addRelationshipManagers(Moose::RelationshipManagerType::GEOMETRIC);
90
91 const auto & relationship_managers = _app->relationshipManagers();
92 ASSERT_EQ(relationship_managers.size(), 1);
93
94 auto & rm = **relationship_managers.begin();
95 EXPECT_EQ(rm.type(), "GhostPrimaryFace");
96 EXPECT_TRUE(rm.isType(Moose::RelationshipManagerType::GEOMETRIC));
97 EXPECT_TRUE(rm.isType(Moose::RelationshipManagerType::ALGEBRAIC));
98 EXPECT_EQ(rm.attachGeometricEarly(), !enabled);
99 EXPECT_EQ(rm.getInfo(), enabled ? "GhostPrimaryFace" : "GhostPrimaryFace (disabled)");
100 }
std::shared_ptr< ContactAction > buildContactAction(const GhostWholeInterfaceInput ghost_whole_interface=GhostWholeInterfaceInput::Default, const std::string &formulation="kinematic")

◆ testMortarContactActionRejectsGhostWholeInterface()

void ContactRelationshipManagerTest::testMortarContactActionRejectsGhostWholeInterface ( const std::string &  formulation)
inlineprotected

Definition at line 102 of file ContactRelationshipManagerTest.C.

103 {
104 const std::string error =
105 "Mortar contact always geometrically and algebraically ghosts the interface.";
106 EXPECT_THROW_MSG_CONTAINS(
107 buildContactAction(GhostWholeInterfaceInput::True, formulation), std::runtime_error, error);
108 EXPECT_THROW_MSG_CONTAINS(buildContactAction(GhostWholeInterfaceInput::False, formulation),
109 std::runtime_error,
110 error);
111 }

Member Data Documentation

◆ _app

std::shared_ptr<MooseApp> ContactRelationshipManagerTest::_app
protected

◆ _factory

Factory* ContactRelationshipManagerTest::_factory
protected

Definition at line 114 of file ContactRelationshipManagerTest.C.

Referenced by buildMooseMesh(), and SetUp().


The documentation for this class was generated from the following file: