Hi
I've been trying to get started using Basilisk. I have used Gerris before, but a long time ago and I consider myself a decent C++ programmer, so I was hoping to pick things up quite quickly. I followed the tutorial and then ran the von-karman example, all seemed to be going well.
Then I tried my own example. My intention was to define a cold region of air in my simulation and have this sink under the impact of gravity. The air would not be so cold as to need its density specifying as different (i.e. Bousinesq approximation).
I coded up what I thought would work and basically nothing happened. My air parcel just stayed static. I then recoded it up basing it on the example at
http://basilisk.fr/freeconvection.c, but still nothing happens.
I have no idea what I'm doing wrong. Perhaps someone could give me some pointers?
My minimal code is below. Sorry that google seems to have removed the indents.
Thanks for any help
Phil
#include "navier-stokes/centered.h"
//navier stokes centred creates glabal variables:
//scalar p[]; pressure at each grid point
//vector u[]; velocity at each grid point
//vector a[]; external acceleration at each grid point
#include "tracer.h"
scalar temperature[];
scalar * tracers = {temperature};
face vector av[];
int main() {
a = av; //I think this makes a point to av, so when we modify av to solver sees the change in a
init_grid(1 << 8);
run();
}
event init (t = 0)
{
//initiate a region in the top left with temperature = 3, eveywhere else it's 1
foreach()
{
temperature[] = x < 0.8 || y < 0.8 ? 1 : 3;
}
}
//this event should update a to match the advected temperature
event gravity(i++)
{
coord Del = { 0 , 1, 0};
foreach_face()
{
av.x[] = Del.x* (((temperature[]+temperature[-1])/2));
}
}
//end after 500 time units
event end (t = 500.0)
{
printf ("i = %d t = %g\n", i, t);
return 1;
}
//output some parameters
event logfile (i++)
{
fprintf (stderr, "%d %g %d %d\n", i, t, mgp.i, mgu.i);
}
//make some movies
event movies (t += 2.0)
{
output_ppm (temperature, file = "temperature.mp4");
output_ppm (p, file = "pressure.mp4");
output_ppm (a.y, file = "gravity.mp4");
}