Read out of Scenario Steps names and passing them in a PyFlux macro as an argument

Rafud
Rafud Altair Community Member
edited March 2021 in Community Q&A

Hi All, 

I am completely new to Flux and PyFlux, but, since there were some materials avialable, I wrote some scripts to automatize my work.

What is really interesting for me now, is the opportunity to read out from Flux solving scenario step names and use them for example to create new names of SpatialCurves. Could it be possible to read them out easily and then pass as an argument to other functions?

Best regards,

Rafud

 

Tagged:

Best Answer

  • Yann_Le_Floch
    Yann_Le_Floch
    Altair Employee
    edited March 2021 Answer ✓

    Hi Rafud,

    To find how to used Scenario you can use : 

    Scenario.help()

    You will find all the possible method : 

    Methods :

    - addPilot (Add a parameter pilot) :

    Arguments :

    - pilot (Pilot associated to a parameter) : [1...1] of EvolutionPilot

    Outputs : none

    - clone (Clone the scenario with a new name) :

    Arguments :

    - name (New scenario name) : [1...1] of C80

    Outputs :

    - clone (Cloned scenario instance) : [1...1] of Scenario

    - closeSessionMultiPhysics (Close a multi-physics session) :

    Arguments : none

    Outputs : none

    - continueToSolve (Continue to solve a scenario) :

    Arguments :

    - distributed (Distributed number) : [0...1] of I04 (optional)

    - option (Option 'IterateOnNonConvergentSteps', 'DoNotIterateOnNonConvergentSteps' or 'IterateOnOneStep') : [0...1] of C80 (optional)

    - parameterSet (Step (example : 'Param1=0.3','Param2=1.7')) : [0...900000] of C80 (optional)

    - projectName (Name of the project to save during solving process) : [1...1] of C80

    Outputs : none

    - deleteAllResults (Delete all results of a scenario) :

    Arguments : none

    Outputs : none

    - deleteResults (Delete results of a scenario) :

    Arguments :

    - parameterSet (Parameter Values) : [0...900000] of C80 (optional)

    Outputs : none

    - displaySolverReport (Display solver report in the current step) :

    Arguments : none

    Outputs :

    - displaySolvingReport.report (Report) : [1...1] of SolverReport

    - existNextStep (Check the presence of the step) :

    Arguments : none

    Outputs :

    - exist (Presence of the next step(0:no, 1:yes)) : [1...1] of I04

    - generateH3DExport (Generate an export file for HyperView) :

    Arguments :

    - H3DFilename (File name of H3D export) : [1...1] of C80

    - H3DFormula (Formula) : [1...900000] of SpatialFormula

    Outputs : none

    - getIndexStep (Get Index Step from value of pilots ) :

    Arguments :

    - parameterName (Names of pilots) : [1...20] of C80

    - parameterValue (Value associated to each pilot) : [1...20] of R08

    Outputs :

    - index (Index of steps corresponding to input pilot values) : [1...20] of I04

    - getValuesParameter (Get values of parameters) :

    Arguments : none

    Outputs :

    - values (Values of pilots (dictionary)) : [0...900000] of R08 (optional)

    - isPostprocessingOK (Check the validity of all steps) :

    Arguments : none

    Outputs :

    - valid (Validity of all steps ( 0:invalid, 1:valid)) : [1...1] of I04

    - isValidStep (Check the validity of the step) :

    Arguments :

    - index (Index of step) : [1...1] of I04

    Outputs :

    - valid (Validity of the step ( 0:invalid, 1:valid)) : [1...1] of I04

    - iterateOnOneStep (Iterate on one step of a scenario) :

    Arguments :

    - parameterSet (Step (example : 'Param1=0.3','Param2=1.7')) : [0...900000] of C80 (optional)

    - projectName (Name of the project to save during solving process) : [1...1] of C80

    Outputs : none

    - openSessionMultiPhysics (Open a multi physic session (existing scenario)) :

    Arguments :

    - projectName (Name of the project to save during solving process) : [1...1] of C80

    Outputs : none

    - partialStorage (Partial storage) :

    Arguments : none

    Outputs : none

    - removePilot (Remove a piloted parameter) :

    Arguments :

    - parameter (Name of the piloted parameter) : [1...1] of VariationParameter

    Outputs : none

    - selectFirstStep (Select first step) :

    Arguments : none

    Outputs : none

    - selectIndexStep (Select step by index) :

    Arguments :

    - index (Index of step) : [1...1] of I04

    Outputs : none

    - selectLastStep (Select last step) :

    Arguments : none

    Outputs : none

    - selectNextStep (Select next step) :

    Arguments : none

    Outputs : none

    - setInvisiblePositions (Modify visibility of positions associated to free mechanical set pilot) :

    Arguments : none

    Outputs : none

    - setPartialStorage (Set partial storage) :

    Arguments :

    - partialStorage (Partial storage) : [1...1] of C80

    - storageModes (Intervals storage mode) : [0...900000] of C80 (optional)

    Outputs : none

    - setVisiblePositions (Modify visibility of positions associated to free mechanical set pilot) :

    Arguments : none

    Outputs : none

    - solve (Solve) :

    Arguments :

    - projectName (Name of the project to save during solving process) : [1...1] of C80

    Outputs : none

