SPINS resize
Matlab functions which change the resolutions of a simulation with spectral accuracy. The resolution can be increased or decreased. These exist in the SPINSmatlab toolbox.
Returns either a resized field within a live matlab session, or saves resized fields to a new subdirectory.
Assumptions
Applicable for:
- 2D (in the x-z plane) and 3D data
- free-slip and periodic boundary conditions
Chebyshev and mapped grids are not available, but this will not be too hard to implement should the need arise.
Resize a single field in one dimension
The following files return a matlab array.
- resize_x.m
- resize_y.m
- resize_z.m
Usage
These functions require 3 input arguments (in order):
- field name
- field data
- new resolution
Example:
rho_new = resize_x('rho', rho, 512);
will return the array, rho_new, with an x-resolution containing 512 (whether this was larger or smaller than the initial size is unimportant).
If no spins.conf exists, or a general matrix is to be resized, then an optional argument can be passed. The optional argument must be a structure containing the type of expansion and the length of the dimension. The general matrix must satisfy the listed boundary condition.
Example:
opts.type_x = "FREE_SLIP";
opts.Lx = 1.0;
rho_new = resize_x('rho', rho, 512, opts);
Resize all fields for a particular output
The following files save resized fields for a particular output in a new subdirectory called 'resized'.
In one dimension only
- resize_all_x.m
- resize_all_y.m
- resize_all_z.m
In x and z dimensions simultaneously
- resize_all_xz.m
Usage
These functions require 2 (or 3) input arguments (in order):
- output number
- new resolution (for *xz.m input x resolution before z resolution)
Examples:
resize_all_x(5, 512);
will create a subdirectory called 'resized' which contains resized fields with an x-resolution containing 512 for all files for output number 5. A spins.conf file must be present.
resize_all_xz(5, 512, 256);
will create a subdirectory called 'resized' which contains resized fields with an x-resolution containing 512 and a z-resolution of 256 for all files for output number 5. A spins.conf file must be present.