WIP: Pull Request for a complete Solver package #1
@ -32,7 +32,7 @@ jmax 45 # number of interior cells in y-direction
|
||||
# Time Data:
|
||||
# ---------
|
||||
|
||||
te 30.0 # final time
|
||||
te 60.0 # final time
|
||||
dt 0.02 # time stepsize
|
||||
tau 0.5 # safety factor for time stepsize control (<0 constant delt)
|
||||
|
||||
@ -49,7 +49,7 @@ gamma 0.9 # upwind differencing factor gamma
|
||||
# -----------------------
|
||||
|
||||
numberOfParticles 60
|
||||
startTime 0
|
||||
startTime 100.0
|
||||
injectTimePeriod 0.5
|
||||
writeTimePeriod 0.2
|
||||
|
||||
|
@ -15,11 +15,11 @@ bcRight 3 #
|
||||
gx 0.0 # Body forces (e.g. gravity)
|
||||
gy 0.0 #
|
||||
|
||||
re 10000.0 # Reynolds number
|
||||
re 5050.0 # Reynolds number
|
||||
|
||||
u_init 1.0 # initial value for velocity in x-direction
|
||||
v_init 0.0 # initial value for velocity in y-direction
|
||||
p_init 0.0 # initial value for pressure
|
||||
p_init 1.0 # initial value for pressure
|
||||
|
||||
# Geometry Data:
|
||||
# -------------
|
||||
@ -32,7 +32,7 @@ jmax 50 # number of interior cells in y-direction
|
||||
# Time Data:
|
||||
# ---------
|
||||
|
||||
te 100.0 # final time
|
||||
te 150.0 # final time
|
||||
dt 0.02 # time stepsize
|
||||
tau 0.5 # safety factor for time stepsize control (<0 constant delt)
|
||||
|
||||
@ -48,13 +48,13 @@ gamma 0.9 # upwind differencing factor gamma
|
||||
# Particle Tracing Data:
|
||||
# -----------------------
|
||||
|
||||
numberOfParticles 60
|
||||
startTime 0
|
||||
injectTimePeriod 0.5
|
||||
numberOfParticles 200
|
||||
startTime 50
|
||||
injectTimePeriod 1.0
|
||||
writeTimePeriod 0.5
|
||||
|
||||
x1 0.0
|
||||
y1 1.9
|
||||
y1 1.8
|
||||
x2 0.0
|
||||
y2 2.1
|
||||
|
||||
@ -63,7 +63,7 @@ y2 2.1
|
||||
# Shape 0 disable, 1 Rectangle/Square, 2 Circle
|
||||
|
||||
shape 2
|
||||
xCenter 4.0
|
||||
xCenter 5.0
|
||||
yCenter 2.0
|
||||
xRectLength 2.0
|
||||
yRectLength 1.0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -78,7 +78,7 @@ int main (int argc, char** argv)
|
||||
|
||||
|
||||
/* Added function for particle tracing. Will inject and advance particles as per timePeriod */
|
||||
trace(&particletracer, solver.u, solver.v, t);
|
||||
trace(&particletracer, solver.u, solver.v, solver.s, t);
|
||||
|
||||
t += solver.dt;
|
||||
nt++;
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#define U(i, j) u[(j) * (imax + 2) + (i)]
|
||||
#define V(i, j) v[(j) * (imax + 2) + (i)]
|
||||
#define S(i, j) s[(j) * (imax + 2) + (i)]
|
||||
|
||||
static int ts = 0;
|
||||
void printParticles(ParticleTracer* particletracer)
|
||||
@ -37,7 +38,7 @@ void injectParticles(ParticleTracer* particletracer)
|
||||
}
|
||||
}
|
||||
|
||||
void advanceParticles(ParticleTracer* particletracer, double* restrict u, double* restrict v, double time)
|
||||
void advanceParticles(ParticleTracer* particletracer, double* restrict u, double* restrict v, int* restrict s, double time)
|
||||
{
|
||||
int imax = particletracer->imax;
|
||||
int jmax = particletracer->jmax;
|
||||
@ -101,6 +102,11 @@ void advanceParticles(ParticleTracer* particletracer, double* restrict u, double
|
||||
{
|
||||
particletracer->particlePool[i].flag = false;
|
||||
}
|
||||
int i_new = new_x/dx, j_new = new_y/dy;
|
||||
if(S(i_new, j_new) == LOCAL)
|
||||
{
|
||||
particletracer->particlePool[i].flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,10 +122,10 @@ void writeParticles(ParticleTracer* particletracer)
|
||||
VtkOptions opts = { .particletracer = particletracer };
|
||||
|
||||
char filename[50];
|
||||
snprintf(filename, 50, "vtk_files/particles%d.vtk", ts);
|
||||
vtkOpen(&opts, filename, ts);
|
||||
vtkParticle(&opts, "particle");
|
||||
vtkClose(&opts);
|
||||
// snprintf(filename, 50, "vtk_files/particles%d.vtk", ts);
|
||||
// vtkOpen(&opts, filename, ts);
|
||||
// vtkParticle(&opts, "particle");
|
||||
// vtkClose(&opts);
|
||||
|
||||
FILE* fp;
|
||||
Particle* particlePool = particletracer->particlePool;
|
||||
@ -177,6 +183,7 @@ void initParticleTracer(ParticleTracer* particletracer, Parameter* params)
|
||||
particletracer->particlePool = malloc(sizeof(Particle) * particletracer->estimatedNumParticles);
|
||||
particletracer->linSpaceLine = malloc(sizeof(Particle) * particletracer->numberOfParticles);
|
||||
|
||||
|
||||
for (int i = 0; i < particletracer->numberOfParticles; ++i)
|
||||
{
|
||||
double spacing = (double)i / (double)(particletracer->numberOfParticles - 1);
|
||||
@ -197,7 +204,7 @@ void printParticleTracerParameters(ParticleTracer* particletracer)
|
||||
printf("\tdt : %.2f, dx : %.2f, dy : %.2f\n", particletracer->dt, particletracer->dx, particletracer->dy);
|
||||
}
|
||||
|
||||
void trace(ParticleTracer* particletracer, double* u, double* v, double time)
|
||||
void trace(ParticleTracer* particletracer, double* u, double* v, int* s, double time)
|
||||
{
|
||||
if (time >= particletracer->startTime)
|
||||
{
|
||||
@ -213,7 +220,7 @@ void trace(ParticleTracer* particletracer, double* u, double* v, double time)
|
||||
particletracer->lastWriteTime = time;
|
||||
|
||||
}
|
||||
advanceParticles(particletracer, u, v, time);
|
||||
advanceParticles(particletracer, u, v, s, time);
|
||||
compress(particletracer);
|
||||
particletracer->lastUpdateTime = time;
|
||||
}
|
||||
|
@ -38,11 +38,11 @@ typedef struct {
|
||||
|
||||
void initParticleTracer(ParticleTracer*, Parameter*);
|
||||
void injectParticles(ParticleTracer*);
|
||||
void advanceParticles(ParticleTracer*, double* , double*, double);
|
||||
void advanceParticles(ParticleTracer*, double* , double*, int*, double);
|
||||
void freeParticles(ParticleTracer*);
|
||||
void writeParticles(ParticleTracer*);
|
||||
void printParticleTracerParameters(ParticleTracer*);
|
||||
void printParticles(ParticleTracer*);
|
||||
void trace(ParticleTracer*, double* , double* , double );
|
||||
void trace(ParticleTracer*, double* , double* , int* , double );
|
||||
void compress(ParticleTracer* );
|
||||
#endif
|
@ -1,5 +1,7 @@
|
||||
set terminal png size 3600,768 enhanced font ,28
|
||||
set output 'velocity.png'
|
||||
set xrange[0:30]
|
||||
set yrange[0:4]
|
||||
set size ratio -1
|
||||
set datafile separator whitespace
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 206 KiB |
@ -1,12 +1,13 @@
|
||||
unset border; unset tics; unset key;
|
||||
set term gif animate delay 20
|
||||
set term gif animate delay 10
|
||||
set output "trace.gif"
|
||||
set xrange [0:30]
|
||||
set yrange [0:4]
|
||||
set object 1 circle front at 4.0,2.0 size 1.0 fillcolor rgb "black" lw 2
|
||||
set size ratio -1
|
||||
set object 1 circle front at 5.0,2.0 size 1.0 fillcolor rgb "black" lw 2
|
||||
|
||||
|
||||
do for [ts=0:300] {
|
||||
plot "particles_".ts.".dat" with points pointtype 7
|
||||
do for [ts=0:500] {
|
||||
plot "particles_".ts.".dat" with points pointtype 7 pointsize 0.3
|
||||
}
|
||||
unset output
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 709 KiB |
Loading…
Reference in New Issue
Block a user