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

For Loops as part of an Adjust

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 31, 2022, 17:01
Default For Loops as part of an Adjust
  #1
Member
 
Pierce
Join Date: May 2019
Posts: 40
Rep Power: 7
PierceH is on a distinguished road
Hello,


I'm trying to add an actuator disk into my simulation which involves creating an X-momentum source code. In order to create a Gaussian distribution over every cell (p) where the actuator disk lies I've created a for loop however upon implementing the adjust function to fluent the solution will not iterate once after 5 minutes (Fluent is not crashing).
Any suggestions?



See the code here


DEFINE_ADJUST(adjust1,d)
{
Thread *t;
cell_t c;
real xc[ND_ND];
real variable;
thread_loop_c (t,d)
{
begin_c_loop (c,t)

C_CENTROID(xc,c,t);

xp = 0.0125;
epsilon = 0.052632;
sum = 0;
delta = 1;
n=38;

for (i=1 ; i=n ; 1)
{
yp = -10-(i/38);

r = pow((xc[0]-xp),2) + pow((xc[1]-yp),2);
term1 = exp(-pow(r/epsilon,2));
eta = term1*(1/M_PI*epsilon*epsilon*delta);
sum = sum + eta;
}

C_UDSI(c,t,0) = sum*500000;
C_UDSI(c,t,1) = r;

end_c_loop(c,t)
}
PierceH is offline   Reply With Quote

Old   February 2, 2022, 20:48
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
check this condition
Code:
for (i=1 ; i=n ; 1)
use C language
__________________
best regards


******************************
press LIKE if this message was helpful
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
Input part for automated mesh (2D) ReubenBuehler STAR-CCM+ 4 November 2, 2018 07:58
part remesh for optimization Marien ANSA 1 May 9, 2017 03:08
[snappyHexMesh] snappyHexMesh can't create a fine Mesh from stl from Rhinoceros Taghi OpenFOAM Meshing & Mesh Conversion 13 May 4, 2017 16:48
replacing of shock tube high pressure part with a boundary condition for low pressure immortality Main CFD Forum 0 May 2, 2013 14:30
what boundary condition is proper for simulation of shock-tube low pressure part? immortality OpenFOAM Running, Solving & CFD 0 May 2, 2013 14:22


All times are GMT -4. The time now is 20:28.