Tabular load implemented from Python scripting
Hello everyone
I am working in Ansys Workbench 2022R2 in a coupled field module. I am adding loads from scripting. With a single value works easily, but I want to use tabular data for the load. Can i read tabular data for a load from scripting?
Can i set the step end time in analysis settings with input from csv?
Answers
-
I assume you are trying to define a tabular load in Mechanical.
If you provide load and related timestep values as lists this should not be a problem. It could be that you first have to define the number of timesteps in the analysis.
Maybe my example for a pressure load below can help you:
get analysis object
Analysis = ExtAPI.DataModel.AnalysisByName("AnalysisName")
define time steps for simulation
Analysis.AnalysisSettings.NumberOfSteps = len(tsteps)-1
for i,t in enumerate(tsteps,1):
Analysis.AnalysisSettings.CurrentStepNumber = i
Analysis.AnalysisSettings.StepEndTime = Quantity("{} [sec]".format(t))generate lists of tabular values
time_vals = [Quantity("{} [sec]".format(t)) for t in tsteps]
pressure_vals = [Quantity("{} [Pa]".format(p)) for p in pressure loads]define new pressure load for selection
PressureLoad = Analysis.AddPressure()
PressureLoad.Location = selection
PressureLoad.Magnitude.Inputs[0].DiscreteValues = time_vals
PressureLoad.Magnitude.Output.DiscreteValues = pressure_vals1 -