Sie sind auf Seite 1von 2

ZhaoVr10R5.

c
#include "udf.h"
#include "stdio.h"
#include "stdlib.h"
#include "sg_mem.h"
#include "dynamesh_tools.h"
#include "unsteady.h"

#define mr 3.0 //mass ratio = 3.0
#define md 0.9982 
#define ca 1.0 
#define fn 0.113920833 //Vr = 10.0
#define z 0

static real v_prev_x;
static real v_prev_y;
static real dv_x, dv_y, acc_x, acc_y, k, wn, c, osc_mass, ms;
FILE *fout, *fout1;

DEFINE_CG_MOTION(ZhaoVr10, dt, vel, omega, time, dtime)
{
Thread *t;
t = DT_THREAD(dt);
Domain *d = Get_Domain(1);

real x_cg[3], force[3], moment[3], vel_cg[3];

NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);

osc_mass = (mr+ca)*md;
ms = mr*md;

wn = 2 * M_PI*fn;
k = osc_mass *wn*wn;
c = 2 * osc_mass*wn*z;

int j;
for (j = 0; j < 3; j++)
x_cg[j] = DT_CG(dt)[j];

fout = fopen("Vr10_XY.txt", "a");
fprintf(fout, "%g %g %g \n", time, DT_CG(dt)[0], DT_CG(dt)[1]);
fclose(fout);

Compute_Force_And_Moment(d, t, x_cg, force, moment, TRUE);

force[0] += ‐k * x_cg[0] ‐ c * vel[0];
force[1] += ‐k * x_cg[1] ‐ c * vel[1];

acc_x = force[0] / ms;
acc_y = force[1] / ms;
Page 1
ZhaoVr10R5.c

dv_x = acc_x * dtime;
dv_y = acc_y * dtime;

v_prev_x += dv_x;
v_prev_y += dv_y;

vel[0] = v_prev_x; //streamwise direction
vel[1] = v_prev_y; //transverly direction

Page 2

Das könnte Ihnen auch gefallen