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

update UDM via DEFINE_ADJUST

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 20, 2015, 07:02
Default update UDM via DEFINE_ADJUST
  #1
Member
 
Peter Aestas
Join Date: Dec 2013
Posts: 64
Rep Power: 12
aestas is on a distinguished road
hi,friends,i am still work on a MHD problem, i defined current density of three dimensions,Jx,Jy,Jz, and treated them as UDM. Every iteration i put them in UDF DEFINE_ADJUST to update.
the UDM i put in the DEFINE_ADJUST is cell value such as
#define Jx C_UDMI(c,t,0)

One problems are confusing me:
on the boundary of cathode(zone_ID=1), the current density should be treated as evenly distributed as current I/(pi*r^2),how should i define this in UDM?
my ADJUST marco is as follows
Code:
DEFINE_ADJUST(uds,d)
{
	Thread *t;
	cell_t c;
	face_t,f;

	/* Make sure there are enough user defined-scalars. */
	if (n_uds < N_REQUIRED_UDS)
		Internal_Error("not enough user-defined scalars allocated");
	thread_loop_c(t,d)
	{
		begin_c_loop_all(c,t)
		{
			Be=e*Bad/me*3.0e10*pow(1.5,3./2.)/(Zi*Zi*C_R(c,t)/mi)
			Jx=sigma*(-C_UDSI_G(c,t,phi)[0]+k*Te/e)*Nz*C_R(c,t)/mi);
			Jy=sigma/(1+Be*Be)*(-C_UDSI_G(c,t,phi)[1]+(k*Te/e)*Ny*C_R(c,t)/mi);
			Jz=Be*Jy;
			J=sqrt(Jx*Jx+Jy*Jy+Jz*Jz);	
		}
		end_c_loop_all(c,t)


	}
}
aestas is offline   Reply With Quote

Old   January 20, 2015, 07:18
Default
  #2
Member
 
Peter Aestas
Join Date: Dec 2013
Posts: 64
Rep Power: 12
aestas is on a distinguished road
I came up with one using THREAD_ID to decide how to do in the loop:
Code:
DEFINE_ADJUST(uds,d)
{
	Thread *t;
	cell_t c;
	face_t,f;
	int zone_ID;
	/* Make sure there are enough user defined-scalars. */
	if (n_uds < N_REQUIRED_UDS)
		Internal_Error("not enough user-defined scalars allocated");
	thread_loop_c(t,d)
	{
		zone_ID=THREAD_ID(t);
		if zone_ID==1
		{
			begin_c_loop_all(c,t)
			{
				Jx=6.4e5;
				Jy=0;
				Jz=0;
				J=sqrt(Jx*Jx+Jy*Jy+Jz*Jz);	
			}
			end_c_loop_all(c,t)

		}
		else
		{
			begin_c_loop_all(c,t)
			{
				Be=e*Bad/me*3.0e10*pow(1.5,3./2.)/(Zi*Zi*C_R(c,t)/mi)
					Jx=sigma*(-C_UDSI_G(c,t,phi)[0]+(k*Te/e)*Nz*C_R(c,t)/mi);
				Jy=sigma/(1+Be*Be)*(-C_UDSI_G(c,t,phi)[1]+(k*Te/e)*Ny*C_R(c,t)/mi);
				Jz=Be*Jy;
				J=sqrt(Jx*Jx+Jy*Jy+Jz*Jz);	
			}
			end_c_loop_all(c,t)


		}
	}
}
but i don't know whether it's right or wrong,and i am not sure whether a boundary zone has cell values or just has face value.I need the cell value of current denesity to calculate other varibles. So help me,my friends
aestas is offline   Reply With Quote

Old   April 3, 2015, 23:21
Default
  #3
New Member
 
WG Lin
Join Date: Apr 2015
Posts: 1
Rep Power: 0
Lin_wg is on a distinguished road
DEFINE_PROFILE(current_density,thread,position)
{
real x[ND_ND],x1,y1,r;
face_t f;

begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
x1=x[0],y1=x[1];
r=sqrt(x1*x1+((y1-0.0055)*(y1-0.0055)));
if(r<0.003)
{
F_PROFILE(f,thread,position)=-1.2e8*exp(-1920.88*r);
}
else
{
F_PROFILE(f,thread,position)=0;
}
}
end_f_loop(f,thread)
}
I think you can try like this
Lin_wg 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
Change "Implicit Mesh Update Interval" using UDF ASimonsen Fluent UDF and Scheme Programming 2 October 12, 2017 09:38
Segmentation violation louiza FLUENT 16 June 27, 2017 15:41
Cleaning UDM CeesH Fluent UDF and Scheme Programming 8 August 7, 2014 07:17
Help! Delete the UDM codes in the UDF Messi Fluent UDF and Scheme Programming 2 January 28, 2014 09:01
Udm nasser FLUENT 0 April 7, 2013 09:19


All times are GMT -4. The time now is 19:25.