How to get DPM values as output for Design Xplorer
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.