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

Body_Force_UDF Trouble

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 20, 2018, 17:59
Red face Body_Force_UDF Trouble
  #1
New Member
 
Join Date: Jun 2018
Posts: 8
Rep Power: 8
RCamp is on a distinguished road
Hi everyone,

I am working on a body force UDF right now and am having some trouble. I am pretty new to programming so it may be something very simple but I keep getting an error that says

"Contact_force_body_force.c(13): error C2109: subscript requires array or pointer type
Contact_force_body_force.c(18): error C2109: subscript requires array or pointer type"

I am a little confused by this because I thought the tp was the pointer and that the i should be Cartesian coordinates already build in. Can someone help out?

My code is:

#include "udf.h"

#define TSTART 5.0 /* field applied at t = tstart */

DEFINE_DPM_BODY_FORCE(particle_body_force,tp,i)

{ real bforce=0;
real deltaV=0;
if(TP_TIME(tp)>=TSTART)
{
if(i==0)
{
deltaV= TP_VEL(tp)[0]-TP_VELO(tp)[0];
bforce=TP_Mass(tp)*deltaV;
}
else if(i==1)
{
deltaV= TP_VEL(tp)[1]-TP_VELO(tp)[1];
bforce=TP_Mass(tp)*deltaV;
}
else
{
deltaV=0;
bforce=0;
}
}
}
RCamp is offline   Reply With Quote

Old   December 21, 2018, 01:07
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
change
Code:
real deltaV=0;
to
Code:
real deltaV[3];
velocity is a vector not scalar

best regards
RCamp likes this.
AlexanderZ is offline   Reply With Quote

Old   December 28, 2018, 11:28
Default
  #3
New Member
 
Join Date: Jun 2018
Posts: 8
Rep Power: 8
RCamp is on a distinguished road
The ultimate answer to this for anyone with a similar problem was to take out deltaV and just use that equation directly in my bforce.

After that the only issue was I was using a O instead of a zero.
RCamp is offline   Reply With Quote

Reply

Tags
19.1, body_force, fluent - udf


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
[waves2Foam] Having a lot of trouble for a short wavelengths arieljeds OpenFOAM Community Contributions 1 January 2, 2024 14:10
Trouble with rotating wall boundary condition king1989 OpenFOAM Running, Solving & CFD 7 July 29, 2016 14:44
Trouble with sampleDict syntax for OpenFOAM 2.3.1 rawdoggity OpenFOAM Post-Processing 1 February 1, 2015 06:24
[ICEM] trouble with mesh quality from ICEM in CFX Solver escher25 ANSYS Meshing & Geometry 0 February 28, 2011 08:38
[GAMBIT] Trouble meshing complex VOF geometry RPJones ANSYS Meshing & Geometry 2 February 14, 2011 19:54


All times are GMT -4. The time now is 17:35.