|
[Sponsors] |
July 24, 2018, 14:01 |
Plasma UDF
|
#1 |
New Member
Join Date: Jul 2018
Posts: 3
Rep Power: 8 |
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.
|
|
July 24, 2018, 21:39 |
|
#2 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Quote:
best regards |
||
July 24, 2018, 22:57 |
|
#3 |
New Member
Join Date: Jul 2018
Posts: 3
Rep Power: 8 |
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) } |
|
July 26, 2018, 01:38 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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; } |
|
July 26, 2018, 15:48 |
|
#5 |
New Member
Join Date: Jul 2018
Posts: 3
Rep Power: 8 |
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.
|
|
July 27, 2018, 02:02 |
|
#6 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Quote:
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 |
||
|
|
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 |