|
[Sponsors] |
problem in gradient of user defined scalar C_UDSI_G(c,t,i) at boundaries |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 7, 2020, 04:02 |
problem in gradient of user defined scalar C_UDSI_G(c,t,i) at boundaries
|
#1 |
New Member
Ahmed Hafez
Join Date: Jul 2018
Posts: 26
Rep Power: 8 |
Hello,
During writing a udf ,I need to compute gradient, so I put the variable in UDS then compute gradient using C_UDSI_G(c,t,i), However the value I get is not logical at boundaries. So as to make sure that everything is going well. I put a variable that have predefined gradient in the uds (say C_UDSI(c,t,0)=C_K(c,t)) and compare its predefined gradient (C_K_G(c,t) [0]) with uds gradient (C_UDSI_G(c,t,0)[0]). I found significant difference at 1st two cells adjacent to all boundaries, then perfect agreement after those 2 cells. Do any one know where is the problem. Below is extracted part from my udf regarding this issue ----- #include "udf.h" #include "mem.h" DEFINE_ADJUST(adjust_udf, domain) { Thread *t; cell_t c; thread_loop_c(t,domain) { begin_c_loop(c,t) { C_UDSI(c,t,0) = C_K(c,t); C_UDMI(c,t,0) = C_UDSI_G(c,t,0)[0]; C_UDMI(c,t,1) = C_K_G(c,t)[0]; } end_c_loop(c,t) } } |
|
April 7, 2020, 04:54 |
Wall Treatment
|
#2 |
Senior Member
|
The reason for that is the wall treatment. For momentum, thermal energy, species, turbulence, etc., there is a wall treatment carried out but not for UDS. For UDS, users have to do it themselves.
https://www.afs.enea.it/project/nept.../th/node99.htm For , though the boundary condition at wall is 0 flux, but its generation modifies the profile near the wall.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 7, 2020, 05:31 |
|
#3 |
New Member
Ahmed Hafez
Join Date: Jul 2018
Posts: 26
Rep Power: 8 |
Thank you Vinerm for your reply.
However the problem takes place at all boundaries ( velocity inlet, pressure outlet and wall) not walls only so I think it is not an issue of wall treatment. |
|
April 7, 2020, 06:30 |
Boundary Conditions and Solving
|
#4 |
Senior Member
|
Do you have same boundary conditions for UDS as those for ? Furthermore, do you solve for UDS? If yes, then the change is expected since the equations are not the same.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 7, 2020, 06:37 |
|
#5 | |
New Member
Ahmed Hafez
Join Date: Jul 2018
Posts: 26
Rep Power: 8 |
Quote:
For you second question, No, I turned off the uds. |
||
April 7, 2020, 06:44 |
Reconstructed
|
#6 |
Senior Member
|
Did you try using Reconstructed gradient instead of gradient?
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 7, 2020, 07:56 |
|
#7 |
New Member
Ahmed Hafez
Join Date: Jul 2018
Posts: 26
Rep Power: 8 |
||
April 7, 2020, 08:50 |
Comparison
|
#8 |
Senior Member
|
Are you comparing cell values or node values? That may make a difference. Though with same boundary conditions applied, it should not make a difference but it may.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 7, 2020, 11:04 |
|
#9 | |
New Member
Ahmed Hafez
Join Date: Jul 2018
Posts: 26
Rep Power: 8 |
Quote:
Here is an update!! I repeated the simulation using green gauss node base method for gradient and I got perfect agreement at inlet but not at wall nor outlet, it may be due to zero flux boundary condition for uds, so I looped over all boundary face and assign F_UDSI(f,t,0)=F_K(f,t) similar as in the following link: https://www.afs.enea.it/project/nept...df/node103.htm This time I got perfect agreement between C_USDI_G & C_K_G however when I repeated the same procedure using least square method, there is big enhancement at wall and pressure outlet and no enhancement at inlet and generally I still have significant difference at all boundaries. Do you have any guess why this happens with least square method? |
||
April 9, 2020, 06:52 |
Least Square
|
#10 |
Senior Member
|
Most likely because least square gradient is based on the assumption that the solution varies linearly. However, the difference you are observing could also be due to the gradient method being used, i.e., cell-to-face and not cell-to-cell. You can try using cell-to-cell as well as trying using differentiable limiter instead of default non-differentiable one.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 11, 2020, 18:15 |
|
#11 | |
New Member
Ahmed Hafez
Join Date: Jul 2018
Posts: 26
Rep Power: 8 |
Quote:
I tried differentiable, cell-to-face and not cell-to-cell but the same problem still occur. |
||
January 8, 2021, 06:10 |
|
#12 |
New Member
Vincenzo Luci
Join Date: Jan 2019
Posts: 9
Rep Power: 7 |
Hello to everyone, someone has solved this problem?
Thank you, Vincenzo |
|
January 8, 2021, 09:03 |
|
#13 |
New Member
Ahmed Hafez
Join Date: Jul 2018
Posts: 26
Rep Power: 8 |
||
April 4, 2024, 06:11 |
|
#14 | |
New Member
Diogo Martinho
Join Date: Sep 2022
Posts: 7
Rep Power: 4 |
Quote:
I am facing a problem with the gradient of my UDS. Similar to the one presented on this thread. However, I haven't solved it yet. I am defining a UDS and this UDS is only defined in certain domains. However, the cells of the domain where the UDS is solved that are neighbours to the cells of the domain where the UDS is not solved, present a wrong gradient. I already tried set the UDS to be solved in all the domains and then I would set a low diffusion coefficient on the domains where it shouldnt be solved but didnt manage to get it right. Do you have any alternative to this? I know boundary_face_thread, however, I am not entirely sure how could I use it to fix this issue. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
whats the cause of error? | immortality | OpenFOAM Running, Solving & CFD | 13 | March 24, 2021 08:15 |
User Defined Scalar Flux | SandilyaCFD | OpenFOAM Running, Solving & CFD | 0 | February 15, 2017 16:08 |
Diverging solution in transonicMRFDyMFoam | tsalter | OpenFOAM Running, Solving & CFD | 30 | July 7, 2014 07:20 |
is internalField(U) equivalent to zeroGradient? | immortality | OpenFOAM Running, Solving & CFD | 7 | March 29, 2013 02:27 |
user defined function in Transient Structural for FSI problem | omidiut | CFX | 5 | December 5, 2011 12:19 |