| 8 | 1/1 | 返回列表 |
| 查看: 2384 | 回復(fù): 7 | |||
[求助]
fluent中求解兩相邊界曲率的udf 已有1人參與
|
|
望提供求解兩相邊界曲率的udf代碼, 或者提供求解散度的方法, 亦或提出一些合理化建議。 非常感謝 |
專家顧問 (正式寫手)
![]() |
專家經(jīng)驗(yàn): +78 |
|
3 讀取VOF梯度方法1 #include "udf.h" #include "sg.h" #include "sg_mphase.h" #include "flow.h" #include "mem.h" #include "metric.h" DEFINE_ADJUST(store_VOF_gradient, domain) { Thread *t; Thread *ppt; Thread **pt; cell_t c; int phase_domain_index=1; Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,phase_domain_index); Alloc_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL); 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)) { ppt = pt[phase_domain_index]; begin_c_loop (c,t) { C_UDMI(c,t,0) = C_VOF_G(c,ppt)[0]; C_UDMI(c,t,1) = C_VOF_G(c,ppt)[1]; C_UDMI(c,t,2) = C_VOF_G(c,ppt)[2]; } end_c_loop (c,t) } } Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL); } 上例利用了一些幫助上無法查到的FLUENT函數(shù)手動(dòng)設(shè)置VOF梯度計(jì)算,Alloc_Storage_Vars, Scalar_Reconstruction,Scalar_Derivatives這些函數(shù)的大概功能可以猜到,但是沒有詳細(xì)說明。 4 讀取VOF梯度方法2 將VOF賦值給UDS變量,然后通過C_UDSI_G間接求得梯度。 下例是FLUENT幫助文檔中給出的一個(gè)例子: 將VOF賦值給UDS;進(jìn)行一次迭代計(jì)算,但不計(jì)算UDS方程;盡管未計(jì)算UDS方程,仍可以得到梯度值,并將其賦值給UDM用于顯示。 # include "udf.h" # define domain_ID 2 DEFINE_ADJUST(adjust_gradient, domain) { Thread *t; cell_t c; face_t f; domain = Get_Domain(domain_ID); /* Fill UDS with the variable. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDSI(c,t,0) = C_VOF(c,t); } end_c_loop (c,t) } thread_loop_f (t,domain) { if (THREAD_STORAGE(t,SV_UDS_I(0))!=NULL) begin_f_loop (f,t) { F_UDSI(f,t,0) = F_VOF(f,t); } end_f_loop (f,t) } } DEFINE_ON_DEMAND(store_gradient) { Domain *domain; cell_t c; Thread *t; domain=Get_Domain(1); /* Fill the UDM with magnitude of gradient. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDMI(c,t,0) = NV_MAG(C_UDSI_G(c,t,0)); } end_c_loop (c,t) } } |
|
3 讀取VOF梯度方法1 #include "udf.h" #include "sg.h" #include "sg_mphase.h" #include "flow.h" #include "mem.h" #include "metric.h" DEFINE_ADJUST(store_VOF_gradient, domain) { Thread *t; Thread *ppt; Thread **pt; cell_t c; int phase_domain_index=1; Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,phase_domain_index); Alloc_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL); 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)) { ppt = pt[phase_domain_index]; begin_c_loop (c,t) { C_UDMI(c,t,0) = C_VOF_G(c,ppt)[0]; C_UDMI(c,t,1) = C_VOF_G(c,ppt)[1]; C_UDMI(c,t,2) = C_VOF_G(c,ppt)[2]; } end_c_loop (c,t) } } Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL); } 上例利用了一些幫助上無法查到的FLUENT函數(shù)手動(dòng)設(shè)置VOF梯度計(jì)算,Alloc_Storage_Vars, Scalar_Reconstruction,Scalar_Derivatives這些函數(shù)的大概功能可以猜到,但是沒有詳細(xì)說明。 4 讀取VOF梯度方法2 將VOF賦值給UDS變量,然后通過C_UDSI_G間接求得梯度。 下例是FLUENT幫助文檔中給出的一個(gè)例子: 將VOF賦值給UDS;進(jìn)行一次迭代計(jì)算,但不計(jì)算UDS方程;盡管未計(jì)算UDS方程,仍可以得到梯度值,并將其賦值給UDM用于顯示。 # include "udf.h" # define domain_ID 2 DEFINE_ADJUST(adjust_gradient, domain) { Thread *t; cell_t c; face_t f; domain = Get_Domain(domain_ID); /* Fill UDS with the variable. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDSI(c,t,0) = C_VOF(c,t); } end_c_loop (c,t) } thread_loop_f (t,domain) { if (THREAD_STORAGE(t,SV_UDS_I(0))!=NULL) begin_f_loop (f,t) { F_UDSI(f,t,0) = F_VOF(f,t); } end_f_loop (f,t) } } DEFINE_ON_DEMAND(store_gradient) { Domain *domain; cell_t c; Thread *t; domain=Get_Domain(1); /* Fill the UDM with magnitude of gradient. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDMI(c,t,0) = NV_MAG(C_UDSI_G(c,t,0)); } end_c_loop (c,t) } } |
|
讀取VOF梯度方法1 #include "udf.h" #include "sg.h" #include "sg_mphase.h" #include "flow.h" #include "mem.h" #include "metric.h" DEFINE_ADJUST(store_VOF_gradient, domain) { Thread *t; Thread *ppt; Thread **pt; cell_t c; int phase_domain_index=1; Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,phase_domain_index); Alloc_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL); 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)) { ppt = pt[phase_domain_index]; begin_c_loop (c,t) { C_UDMI(c,t,0) = C_VOF_G(c,ppt)[0]; C_UDMI(c,t,1) = C_VOF_G(c,ppt)[1]; C_UDMI(c,t,2) = C_VOF_G(c,ppt)[2]; } end_c_loop (c,t) } } Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL); } 上例利用了一些幫助上無法查到的FLUENT函數(shù)手動(dòng)設(shè)置VOF梯度計(jì)算,Alloc_Storage_Vars, Scalar_Reconstruction,Scalar_Derivatives這些函數(shù)的大概功能可以猜到,但是沒有詳細(xì)說明。 2讀取VOF梯度方法2 將VOF賦值給UDS變量,然后通過C_UDSI_G間接求得梯度。 下例是FLUENT幫助文檔中給出的一個(gè)例子: 將VOF賦值給UDS;進(jìn)行一次迭代計(jì)算,但不計(jì)算UDS方程;盡管未計(jì)算UDS方程,仍可以得到梯度值,并將其賦值給UDM用于顯示。 # include "udf.h" # define domain_ID 2 DEFINE_ADJUST(adjust_gradient, domain) { Thread *t; cell_t c; face_t f; domain = Get_Domain(domain_ID); /* Fill UDS with the variable. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDSI(c,t,0) = C_VOF(c,t); } end_c_loop (c,t) } thread_loop_f (t,domain) { if (THREAD_STORAGE(t,SV_UDS_I(0))!=NULL) begin_f_loop (f,t) { F_UDSI(f,t,0) = F_VOF(f,t); } end_f_loop (f,t) } } DEFINE_ON_DEMAND(store_gradient) { Domain *domain; cell_t c; Thread *t; domain=Get_Domain(1); /* Fill the UDM with magnitude of gradient. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDMI(c,t,0) = NV_MAG(C_UDSI_G(c,t,0)); } end_c_loop (c,t) } } |
|
本帖內(nèi)容被屏蔽 |
|
3 讀取VOF梯度方法1 #include "udf.h" #include "sg.h" #include "sg_mphase.h" #include "flow.h" #include "mem.h" #include "metric.h" DEFINE_ADJUST(store_VOF_gradient, domain) { Thread *t; Thread *ppt; Thread **pt; cell_t c; int phase_domain_index=1; Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,phase_domain_index); Alloc_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL); 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)) { ppt = pt[phase_domain_index]; begin_c_loop (c,t) { C_UDMI(c,t,0) = C_VOF_G(c,ppt)[0]; C_UDMI(c,t,1) = C_VOF_G(c,ppt)[1]; C_UDMI(c,t,2) = C_VOF_G(c,ppt)[2]; } end_c_loop (c,t) } } Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL); } 上例利用了一些幫助上無法查到的FLUENT函數(shù)手動(dòng)設(shè)置VOF梯度計(jì)算,Alloc_Storage_Vars, Scalar_Reconstruction,Scalar_Derivatives這些函數(shù)的大概功能可以猜到,但是沒有詳細(xì)說明。 4 讀取VOF梯度方法2 將VOF賦值給UDS變量,然后通過C_UDSI_G間接求得梯度。 下例是FLUENT幫助文檔中給出的一個(gè)例子: 將VOF賦值給UDS;進(jìn)行一次迭代計(jì)算,但不計(jì)算UDS方程;盡管未計(jì)算UDS方程,仍可以得到梯度值,并將其賦值給UDM用于顯示。 # include "udf.h" # define domain_ID 2 DEFINE_ADJUST(adjust_gradient, domain) { Thread *t; cell_t c; face_t f; domain = Get_Domain(domain_ID); /* Fill UDS with the variable. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDSI(c,t,0) = C_VOF(c,t); } end_c_loop (c,t) } thread_loop_f (t,domain) { if (THREAD_STORAGE(t,SV_UDS_I(0))!=NULL) begin_f_loop (f,t) { F_UDSI(f,t,0) = F_VOF(f,t); } end_f_loop (f,t) } } DEFINE_ON_DEMAND(store_gradient) { Domain *domain; cell_t c; Thread *t; domain=Get_Domain(1); /* Fill the UDM with magnitude of gradient. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDMI(c,t,0) = NV_MAG(C_UDSI_G(c,t,0)); } end_c_loop (c,t) } } 發(fā)自小木蟲IOS客戶端 |
|
本帖內(nèi)容被屏蔽 |
| 8 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 22408 266求調(diào)劑 +3 | masss11222 2026-04-02 | 3/150 |
|
|---|---|---|---|---|
|
[考研] 一志愿山東大學(xué),085600,344 +3 | 魏子per 2026-04-02 | 4/200 |
|
|
[考研] 301求調(diào)劑 +14 | 駱駝男人 2026-04-02 | 14/700 |
|
|
[考研] 總分328生物與醫(yī)藥考數(shù)學(xué)求調(diào)劑 +3 | aaadim 2026-04-02 | 3/150 |
|
|
[考研] 08開頭看過來。! +4 | wwwwffffff 2026-03-31 | 6/300 |
|
|
[考研] 材料專碩322分 +11 | 哈哈哈吼吼吼哈 2026-04-01 | 11/550 |
|
|
[考研] 303求調(diào)劑 +8 | DLkz1314. 2026-03-30 | 8/400 |
|
|
[考研] 275求調(diào)劑 +12 | waltzh 2026-04-01 | 12/600 |
|
|
[考研] 290求調(diào)劑 +5 | dfffsar 2026-03-29 | 5/250 |
|
|
[考研] 材料調(diào)劑 +10 | Eujd1 2026-03-31 | 11/550 |
|
|
[考研] 化學(xué)0703 調(diào)劑 306分 一志愿211 +12 | 26要上岸 2026-03-28 | 12/600 |
|
|
[考研] 301求調(diào)劑 +8 | axibli 2026-04-01 | 8/400 |
|
|
[考研] 一志愿a區(qū)211,085601-307分求調(diào)劑 +10 | 黨嘉豪 2026-03-31 | 23/1150 |
|
|
[考研] 一志愿華東師范大學(xué)有機(jī)化學(xué)專業(yè),初試351分,復(fù)試被刷求調(diào)劑! +9 | 真名有冰 2026-03-29 | 10/500 |
|
|
[考研] 286求調(diào)劑 +6 | Faune 2026-03-30 | 6/300 |
|
|
[考研] 08工科,295,接受跨專業(yè)調(diào)劑 +6 | lmnlzy 2026-03-30 | 6/300 |
|
|
[考研] 282求調(diào)劑 +3 | 呼吸都是減肥 2026-03-31 | 3/150 |
|
|
[考研] 071010 323 分求調(diào)劑 +3 | Baekzhy 2026-03-27 | 3/150 |
|
|
[考研] 本科新能源科學(xué)與工程,一志愿華理能動(dòng)285求調(diào)劑 +3 | AZMK 2026-03-27 | 5/250 |
|
|
[考研] 283求調(diào)劑 +3 | A child 2026-03-28 | 3/150 |
|