Skip to content

Commit d9b13e4

Browse files
committed
Add enum for strong and weak enforcement
1 parent 5e720a2 commit d9b13e4

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

include/base/periodic_boundary_base.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ namespace libMesh
3838
class Elem;
3939
class MeshBase;
4040

41+
/**
42+
* The type of enforcement of condition; strong(default) = constraint matrix
43+
*/
44+
enum class EnforcementType
45+
{ STRONG_ENFORCEMENT=0,
46+
WEAK_ENFORCEMENT=1 };
47+
4148
/**
4249
* The base class for defining periodic boundaries.
4350
*
@@ -126,6 +133,16 @@ class PeriodicBoundaryBase
126133
*/
127134
const std::set<unsigned int> & get_variables() const;
128135

136+
/**
137+
* Get the enforcement type.
138+
*/
139+
const EnforcementType & get_enforcement_type() const;
140+
141+
/**
142+
* Set the enforcement type.
143+
*/
144+
void set_enforcement_type(const EnforcementType & e_type);
145+
129146
protected:
130147

131148
/**
@@ -145,6 +162,8 @@ class PeriodicBoundaryBase
145162
*/
146163
std::unique_ptr<DenseMatrix<Real>> _transformation_matrix;
147164

165+
EnforcementType _enforcement_type;
166+
148167
};
149168

150169
} // namespace libmesh

src/base/periodic_boundary_base.C

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,18 @@ const std::set<unsigned int> & PeriodicBoundaryBase::get_variables() const
111111
return variables;
112112
}
113113

114+
115+
const EnforcementType & PeriodicBoundaryBase::get_enforcement_type() const
116+
{
117+
return _enforcement_type;
118+
}
119+
120+
121+
void PeriodicBoundaryBase::set_enforcement_type(const EnforcementType & e_type)
122+
{
123+
this->_enforcement_type = e_type;
124+
}
125+
114126
} // namespace libMesh
115127

116128
#endif // LIBMESH_ENABLE_PERIODIC

src/fe/fe_base.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,7 @@ compute_periodic_constraints (DofConstraints & constraints,
19281928
for (const auto & boundary_id : bc_ids)
19291929
{
19301930
const PeriodicBoundaryBase * periodic = boundaries.boundary(boundary_id);
1931-
if (!periodic || !periodic->is_my_variable(variable_number))
1931+
if (!periodic || !periodic->is_my_variable(variable_number) || (periodic->get_enforcement_type()==EnforcementType::WEAK_ENFORCEMENT))
19321932
continue;
19331933

19341934
libmesh_assert(point_locator);

0 commit comments

Comments
 (0)