CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Problem with CG Motion

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

LinkBack Thread Tools Search this Thread Display Modes
Old   April 13, 2012, 23:26
Default Problem with CG Motion
New Member
Jessica Simberg
Join Date: Mar 2012
Posts: 18
Rep Power: 14
Jessica.S is on a distinguished road
I'm having a little trouble with the Define_CG_Motion macro. I'm trying to do a simulation of a cylinder moving as a result of pressure and shear forces. This is an image of the problem:

I'm using this UDF, but a moment after I'm starting the calculation an "access violation" error appear..

#include "udf.h"
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include "dynamesh_tools.h"
#include "storage.h"

static real v0_prev = 0.0;
static real v1_prev = 0.0;
static real v2_prev = 0.0;

DEFINE_CG_MOTION(CoGRAVITY_M,dt,vel,omega,time,dti me)
Thread *t;
face_t f;
real NV_VEC(A);
real force0, force1, force2;
real dv0, dv1, dv2;
real mass = 0.5;

/* reset velocities */
NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);

if (!Data_Valid_P()) /* Do nothing if gradient isnít allocated yet. */

/* get the thread pointer for which this motion is defined */
t = DT_THREAD(dt);

/*reset forces*/
force0 = 0.0;
force1 = 0.0;
force2 = 0.0;

force0 += F_P(f,t)*A[0] + F_STORAGE_R_N3V(f,t,SV_WALL_SHEAR)[0];
force1 += F_P(f,t)*A[1] + F_STORAGE_R_N3V(f,t,SV_WALL_SHEAR)[1];
force2 += F_P(f,t)*A[2] + F_STORAGE_R_N3V(f,t,SV_WALL_SHEAR)[2];

/* compute change in velocity, i.e., dv = F * dt / mass velocity update using explicit Euler formula */
dv0 = dtime * force0 / mass;
dv1 = dtime * force1 / mass;
dv2 = dtime * force2 / mass;

v0_prev += dv0;
v1_prev += dv1;
v2_prev += dv2;

/* sets the components of velocity */
vel[0] = v0_prev;
vel[1] = v1_prev;
vel[2] = v2_prev;
printf ("force0 = %f, force1 = %f, X_force2 = %f\n", force0, force1, force2);

I've defined all dynamic mesh zones as "deforming" except for the solid interface zone "contact_region-trg" which is defined as "rigid body" with the above UDF.

Any help in this regard will be very appreciated.

with kind regards,
Jessica.S is offline   Reply With Quote


access violation error, cg_motion, dynamic mesh, motion, remeshing

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
tutorial for solving oscillating cylinder problem CH FLUENT 8 April 2, 2014 10:56
Mesh motion with Translation & Rotation Doginal CFX 2 January 12, 2014 06:21
Velocity profiles problem behind the elbow (3D problem) kabat73 FLUENT 8 May 9, 2010 04:26
problem with Mesh motion, please help me! Giuliano FLUENT 2 November 17, 2006 02:44
Dynamic Mesh Problem - please help! Hila FLUENT 0 August 19, 2006 04:19

All times are GMT -4. The time now is 18:46.