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

How to use UDS solve this problem

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 23, 2013, 21:22
Default How to use UDS solve this problem
  #1
New Member
 
risk
Join Date: Jan 2010
Posts: 4
Rep Power: 7
risklotus is on a distinguished road
Hi Guys, I have a set of eqs and want to use UDS to solve them. I solved this problem before with my own code and Matlab. I just want to see whether I can get the same results and learn how to use UDS. The following is the set of the eqs. I also attach the UDF I wrote for your information. I still have problem to get the right answer as I got before. I cannot find out the errors.

d^2 C1/dx^2 = PHI^2 * {C1*exp[(1-ALPHA)(C2-C3)] - C0*exp[-ALPHA(C2-C3)]}
d^2 C2/dx^2 = PHI1^2 * {C1*exp[(1-ALPHA)(C2-C3)] - C0*exp[-ALPHA(C2-C3)]}
d^2 C3/dx^2 = -PHI2^2 * {C1*exp[(1-ALPHA)(C2-C3)] - C0*exp[-ALPHA(C2-C3)]}

The dependent variables are C1, C2, and C3. The others are constant

/************************************************** ****************
UDF that adds momentum source term and derivative to duct flow
************************************************** *****************/
#include "udf.h"
#define PHI2 0.1406
#define PHI12 0.8277
#define PHI22 0.8277
#define C0 0.5714
#define ALPHA 0.5
enum
{
C1,
C2,
C3
};
 
DEFINE_SOURCE(C1_source, cell, thread, dS, eqn)
{
real source;
dS[eqn] = -PHI2 * exp((1-ALPHA)*(C_UDSI(cell,thread,C2)-C_UDSI(cell,thread,C3)));
source = -PHI2 * (C_UDSI(cell,thread,C1) * exp((1-ALPHA)*(C_UDSI(cell,thread,C2)-C_UDSI(cell,thread,C3))) - C0 * exp(-ALPHA*(C_UDSI(cell,thread,C2)-C_UDSI(cell,thread,C3))));
return source;
}
DEFINE_SOURCE(C2_source, cell, thread, dS, eqn)
{
real source;
dS[eqn] = -PHI12 * ((1-ALPHA)*C_UDSI(cell,thread,C1) * exp((1-ALPHA)*(C_UDSI(cell,thread,C2)-C_UDSI(cell,thread,C3))) + ALPHA* C0 * exp(-ALPHA*(C_UDSI(cell,thread,C2)-C_UDSI(cell,thread,C3))));
source = -PHI12 * (C_UDSI(cell,thread,C1) * exp((1-ALPHA)*(C_UDSI(cell,thread,C2)-C_UDSI(cell,thread,C3))) - C0 * exp(-ALPHA*(C_UDSI(cell,thread,C2)-C_UDSI(cell,thread,C3))));
return source;
}
DEFINE_SOURCE(C3_source, cell, thread, dS, eqn)
{
real source;
dS[eqn] = PHI22 * ((ALPHA-1)*C_UDSI(cell,thread,C1) * exp((1-ALPHA)*(C_UDSI(cell,thread,C2)-C_UDSI(cell,thread,C3))) - ALPHA*C0 * exp(-ALPHA*(C_UDSI(cell,thread,C2)-C_UDSI(cell,thread,C3))));
source = PHI22 * (C_UDSI(cell,thread,C1) * exp((1-ALPHA)*(C_UDSI(cell,thread,C2)-C_UDSI(cell,thread,C3))) - C0 * exp(-ALPHA*(C_UDSI(cell,thread,C2)-C_UDSI(cell,thread,C3))));
return source;
}

Thanks
risklotus is offline   Reply With Quote

Old   January 24, 2013, 02:54
Default
  #2
Member
 
Join Date: Nov 2011
Location: Czech Republic
Posts: 95
Rep Power: 5
Sixkillers is on a distinguished road
I am quite sure that you can't use UDS for this particular case. Because is Fluent is solving partial differential equation (scalar transport equation), however you would like to solve set of ordinary differential equations. In other words your left side of equations is completely different from Fluent ones.
Sixkillers is offline   Reply With Quote

Old   January 24, 2013, 07:54
Default
  #3
Senior Member
 
SSL
Join Date: Oct 2012
Posts: 227
Rep Power: 5
msaeedsadeghi is on a distinguished road
Quote:
Originally Posted by Sixkillers View Post
I am quite sure that you can't use UDS for this particular case. Because is Fluent is solving partial differential equation (scalar transport equation), however you would like to solve set of ordinary differential equations. In other words your left side of equations is completely different from Fluent ones.
No, he can model it. Left hand side is the flux term and the right hand side is sources. Correct.
msaeedsadeghi is offline   Reply With Quote

Old   January 24, 2013, 07:55
Default
  #4
Senior Member
 
SSL
Join Date: Oct 2012
Posts: 227
Rep Power: 5
msaeedsadeghi is on a distinguished road
I have done like that before. It has so many complicated points that should be cared.
msaeedsadeghi is offline   Reply With Quote

Old   January 24, 2013, 13:55
Default
  #5
New Member
 
risk
Join Date: Jan 2010
Posts: 4
Rep Power: 7
risklotus is on a distinguished road
Saeed,

Can you recall any particular tips? Anyone is helpful to me.
risklotus is offline   Reply With Quote

Old   January 25, 2013, 01:21
Default
  #6
Senior Member
 
SSL
Join Date: Oct 2012
Posts: 227
Rep Power: 5
msaeedsadeghi is on a distinguished road
It seems you want to add three new scalar equations. So add three UDS. These equations only have source and diffusion terms. So disable unsteady and convection terms in UDS menu. Now you need to write UDF for defining source and diffusion terms.
msaeedsadeghi is offline   Reply With Quote

Reply

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
UDS problem with wall boundary condition Alex F. FLUENT 14 August 6, 2014 05:08
can you solve this problem? mehendis FLUENT 0 August 17, 2010 04:25
Solve a mass diffusion problem Roberta FLUENT 0 November 26, 2008 02:47
how to solve steady-transient mixed problem? touchstone CD-adapco 0 September 12, 2005 10:08
Can CFX solve problem with structured mesh? Peted CFX 2 May 31, 2004 23:45


All times are GMT -4. The time now is 16:55.