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

Problem with CG Motion

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2012, 00:26
Default Problem with CG Motion
  #1
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. */
return;

/* 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;

begin_f_loop(f,t)
{
F_AREA(A,f,t);
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];
}
end_f_loop(f,t)

/* 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.
Jessica.S is offline   Reply With Quote

Reply

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


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 11:56
Mesh motion with Translation & Rotation Doginal CFX 2 January 12, 2014 07:21
Velocity profiles problem behind the elbow (3D problem) kabat73 FLUENT 8 May 9, 2010 05:26
problem with Mesh motion, please help me! Giuliano FLUENT 2 November 17, 2006 03:44
Dynamic Mesh Problem - please help! Hila FLUENT 0 August 19, 2006 05:19


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