Modifying field values for neighboring cells inside a postprocessor
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Modifying field values for neighboring cells inside a postprocessor
- This topic has 22 replies, 2 voices, and was last updated 2 days, 5 hours ago by Danial.Khazaeipoul.
-
AuthorPosts
-
August 19, 2024 at 7:32 pm #9121Danial.KhazaeipoulParticipant
I did though about storing the cell IDs, instead of storing pointers to the cell interfaces. However, I would need to create a Cell interface to be able to modify a global data which requires a blockLattice to be passed as an argument:
Cell<T,DESCRIPTOR> cell(blockLattice, iCell);
From the user-guide, I can see that the OperatorScope can be set to PerBlock instead of PerCell or PerCellWithParameters. However, I am not sure if this works with the freeSurfacePostProcessor or if OpenLB provides a similar method for block lattice operator such as:
template <typename T, typename DESCRIPTOR>
template <typename BLOCK>
void TestPostProcessor3D<T, DESCRIPTOR>::apply(BLOCK& block)
{}August 19, 2024 at 7:39 pm #9122Danial.KhazaeipoulParticipantI could potentially simplify this by implementing the algorithm directly within the top-level example. However, I believe doing so would introduce unnecessary complexity and complicate future integration efforts. Instead, I’m working on a more general integration approach, allowing users to easily utilize it in the same way they currently use the free-surface dynamics feature when the code is ready to merge.
August 20, 2024 at 8:14 pm #9125Danial.KhazaeipoulParticipantIn regard to this part of your question:
“I assume you want to preserve the queue across operator applications?”
No, I don’t need to preserve the queue, it is only used as a temporary container to store the cells or their ids to search for the connected gas or interface cells for which the global data, e.g., TEST_ID, is to be modified. Each operator call is going to build its own queue and discard it when the global data is modified.
August 21, 2024 at 9:21 am #9128AdrianKeymasterOk, good. This means that you can build on your previous post and store e.g. copies of the cell interfaces instead of pointers or just plain cell IDs and apply them using the
CELL::setCellID
method.August 22, 2024 at 12:25 am #9131Danial.KhazaeipoulParticipantThank you Adrian,
I attempted to follow your suggestion and only stored the “CellIDs” in the queue. However, it seems that the CUDA platform does not provide the “CELL::setCellId”. I did check the core/platform directory and only the CPU platform implements the “CELL::setCellId” method to be used. The code compiles and runs on CPU platform but it fails to compile on GPUs:
error: class “olb::gpu::cuda::Cell<T, NavierStokesDescriptor>” has no member “setCellId”
August 22, 2024 at 7:47 am #9133AdrianKeymasterYou are right. Luckily this is easy to fix.
August 22, 2024 at 9:12 pm #9144Danial.KhazaeipoulParticipantThank you for your assistance. FYI, the cell interface for cuda does also miss a getCellId() method which I added per your suggestion:
CellID getCellId() const __device__ {
return this->_iCell;
}September 12, 2024 at 7:21 pm #9235Danial.KhazaeipoulParticipantDear Adrian,
Is it possible to perform atomic operations within the operators?
I am attempting to do atomicMin within the apply() operator as below but I get a compile time error that no instances of the overloaded function “atomicMin” matches the argument provided:reducedID = atomicMin(cell.template getFieldPointer<FreeSurface::TEST_ID>(), nbrID);
Note that, nbrID and the TEST_ID fields are of the type CellID. Moreover, the function itself requires a memory address and a value as below:
int atomicMin(int* address, int val); unsigned int atomicMin(unsigned int* address, unsigned int val); unsigned long long int atomicMin(unsigned long long int* address, unsigned long long int val); long long int atomicMin(long long int* address, long long int val);
- This reply was modified 2 days, 5 hours ago by Danial.Khazaeipoul.
-
AuthorPosts
- You must be logged in to reply to this topic.