Hints on how to modify the macro "ExportAreaAverageValue" provided with FLUX

Marco Biasion
Marco Biasion Altair Community Member
edited November 2022 in Community Q&A

Hi all,

I would like to modify the macro "ExportAreaAverageValue" provided with FLUX 2D as follows:

1) The original macro exports in an Excel file some selected quantities (see the attached file). This is done for the current step of a transient simulation.
2) What I would like to do now is to automatize the process for a certain number of steps. Imagine that I have a transient simulation with 100 steps: I would like to automatically create an Excel file for all the steps (getting then 100 different Excel files, one per each step).

I tried to modify the original macro by myself, but I always get an error like "Failed convert object: class cast error" which involves a list of messages related to some errors in the Java environment I guess.

The topic was already discussed in the following question: How to extract the magnitude of the magnetic flux density at the centroid of each element of the 2D mesh - Flux - Altair Products - Altair Community.

I would like to ask for the kind support of the Altair staff as well as some advanced/expert users.

Thank you very much in advance for all the help!

Marco

Tagged:

Best Answer

  • Alexandru-Ionel Constantin
    Alexandru-Ionel Constantin Altair Community Member
    edited March 2022 Answer ✓

    Hi Marco Biasion,

     

    I modified the original macro and created the new macro: ExportAreaAverageValueTimeSteps.PFM

     

    The input parameters for this new macro are, see the figure below:

    • List of regions;
    • Quantity;
    • Name of the solved scenario;
    • Start time in seconds;
    • The number of steps.

     image

     

    I tested the Macro and I think it does what you want.

     

    Please try it and let me know if it does what you want.

     

    Best regrds,

    Alexandru

Answers

  • Alexandru-Ionel Constantin
    Alexandru-Ionel Constantin Altair Community Member
    edited March 2022 Answer ✓

    Hi Marco Biasion,

     

    I modified the original macro and created the new macro: ExportAreaAverageValueTimeSteps.PFM

     

    The input parameters for this new macro are, see the figure below:

    • List of regions;
    • Quantity;
    • Name of the solved scenario;
    • Start time in seconds;
    • The number of steps.

     image

     

    I tested the Macro and I think it does what you want.

     

    Please try it and let me know if it does what you want.

     

    Best regrds,

    Alexandru

  • Marco Biasion
    Marco Biasion Altair Community Member
    edited March 2022

    Hi Marco Biasion,

     

    I modified the original macro and created the new macro: ExportAreaAverageValueTimeSteps.PFM

     

    The input parameters for this new macro are, see the figure below:

    • List of regions;
    • Quantity;
    • Name of the solved scenario;
    • Start time in seconds;
    • The number of steps.

     image

     

    I tested the Macro and I think it does what you want.

     

    Please try it and let me know if it does what you want.

     

    Best regrds,

    Alexandru

    Dear Alexandru,

    Thank you so much! the macro you modified works well and this is exactly what I was looking for! I really appreciated your kind help.
    Apparently, my code didn't work because of an error in defining the cardinalities of one parameter and also another error in the commands.

    Best regards,

    Marco

  • Alexandru-Ionel Constantin
    Alexandru-Ionel Constantin Altair Community Member
    edited March 2022

    Dear Alexandru,

    Thank you so much! the macro you modified works well and this is exactly what I was looking for! I really appreciated your kind help.
    Apparently, my code didn't work because of an error in defining the cardinalities of one parameter and also another error in the commands.

    Best regards,

    Marco

    Hi Marco,

    You are welcome!

    Best regards,

    Alexandru

  • Marco Biasion
    Marco Biasion Altair Community Member
    edited November 2022

    Dear Alexandru,

    I've been using this macro quite a lot since last March, and it works super well! However, when I need to create several Excel files (i.e., several time steps), it is really slow. FLUX itself needs at least 90 seconds to create a single Excel file; imagine I need to postprocess 200 steps, this means (200*90)/60 = 300 mins approx. to create all the 200 Excel files. My believe is that FLUX is not "opimized" to extract such data efficiently creating Excel files.

    Do you think there is a way to create a macro that works exactly in the same way, but creates .DEX (or .txt) files? Thank you in advance!

    I can maybe also start a new topic in the forum in order to attract the attention of the FLUX developers!

    Best regards,

    Marco