|
[Sponsors] |
January 26, 2022, 12:52 |
Species diffusion through a wall
|
#1 |
New Member
Joe
Join Date: Jan 2022
Posts: 13
Rep Power: 4 |
Hello all,
I want to simulate the diffusion flow of a species through a wall to the other side of the wall. For this purpose, I have already determined the cells adjacent to the wall using a UDF and thus built in source terms from both sides. To make the sources now dependent on the concentration of the species, I want to determine the gradient of the species. For this I found in pressure-based solver after entering the command "(rpsetvar 'species/save-gradients? #t)" into the TUI. As a first step, I tried to determine the gradient and save it in a UDM so that I can use it later for computation. When compiling the UDF the following error occurs: error C2440: '=': 'real *' cannot be converted to 'real. When modifying the UDF to save the mass fraction, no error occurs. Can anyone give me a hint where my error is? This is my Code for Saving Gradient: Code:
#include "udf.h" #include "mem.h" DEFINE_EXECUTE_AT_END(Grad_calc) { Domain* d; Thread* t; cell_t c; d = Get_Domain(1); thread_loop_c(t, d) { begin_c_loop(c, t) { C_UDMI(c, t, 1) = C_YI_G(c, t, 0); } end_c_loop(c,t) } } Many Greetings Joe |
|
February 2, 2022, 20:21 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
gradient is a vector so you have 3 scalar values for 3D problem
to be Code:
C_UDMI(c, t, 1) = C_YI_G(c, t, 0)[0]; C_UDMI(c, t, 2) = C_YI_G(c, t, 0)[1]; C_UDMI(c, t, 3) = C_YI_G(c, t, 0)[2];
__________________
best regards ****************************** press LIKE if this message was helpful |
|
February 3, 2022, 05:10 |
|
#3 |
New Member
Joe
Join Date: Jan 2022
Posts: 13
Rep Power: 4 |
Dear Alexander,
Thank you for your reply. I have already been able to fix the problem myself. Your hint that the gradient is a vector was part of it. I converted the gradient to a scalar using the Magnitude macro. After this error was fixed, a memory error occurred, which I fixed by having the solver access the gradient only after checking to see if it was in memory. In addition, I have replaced Execute at End macro with a Define Adjust macro. Thanks for your help. Many greetings Joe |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to define diffusion coefficients for every species in the system? | Weiqiang Liu | FLUENT | 7 | June 23, 2021 11:03 |
Table bounds warnings at: END OF TIME STEP | CFXer | CFX | 4 | July 17, 2020 00:44 |
Centrifugal fan | j0hnny | CFX | 13 | October 1, 2019 14:55 |
Diffusion flux calculation in the wall boundary face of the wall function approach | randolph | OpenFOAM | 1 | August 27, 2018 23:02 |
Anisotropic Species Diffusion | Baden | FLUENT | 6 | January 17, 2017 05:06 |