CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

saving C_UDMI from F_UDMI (global variable)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 19, 2022, 02:42
Default saving C_UDMI from F_UDMI (global variable)
  #1
New Member
 
qntldoql
Join Date: Sep 2020
Posts: 15
Rep Power: 6
qntldoql is on a distinguished road
I am currently trying to save the temperature values at the interface (at the boundary of the domain) in the global variable and access it to set the C_UDMI of the domain to be the temperature values at the interface according to their x-coordinate. (therefore same temperature vertically throughout the domain).



currently UDF I am using works perfectly in serial mode. But, in parallel, it is not vertically uniform throughout the domain, but it is influenced by how the cells are partitioned. Therefore, I believe it is a UDF parallelization error but cannot find a solution. If someone could provide me with a suggestion, I would greately appreciate it. (I have also attached the code below)


#include "udf.h"
#include "mem.h"
real xx[3809] = {0.}; //for x-coord at the wall
real zz[3809] = {0.}; // for temperature at that x-coord
int count = 0; //counter


DEFINE_INIT(my_init_func1,mixture_domain)
{

int phase_domain_index;
cell_t c;
Thread *t;
Domain *subdomain;
real xc[ND_ND];

sub_domain_loop(subdomain, mixture_domain, phase_domain_index)
{

if (DOMAIN_ID(subdomain) == 2) //primary phase is domain 2, mixture is domain 1, etc.

thread_loop_c (t,subdomain)
{
begin_c_loop_all (c,t)
{
C_CENTROID(xc,c,t);
C_UDMI(c,t,2) = 0.0; //initialization of the C_UDMI

}
end_c_loop_all (c,t)
}

}
}


DEFINE_ADJUST(face_temp,mixture_domain)
{

int surface_id = 23;

#if !RP_HOST
Domain *d;
Thread *t;
d = Get_Domain(2);
face_t f;
real x[ND_ND];
#endif

host_to_node_int_1(surface_id);

#if !RP_HOST
t = Lookup_Thread(d,surface_id);

begin_f_loop(f,t) /*looping over the desired interface to save the x-coord & temperature values*/
if(PRINCIPAL_FACE_P(f,t)){
F_CENTROID(x,f,t);
xx[count] = x[0];
zz[count] = F_T(f,t);
count++;
}
end_f_loop(f,t)
#endif

}

DEFINE_ADJUST(liq_frac1,mixture_domain)
{
int phase_domain_index;

cell_t c;
Thread *t;
Domain *subdomain;
real xc[ND_ND];


sub_domain_loop(subdomain, mixture_domain, phase_domain_index)
{

if (DOMAIN_ID(subdomain) == 2)

thread_loop_c (t,subdomain)
{
begin_c_loop_all (c,t)
{
C_CENTROID(xc,c,t);
if(xc[0] < -1){
C_UDMI(c,t,2) = 0.;
}
else if(xc[0] >2){
C_UDMI(c,t,2)=0.;
}
else{

real dist_dummy =0.;
real dist_min = 100000.;
real tdummy = 0.;

for(int j =0; j<count; j++){
dist_dummy = fabs(xc[0]-xx[j]);
if(dist_min>dist_dummy){
dist_min = dist_dummy;
tdummy = zz[j];
}
}
C_UDMI(c,t,2) = tdummy;

}


}
end_c_loop_all (c,t)
}

}
}
qntldoql is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stuck in a Rut- interDyMFoam! xoitx OpenFOAM Running, Solving & CFD 14 March 25, 2016 08:09
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 20:43
Help for the small implementation in turbulence model shipman OpenFOAM Programming & Development 25 March 19, 2014 11:08
error in COMSOL:'ERROR:6164 Duplicate Variable' bhushas COMSOL 1 May 30, 2008 05:35
Replace periodic by inlet-outlet pair lego CFX 3 November 5, 2002 21:09


All times are GMT -4. The time now is 15:58.