From e53476db143a6f40180e4006a67409a0bec287cf Mon Sep 17 00:00:00 2001 From: Tiago Pires Date: Tue, 28 May 2024 21:44:25 +0100 Subject: [PATCH] Fixed errors on field reading --- piglot/solver/abaqus/fields.py | 2 +- piglot/solver/abaqus/reader.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/piglot/solver/abaqus/fields.py b/piglot/solver/abaqus/fields.py index 6dfbf5c..0c2f7fc 100644 --- a/piglot/solver/abaqus/fields.py +++ b/piglot/solver/abaqus/fields.py @@ -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.") diff --git a/piglot/solver/abaqus/reader.py b/piglot/solver/abaqus/reader.py index 25275b4..eedafba 100644 --- a/piglot/solver/abaqus/reader.py +++ b/piglot/solver/abaqus/reader.py @@ -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 @@ -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: @@ -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: @@ -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 @@ -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 @@ -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: