Hello,
When defining the 2D domain object for an IVP problem, one sets the dealias factor as 3/2 to deal with quadratic nonlinearity. After that, what is the correct scale to use for initial conditions and the forcing term in the grid space?
Suppose one has
dealias = 3/2
x_basis = de.Fourier('x', Nx, interval=(0, Lx), dealias=dealias)
z_basis = de.Fourier('z', Nz, interval=(-Lz/2., Lz/2.), dealias=dealias)
domain = de.Domain([x_basis, z_basis], grid_dtype=np.float64)
Should one define the forcing term by
I.
x,z = domain.all_grids(scales=domain.dealias)
# Force
forceu = domain.new_field()
forcew = domain.new_field()
forceu.set_scales(scales=domain.dealias)
forcew.set_scales(scales=domain.dealias)
forceu['g'] = np.cos(2.*x) * np.cos(3.*z)
forcew['g'] = np.sin(x) * np.sin(4.*z)
or
II.
x,z = domain.all_grids()
forceu = domain.new_field()
forcew = domain.new_field()
forceu['g'] = np.cos(2.*x) * np.cos(3.*z)
forcew['g'] = np.sin(x) * np.sin(4.*z)
It seems that the code runs for both cases, but I am confused about which one should be used. Similarly for the initial conditions.
In
this line of the rayleigh benard example, the default scale 1 is used, while in t
his example, scales=domain.dealias is used for setting the initial condition. When I change the scale in the rayleigh-benard example to scales=domain.dealias, I got some error message like `ValueError: operands could not be broadcast together with shapes (256,64) (1,96)`.
I may misunderstand something. What is the correct way to set the scales?
Thanks,
Jack