How to use an external excel file for topology optimization in optistruct as an objective?

Dóczi Martin
Dóczi Martin Altair Community Member
edited October 2022 in Community Q&A

Hi,
I would like to use Optistruct for topology optimization.
There is no any built-in response which can I use for my custom objective function. Making an equation is also not an option. I have just read, that the cells from given excel files can be used explicitly as a response.

The task is the following:

There are multiple loadcases. I would like to choose 3 from them, and request their Strain Energy Densities' results for a given element set.  I can export this result to h3d files after each iteration (The files with name of ..._s1.h3d, ..._s2.h3d...) I can write a TcL script, which can query the SED values of the given element set, from each relevant h3d file of the subcases. After that, I import them in python to make calulations with them, then a single number as an objective value can be exported into an excel file, for example in the A1 cell. And in the next run, I do this again, rewriting the excel file, until my objective reach its minimum. Calculations in the excel spreadsheet is not an option either, because I have a LOT of elements. (The results from the other loadcases are used for other constraints, but it is irrelevant now, because there is built-in response for that.)


Is that possible? How does Optistruct know, that my excel is ready? Can I automatically interrupt the calculations of the optimization run, until I query the results and calculate my objective with python? Is there any "banana peel" in this job?


Any comment will be appreciated.

Answers

  • Ben Buchanan
    Ben Buchanan
    Altair Employee
    edited October 2022

    I am not sure I follow all that you are trying to do but would a DRESP3 work for this?  It sounds like it would be a good fit.
    https://2022.help.altair.com/2022.1/hwsolvers/os/topics/solvers/os/dresp3_bulk_r.htm

    Using a Compose function might help.

    https://2022.help.altair.com/2022.1/hwsolvers/os/topics/solvers/os/compose_function_for_dresp3_response_example_problem_r.htm

  • Dóczi Martin
    Dóczi Martin Altair Community Member
    edited October 2022

    I am not sure I follow all that you are trying to do but would a DRESP3 work for this?  It sounds like it would be a good fit.
    https://2022.help.altair.com/2022.1/hwsolvers/os/topics/solvers/os/dresp3_bulk_r.htm

    Using a Compose function might help.

    https://2022.help.altair.com/2022.1/hwsolvers/os/topics/solvers/os/compose_function_for_dresp3_response_example_problem_r.htm

    Hi,

    thank you for your answer.

    Yes, I have read about the DRESP3 card. But the problem is, in the examples, the inputs of the DRESP3 card are always some internal (DRESP1) response, and the strain energy density of each element is not available as an internal response, only in the result files (.h3d files).

    Sadly it cannot be calculated either, using equations because the stress and strain values cannot be obtained in the integration points as internal responses.

     

    If somehow after each iteration during topology optimization, I can calculate from the h3d files my objective value and give it to optistruct to continue the optimization, that would be the solution. 

    But surprisingly I cannot find any method or example for this. 

  • Ben Buchanan
    Ben Buchanan
    Altair Employee
    edited October 2022

    Hi,

    thank you for your answer.

    Yes, I have read about the DRESP3 card. But the problem is, in the examples, the inputs of the DRESP3 card are always some internal (DRESP1) response, and the strain energy density of each element is not available as an internal response, only in the result files (.h3d files).

    Sadly it cannot be calculated either, using equations because the stress and strain values cannot be obtained in the integration points as internal responses.

     

    If somehow after each iteration during topology optimization, I can calculate from the h3d files my objective value and give it to optistruct to continue the optimization, that would be the solution. 

    But surprisingly I cannot find any method or example for this. 

     

    Ok. I understand a little more the challenges you are facing.  I am not sure when the information for each iteration is written but it might not be available when the responses are calculated.  If that is the case I think you would have to try a HyperStudy approach (which may be the best option any ways).   If the information is available you could probably have dummy inputs into your DRESP3 and use your scripts to feed back in the right answer.  That is a big if though.

    So using HyperStudy you would actually take out all the optimization setup and instead set those things up in HyperStudy.  I am not an export in HyperStudy but I know there is lots of information out there.  And you could post another question on the HyperStudy forum :) but to get you started here are 2 tutorials that may help.

    https://2022.help.altair.com/2022.1/hwdesktop/hst/topics/tutorials/hst/tut_hs_1515_t.htm

    https://2022.help.altair.com/2022.1/hwdesktop/hst/topics/tutorials/hst/tut_hs_1680_t.htm

    Hope that helps.