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

Problem with UDS and UDM.

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2022, 08:01
Default Problem with UDS and UDM.
  #1
KLD
New Member
 
KHALID
Join Date: Dec 2021
Posts: 3
Rep Power: 4
KLD is on a distinguished road
Hi everybody,
I'm doing a simulation of an electrodepostion process and I need to code a UDS and UDM (below) to calculate the thickness of the zinc layer on my cathode (Domain ID=2). The problem is that I'm getting a zero FOR THE UDS and the UDM just like it doesn't work.
Any help well be appreciated.
Thanks.


# include "udf.h"
# define domain_ID 2
DEFINE_EXECUTE_AT_END(adjust_gradient)
{
Domain *domain;
Thread *t;
cell_t c;
face_t f;/*real F=0.0044910826582479*/
real J;
real *E;
real EMag;
real sigma= 20;
domain=Get_Domain(2);
/* Fill UDS with the variable. */
thread_loop_c (t,domain)
{
begin_c_loop (c,t)
{
E=C_PHI_1_G(c,t);/*call potential gradient vector from adjacent cell of the face*/
EMag=NV_MAG(E);/*magnitude of potential gradient vector*/
J=sigma*EMag;/*current density*/
C_UDSI(c,t,0)=C_UDSI_M1(c,t,0)+((0.1475*J)-0.0963)*J*0.0044910826582479;/*cathode thickness*/

}
end_c_loop (c,t)
}
thread_loop_f (t,domain)
{
if (THREAD_STORAGE(t,SV_UDS_I(0))!=NULL)
begin_f_loop (f,t)
{
E=C_PHI_1_G(F_C0(f,t),THREAD_T0(t));/*call potential gradient vector from adjacent cell of the face*/
EMag=NV_MAG(E);/*magnitude of potential gradient vector*/
J=sigma*EMag;
F_UDSI(f,t,0)=C_UDSI_M1(F_C0(f,t),THREAD_T0(t),0)+ ((0.1475*J)-0.0963)*J*0.0044910826582479;
}
end_f_loop (f,t)
}
}
DEFINE_EXECUTE_AT_END(store_gradient)
{
Domain *domain;
cell_t c;
Thread *t;
domain=Get_Domain(2);
/* Fill the UDM with magnitude of gradient. */
thread_loop_c (t,domain)
{
begin_c_loop (c,t)
{
C_UDMI(c,t,0) =C_UDSI_M1(c,t,0)+NV_MAG(C_UDSI_G(c,t,0));
}
end_c_loop (c,t)
}
}
KLD is offline   Reply With Quote

Old   April 14, 2022, 22:32
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
first, do you have multiphase flow?
as you are using "domain=Get_Domain(2);" for single phase domain is always 1.

As you are using value from previous timestep C_UDSI_M1(c,t,0) how did you organize it for the first time step? Previous timestep doesn't exist yet.

Probably, better to define *E as a vector explicitly:
Code:
real NV_VEC(E);
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply

Tags
udf code, udm; udf; profile;, udmi.uds, uds equation

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Different values for identical UDS and UDM FarzinD Fluent UDF and Scheme Programming 26 August 3, 2022 07:10
Adjusting UDM to UDS mvee Fluent UDF and Scheme Programming 16 June 26, 2018 04:30
Segmentation violation louiza FLUENT 16 June 27, 2017 15:41
UDS stored to UDM do not show the same values swati_mohanty FLUENT 0 December 3, 2010 03:46
usage of UDS & UDM Tong FLUENT 2 February 15, 2006 10:32


All times are GMT -4. The time now is 18:38.