Number of variables stored in user defined memory locations(C_UDMI)

 Register Blogs Members List Search Today's Posts Mark Forums Read

 December 20, 2021, 02:55 Number of variables stored in user defined memory locations(C_UDMI) #1 Member   Join Date: Jul 2020 Location: India Posts: 66 Rep Power: 5 Let us say I loop over all the cells in the domain and store the values of cell centres(xc[0] and xc[1]) in two different C_UDMs only if a certain condition is satisfied as shown below: begin_c_loop(c,t) { C_CENTROID(xc,c,t); real r = sqrt(pow(xc[0]-x0-v*time,2.0) + pow(xc[1]-y0,2.0)); if(r<=R && xc[2] == -0.0000855) { C_UDMI(c,t,7) = c; C_UDMI(c,t,8) = xc[0]; C_UDMI(c,t,9) = xc[1]; C_UDMI(c,t,10) = xc[2]; } } end_c_loop(c,t) Now I want to make a 2D dynamic array consisting of the elements in C_UDMI(c,t,8) and C_UDMI(c,t,9) i.e, a 2D array with elements being x and y centres of the cells. As I understand, I need to find the number of variables in both the UDMs after each iteration and then I can allocate a 2D dynamic array. Can someone help with the method to find the number of variables in UDMs after each iteration? Or if there is another way to store the cell centres apart from allocating a dynamic array? Please help if you know any method. Thanks in advance.

December 20, 2021, 13:18
#2
Senior Member

Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
Quote:
 As I understand, I need to find the number of variables in both the UDMs
I think you use the wrong terminology. Each UDM contains one variable, so that would be a very easy answer.

I guess that you mean how many values are stored in the UDMs. Including the ones with value zero, it's the number of cells in your simulation. If you only want to know how many values were set in your loop, the simplest method is to just count them. Add a counter in your code, set it at zero initially, and add one every time that you put a value in a UDM.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".

 December 20, 2021, 22:31 #3 Member   Join Date: Jul 2020 Location: India Posts: 66 Rep Power: 5 Thanks pakk. And sorry for the words. Yes, I want to know the number of values for each variable stored in a UDM after each iteration/time-step. I will add what you have suggested.

December 21, 2021, 09:26
#4
Member

Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 5
I did what you suggested. Now since my if condition satisfies a circular region, so in 3D I will have a cylindrical region. Now I know the cell ids and centres of all the cells inside this cylindrical region. Looking from the side, the cylindrical region consists of a number of columns and each column has a number of cells.
My target is to loop over all the columns and over all the cells inside the column. From my understanding, using begin_c_loop anywhere starts to loop over all the cells in an order which I can't know. Can anyone please share some thoughts on how to do this? I have attached an image showing the cylindrical region I am talking about.
Attached Images
 side.png (37.3 KB, 14 views)

 December 21, 2021, 11:39 #5 Senior Member   Join Date: Nov 2013 Posts: 1,965 Rep Power: 26 I don't understand your problem. The UDF from your first post seems to do what you describe, so what more do you want? __________________ "The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".

 December 21, 2021, 12:19 #6 Member   Join Date: Jul 2020 Location: India Posts: 66 Rep Power: 5 From my first post, I am able able to get all the cells inside a cylindrical region as the if condition is for a circle and in 3D domain, it would include all the cells inside a cylindrical region. Now, for each column of cells along z direction(vertical and each column will have a number of cells), I want to identify a particular cell. By looping through all the columns, I want to identify all those cells. My doubt is how to loop along each column of cells? I have shown in the previous image how a cylinder is made of a number of columns and each column is made up of a number of cells.

 December 21, 2021, 13:36 #7 Senior Member   Join Date: Nov 2013 Posts: 1,965 Rep Power: 26 Now I understand. I don't know a simple way to do that. __________________ "The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".

 December 21, 2021, 13:50 #8 Member   Join Date: Jul 2020 Location: India Posts: 66 Rep Power: 5 No issues. Thanks for your answers.

 Tags cell centre data, udmi, user defined memory