|
[Sponsors] |
Number of variables stored in user defined memory locations(C_UDMI) |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Member
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#2 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 ![]() |
Quote:
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". |
||
![]() |
![]() |
![]() |
![]() |
#3 |
Member
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Member
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#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". |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Member
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#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". |
|
![]() |
![]() |
![]() |
![]() |
#8 |
Member
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6 ![]() |
No issues. Thanks for your answers.
|
|
![]() |
![]() |
![]() |
Tags |
cell centre data, udmi, user defined memory |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
SimpleFoam & Theater | jipai | OpenFOAM Running, Solving & CFD | 3 | June 18, 2019 10:11 |
[snappyHexMesh] Error snappyhexmesh - Multiple outside loops | avinashjagdale | OpenFOAM Meshing & Mesh Conversion | 53 | March 8, 2019 09:42 |
SigFpe when running ANY application in parallel | Pj. | OpenFOAM Running, Solving & CFD | 3 | April 23, 2015 14:53 |
AMI interDyMFoam for mixer | danny123 | OpenFOAM Running, Solving & CFD | 4 | June 19, 2013 04:49 |
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues | michele | OpenFOAM Meshing & Mesh Conversion | 2 | July 15, 2005 04:15 |