CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

an error problem for a change of boundary condition

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 27, 2012, 05:39
Question an error problem for a change of boundary condition
  #1
New Member
 
Join Date: Mar 2012
Posts: 26
Rep Power: 5
tsi07 is on a distinguished road
HI every body,

it's my first time on this forum.

I'm trying to change a boundary condition on a wall to put a velocity inlet but I have some problem when I want to use the adjacent cells of the face thread.

Can Anyone help me, I don't understand what is the problem.

I tried to find the problem, and I think it comes from the "F_C0" command.

The error message that it's appear is :

FLUENT received fatal signal (ACCESS_VIOLATION)

Here is my UDF,
////////////////////////////
#include "udf.h"
#include "mem.h"

double V_n[ND_ND], V_t[ND_ND], BC[ND_ND], VC[ND_ND];
real K, n, TAU0; /* consistency, power law parameter, limit yield stress for flowing */
real m, Cf, SL; /* regularization parameter, friction coefficient, limit yield stress for slipping */
double vmag, StrainRate, constante, TAUxx, TAUxy, TAUyy, VC_MAG;
double dudx, dudy, dvdx, dvdy; /* derivatives */
face_t f;
cell_t c0;

DEFINE_PROFILE(wall_new_boundary, thread, position)
{
K=1;
n=1;
TAU0=1;
m=100000;
SL=0.6;
begin_f_loop(f, thread)
{
F_AREA(V_n,f,thread);
c0 = F_C0(f,thread); /* adjacent cell to f */
vmag=-NV_MAG(V_n); /* magnitude and opposite of normal vector */
V_n[0]=V_n[0]/vmag; /* normed vector */
V_n[1]=V_n[1]/vmag; /* normed vector */
F_CENTROID(BC, f, thread);
NV_D(V_t,=,-V_n[1],V_n[0]); /* tangent vector */
StrainRate = C_STRAIN_RATE_MAG(c0, thread);
constante = K*pow(StrainRate,(n-1))+TAU0*(1-exp(-m*StrainRate))/StrainRate;
dudx = C_U_G(c0,thread)[0];
dudy = C_U_G(c0,thread)[1];
dvdx = C_V_G(c0,thread)[0];
dvdy = C_V_G(c0,thread)[1];
TAUxx=2*constante*dudx; /* stress tensor's xx componant*/
TAUyy=2*constante*dvdy; /* stress tensor's yy componant*/
TAUxy=constante*(dudy+dvdx); /* stress tensor's xy componant*/
VC[0]=(TAUxx*V_n[0]+TAUxy*V_n[1])*(pow(V_t[0],2)); /* stress vector's x componant*/
VC[1]=(TAUxy*V_n[0]+TAUyy*V_n[1])*(pow(V_t[1],2)); /* stress vector's y componant*/
VC_MAG=NV_MAG(VC); /* stress vector's magnitude */
if ( VC_MAG < SL)
{
F_PROFILE(f, thread, position)=0;
}
else {
F_PROFILE(f, thread, position)= -VC[0]*(VC_MAG-SL)/(VC_MAG*Cf);
}
}
end_f_loop(f, thread)
}
////////////////////////////

Thanks for your help !!
tsi07 is offline   Reply With Quote

Old   March 27, 2012, 12:10
Question a simplified issue to solve my problem
  #2
New Member
 
Join Date: Mar 2012
Posts: 26
Rep Power: 5
tsi07 is on a distinguished road
Here is a simplified UDF. It has no physical sense but it much more readable.

My problem is that I need to use the adjacent cell of face to chek the velocity there, but when I use "F_C0" command for it I have an error message which is :

Quote:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
ANd here is the code :
Code:
#include "udf.h"
#include "mem.h"

double VC[ND_ND];
real SL;
double VC_MAG;
double dudx, dvdy;		/* derivatives */
face_t f;
cell_t c0;

DEFINE_PROFILE(wall_velocity_x, thread, position)
	{
	SL=0.6;
	begin_f_loop(f, thread)
		{
		c0 = F_C0(f,thread);			/* adjacent cell to f */
		dudx = C_U_G(c0,thread)[0]; 
		dvdy = C_V_G(c0,thread)[1];
		VC[0]=dudx;
		VC[1]=dvdy;
		VC_MAG=NV_MAG(VC);
		if ( VC_MAG < SL)
			{
			F_PROFILE(f, thread, position)=0;
			}
		else	{
			F_PROFILE(f, thread, position)= VC_MAG-SL;
			}
		}
	end_f_loop(f, thread)
	}
If anyone have an idea, I'll take it !

Thanks.......
tsi07 is offline   Reply With Quote

