Skip to content

[Core] Scalar/Vector variable assignment inconsistency #14468

Description

@matekelemen

AssignVectorVariable*Process allows setting null to components of its value, but AssignScalarVariable*Process does not.

=> for example, if I want to constrain DoFs to whatever their state is at the time of constraining, I can't use AssignScalarVariable*Process.

for indice,variable in enumerate(["_X", "_Y", "_Z"]):
if not settings["value"][indice].IsNull():
i_params = KratosMultiphysics.Parameters("{}")
i_params.AddValue("model_part_name",settings["model_part_name"])
i_params.AddEmptyValue("constrained").SetBool(settings["constrained"][indice].GetBool())
i_params.AddValue("interval",settings["interval"])
i_params.AddValue("value",settings["value"][indice])
i_params.AddEmptyValue("variable_name").SetString(settings["variable_name"].GetString() + variable)
i_params.AddValue("local_axes",settings["local_axes"])
self.aux_processes.append( assign_scalar_variable_process.AssignScalarVariableProcess(Model, i_params) )

if settings["value"].IsNumber():
self.value_is_numeric = True
self.value = settings["value"].GetDouble()
elif settings["value"].IsString():
self.value_is_function = True
self.function_string = settings["value"].GetString()
self.aux_function = KratosMultiphysics.GenericFunctionUtility(self.function_string, settings["local_axes"])
if self.aux_function.DependsOnSpace():
self.cpp_apply_function_utility = KratosMultiphysics.ApplyFunctionToNodesUtility(self.model_part.Nodes, self.aux_function )
else:
self.table = ReadCsvTableUtility(settings["value"]).Read(self.model_part)

Metadata

Metadata

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions