Skip to content

Commit 3ab9f16

Browse files
Merge pull request #563 from davidrudlstorfer/simplify_potential_params
Simplify potential params
2 parents e7c6490 + 3657664 commit 3ab9f16

File tree

26 files changed

+313
-697
lines changed

26 files changed

+313
-697
lines changed

src/beamcontact/4C_beamcontact_beam3contact_manager.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -275,27 +275,27 @@ CONTACT::Beam3cmanager::Beam3cmanager(Core::FE::Discretization& discret, double
275275
mi_->clear();
276276
// read potential law parameters from input and check
277277
{
278-
std::string pot_law_exponents_in(
278+
std::string potential_law_exponents_in(
279279
Teuchos::getNumericStringParameter(sbeampotential_, "POT_LAW_EXPONENT"));
280280

281-
Core::IO::ValueParser pot_law_exponents_parser(
282-
pot_law_exponents_in, {.user_scope_message = "While reading potential law exponents: "});
281+
Core::IO::ValueParser potential_law_exponents_parser(potential_law_exponents_in,
282+
{.user_scope_message = "While reading potential law exponents: "});
283283

284-
while (!pot_law_exponents_parser.at_end())
284+
while (!potential_law_exponents_parser.at_end())
285285
{
286-
mi_->push_back(pot_law_exponents_parser.read<double>());
286+
mi_->push_back(potential_law_exponents_parser.read<double>());
287287
}
288288
}
289289
{
290-
std::string pot_law_prefactors_in(
290+
std::string potential_law_prefactors_in(
291291
Teuchos::getNumericStringParameter(sbeampotential_, "POT_LAW_PREFACTOR"));
292292

293-
Core::IO::ValueParser pot_law_prefactors_parser(pot_law_prefactors_in,
293+
Core::IO::ValueParser potential_law_prefactors_parser(potential_law_prefactors_in,
294294
{.user_scope_message = "While reading potential law prefactors: "});
295295

296-
while (!pot_law_prefactors_parser.at_end())
296+
while (!potential_law_prefactors_parser.at_end())
297297
{
298-
ki_->push_back(pot_law_prefactors_parser.read<double>());
298+
ki_->push_back(potential_law_prefactors_parser.read<double>());
299299
}
300300
}
301301
if (!ki_->empty())

src/beaminteraction/src/potential/4C_beaminteraction_potential_input.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ void BeamPotential::set_valid_parameters(std::map<std::string, Core::IO::InputSp
5959
{.description = "Use regularization of force law at separations smaller than this separation",
6060
.default_value = -1.0}));
6161

62-
beampotential.specs.emplace_back(parameter<int>("NUM_INTEGRATION_SEGMENTS",
62+
beampotential.specs.emplace_back(parameter<int>("N_INTEGRATION_SEGMENTS",
6363
{.description = "Number of integration segments used per beam element", .default_value = 1}));
6464

65-
beampotential.specs.emplace_back(parameter<int>("NUM_GAUSSPOINTS",
65+
beampotential.specs.emplace_back(parameter<int>("N_GAUSS_POINTS",
6666
{.description = "Number of Gauss points used per integration segment", .default_value = 10}));
6767

6868
beampotential.specs.emplace_back(parameter<bool>("AUTOMATIC_DIFFERENTIATION",
@@ -93,7 +93,7 @@ void BeamPotential::set_valid_parameters(std::map<std::string, Core::IO::InputSp
9393

9494
// output interval regarding steps: write output every INTERVAL_STEPS steps
9595
beampotential_output_sublist.specs.emplace_back(parameter<int>("INTERVAL_STEPS",
96-
{.description = "write output at runtime every INTERVAL_STEPS steps", .default_value = -1}));
96+
{.description = "write output at runtime every INTERVAL_STEPS steps", .default_value = 1}));
9797

9898
// whether to write output in every iteration of the nonlinear solver
9999
beampotential_output_sublist.specs.emplace_back(parameter<bool>(
@@ -130,30 +130,31 @@ void BeamPotential::set_valid_conditions(
130130
{
131131
using namespace Core::IO::InputSpecBuilders;
132132

133-
/*-------------------------------------------------------------------*/
134133
// beam potential interaction: atom/charge density per unit length on LINE
135-
Core::Conditions::ConditionDefinition rigidsphere_potential_charge(
136-
"DESIGN POINT RIGIDSPHERE POTENTIAL CHARGE CONDITIONS", "RigidspherePotentialPointCharge",
137-
"Rigidsphere_Potential_Point_Charge", Core::Conditions::RigidspherePotential_PointCharge,
138-
false, Core::Conditions::geometry_type_point);
139134

140135
Core::Conditions::ConditionDefinition beam_potential_line_charge(
141136
"DESIGN LINE BEAM POTENTIAL CHARGE CONDITIONS", "BeamPotentialLineCharge",
142137
"Beam_Potential_Line_Charge_Density", Core::Conditions::BeamPotential_LineChargeDensity,
143138
false, Core::Conditions::geometry_type_line);
144139

145-
rigidsphere_potential_charge.add_component(parameter<int>("POTLAW"));
146-
rigidsphere_potential_charge.add_component(parameter<double>("VAL"));
147-
rigidsphere_potential_charge.add_component(
148-
parameter<std::optional<int>>("FUNCT", {.description = ""}));
149-
150140
beam_potential_line_charge.add_component(parameter<int>("POTLAW"));
151141
beam_potential_line_charge.add_component(parameter<double>("VAL"));
152142
beam_potential_line_charge.add_component(
153143
parameter<std::optional<int>>("FUNCT", {.description = ""}));
154144

155-
condlist.push_back(rigidsphere_potential_charge);
156145
condlist.push_back(beam_potential_line_charge);
146+
147+
Core::Conditions::ConditionDefinition rigidsphere_potential_charge(
148+
"DESIGN POINT RIGIDSPHERE POTENTIAL CHARGE CONDITIONS", "RigidspherePotentialPointCharge",
149+
"Rigidsphere_Potential_Point_Charge", Core::Conditions::RigidspherePotential_PointCharge,
150+
false, Core::Conditions::geometry_type_point);
151+
152+
rigidsphere_potential_charge.add_component(parameter<int>("POTLAW"));
153+
rigidsphere_potential_charge.add_component(parameter<double>("VAL"));
154+
rigidsphere_potential_charge.add_component(
155+
parameter<std::optional<int>>("FUNCT", {.description = ""}));
156+
157+
condlist.push_back(rigidsphere_potential_charge);
157158
}
158159

159160
FOUR_C_NAMESPACE_CLOSE

src/beaminteraction/src/potential/4C_beaminteraction_potential_pair_base.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ std::shared_ptr<BeamInteraction::BeamPotentialPair> BeamInteraction::BeamPotenti
8686
return std::make_shared<BeamInteraction::BeamToSpherePotentialPair<2, 1>>();
8787
else
8888
{
89-
if (beam_potential_params.use_fad())
89+
if (beam_potential_params.use_fad)
9090
return std::make_shared<
9191
BeamInteraction::BeamToBeamPotentialPair<2, 1, Sacado::Fad::DFad<double>>>();
9292
else
@@ -99,7 +99,7 @@ std::shared_ptr<BeamInteraction::BeamPotentialPair> BeamInteraction::BeamPotenti
9999
return std::make_shared<BeamInteraction::BeamToSpherePotentialPair<3, 1>>();
100100
else
101101
{
102-
if (beam_potential_params.use_fad())
102+
if (beam_potential_params.use_fad)
103103
return std::make_shared<
104104
BeamInteraction::BeamToBeamPotentialPair<3, 1, Sacado::Fad::DFad<double>>>();
105105
else
@@ -112,7 +112,7 @@ std::shared_ptr<BeamInteraction::BeamPotentialPair> BeamInteraction::BeamPotenti
112112
return std::make_shared<BeamInteraction::BeamToSpherePotentialPair<4, 1>>();
113113
else
114114
{
115-
if (beam_potential_params.use_fad())
115+
if (beam_potential_params.use_fad)
116116
return std::make_shared<
117117
BeamInteraction::BeamToBeamPotentialPair<4, 1, Sacado::Fad::DFad<double>>>();
118118
else
@@ -125,7 +125,7 @@ std::shared_ptr<BeamInteraction::BeamPotentialPair> BeamInteraction::BeamPotenti
125125
return std::make_shared<BeamInteraction::BeamToSpherePotentialPair<5, 1>>();
126126
else
127127
{
128-
if (beam_potential_params.use_fad())
128+
if (beam_potential_params.use_fad)
129129
return std::make_shared<
130130
BeamInteraction::BeamToBeamPotentialPair<5, 1, Sacado::Fad::DFad<double>>>();
131131
else
@@ -154,7 +154,7 @@ std::shared_ptr<BeamInteraction::BeamPotentialPair> BeamInteraction::BeamPotenti
154154
return std::make_shared<BeamInteraction::BeamToSpherePotentialPair<2, 2>>();
155155
else
156156
{
157-
if (beam_potential_params.use_fad())
157+
if (beam_potential_params.use_fad)
158158
return std::make_shared<
159159
BeamInteraction::BeamToBeamPotentialPair<2, 2, Sacado::Fad::DFad<double>>>();
160160
else
@@ -203,7 +203,7 @@ void BeamInteraction::BeamPotentialPair::check_init_setup() const
203203
*-----------------------------------------------------------------------------------------------*/
204204
Core::FE::GaussRule1D BeamInteraction::BeamPotentialPair::get_gauss_rule() const
205205
{
206-
switch (params()->number_gauss_points())
206+
switch (params()->n_gauss_points)
207207
{
208208
case 5:
209209
{
@@ -236,7 +236,7 @@ Core::FE::GaussRule1D BeamInteraction::BeamPotentialPair::get_gauss_rule() const
236236
}
237237

238238
default:
239-
FOUR_C_THROW("{} Gauss points are not supported yet!", params()->number_gauss_points());
239+
FOUR_C_THROW("{} Gauss points are not supported yet!", params()->n_gauss_points);
240240
}
241241

242242
return Core::FE::GaussRule1D::undefined;

src/beaminteraction/src/potential/4C_beaminteraction_potential_pair_base.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace Core::Elements
3333
namespace BeamInteraction
3434
{
3535
// forward declaration ...
36-
class BeamPotentialParams;
36+
struct BeamPotentialParams;
3737

3838

3939
/*!

0 commit comments

Comments
 (0)