CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Using value at certain location inside equation (https://www.cfd-online.com/Forums/openfoam-programming-development/255170-using-value-certain-location-inside-equation.html)

songyi719 March 23, 2024 00:00

Using value at certain location inside equation
 
I am trying to include some turbulent flux term of scalar by modifying scalartransport, but having some difficulty. There are two parts that is difficult to implement, one is differentiating for only single direction, and other is normalizing by center value.


I am trying to neglect turbulent flux in other direction, but leave only x direction u's' term, so I have to calculate only ds/dx, not fvm::div ds/dx+ds/dy. Thankfully, ChatGPT tells me that I can use fvm::grad().component(DIM_Y), so I think I will try this one.


Actually, real issue is that closure equation of this scalar use z direction velocity value at certain point, such as (0,0,z) when equation is solved at location (x,y,z). I first thought of using findCell, but it wouldn't work for parallel computation. How can I implement this to work at parallel condition? Luckily, z dimension of cell is equal along the x and y axis. But I can't just divide coordinate by dz to find index because height ratio exists along z axis.


All times are GMT -4. The time now is 14:00.