|
[Sponsors] |
![]() |
![]() |
#41 |
Senior Member
|
Yes, you have to write it as SV_Y_G but while accessing a cell value, it has to be C_YI_G.
__________________
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. |
|
![]() |
![]() |
![]() |
![]() |
#42 |
Senior Member
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6 ![]() |
||
![]() |
![]() |
![]() |
![]() |
#43 |
Senior Member
|
If you do that then Alloc_... comes twice, which is not required. Yes, Free_... for RG is alright.
__________________
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. |
|
![]() |
![]() |
![]() |
![]() |
#44 | |
Senior Member
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6 ![]() |
Quote:
please modify my code. i'm confused very much please help DEFINE_ADJUST(gradient, domain) { Thread *t; Thread **pt; cell_t c; Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,P_PHASE); real voidx, voidy, voidz=0.0; { 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); } { Alloc_Storage_Vars(pDomain,SV_Y_RG,SV_Y_G,SV_NULL) ; Scalar_Reconstruction(pDomain, SV_Y,-1,SV_Y_RG,NULL); Scalar_Derivatives(pDomain,SV_Y,-1,SV_Y_G,SV_Y_RG,NULL); } { Alloc_Storage_Vars(domain, SV_Y_RG, SV_Y_G, SV_NULL); yi_derivatives(domain,0); Free_Storage_Vars(domain, SV_Y_RG, SV_NULL); } mp_thread_loop_c (t,domain,pt) if (FLUID_THREAD_P(t)) { Thread *tp = pt[P_PHASE]; begin_c_loop (c,t) { #if RP_3D /*(C_VOF_G(c,tp)[0]*C_T_G(c,t)[0]+C_VOF_G(c,tp)[1]*C_T_G(c,t)[1]+C_VOF_G(c,tp)[2]*C_T_G(c,t)[2]);*/ C_UDMI(c,t,0) = C_YI_G(c,tp,0)[0];//(C_VOF_G(c,tp)[0]*C_YI_G(c,tp,0)[0] + C_VOF_G(c,tp)[1]*C_YI_G(c,tp,0)[1] + C_VOF_G(c,tp)[2]*C_YI_G(c,tp,0)[2]); #endif } end_c_loop (c,t) } Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NU LL); Free_Storage_Vars(domain, SV_Y_G, SV_NULL); } thanks a lot |
||
![]() |
![]() |
![]() |
![]() |
#45 |
Senior Member
|
The reality is as follows. If you use the command stated earlier,
(rpsetvar 'species/save-gradients? #t) then you do not need any of these function. C_YI_G are directly available. So, you should remove all functions such as Alloc_, Scalar_, Free_, and yi_derivates. Rest should work as it is.
__________________
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. |
|
![]() |
![]() |
![]() |
![]() |
#46 | |
Senior Member
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6 ![]() |
Quote:
in TUI and run but earlier 1st iteration appear message "the f1 process couldnot be started" and fluent closed |
||
![]() |
![]() |
![]() |
![]() |
#47 |
Senior Member
|
Paste the modified code here. Do note that my previous suggestion will work as long as you are trying to access only mass fraction gradient. If you also want volume fraction gradient, then it has to be modified. But better to take one step at a time.
__________________
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. |
|
![]() |
![]() |
![]() |
![]() |
#48 | |
Senior Member
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6 ![]() |
Quote:
{ Thread *t; Thread **pt; cell_t c; Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,P_PHASE); real voidx, voidy, voidz=0.0; { 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 (t,domain,pt) if (FLUID_THREAD_P(t)) { Thread *tp = pt[P_PHASE]; begin_c_loop (c,t) { #if RP_3D C_UDMI(c,t,0) = C_YI_G(c,tp,0)[0]; #endif } end_c_loop (c,t) } Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NU LL); Free_Storage_Vars(domain, SV_Y_G, SV_NULL); } |
||
![]() |
![]() |
![]() |
![]() |
#49 |
Senior Member
|
Try this one. Ensure to give the rp command before using it. And it must be compiled not Interpreted. Ensure that you have at least one UDM assigned and patched with 0 values before using this UDF.
Code:
DEFINE_ADJUST(mfgradient, domain) { Thread *t; Thread **pt; cell_t c; mp_thread_loop_c (t,domain,pt) { if (FLUID_THREAD_P(t) && n_udm > 0) { begin_c_loop (c,t) { C_UDMI(c,t,0) = C_YI_G(c,pt[P_PHASE],0)[0]; } end_c_loop (c,t) } } }
__________________
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. |
|
![]() |
![]() |
![]() |
![]() |
#50 | |
Senior Member
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6 ![]() |
Quote:
fluent closed |
||
![]() |
![]() |
![]() |
![]() |
#51 |
Senior Member
|
Just to confirm, does your case have following characteristics?
1. Multiphase 2. Primary phase with at least two species If not, then the UDF will not work.
__________________
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. |
|
![]() |
![]() |
![]() |
![]() |
#52 |
Senior Member
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6 ![]() |
||
![]() |
![]() |
![]() |
![]() |
#53 |
Senior Member
|
Well, then it is weird. If you use the rp command and then check in Contours, do you see gradients for mass fraction and volume fraction? For volume fraction you have to give TUI so that Fluent keeps the memory from being freed. If you do not have gradients available in Contour plots, then there is some issue with the setup
__________________
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. |
|
![]() |
![]() |
![]() |
![]() |
#54 | |
Senior Member
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6 ![]() |
Quote:
|
||
![]() |
![]() |
![]() |
![]() |
#55 |
Senior Member
|
I checked it at my end and the code works perfectly good. Could you share the output of compilation, i.e., the output shown by Fluent when you click on Build?
__________________
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. |
|
![]() |
![]() |
![]() |
![]() |
#56 |
Senior Member
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6 ![]() |
hi how are you today
Copied F:\Cooling Tower\mass-transfer\mass-transfer_files\dp0\FFF-1\Fluent/F:\Cooling Tower\mass-transfer\mass-transfer_files\dp0\FFF-1\Fluent\TOTAL-VOF2.c to F:\Cooling Tower\mass-transfer\mass-transfer_files\dp0\FFF-1\Fluent\libudf\src udf_names.c and user_nt.udf files in 3ddp_host are upto date. (system "copy "D:\ANSYS Inc\v195\fluent"\fluent19.5.0\src\udf\makefile_nt. udf "F:\Cooling Tower\mass-transfer\mass-transfer_files\dp0\FFF-1\Fluent\libudf\win64\3ddp_host\makefile" ") 1 file(s) copied. (chdir "F:\Cooling Tower\mass-transfer\mass-transfer_files\dp0\FFF-1\Fluent\libudf")(chdir "win64\3ddp_host")udf_names.c and user_nt.udf files in 3ddp_node are upto date. (system "copy "D:\ANSYS Inc\v195\fluent"\fluent19.5.0\src\udf\makefile_nt. udf "F:\Cooling Tower\mass-transfer\mass-transfer_files\dp0\FFF-1\Fluent\libudf\win64\3ddp_node\makefile" ") 1 file(s) copied. (chdir "F:\Cooling Tower\mass-transfer\mass-transfer_files\dp0\FFF-1\Fluent\libudf")(chdir "win64\3ddp_node") Done. |
|
![]() |
![]() |
![]() |
![]() |
#57 |
Senior Member
|
As per this output, there is no compilation of the UDF. You need to compile the UDF outside workbench. And then load it within workbench.
__________________
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. |
|
![]() |
![]() |
![]() |
![]() |
#58 |
Senior Member
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6 ![]() |
||
![]() |
![]() |
![]() |
![]() |
#59 |
Senior Member
|
It is possible to compile within WB as well, provided the paths for the compiler are correctly set. If the compilation is good, you should be able to find .dll file in the libudf/win64. If it does not exist, then the compilation is not successful. To confirm it, delete the existing libudf directory and compile it again.
And as stated earlier, even without the UDF, but after issuing command Code:
(rpsetvar 'species/save-gradients? #t)
__________________
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. |
|
![]() |
![]() |
![]() |
![]() |
#60 | |
Senior Member
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6 ![]() |
Quote:
i run my project without udf and it's running well and the contour of species mass fraction exist. but when i running without udf and writing command "(rpsetvar 'species.....)" before running, appear this message"the f1 process couldnot be started" and FLUENT closed(exactly similar to running with udf)!!!!! it seams entirely FLUENT don't access to species mass fraction!!! second, this file (---.dll) exist in libudf folder in path of storing my project |
||
![]() |
![]() |
![]() |
Tags |
macros, segmentation error, udf |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
mass fraction of species | Lilly | FLUENT | 5 | March 13, 2022 17:52 |
CFD by anderson, chp 10.... supersonic flow over flat plate | varunjain89 | Main CFD Forum | 18 | May 11, 2018 07:31 |
Accessing the species mass fraction for particles data in UDF | mac_09 | FLUENT | 17 | August 9, 2017 20:15 |
Define mass flow profile with regards to species mass fraction | danS | Fluent UDF and Scheme Programming | 0 | June 20, 2017 06:21 |
Water subcooled boiling | Attesz | CFX | 7 | January 5, 2013 03:32 |