|
[Sponsors] |
Gradient of UDS is zero while UDS has non-zero values |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 21, 2021, 21:36 |
Gradient of UDS is zero while UDS has non-zero values
|
#1 |
New Member
YF
Join Date: Sep 2016
Posts: 5
Rep Power: 10 |
Hi everyone,
I would like to get the gradient of species mass concentration to compute the mass transfer coefficient based on Fick's law. The code runs in parallel mode. I am stuck with the issue of getting zero gradients of UDS. But when I check the value of UDS, there are non-zero values. My UDF code is as below, ---------------------------------------------------------------------------------- #include "udf.h" DEFINE_ADJUST(spec_interf_concen,mixture_domain) { #if !RP_HOST int liq_phase_id = 0; int gas_phase_id = 1; int co2_species_id = 0; int yi = 0; ...... Domain *pDomain = DOMAIN_SUB_DOMAIN(mixture_domain,gas_phase_id); { Alloc_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_N ULL); Scalar_Reconstruction(pDomain, SV_VOF,-1,SV_VOF_RG,NULL); Scalar_Derivatives(pDomain,SV_VOF,-1,SV_VOF_G,SV_VOF_RG,Vof_Deriv_Accumulate); } mp_thread_loop_c(mix_thread, mixture_domain, pt) { if (FLUID_THREAD_P(mix_thread)) { begin_c_loop(c,mix_thread) { liq_thread = THREAD_SUB_THREAD(mix_thread,liq_phase_id); gas_thread = THREAD_SUB_THREAD(mix_thread,gas_phase_id); ...... C_UDSI(c,pt[liq_phase_id],yi) = C_YI(c,pt[liq_phase_id],co2_species_id); if((vof_l_c > 1e-6)&&(vof_l_c < 0.999999)) { ca = press/KH_px*rho_l/Ml*vof_l_c; C_UDSI(c,pt[liq_phase_id],yi) = ca*Mg/(ca*Mg+rho_l*vof_l_c); } ...... } end_c_loop_int(c,mix_thread) } } /* Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NU LL); */ #endif } DEFINE_LINEARIZED_MASS_TRANSFER(surface_renewal, c, mixture_thread, from_phase_index, from_species_index, to_phase_index, to_species_index, lin_from, lin_to) { Thread *liq; Thread **pt; int liquid_species_id = 0; int gas_phase_ID = 1; int co2_species_id = 0; int yi = 0; ...... real rho_l, rho_g, r_rho_lg; real cg_G[3]; liq = THREAD_SUB_THREAD(mixture_thread, to_phase_index); pt = THREAD_SUB_THREADS(mixture_thread); rho_l = C_R(c,liq); rho_g = C_R(c,pt[gas_phase_ID]); vof_l = C_VOF(c,liq); vof_g = C_VOF(c,pt[gas_phase_ID]); if (NULL != THREAD_STORAGE(liq,SV_UDSI_G(yi))) { /* gradient of species mass concentration */ NV_V(cg_G,=,C_UDSI_G(c,liq,yi)); Message("Magnitude of species mass concentration: %f \n",NV_MAG(cg_G)); } else { NV_S(cg_G,=,0.0); } ...... return m_source; } ---------------------------------------------------------------------------------- Moreover, I did the following setup to keep the memory from freeing: /solve/set/expert but the TUI shows the option is incompatible with the adaption in parallel. I wonder whether this option will affect the value of UDS gradient.
__________________
Yuan Fang |
|
November 23, 2021, 00:06 |
|
#2 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
manual
Quote:
__________________
best regards ****************************** press LIKE if this message was helpful |
||
November 23, 2021, 20:55 |
|
#3 | |
New Member
YF
Join Date: Sep 2016
Posts: 5
Rep Power: 10 |
Quote:
Do you know how to fix this issue? I found a similar topic in Ansys forum: https://forum.ansys.com/discussion/1...on-not-only-in A coordinator mentioned that there is an unofficial method retrieving the gradient values, but he did not give the solution. |
||
November 24, 2021, 04:41 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
unofficial way is to use reconstruction gradient macros, which you are using already
Code:
Alloc_Storage_Vars(...) Scalar_Reconstruction(...) Scalar_Derivatives(...) Free_Storage_Vars(...) Code:
thread_loop_c(t, d) { if (!SV_ALLOCATED_P(t, SV_T)) { Message("Energy Equation not active in zone %d on compute node %d\n", THREAD_ID(t), myid); } else { Message("Energy Equation active in zone %d on compute node %d\n", THREAD_ID(t), myid); }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
Tags |
mass fraction (y), uds gradient of scalar, zero gradient |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
reconstruct gradient of UDS | loving_cfd | FLUENT | 10 | May 18, 2020 09:39 |
temperature gradient source term in uds | cfd_mech | FLUENT | 0 | July 27, 2014 05:55 |
non-exact gradient values | elisabet | OpenFOAM Programming & Development | 3 | July 18, 2012 08:45 |
reconstruction gradient of a UDS | gemini | Fluent UDF and Scheme Programming | 0 | June 7, 2009 17:03 |
Gradient UDS | tom | FLUENT | 1 | April 28, 2006 04:46 |