|
[Sponsors] |
December 14, 2016, 09:14 |
Velocity pertrubation using momentum source
|
#1 |
New Member
Johannes Hall
Join Date: Sep 2016
Posts: 21
Rep Power: 10 |
Hello everyone!
I am trying to create an increase of velocity in a flow over a wing in order to simulate a gust wind. The idea is to apply a momentum source in a region upstream of the wing and let the perturbation flow downstream through convection. I found this https://www.sharcnet.ca/Software/Flu...ug/node309.htm When I use the UDF below I get strange changes in the velocity field where smaller cells gets a much higher velocity than larger. I suppose it sort of makes sense the source term divides by the volume and I fear I have misunderstood something. If anyone have experience with this kind of implementation, or has another suggestion of achieving a similar result, it would be of great help. Below you find the udf and a picture of the flowfield. #include "udf.h" real A[ND_ND]; /* Declared as global variables*/ real area; DEFINE_ON_DEMAND(face_area) { Domain *d = Get_Domain(1); Thread *ft; face_t f; thread_loop_f(ft,d) /* Finding the area of the cell face with a define on demand macro. Found this in another thread here on CFD-online */ { begin_f_loop(f,ft) { real NV_VEC(A); F_AREA(A,f,ft); area = NV_MAG(A); } end_f_loop(f,ft) } } DEFINE_SOURCE(source_still_in_sharp_smooth, c,t,dS,eqn) { real x[ND_ND]; C_CENTROID(x,c,t) real x_0 = x[0]; real pi = 3.14159265359; real Wg = 10; /* amplitude gust */ real start_g = -5; /* start gust source region */ real length_g = 1; /* length gust source region */ real end_g = (start_g + length_g); /* end gust source region */ real real_time = CURRENT_TIME; real start_time_gust = 0.01; /* start time gust */ real end_time_gust = 0.51; /* end time gust */ real gust_time = (real_time - start_time_gust); real gust; if(0 <= gust_time && gust_time <= end_time_gust) { if(start_g <= x_0 && x_0 <= end_g) { gust = (C_U(c,t) + 5) * C_R(c,t) * area / C_VOLUME(c,t); /* flux through cell, 5 [m/s] is the perturbation */ } else { gust = 0.0; } } else { gust = 0.0; } real source = gust; /* whetever your source is */ dS[eqn] = C_R(c,t) * area / C_VOLUME(c,t); /* derivative source term */ return source; } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem compiling a custom Lagrangian library | brbbhatti | OpenFOAM Programming & Development | 2 | July 7, 2014 12:32 |
OpenFOAM without MPI | kokizzu | OpenFOAM Installation | 4 | May 26, 2014 10:17 |
[swak4Foam] Error bulding swak4Foam | sfigato | OpenFOAM Community Contributions | 18 | August 22, 2013 13:41 |
pisoFoam compiling error with OF 1.7.1 on MAC OSX | Greg Givogue | OpenFOAM Programming & Development | 3 | March 4, 2011 18:18 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 20:08 |