Skip to content

Commit

Permalink
Fixed errors on field reading
Browse files Browse the repository at this point in the history
  • Loading branch information
tmnp19 committed May 28, 2024
1 parent 9b4883a commit e53476d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion piglot/solver/abaqus/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def check(self, parameters: ParameterSet) -> None:
"""
# Generate a dummy set of parameters (to ensure proper handling of output parameters)
values = np.array([parameter.inital_value for parameter in parameters])
param_dict = parameters.to_dict(values, input_normalised=False)
param_dict = parameters.to_dict(values)
for name in param_dict:
if not has_parameter(self.input_file, f'<{name}>'):
raise RuntimeError(f"Parameter '{name}' not found in input file.")
Expand Down
11 changes: 6 additions & 5 deletions piglot/solver/abaqus/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def file_name_func(set_name, variable_name, inp_name):
return file_name


def field_location(i, output_variable, location):
def field_location(output_variable, location):
"""It gets the node data of the specified node set.
Parameters
Expand All @@ -91,7 +91,7 @@ def field_location(i, output_variable, location):
location_output_variable
Location of the output variable.
"""
if i in (0, 1):
if output_variable in ('S', 'E', 'LE'):
location_output_variable = output_variable.getSubset(region=location,
position=ELEMENT_NODAL)
else:
Expand All @@ -109,6 +109,7 @@ def main():
inp_name = variables["input_file"]
job_name = variables["job_name"]
step_name = variables["step_name"]
instance_name = variables["instance_name"]
if instance_name is not None:
instance_name = variables["instance_name"].upper()
else:
Expand Down Expand Up @@ -149,7 +150,7 @@ def main():
# Create a variable that refers to the first step.
step = odb.steps[step_name]

for i, var in enumerate(variables_array):
for var in variables_array:

header_variable = "%s_%d"
variable = var
Expand All @@ -173,7 +174,7 @@ def main():
# Create a variable that refers to the output variable of the node set. If the
# field is S or E it extrapolates the data to the nodes, if the field is U or RF
# the data is already on the nodes so it doesn't need extrapolation.
location_output_variable = field_location(i, output_variable, location)
location_output_variable = field_location(output_variable, location)

# Get the component labels
component_labels = output_variable.componentLabels
Expand All @@ -190,7 +191,7 @@ def main():

# Create a variable that refers to the output_variable of the node
# set in the current frame.
location_output_variable = field_location(i, output_variable, location)
location_output_variable = field_location(output_variable, location)

output_file.write("%d " % frame.frameId)
for v in location_output_variable.values:
Expand Down

0 comments on commit e53476d

Please sign in to comment.