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

Define_source

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

Like Tree2Likes
  • 2 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 12, 2019, 11:45
Default Define_source
  #1
New Member
 
Zhandos Baizhuma
Join Date: Nov 2019
Posts: 12
Rep Power: 2
zhandos_baizhuma is on a distinguished road
Dear all!
I am trying to simulate Eulerian multi phase flow around the airfoil and I need to add source terms to airfoil wall.
see Source terms and my udf file in attachments.
As example I took continuity equation
In source terms:
αd the droplet volume fraction, ρd the droplet density and A the face area vector and vd the droplet impingement vector.
I am new in UDF writing, so please can you give me any feedback,
Best
Zhandos
Attached Images
File Type: png 1pic.png (6.0 KB, 11 views)
Attached Files
File Type: c udfsource.c (243 Bytes, 21 views)
zhandos_baizhuma is offline   Reply With Quote

Old   December 13, 2019, 01:21
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,418
Rep Power: 21
AlexanderZ will become famous soon enough
your code
Code:
#include "udf.h"
#include "mem.h"
#include "metric.h"

#define d=1000;

DEFINE_SOURCE (continuity,c,t,ds,eqn)
{ 
	real NV_VEC(v);
	real NV_VEC(A);
	F_Area(A,f,t);
	source = -NV_DOT(v,A)*C_VOF(c,t)*d;
	ds[eqn]=0;
	return source;
}
1. v is not defined
2. what is the unit of source you want to apply?
3. to use F_Area(A,f,t); macro you need face, but DEFINE_SOURCE makes a loop over cells (not faces) -> f is not defined
4. to define f inside DEFINE_SOURCE macro is challenging (from my point of view)
arunraj and zhandos_baizhuma like this.
__________________
best regards


******************************
press LIKE if this message helped you

How to ask questions:
https://www.cfd-online.com/Forums/si...tml#post612025
AlexanderZ is offline   Reply With Quote

Old   December 13, 2019, 02:58
Default
  #3
New Member
 
Zhandos Baizhuma
Join Date: Nov 2019
Posts: 12
Rep Power: 2
zhandos_baizhuma is on a distinguished road
Alexander Z, thank you for reply.
Actually I need to add 4 source terms, such as in picture

v - droplet velocity vector, I thought that Fluent will pass value from inlet

if face area vector is not applicable, maybe use x[ND_ND]?
Attached Images
File Type: png 2.png (11.5 KB, 10 views)
zhandos_baizhuma is offline   Reply With Quote

Old   December 13, 2019, 03:13
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,418
Rep Power: 21
AlexanderZ will become famous soon enough
what is the unit of source you want to apply?
__________________
best regards


******************************
press LIKE if this message helped you

How to ask questions:
https://www.cfd-online.com/Forums/si...tml#post612025
AlexanderZ is offline   Reply With Quote

Old   December 13, 2019, 03:48
Default
  #5
New Member
 
Zhandos Baizhuma
Join Date: Nov 2019
Posts: 12
Rep Power: 2
zhandos_baizhuma is on a distinguished road
kilogram per second
zhandos_baizhuma is offline   Reply With Quote

Old   December 13, 2019, 04:17
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,418
Rep Power: 21
AlexanderZ will become famous soon enough
DEFINE_SOURCE macro applying volumetric source W/m3 or kg/m3

you can get more information in Ansys Fluent customization manual
__________________
best regards


******************************
press LIKE if this message helped you

How to ask questions:
https://www.cfd-online.com/Forums/si...tml#post612025
AlexanderZ is offline   Reply With Quote

Old   January 26, 2020, 06:55
Default Hi Alexander Z
  #7
New Member
 
Zhandos Baizhuma
Join Date: Nov 2019
Posts: 12
Rep Power: 2
zhandos_baizhuma is on a distinguished road
I am still trying to solve Eulerian Muldtiphase with UDF
I made some improvement to my UDF. Please can you give some feedback on it?

#include "udf.h"

DEFINE_SOURCE(phase_cont,c,t,dS,eqn)
{
real con, source;
real NV_VEC(v), NV_VEC(A);
int ro=1000;
NV_D(v, =, C_U(c,t), C_V(c,t), C_W(c,t));
F_AREA(A,c,t);
con = NV_DOT(v,A);
source = -con*ro*C_VOF(c,t);
dS[eqn] = 0;
return source;
}
zhandos_baizhuma is offline   Reply With Quote

Old   January 27, 2020, 06:06
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,418
Rep Power: 21
AlexanderZ will become famous soon enough
code seems to be correct, what problems do you have with it?
__________________
best regards


******************************
press LIKE if this message helped you

How to ask questions:
https://www.cfd-online.com/Forums/si...tml#post612025
AlexanderZ is offline   Reply With Quote

Old   January 27, 2020, 08:53
Default
  #9
New Member
 
Zhandos Baizhuma
Join Date: Nov 2019
Posts: 12
Rep Power: 2
zhandos_baizhuma is on a distinguished road
It loads normally. But just after initialization there is a message in TUI

999999: mpt_accept: error: accept failed: No error

999999: mpt_accept: error: accept failed: No error
MPI Application rank 0 exited before MPI_Finalize() with status 2
The fl process could not be started.

I can not figure out why it happens
zhandos_baizhuma is offline   Reply With Quote

Old   January 27, 2020, 23:11
Default
  #10
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,418
Rep Power: 21
AlexanderZ will become famous soon enough
initialize first, then load UDF
__________________
best regards


******************************
press LIKE if this message helped you

How to ask questions:
https://www.cfd-online.com/Forums/si...tml#post612025
AlexanderZ is offline   Reply With Quote

Reply

Tags
define_source, multi phase flow, udf code

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



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