|
[Sponsors] |
February 28, 2023, 10:27 |
Gradient of UDM
|
#1 |
Member
Chris
Join Date: Dec 2020
Posts: 45
Rep Power: 6 |
Hi,
I would like to calculate the gradient of some scalar value, stored in UDMI. The way I found (User guide + forum posts) is some kind of transformation to UDSI and saving UDSI_G afterwards to UDMI. I tried this but it didnt work for me... Do I require face values also? First I use some DEFINE_ADJUST to initialize my UDSI: Code:
DEFINE_ADJUST(DA_UDSI, d) { Thread *t; cell_t c; face_t f; thread_loop_c (t,d) { begin_c_loop (c,t) { C_UDSI(c,t,0) = C_UDMI(c,t,0); } end_c_loop (c,t) } } Code:
DEFINE_ON_DEMAND(DOD_UDMI) { Thread *t; cell_t c; Domain *d = Get_Domain(1); thread_loop_c (t,d) { begin_c_loop (c,t) { C_UDMI(c,t,1) = C_UDSI_G(c,t,0)[0]; C_UDMI(c,t,2) = C_UDSI_G(c,t,0)[1]; C_UDMI(c,t,3) = C_UDSI_G(c,t,0)[2]; } end_c_loop (c,t) } } In CFD-Post, I use some contour on plane for visualization. While C_UDMI(c,t,1) shows me some results, I get "holes" inside my plane for C_UDMI(c,t,2) and C_UDMI(c,t,3), as there are some cells where I get no value. Thanks in advance for any help Pyro |
|
March 2, 2023, 02:46 |
|
#2 |
Member
Odisha
Join Date: Jan 2020
Posts: 59
Rep Power: 6 |
Can you try this instead:
Switch on the UDS equation, and allocate 3 memory locations (since you'll be using C_UDMI thrice) Code:
#include "udf.h" DEFINE_ADJUST (name,d) { #if !RP_HOST Thread *t; cell_t c; face_t f; thread_loop_c (t,d) { begin_c_loop (c,t) { C_UDMI(c,t,0) = C_UDSI_G(c,t,0)[0]; C_UDMI(c,t,1) = C_UDSI_G(c,t,0)[1]; C_UDMI(c,t,2) = C_UDSI_G(c,t,0)[2]; } end_c_loop (c,t) } #endif } |
|
March 3, 2023, 08:19 |
|
#3 |
Member
Chris
Join Date: Dec 2020
Posts: 45
Rep Power: 6 |
Hi and thank you for the answer.
I donīt understand the benefit or change, for doing this... If I turn on the claculation of UDS, than my value changes over time as I have unsteady term and flux, ... I already allocate enough memories and scalars. My data are stored in UDMI 0, I write them to UDSI 0 and than I save them in UDMI 1, UDMI 2 and UDMI 3. So I use 4 UDMI and 1 UDSI. Thanks in advance Pyro |
|
March 3, 2023, 13:00 |
|
#4 |
Member
Odisha
Join Date: Jan 2020
Posts: 59
Rep Power: 6 |
C_UDSI is a solver macro that fetches you the value of your scalar variable. You cannot alter or change the value of C_UDSI by assigning it some value.
Code:
C_UDSI(c,t,0) = C_UDMI(c,t,0) //the above statement is wrong. It's no better than: int a; 2 = a; Code:
C_UDMI(c,t,0) = C_UDSI(c,t,0); |
|
Tags |
gradient, udmi, udsi |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question about C_UDMI and F_UDMI and How to define the gradient of a UDM? | aestas | Fluent UDF and Scheme Programming | 4 | May 14, 2018 11:50 |
pisoFOAM (LES) - internal pipe flow - convergence | gu1 | OpenFOAM Running, Solving & CFD | 0 | January 11, 2018 17:39 |
question regarding LES of pipe flow - pimpleFoam | Dan1788 | OpenFOAM Running, Solving & CFD | 37 | December 26, 2017 15:42 |
Periodic flow using Cyclic - comparison with Fluent | nusivares | OpenFOAM Running, Solving & CFD | 30 | December 12, 2017 06:35 |
How could I get the gradient of UDM? | fireman | FLUENT | 2 | February 8, 2011 06:36 |