Answers

  • Yann_Le_Floch
    Yann_Le_Floch
    Altair Employee
    edited March 2021 Answer ✓

    Hi Rafud,

    To find how to used Scenario you can use : 

    Scenario.help()

    You will find all the possible method : 

    Methods :

    - addPilot (Add a parameter pilot) :

    Arguments :

    - pilot (Pilot associated to a parameter) : [1...1] of EvolutionPilot

    Outputs : none

    - clone (Clone the scenario with a new name) :

    Arguments :

    - name (New scenario name) : [1...1] of C80

    Outputs :

    - clone (Cloned scenario instance) : [1...1] of Scenario

    - closeSessionMultiPhysics (Close a multi-physics session) :

    Arguments : none

    Outputs : none

    - continueToSolve (Continue to solve a scenario) :

    Arguments :

    - distributed (Distributed number) : [0...1] of I04 (optional)

    - option (Option 'IterateOnNonConvergentSteps', 'DoNotIterateOnNonConvergentSteps' or 'IterateOnOneStep') : [0...1] of C80 (optional)

    - parameterSet (Step (example : 'Param1=0.3','Param2=1.7')) : [0...900000] of C80 (optional)

    - projectName (Name of the project to save during solving process) : [1...1] of C80

    Outputs : none

    - deleteAllResults (Delete all results of a scenario) :

    Arguments : none

    Outputs : none

    - deleteResults (Delete results of a scenario) :

    Arguments :

    - parameterSet (Parameter Values) : [0...900000] of C80 (optional)

    Outputs : none

    - displaySolverReport (Display solver report in the current step) :

    Arguments : none

    Outputs :

    - displaySolvingReport.report (Report) : [1...1] of SolverReport

    - existNextStep (Check the presence of the step) :

    Arguments : none

    Outputs :

    - exist (Presence of the next step(0:no, 1:yes)) : [1...1] of I04

    - generateH3DExport (Generate an export file for HyperView) :

    Arguments :

    - H3DFilename (File name of H3D export) : [1...1] of C80

    - H3DFormula (Formula) : [1...900000] of SpatialFormula

    Outputs : none

    - getIndexStep (Get Index Step from value of pilots ) :

    Arguments :

    - parameterName (Names of pilots) : [1...20] of C80

    - parameterValue (Value associated to each pilot) : [1...20] of R08

    Outputs :

    - index (Index of steps corresponding to input pilot values) : [1...20] of I04

    - getValuesParameter (Get values of parameters) :

    Arguments : none

    Outputs :

    - values (Values of pilots (dictionary)) : [0...900000] of R08 (optional)

    - isPostprocessingOK (Check the validity of all steps) :

    Arguments : none

    Outputs :

    - valid (Validity of all steps ( 0:invalid, 1:valid)) : [1...1] of I04

    - isValidStep (Check the validity of the step) :

    Arguments :

    - index (Index of step) : [1...1] of I04

    Outputs :

    - valid (Validity of the step ( 0:invalid, 1:valid)) : [1...1] of I04

    - iterateOnOneStep (Iterate on one step of a scenario) :

    Arguments :

    - parameterSet (Step (example : 'Param1=0.3','Param2=1.7')) : [0...900000] of C80 (optional)

    - projectName (Name of the project to save during solving process) : [1...1] of C80

    Outputs : none

    - openSessionMultiPhysics (Open a multi physic session (existing scenario)) :

    Arguments :

    - projectName (Name of the project to save during solving process) : [1...1] of C80

    Outputs : none

    - partialStorage (Partial storage) :

    Arguments : none

    Outputs : none

    - removePilot (Remove a piloted parameter) :

    Arguments :

    - parameter (Name of the piloted parameter) : [1...1] of VariationParameter

    Outputs : none

    - selectFirstStep (Select first step) :

    Arguments : none

    Outputs : none

    - selectIndexStep (Select step by index) :

    Arguments :

    - index (Index of step) : [1...1] of I04

    Outputs : none

    - selectLastStep (Select last step) :

    Arguments : none

    Outputs : none

    - selectNextStep (Select next step) :

    Arguments : none

    Outputs : none

    - setInvisiblePositions (Modify visibility of positions associated to free mechanical set pilot) :

    Arguments : none

    Outputs : none

    - setPartialStorage (Set partial storage) :

    Arguments :

    - partialStorage (Partial storage) : [1...1] of C80

    - storageModes (Intervals storage mode) : [0...900000] of C80 (optional)

    Outputs : none

    - setVisiblePositions (Modify visibility of positions associated to free mechanical set pilot) :

    Arguments : none

    Outputs : none

    - solve (Solve) :

    Arguments :

    - projectName (Name of the project to save during solving process) : [1...1] of C80

    Outputs : none
  • Rafud
    Rafud Altair Community Member
    edited March 2021

    This is exactly what I was looking for, thank you!