|
[Sponsors] |
ow to get DPM values as output for Design Xplorer |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 13, 2020, 16:12 |
SOLVED - How to get DPM values as output for Design Xplorer
|
#1 |
New Member
Darius
Join Date: Dec 2020
Posts: 8
Rep Power: 6 |
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. Last edited by Darius12345; December 17, 2020 at 12:49. Reason: solved |
|
December 14, 2020, 02:30 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
next time put your code here as a text, not picture
I don't have a lot experience in DPM simulations but what can i suggest is: 1. SIGSEV error means you have problems with memory, you are trying to access something, which doesn't exit 2. Most likely you have problems with loops: loop (I,Ilist) { loop(tp, I) { 3. what I can see in your code, Ilist is defined using Ilist = get_dpm_injection() macro But I is not defined 4. tp is not defined either in your code 5. So you may try to use only one loop with defined injecttion and particle pointers: loop(tp,Ilist->tp)
__________________
best regards ****************************** press LIKE if this message was helpful |
|
December 14, 2020, 06:44 |
|
#3 |
New Member
Darius
Join Date: Dec 2020
Posts: 8
Rep Power: 6 |
Hello AlexanderZ,
thank you for the reply, I thought the pointers are defined with Injection *I and Tracked Particle *tp. Also when I tried to define I and tp as integer I get error messages that these variables are already defined. Is there a way to define them like Ilist with something like get_dpm_particles()? My explanation for the SIGSEV was that TP_USER_REAL is not available in the REPORT_DEFINITION Macro? |
|
December 14, 2020, 07:42 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
change
Code:
loop (I,Ilist) { loop(tp, I) { Code:
loop(tp,Ilist->tp)
__________________
best regards ****************************** press LIKE if this message was helpful |
|
December 14, 2020, 13:01 |
|
#5 | |
New Member
Darius
Join Date: Dec 2020
Posts: 8
Rep Power: 6 |
Thanks again, I tried with your loop but now I get the following error:
Quote:
I tried with different DPM Setups, for my understanding if I use 'Interaction with continuous phase' or transient particle tracking the SCALAR_UPDATE Macro should be called whenever the particles are calculated and then my output parameter should also change. Code:
#include "udf.h" float i = 1.0; float j = 1.0; DEFINE_DPM_SCALAR_UPDATE(sampling_pos,cell,thread,initialize,tp) { float r = 0.0; if (initialize) { } else { r = sqrt(SQR(TP_POS(tp)[0])+SQR(TP_POS(tp)[1])); /*Message("r= %d\n", r);*/ i = i + 1; /*printf("i= %i\n", i);*/ if (r > 0.09) { j = j + 1; /*printf("j= %i\n", j);*/ } } } DEFINE_REPORT_DEFINITION_FN(positions) { float a = 0.0; a = j / i; return a; } |
||
December 17, 2020, 12:48 |
|
#6 |
New Member
Darius
Join Date: Dec 2020
Posts: 8
Rep Power: 6 |
Hello,
I was able to solve the issue by creating a sample file automated after n iterations using 'execute commands' in the Solution > Activities > Create Tab. Then I used DEFINE_DPM_OUTPUT to write the desired data at these points and read it back in with a UDF for an output parameter. Thanks for your suggestions, I will mark this Question as solved then. |
|
Tags |
dpm, output parameters, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Keeping intermediate files | OVS | SU2 | 5 | December 5, 2021 12:41 |
All output values increase rapidly after one cycle | 12ohan | OpenFOAM Running, Solving & CFD | 1 | April 26, 2019 11:52 |
writing values to IOdictionary subDict not generating expected output? | massive_turbulence | OpenFOAM Programming & Development | 2 | January 21, 2019 09:48 |
Output File of DPM Modelling | cwl6750084 | FLUENT | 0 | April 16, 2017 10:41 |
output point values in CFX4 | Dougal McQueen | CFX | 1 | February 14, 2004 00:55 |