Old   March 28, 2012, 11:21
Default Can I call an adjacent cell with an other way ?
  #3
New Member
 
Join Date: Mar 2012
Posts: 26
Rep Power: 5
tsi07 is on a distinguished road
I have no answer up to now.

So I change my question to be helped one day...

Can I call an adjacent cell with an other way or must I use C_F0 ?
tsi07 is offline   Reply With Quote

Old   March 28, 2012, 14:10
Default
  #4
Member
 
banty
Join Date: Mar 2012
Posts: 52
Rep Power: 5
banty is on a distinguished road
Hello,

In Micro (dudx = C_U_G(c0,thread)[0]) thread is the cell thread not face thread. The cells on either side of a face may or may not belong to the same cell thread. If a face is on the boundary of a domain, then only c0 exists. ( c1 is undefined for an external face). Alternatively, if the face is in the interior of the domain, then both c0 and c1 exist.
There are two macros, THREAD_T0(t) and THREAD_T1(t), that can be used to identify cell threads that are adjacent to a given face f in a face thread t.

This may be helpful to u.
banty is offline   Reply With Quote

Old   March 29, 2012, 04:26
Default I understood now !
  #5
New Member
 
Join Date: Mar 2012
Posts: 26
Rep Power: 5
tsi07 is on a distinguished road
Thank you very much Banty , I have not seen that when I wrote my UDF.
It works perfectly now !

thank you !
tsi07 is offline   Reply With Quote

Old   May 14, 2012, 17:03
Default boundary condition problems
  #6
New Member
 
moon
Join Date: Feb 2012
Posts: 23
Rep Power: 5
moun139 is on a distinguished road
i wrote a udf for a boundary condition with mass fraction ,but when i want to initialize it write me : error: fluent receive fatal .....
....
....
...

i tried keep memory...[yes]
and solve/expert/ save gradient ? to #t

this is my udf

/* my condition is rearanged as ma=map-(D/jv)*(dma/dy)*/



#include "udf.h"



DEFINE_PROFILE(frac,t,i)
{
real ma=0.0002; /*initialization of mass fraction */
real grad=0.0002;/*initialization of gradient */
cell_t c;
face_t f;

begin_f_loop(f,t)
{
c=F_C0(f,t);
THREAD_T0(t);


grad=C_YI_RG(c,t,i)[1];

ma=0.000055-0.00002199301*grad;

F_PROFILE(f,t,i)=ma;
}
end_f_loop(f,t)
}

please ,help me .

thank you a lot
moun139 is offline   Reply With Quote

Old   May 15, 2012, 06:18
Default
  #7
New Member
 
Join Date: Mar 2012
Posts: 26
Rep Power: 5
tsi07 is on a distinguished road
You define noting with the command THREAD_T0(t) in your code.

First you have to define a thread name that we point on it with the command C_THREAD_T0 and after you have to define it.
Then for all command start with "C_" you have to use the cell thread that you have defined (here the name of the thread is "cell_thread". you can choose a shorter name if you want) and not the face thread.

#include "udf.h"

DEFINE_PROFILE(frac,t,i)
{
real ma=0.0002; /*initialization of mass fraction */
real grad=0.0002; /*initialization of gradient */
cell_t c;
face_t f;
Thread *cell_thread; /* the star is to say that we will point on it */

begin_f_loop(f,t)
{
c=F_C0(f,t);
cell_thread=THREAD_T0(t); /* the cell thread adjacent to the face thread */


grad=C_YI_RG(c,cell_thread,i)[1];

ma=0.000055-0.00002199301*grad;

F_PROFILE(f,t,i)=ma;
}
end_f_loop(f,t)
}

I hope that helps you.
tsi07 is offline   Reply With Quote

Old   May 15, 2012, 07:56
Default boundary
  #8
New Member
 
moon
Join Date: Feb 2012
Posts: 23
Rep Power: 5
moun139 is on a distinguished road
Dear tsi ,
thank you for your information,i try it but it write me the same problem ,also i changed solver to density based because it mentioned in UDF manual

'C YI RG can be used only in the density-based solver.'

can another persone help me ?

thx



moun139 is offline   Reply With Quote

Reply

Tags
error.change.b.condition

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use DEFINE_ADJUST change boundary condition liurengtong123 Fluent UDF and Scheme Programming 24 August 1, 2014 10:28
inlet velocity boundary condition murali CFX 5 August 3, 2012 08:56
Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 July 15, 2005 04:15
Pressure Boundary Condition Matt Umbel Main CFD Forum 0 January 11, 2002 11:06
UDF, using DEFINE_ADJUST to change a boundary condition Jonas Larsson FLUENT 4 March 21, 2000 19:51


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