Cleaning UDM
Hi all,
I wrote a small DPM_SCALAR_UPDATE script which stores some stuff in a UDM(c,t,0). These UDM variables are needed in the next timestep, but they should be reset to 0 before the next particle update. Since not every cell contains a particle at every timestep, I do this in a loop inside the DPM_SCALAR_UPDATE script. Furthermore I use a secondary UDM(c,t,1) as a boolean to indicate if a cell has been reset or not. This happens in another UDF during a downstream processing step. In practice, this looks like: Code:
if (C_UDMI(c,t,1) > 0) If I run in parallel however, the routine only resets the UDM in the partitions that contain a particle. Although in practice there are nearly always particles in every partition, this could theoretically lead to improper memory cleaning and thereby mass imbalances in other UDFs linked to this UDM. Does anyone have a suggestion to properly clean the memory, by not just looping over all cells in this partition, but by all cells in the entire mesh? Thanks! Cees |
I used something like this (I removed some lines from my code that you don't need, I did not test this version but I think it should still work).
I used it in serial mode, but probably it should work in parallel too. Code:
DEFINE_ON_DEMAND(cleanUDM) |
Thanks Pakk, I'll give it a try.
|
I implemented the piece of code in my DPM_SCALAR_UPDATE UDF (can't use execute at end or define on demand as I need the values in the next timestep).
Unfortunately, it didn't work. Like before only the cells in the partition that contained a particle got cleaned out, while the others were not.. EDIT: Also using both a c_loop_int and c_loop_ext in the routine did not work.. |
I think that is because the DPM_SCALAR_UPDATE UDf is only called if DPM particles are found. You might have better luck with a DEFINE_ADJUST UDF.
|
That might be the case indeed; problem is that the define_adjust routine is called before species and energy equation update, and I need the UDM values during those updates.
If I'm correct, the DPM routine is called after the scalar fields have been treated, and at that point the memory is to be erased. So far this approach has been working well, provided indeed there is a particle in the partition domain. |
One problem with your original code is that it is evaluated for every cell where there is a particle.
If there are 10000 particles, the domain will be 'cleaned' 10000 times. This is not necessarily wrong, but inefficient. More ideally, you need one flag per domain. You can do that be defining a global variable (assuming there is one domain, otherwise make it an array): Code:
int domainisclean=1; Code:
domainisclean=-1; Code:
if (domainisclean < 0) |
Hi Pakk,
The loop is only executed if there the boolean UDM is 1; so once per partition. But in terms of memory it is indeed not efficient, 1 boolean per partition would be sufficient, rather than 1 per cell.. Indeed, time to contact ansys support. Thanks for your help anyway! Best cees |
Quote:
|
All times are GMT -4. The time now is 19:46. |