How to get DPM values as output for Design Xplorer

DariusDarius Member Posts: 10

Hello Everyone,

I am trying to create an optimization setup with Fluent and Design Xplorer where the radial particle distribution is an input parameter for the optimization. So I want to get the x and y position of each particle when it is at a specified plane (or z-position), calculate the radius from it, and see if it is above or below a given radius. The output parameter is then the share of particles above this radius.

I first tried with DEFINE_DPM_OUTPUT to get the x and y position of my particle and then store it in a file, I then read the file back in and create an output parameter using DEFINE_REPORT_DEFINITIN_FN but the file is only updated when a sample is created, which is not useful for my problem, or is it possible to create a sample every few iterations automatically?

My current approach is a SCALAR_UPDATE-UDF, where the positions are stored in the TP_USER_REAL array for each particle, here the data should be updated after each DPM iteration. The array is then read back to create an output parameter with DEFINE_REPORT_DEFINITION, both UDFs compile but when I start simulating I am getting a SIGSEV error. If I only use the SCALAR_UPDATE_MACRO everything is working. You can see my code in the attached picture.

If you have any suggestions on how to solve this issue, your help is much appreciated, also I am not quite sure if I can call DPM functions within non-DPM UDFs, is this possible at all?

Thanks in advance for your help.

Best Answer

  • DrAmineDrAmine GermanyForum Coordinator Posts: 6,642
    Accepted Answer

    You execute a journal file every 100 iterations for example. In that journal file you do sampling (a file is then written), you read that file to extract dpm related values and you output the values then in a sort of Output UDF. I am not sure here if outputting a DPM sample is what you want to do but you will notice whenever you read a dpm sample in histogram in Fluent and you do something with it Fluent will output the number of particles. As you anyway do "sampling" on a known Z-plane I guess you can rely on that built-in sampling after you create that plane for sure.

Answers

  • RobRob UKForum Coordinator Posts: 8,371

    You can create DPM reports and promote those to parameters. You may need to separate the domain into multiple cell zones to do this though and potentially use an expression on the DPM report(s) to give you what you want (you then promote the expression that's a function of the DPM reports to be an output parameter).

  • DrAmineDrAmine GermanyForum Coordinator Posts: 6,642
    edited December 2020

    And how will that parameter be used? You can do code a scheme procedure which serves as output parameter but that will also require sampling data and that sampling should be done all time.

  • DariusDarius Member Posts: 10

    Thanks for your answer, From my understanding DPM reports can only be created after the flow solution has been calculated. However, if I can create an output parameter at this point it should still be working. Can you please tell me how I can promote my report data to a parameter?

  • RobRob UKForum Coordinator Posts: 8,371

    When you create the report there should be a "parameter" button on the panel.

    Like in the above (bottom left). I tend to just add the data to a plot & file so I can review later, but for parametric studies you'll need an Output Parameter.

  • DariusDarius Member Posts: 10

    Thanks @Rob, so if I understood correctly you suggest creating two cell zones (like one in the center and one around it), get the DPM mass in each zone, and then create an expression that compares the two values which will then be my output parameter?

    Is there a way to get the particle radial position that is available in the particle tracks as an output parameter? Also, the mass in domain option is only available with two-way coupling which is not necessary for my case, so if it would be possible without this it would be great because I need to run quite a few simulations for the optimization.

    @DrAmine you mentioned sampling all the time, is this possible somehow?

  • RobRob UKForum Coordinator Posts: 8,371

    Yes, two zones.

    DPM particles are tracked in the lagrangian reference frame so the data isn't available in the same way the "flow" data is: hence using coupled. If the mass loading is low it shouldn't slow the solver down much.

  • DrAmineDrAmine GermanyForum Coordinator Posts: 6,642

    Yes everytime you want to update output parameter Fluent might execute sampling, you use that file to extract what you want and use it as output parameter

  • DrAmineDrAmine GermanyForum Coordinator Posts: 6,642

    A sort of process automation

  • DariusDarius Member Posts: 10

    Thanks for your answer, this sounds exactly like what I need. How can I get Fluent to do so? Because my first try on this was to change the sample output file with DEFINE_DPM_OUTPUT and then read that data back with DEFINE_REPORT_DEFINITION_FN every iteration but the sampling output file didn't got updated.

  • DrAmineDrAmine GermanyForum Coordinator Posts: 6,642
    Accepted Answer

    You execute a journal file every 100 iterations for example. In that journal file you do sampling (a file is then written), you read that file to extract dpm related values and you output the values then in a sort of Output UDF. I am not sure here if outputting a DPM sample is what you want to do but you will notice whenever you read a dpm sample in histogram in Fluent and you do something with it Fluent will output the number of particles. As you anyway do "sampling" on a known Z-plane I guess you can rely on that built-in sampling after you create that plane for sure.

  • DariusDarius Member Posts: 10

    Thanks a lot! This solved my problem. I didn't exactly use the Journal but 'Execute Commands' under 'Solution ->Activities -> Create' did the same.

Sign In or Register to comment.