This set of MATLAB functions simulates diffusion-advection flow in a doubly-periodic domain . The equation for the scalar field is
where is independent of time and is divergence free. is calculated by the function generate_v_field
and is a sum of terms of the form
where m
and n
are random integers and are random real numbers.
The equations are solved by explicit finite differences conservative scheme. one_run
performs a single realization by generating a velocity field, integrating the equations, and returning the result. run_collect_save
is a script (not a function) to perform multiple runs with a given set of parameters and store the result in a handy hdf5
file.
convert_to_single.py
contains a useful python function that converts an h5
file created by run_collect_save
to a file with identical data but in float16
precision, which makes it more manageable.
The file produced by run_collect_save
have this format:
- The name of the file is the value of
/t
is the list of times for which the solutions are calculated (uniformly spaced)/x
and/y
are matrices of shape[n,n]
with thex
andy
coordinates of the finite-differences grid for- Each file contains 50 realizations, which are at groups
/001
,/002
, ...,/050
:/XXX/c
is anndarray
of shape[n,n,len(t)]
that contains the concentration field.c[i,j,k]
is the value of the concentration field at positionx[i,j]
andy[i,j]
at timet[k]
. In other words,c[...,i]
is the snapshot of the concentration field at timet[i]
.- The group
/XXX
also contains/XXX/u
,/XXX/v
, which are thex
andy
components of the velocity field. Note thatu
andv
are not evaluated at the same grid points as c since we use a staggered scheme to ensure conservation. The functional form ofu
andv
is given in both MATLAB and Mathematica syntax in the attributes of/XXX
.
Here are generated hdf5
files. The data is released under Creative Commons CC-BY license.