|
[Sponsors] |
Move two zones at the same time, like a single unit |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 4, 2018, 07:17 |
Move two zones at the same time, like a single unit
|
#1 |
Member
South Yorkshire
Join Date: May 2018
Posts: 33
Rep Power: 7 |
Hi,
I am trying to move two mesh zones at the same time per time step. I used the DEFINE_CG_MOTION, which moves a zone as a rigid body (no internal deformation), and I prescribed a sinusoidal velocity to move both mesh zones. Here is my code: Code:
#include "udf.h" #include "mem.h" static real vy = 0.0; DEFINE_CG_MOTION(rigid,dt,vel,omega,time,dtime) { /*Define variables*/ real cg[3], vcg[3]; int i; NV_S(vel, =, 0.0); NV_S(omega, =, 0.0); Thread *thread; Domain *d = Get_Domain(1); face_t f; thread = Lookup_Thread(d,zoneID); real ctime = RP_Get_Real("flow-time"); for (i=0;i<3;i++) { cg[i]=DT_CG(dt)[i]; vcg[i] = DT_VEL_CG(dt)[i]; } vy = 0.1*sin(31.41*ctime); vel[0] = 0.0; vel[1] = vy; } DEFINE_CG_MOTION(follower,fdt,fvel,fomega,time,dtime) { /*Define variables*/ NV_S(fvel, =, 0.0); NV_S(fomega, =, 0.0); real fcg[3], fvcg[3]; real fctime = RP_Get_Real("flow-time"); int i; Thread *thread; Domain *d = Get_Domain(1); thread = DT_THREAD(fdt); for (i=0;i<3;i++) { fcg[i]=DT_CG(fdt)[i]; fvcg[i] = DT_VEL_CG(fdt)[i]; } fvel[0] = 0.0; fvel[1] = vy; } time - vel_rigid - vel_follower 0.0000 - 0.00000 - 0.00000 0.0010 - 0.00314 - 0.00000 0.0020 - 0.00628 - 0.00314 0.0020 - 0.01253 - 0.00628 ... etc As you can see, there is a delay in the "follower" velocity compared to the "rigid" one. Thus, both zones are not moving as a block. Any ideas / suggestions on how to move both zones at the same time? Thank you, |
|
Tags |
delay, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
High Courant Number @ icoFoam | Artex85 | OpenFOAM Running, Solving & CFD | 11 | February 16, 2017 13:40 |
Floating point exception error | lpz_michele | OpenFOAM Running, Solving & CFD | 53 | October 19, 2015 02:50 |
How to write k and epsilon before the abnormal end | xiuying | OpenFOAM Running, Solving & CFD | 8 | August 27, 2013 15:33 |
same geometry,structured and unstructured mesh,different behaviour. | sharonyue | OpenFOAM Running, Solving & CFD | 13 | January 2, 2013 22:40 |
plot over time | fferroni | OpenFOAM Post-Processing | 7 | June 8, 2012 07:56 |