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

UDF error CG Motion

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2006, 18:40
Default UDF error CG Motion
  #1
Alex
Guest
 
Posts: n/a
Hi, I just wrote a UDF code to describe motion of an airfoil in pitch an plunge. When reading the case file in fluent I get an error saying there is a "SEGMENTATION ERROR".

This happens after I change the UDF file name within the .cas file. eg. (udf/filename "fabio.c") -> within my .cas file.

I think I need to do this so the UDF file is recognized in the .cas file after opening it.

Please correct me if I'm wrong.

This is my UDF file. I'm not sure where the mistake is.

/************************************************** ********** * * Equations of motion to describe an airfoil in pitch (omega = along z-axis) and plunge (vel = y-dir) compiled UDF * ************************************************** **********/ #include "udf.h"

static real v_prev = 0.0;

static real omega_prev = 0.0;

DEFINE_CG_MOTION(piston, dt, vel, omega, time, dtime) { Thread *t; face_t f; real NV_VEC (A); real force, dv, om, f, domega, delta;

f= 0.5; om=2*3.14*f; delta =3.14/2;

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

if (!Data_Valid_P ())

return;

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

/* compute pressure force on body by looping through all faces */ force = 0.0; begin_f_loop (f, t)

{

F_AREA (A, f, t);

force += F_P (f, t) * NV_MAG (A);

} end_f_loop (f, t)

/* compute change in velocity, i.e., dv = F * dt / mass

velocity update using explicit Euler formula */ /* dv = dtime * force / 50.0; */

dv=om*cos(om*dtime);

domega=om*cos(om*dtime+delta);

v_prev += dv;

omega_prev +=domega;

Message ("time = %f, y_vel = %f, force = %f, omega=%f\n", time, v_prev, force, omega_prev);

/* set x-component of velocity */ vel[1] = v_prev; omega[2] =omega_prev; }

Could someone please comment if you see a flaw with the code?

Thank you

Alex
  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
UDF problem: incorrect grid motion Fil FLUENT 5 December 19, 2020 10:16
Grid motion with UDF fivos Fluent UDF and Scheme Programming 5 June 30, 2018 09:50
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Fluent UDF Discontinuous Motion lequi7 Fluent UDF and Scheme Programming 2 November 4, 2011 00:18
UDF: DEFINE_CG_MOTION for vertical jump motion of an electrode! alban Fluent UDF and Scheme Programming 2 June 8, 2010 19:54


All times are GMT -4. The time now is 14:43.