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

DEFINE_SOURCE error

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 28, 2008, 11:13
Default DEFINE_SOURCE error
  #1
romans
Guest
 
Posts: n/a
Hello, I am solving the diffusion equation with the concentration formulation. I would like to add a source term via UDF that includes the gradient of concentration but I get an Access Violation error when I try to use the C_UDSI_G(c,t,i) macro. Can I use this macro with the concentration formulation?

my code is:

DEFINE_SOURCE(MySource,c,t,dS,eqn)

{ real Rw,Dc,De,Q; #define Rw 4.0e-4 #define Dc 0.0001 #define De 4.0e-5 #define Q 2.14e10

real x[ND_ND],XX, Source;

C_CENTROID(x,c,t);

XX=De*C_UDSI_G(c,t,C0)[2];

Source=XX-(Rw+Dc)*C_UDSI(c,t,C0)+Q;

C_UDSI(c,t,C1)=C_UDSI_G(c,t,C0)[2];

dS[eqn]=XX*C_UDSI_G(c,t,C1)[2]-Rw-Dc;

return Source; }

I have used the first derivative and second derivative.

Best Regards, thank you

romans

  Reply With Quote

Old   August 28, 2008, 23:09
Default Re: DEFINE_SOURCE error
  #2
romans
Guest
 
Posts: n/a
HI, I have used the first derivative and second derivative for the user defined scalars,when i initialize source terms, i get this error,just like: error: 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. Error Object: ()

would you help me? Thank you in advance.

romans

  Reply With Quote

Old   August 29, 2008, 01:34
Default Re: DEFINE_SOURCE error
  #3
CDE
Guest
 
Posts: n/a
in the C_UDSI_G(c,t,i) macro, you use i = C0. Is C0 an integer?
  Reply With Quote

Old   August 29, 2008, 06:57
Default Re: DEFINE_SOURCE error
  #4
romans
Guest
 
Posts: n/a
Hi, in the C_UDSI_G(c,t,C0) macro, C0 is an integer. the code is compiled without error. now, i want to get the second derivative for C_UDSI_G(x,t,i),how to do?

Thanks.

romans
  Reply With Quote

Old   April 30, 2012, 23:08
Default
  #5
New Member
 
Pacheo
Join Date: Apr 2009
Posts: 7
Rep Power: 16
pacheo is on a distinguished road
Quote:
Originally Posted by romans
;153064
Hi, in the C_UDSI_G(c,t,C0) macro, C0 is an integer. the code is compiled without error. now, i want to get the second derivative for C_UDSI_G(x,t,i),how to do?

Thanks.

romans
try to calculate several steps, then hook your udf.

hope that can help you.
pacheo is offline   Reply With Quote

Old   May 1, 2012, 21:00
Default
  #6
Member
 
Krishna
Join Date: Oct 2009
Posts: 34
Rep Power: 16
t.krishnamohan is on a distinguished road
The last argument in the DEFINE_SOURCE is an index. In your case it is eqn. C0 and C1 are not defined in your code.
t.krishnamohan is offline   Reply With Quote

Reply

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
DEFINE_SOURCE PK FLUENT 0 December 6, 2006 11:36
DEFINE_SOURCE CN FLUENT 2 August 5, 2005 12:29
DEFINE_SOURCE saghir FLUENT 0 May 12, 2005 04:53
DEFINE_SOURCE Dolores FLUENT 2 May 18, 2004 06:18
error message about using DEFINE_SOURCE emma FLUENT 5 April 2, 2004 05:18


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