100% found this document useful (1 vote)
626 views1 page

Fluent UDF File

This document defines two CG motion functions in C: osc and osc_inert. The osc function computes the force and acceleration on a damped harmonic oscillator over a time step. It calculates the velocity by integrating the acceleration over the time step. The osc_inert function simply carries over the previous velocity from osc.

Uploaded by

Mukil Dev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
626 views1 page

Fluent UDF File

This document defines two CG motion functions in C: osc and osc_inert. The osc function computes the force and acceleration on a damped harmonic oscillator over a time step. It calculates the velocity by integrating the acceleration over the time step. The osc_inert function simply carries over the previous velocity from osc.

Uploaded by

Mukil Dev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include "udf.

h"
static real v_prev = 0.0;
DEFINE_CG_MOTION(osc,dt,vel,omega,time,dtime)
{
Thread *t;
Domain *d = Get_Domain(1);
real x_cg[3], force[3], moment[3];
real accl, dv;
real mass = 0.2;
real wn = 12.0;
real k= mass * wn*wn;
real c = 2*mass*wn*0.00;
int i;
NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
t = DT_THREAD(dt);
for(i=0;i<3;i++)
x_cg[i]=DT_CG(dt)[i];
Compute_Force_And_Moment(d, t, x_cg, force, moment, TRUE);
force[1] += -k*x_cg[1] - c*vel[1];

accl = force[1]/mass;
dv = accl*dtime;
v_prev+=dv;
vel[1] = v_prev;
printf("Computed force: %g \n", force[1]);
printf("Velocity: %g\n", vel[1]);
}
DEFINE_CG_MOTION(osc_inert,dt,vel,omega,time,dtime)
{
vel[0] = 0.0;
vel[1] = v_prev;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy