I am a PhD student at the University of Oslo and am currently working on circulation models in fjord environments. Scripts and functions will be added here as the project progress.
Github mirror at: https://github.com/larswd/basiliskSandbox/
Contact me at: [email protected]
Current files in sandbox:
The function in output_vts.h is a function which stores a set of variables of interest to a vts file which can then be viewed using paraview (or other software which can open paraview files). Largely based on a similar function by Øystein Lande which plots a single layer. Sample function call in a basilisk event:
event output_field (t <= tmax; t += dt)
{
fprintf(stdout, "field vts output at step: %d, time: %.2f \n", i, t);
static int j = 0;
char name[100];
sprintf(name, "fields/field_%.6i.vts", j++);
fprintf(stdout, "written to: %s\n", name);
FILE* fp = fopen(name, "w");
output_vts_ascii_all_layers(fp, {eta,h,u}, N);
fclose(fp);
}
Download:
wget http://basilisk.fr/sandbox/larswd/output_vts.h?raw -O output_vts.h
Based on the particle.h
extension of Antoon van Hooft, which can be found here. The code and algorithms remain largely the same, but they are modified to ensure the particles are placed and tracked correctly in the vertical. This extension is only activated if the multilayer solver is imported, and if this is not the case should be identical to Antoon's particle.h
.
Code: particle.h. Requires one or both of the following patches: Multilayer patch Classic version This library depends on particle_multilayer.h and particle_classic.h for tracking particles in either a multilayer or non-multilayer setting respectively.
Current issues
- Strange issue when including, but not using, multilayer library. The LAYERS variable is still defined, meaning any uncommented statement importing the multilayer solver, including
#if 0
#include "layered/hydro.h"
#endif
means the multilayer particle tracker is used instead of the classic particle tracker. Should not cause much trouble except when making comparative test cases.
- Locate layer algorithm in particle pdf is computationally expensive, and results in a significantly slower execution compared to the non-multilayer case.
Test cases and examples
-
brownian.c illustrating gaussian drift with multilayer. Based on the test case of Antoon with the same name which can be found here.
-
brownian_classic.c The gaussian drift example of Antoon without multilayer. Code identical to the original which can be found here..
-
tlengt.c a test case showing that the placement of particles is implemented correctly when using multilayer.
-
tlengt_classic.c a test case showing that the placement of particles is implemented correctly when using multilayer.
-
multilayer_2D_diffusion.c is an example showing diffusion of particles in both vertical and horizontal direction when using mutilayer.
Download
wget http://basilisk.fr/sandbox/larswd/particle.h?raw -O particle.h
wget http://basilisk.fr/sandbox/larswd/particle_classic.h?raw -O particle_classic.h
wget http://basilisk.fr/sandbox/larswd/particle_multilayer.h?raw -O particle_multilayer.h
I have developed the header file pid.h to allow for an easy implementation of a PID controller to enforce damping of either the layer thickness
Test cases and examples
- pid_stokes.c PID damping of the src example (with some slight modifications) of a 2D stokes wave. Notice how the waves are continously dampened until the ocean is nearly at rest.