Calculations/Dipolar-Gas-Simulator/+VariationalSolver2D/@DipolarGas/setupSpace.m

33 lines
1.3 KiB
Matlab

function [Transf] = setupSpace(~,Params)
Transf.Xmax = 0.5*Params.Lx;
Transf.Ymax = 0.5*Params.Ly;
Nx = Params.Nx;
Ny = Params.Ny;
% Fourier grids
x = linspace(-0.5*Params.Lx,0.5*Params.Lx-Params.Lx/Params.Nx,Params.Nx);
Kmax = pi*Params.Nx/Params.Lx;
kx = linspace(-Kmax,Kmax,Nx+1);
kx = kx(1:end-1);
dkx = kx(2)-kx(1);
kx = fftshift(kx);
y = linspace(-0.5*Params.Ly,0.5*Params.Ly-Params.Ly/Params.Ny,Params.Ny);
Kmax = pi*Params.Ny/Params.Ly;
ky = linspace(-Kmax,Kmax,Ny+1);
ky = ky(1:end-1);
dky = ky(2)-ky(1);
ky = fftshift(ky);
[Transf.X,Transf.Y] = ndgrid(x,y);
[Transf.KX,Transf.KY] = ndgrid(kx,ky);
Transf.x = x;
Transf.y = y;
Transf.kx = kx;
Transf.ky = ky;
Transf.dx = x(2)-x(1);
Transf.dy = y(2)-y(1);
Transf.dkx = dkx;
Transf.dky = dky;
end