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

Plasma UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 24, 2018, 14:01
Default Plasma UDF
  #1
New Member
 
Join Date: Jul 2018
Posts: 3
Rep Power: 8
Nabat is on a distinguished road
I want to simulate a plasma on two sides of the cylinder in -90 and 90 degree locations with duty cycle 50%. I wrote it with IF and Loop but it is not working. I would be thankful if you could guide me where is my mistake. I would be thankful if you could guide me.
Nabat is offline   Reply With Quote

Old   July 24, 2018, 21:39
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
Quote:
Originally Posted by Nabat View Post
I want to simulate a plasma on two sides of the cylinder in -90 and 90 degree locations with duty cycle 50%. I wrote it with IF and Loop but it is not working. I would be thankful if you could guide me where is my mistake. I would be thankful if you could guide me.
something wrong with your UDF

best regards
AlexanderZ is offline   Reply With Quote

Old   July 24, 2018, 22:57
Default
  #3
New Member
 
Join Date: Jul 2018
Posts: 3
Rep Power: 8
Nabat is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
something wrong with your UDF

best regards
Yes, but I could not find what is it. Could you guide me. Here it is.

Regards

#include "udf.h"
#define con 1000
DEFINE_SOURCE(plasmasource,cell,thread,ds,eqn)
{
real x[ND_ND];
real t;
real source;
cell_t c;
real y;
t=CURRENT_TIME;
/*Now making source not dependant on velocities where con[N/m^2]*/

begin_f_loop(c,t)
{
C_CENTROID(x,cell,thread);
y=sin(t);
if (y>0.)
{
if(x[0]>-.001 && x[0]<.001 && x[1]>.0127 && x[1]<.0128)
{
source=con;
ds[eqn]=0;
}
else
{ source=ds[eqn]=0;}
}
else
{ source=ds[eqn]=0;}
return source;
}
end_f_loop(c,t)
}

begin_f_loop(c,t)
{
C_CENTROID(x,cell,thread);
y=sin(t);
if (y>0.)
{
if(x[0]>-.001 && x[0]<.001 && x[1]>.0127 && x[1]<.0128)
{
source=con;
ds[eqn]=0;
}
else
{ source=ds[eqn]=0;}
}
else
{ source=ds[eqn]=0;}
return source;
}
end_f_loop(c,t)
}
Nabat is offline   Reply With Quote

Old   July 26, 2018, 01:38
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
I can only guess, what exactly you want. May be this code is OK for your case
Code:
#include "udf.h" 
#define con 1000 
DEFINE_SOURCE(plasmasource,cell,thread,ds,eqn) 
{ 
real x[ND_ND]; 
real t; 
real source; 
real y;
t=CURRENT_TIME; 
/*Now making source not dependant on velocities where con[N/m^2]*/ 

C_CENTROID(x,cell,thread);
y=sin(t);
if (y>0.)
{
if(x[0]>-.001 && x[0]<.001 && x[1]>.0127 && x[1]<.0128) 
{ 
source=con; 
ds[eqn]=0; 
} 
else 
{source=0; ds[eqn]=0;} 
} 
else
{source=0; ds[eqn]=0;} 

return source;
}
best regards
AlexanderZ is offline   Reply With Quote

Old   July 26, 2018, 15:48
Default
  #5
New Member
 
Join Date: Jul 2018
Posts: 3
Rep Power: 8
Nabat is on a distinguished road
Thank you for your guidance. Could you tell me why we do not need loop for different time steps. I also attached my geometry in which the locations of 2 plasmas are shown. Should I add one more if, to add the second plasma? Thank you very much for you time.
Attached Images
File Type: jpg Untitled.jpg (47.2 KB, 32 views)
Nabat is offline   Reply With Quote

Old   July 27, 2018, 02:02
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Quote:
Originally Posted by Nabat View Post
Thank you for your guidance. Could you tell me why we do not need loop for different time steps. I also attached my geometry in which the locations of 2 plasmas are shown. Should I add one more if, to add the second plasma? Thank you very much for you time.
in your original code there was no lopps for different time steps. There was loop over faces of domain (which is not needed here and was implemented in wrong way. For more information look into Ansys Fluent Customization manual)

Macro DEFINE_SOURCE contains cell and thread as arguments, so using this macro you define source value on each specific finite volume element of mesh. Loop over elements is not needed.

You may add as many locations, as you want. In your first code coordinate values were exactly same, that's why I've deleted second IF statement

best regards
AlexanderZ is offline   Reply With Quote

Reply


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
UDF for vapor pressure anuarun Fluent UDF and Scheme Programming 13 June 23, 2024 14:12
Replicating Scalable Wall Function with a UDF yousefaz FLUENT 0 August 4, 2017 03:30
udf for biomass plasma gasification xlwmoaggouri Fluent UDF and Scheme Programming 0 January 10, 2014 15:45
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 13:57.