Skip to content

Commit 5c40329

Browse files
Merge pull request #313 from davidrudlstorfer/fix_yaml_beam_potential
Fix yaml beam potential
2 parents e6b6680 + b1795b6 commit 5c40329

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

src/meshpy/four_c/beam_potential.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(
9191
def add_header(
9292
self,
9393
*,
94-
potential_type="Volume",
94+
potential_type="volume",
9595
cutoff_radius=None,
9696
evaluation_strategy=None,
9797
regularization_type=None,
@@ -141,23 +141,23 @@ def add_header(
141141
settings = {
142142
"POT_LAW_PREFACTOR": " ".join(map(str, self.pot_law_prefactor)),
143143
"POT_LAW_EXPONENT": " ".join(map(str, self.pot_law_exponent)),
144-
"BEAMPOTENTIAL_TYPE": potential_type,
144+
"TYPE": potential_type,
145145
"CUTOFF_RADIUS": cutoff_radius,
146146
"STRATEGY": evaluation_strategy,
147-
"NUM_INTEGRATION_SEGMENTS": integration_segments,
148-
"NUM_GAUSSPOINTS": gauss_points,
147+
"N_INTEGRATION_SEGMENTS": integration_segments,
148+
"N_GAUSS_POINTS": gauss_points,
149149
"POTENTIAL_REDUCTION_LENGTH": potential_reduction_length,
150150
"AUTOMATIC_DIFFERENTIATION": automatic_differentiation,
151151
}
152152

153153
if regularization_type is not None:
154-
settings | {
154+
settings = settings | {
155155
"REGULARIZATION_TYPE": regularization_type,
156156
"REGULARIZATION_SEPARATION": regularization_separation,
157157
}
158158

159159
if choice_master_slave is not None:
160-
settings | {"CHOICE_MASTER_SLAVE": choice_master_slave}
160+
settings = settings | {"CHOICE_MASTER_SLAVE": choice_master_slave}
161161

162162
self.input_file.add(
163163
{"BEAM POTENTIAL": settings},

tests/reference-files/test_four_c_simulation_beam_potential_helix.4C.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ BEAM POTENTIAL:
99
N_INTEGRATION_SEGMENTS: 2
1010
N_GAUSS_POINTS: 50
1111
POTENTIAL_REDUCTION_LENGTH: 15
12+
CHOICE_MASTER_SLAVE: smaller_eleGID_is_slave
13+
AUTOMATIC_DIFFERENTIATION: false
1214
BEAM POTENTIAL/RUNTIME VTK OUTPUT:
1315
VTK_OUTPUT_BEAM_POTENTIAL: true
16+
INTERVAL_STEPS: 1
1417
EVERY_ITERATION: true
1518
FORCES: true
1619
MOMENTS: true
@@ -44,6 +47,7 @@ DESIGN LINE BEAM POTENTIAL CHARGE CONDITIONS:
4447
- E: 1
4548
POTLAW: 2
4649
VAL: 2
50+
FUNCT: none
4751
DNODE-NODE TOPOLOGY:
4852
- NODE 1 DNODE 1
4953
DLINE-NODE TOPOLOGY:

tests/test_four_c.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ def test_four_c_material_numbering(
166166
assert_results_equal(get_corresponding_reference_file_path(), input_file)
167167

168168

169-
@pytest.mark.skip(
170-
reason="Temporarily disabled due to switch to .yaml based input files - check if test is necessary and fix"
171-
)
172169
def test_four_c_simulation_beam_potential_helix(
173170
assert_results_equal, get_corresponding_reference_file_path
174171
):
@@ -179,7 +176,7 @@ def test_four_c_simulation_beam_potential_helix(
179176
mat = MaterialReissner(youngs_modulus=1000, radius=0.5, shear_correction=1.0)
180177

181178
# define function for line charge density
182-
fun = Function([{"SYMBOLIC_FUNCTION_OF_SPACE_TIME": "t"}])
179+
fun = Function([{"COMPONENT": 0, "SYMBOLIC_FUNCTION_OF_SPACE_TIME": "t"}])
183180

184181
# define the beam potential
185182
beampotential = BeamPotential(
@@ -192,16 +189,16 @@ def test_four_c_simulation_beam_potential_helix(
192189

193190
# set headers for static case and beam potential
194191
beampotential.add_header(
195-
potential_type="Volume",
192+
potential_type="volume",
196193
cutoff_radius=10.0,
197-
evaluation_strategy="SingleLengthSpecific_SmallSepApprox_Simple",
198-
regularization_type="linear_extrapolation",
194+
evaluation_strategy="single_length_specific_small_separations_simple",
195+
regularization_type="linear",
199196
regularization_separation=0.1,
200197
integration_segments=2,
201198
gauss_points=50,
202199
potential_reduction_length=15.0,
203200
automatic_differentiation=False,
204-
choice_master_slave="lower_eleGID_is_slave",
201+
choice_master_slave="smaller_eleGID_is_slave",
205202
)
206203
beampotential.add_runtime_output(every_iteration=True)
207204

@@ -235,6 +232,8 @@ def test_four_c_simulation_beam_potential_helix(
235232
{
236233
"NUMDOF": 9,
237234
"ONOFF": [1, 1, 1, 1, 1, 1, 0, 0, 0],
235+
"VAL": [0, 0, 0, 0, 0, 0, 0, 0, 0],
236+
"FUNCT": [0, 0, 0, 0, 0, 0, 0, 0, 0],
238237
},
239238
bc_type=mpy.bc.dirichlet,
240239
)

0 commit comments

Comments
 (0)