Efficient usage of multiple DEFINE_SOURCE
Hello,
Currently, I'm using the DEFINE_SOURCE macro for both x and y momentum source terms, but the computation is duplicated across the macros. The logic is to use DEFINE_SOURCE to loop through cells, calculate values based on cell variables, and then conditionally impose an x/y momentum source term. In one instance of DEFINE_SOURCE, the values for both x/y momentum is already solved for, but two separate instances are still needed when hooking the macro, leading to duplicated computations. Can anyone suggest a more efficient implementation that doesn't require the duplication of DEFINE_SOURCE? I thought about using arrays/UDMs to store the source terms so that in the 1st DEFINE_SOURCE, x/y terms are calculated and stored with x imposed, and in the 2nd DEFINE_SOURCE look up the y terms based on some cell identifier and impose. However, I think lookup operations don't scale well with number of cells. Any advice is appreciated! |
show the code you are using
|
All times are GMT -4. The time now is 04:21. |