PyFlux: Get application type

Romain B
Romain B Altair Community Member
edited October 2020 in Community Q&A

Hi, 

I'm back with questions regarding Python/PyFlux. I'm trying to determine the current application in a script. I have two questions:

1. In my tests, I found out that my current application is always Application[2]. Why is there no Application[0], and why is Application[1] the pre-processor?

2. When I type 'Application[2]' in the PyFlux command line, I get 'ApplicationMagneticTransient3D[2]', which would be good for me to determine the application. Yet, when I assign it to a variable 'myVar = Application[2]', a print of that variable returns '2'. I can't seem to get the information I want. There must be a python mechanism that I don't understand, and it might be useful for several other tasks in Flux.

 

Thank you very much in advance!

Romain

Tagged:

Answers

  • plombard
    plombard
    Altair Employee
    edited March 2019

    Hello,

    The Application[1] is always the preprocessor. Application[2] is for the physical application.

    I propose you to use a specific command (which is valid for all Flux entities):

    A=Application[2].getPyFluxCommand()

    print A

    It should display something like this for transient application:

    ApplicationMagneticTransient2D(domain2D=Domain2DPlane(lengthUnit=LengthUnit['MILLIMETER'],

                                                          depth='75'),

                                   solverFE=SolverFEFlux3D(),

                                   coilCoefficient=CoilCoefficientAutomatic(),

                                   transientInitialization=TransientInitializationStaticComputation())


    I hope it will help.

    regards

    Patrick

  • Romain B
    Romain B Altair Community Member
    edited March 2019

    Hello Patrick, 

    Fantastic! Thank you very much.

     

    Romain

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.