recipesrest.blogg.se

Force quit in basilisk ii
Force quit in basilisk ii










force quit in basilisk ii
  1. #FORCE QUIT IN BASILISK II MANUAL#
  2. #FORCE QUIT IN BASILISK II CODE#
  3. #FORCE QUIT IN BASILISK II FREE#

Again, if you just want to use these pre-defined solvers, reading only the first few sections should be sufficient (as we did for saint-venant.h), but feel free to dig deeper if you are interested. If you want to know what Basilisk can be used for, have a look at the various solvers available. You can learn a lot by following these links.

#FORCE QUIT IN BASILISK II CODE#

Note also that in these examples, as in the pieces of code above, various keywords will be linked either to the documentation for standard C functions or to the documentation of Basilisk keywords and functions. The most important concepts and keywords have been covered in this tutorial.įor more examples of applications, post-processing, graphs etc…, you can also look at the Note that you won’t need all the features of the language if you just want to use pre-defined solvers.

#FORCE QUIT IN BASILISK II MANUAL#

Now is a good time to go through the manual and get more familiar with the concepts, keywords and functions which are specific to Basilisk. I have made several references to the Basilisk C manual. #include " saint-venant.h" #define LEVEL 8 event init (t = 0), maxlevel = LEVEL) Rather than changing these three values manually, we can write instead Once as an argument to output_ppm(), once as an argument to adapt_wavelet() and once as an argument of init_grid() in the main() function. If we look at our code, we see that the resolution or level of refinement occur three times. A better way to do this is to use standard C macros (which you should have encountered already during your preparatory work). We could edit the code by hand, changing each reference to resolution, recompile, rerun etc… but that would be quite tedious and error-prone. To do this, we need to run the same code while varying the resolution. I mentioned above that it would be a good idea to study the numerical convergence of our example a bit more seriously. Read “Running and creating test cases (and examples)” if you want to know more. The default Makefile in Basilisk does much more than this. The Makefile detected that nothing was modified which required recompiling and/or rerunning the simulation. You will get make: `bump.tst' is up to date. We also set the minimum and maximum values of the colorscale to avoid changes in color during the animation.Īfter recompiling and re-running, we can now do Rather than writing images to the standard output, we use our file pointer fp. We can now call output_ppm() using l as the field to display. This is done using the standard C function fopen(). This variable is set only once, the first time images is called, and points to a new file called grid.ppm in which we will write (“w”) things. The next line declares a static variable i.e. a variable which is kept in memory between calls to images (in contrast to automatic variables). We then loop over all the cells and set the values of l to the level of the cell. The memory necessary to store the field values will be automatically freed when the code leaves this function. This field is a local, automatic variable i.e. it will be accessible only within the images event. We first declare and allocate a new scalar field l. Static FILE * fp = fopen ( "grid.ppm", "w") To have an idea of how long the simulation took, we can do Simpler grid structures usually run faster. With Basilisk, we also have the choice of the type of grid used to discretise the equations. We could use a faster computer and/or use more processors (use parallel computing). How can we make things faster without loosing the accuracy of the finer grid? Putting this together with the increase in number of grid points, we can expect the total runtime to be 16\times 4=64 times larger than for the previous simulation… In our case we have decreased the grid spacing by a factor of four, so that we would need four times as many timesteps to reach the same time as in the previous simulation. Indeed, the timestep is controled by the CFL condition for the Saint-Venant system and is thus proportional to the grid spacing. Since we do the same number of timesteps, it must mean that each timestep is smaller than before. We get a larger (and sharper) picture of the wave, however it does not propagate as far as before (it barely touches the walls of the box).












Force quit in basilisk ii