GeneralizedGrossPitaevskii.GrossPitaevskiiProblem — TypeGrossPitaevskiiProblem(u0, lengths; dispersion=additiveIdentity, potential=additiveIdentity,
nonlinearity=additiveIdentity, pump=additiveIdentity, position_noise_func=additiveIdentity,
momentum_noise_func=additiveIdentity, noise_prototype=additiveIdentity, param=nothing) -> GrossPitaevskiiProblemRepresents a generalized Gross-Pitaevskii equation problem with specified initial conditions and domain.
This struct encapsulates all components needed to define and solve a generalized Gross-Pitaevskii equation, which describes the dynamics of quantum fluids such as Bose-Einstein condensates, exciton-polariton condensates, and other nonlinear wave phenomena.
The equation to be solved is of the form:
$i du(r, t) = [D(-i∇)u + V(r)u + G(u)u + i F(r, t)]dt + η(u, r) dW$
where:
Arguments
u0::Tuple: Initial conditions for the fields. This should be a tuple of arrays, where each array represents a field in the simulation. The fields should have the same shape.lengths::Tuple: Physical dimensions of the simulation domain.dispersion: D(-i∇) in the above equation. Should have the signaturedispersion(k, param), wherekis a tuple representing a point in momentum space andparamare additional parameters.potential: V(r) in the above equation. Spatial potential function. Should have the signaturepotential(r, param), whereris a tuple representing a point in direct space andparamare additional parameters.nonlinearity: G(u) in the above equation. Function defining nonlinear interaction terms. Should have the signaturenonlinearity(u, param), whereuis a tuple representing the fields at a point in direct space andparamare additional parameters.pump: F(r, t) in the above equation. Function defining pump/drive terms, may be time-dependent. Should have the signaturepump(r, param, t), whereris a tuple representing a point in direct space,paramare additional parameters, andtis time.position_noise_func: η(u, r) in the above equation. Function defining stochastic terms in position. Should have the signaturenoise_func(u, r, param), whereuis a tuple representing the fields at a point in direct spacerandparamare additional parameters.momentum_noise_func: A counterpart ofposition_noise_funcfor momentum space. (Untested)noise_prototype: ξ in the above equation. Prototype for noise terms. When specified, this should be a tuple of arrays with the correct element type and shape for the noise terms. We will callrandn!(rng, noise_prototype)to generate the noise terms, which generates a random gaussian number with mean ⟨ξ⟩ = 0 and mean absolute square ⟨|ξ|²⟩ = 1.param: Additional parameters used by the component functions.
Examples
# Free propagation example
L = 10
N = 128
u0 = (rand(ComplexF64, N, N),)
dispersion(ks, param) = sum(abs2, ks) / 2
prob = GrossPitaevskiiProblem(u0, (L, L); dispersion)# Exciton-polariton example
# Define system parameters
param = (;
ħ = 1, # Reduced Planck constant
m = 1, # Effective mass
δc = 0, # Cavity detuning
δx = 0, # Exciton detuning
γc = 0.1, # Cavity decay rate
γx = 0.1, # Exciton decay rate
Ωr = 2, # Rabi coupling
g = 0.01, # Nonlinearity strength
A = 1, # Pump amplitude
w = 2 # Pump width
)
# Define grid parameters
L = 10
N = 128
lengths = (L, L)
# Initial condition (photon and exciton fields)
u0 = (zeros(ComplexF64, N, N), zeros(ComplexF64, N, N))
# Define components of the generalized GP equation
function dispersion(k, param)
Dcc = param.ħ * sum(abs2, k) / 2param.m - param.δc - im * param.γc
Dxx = -param.δx - im * param.γx
Dxc = param.Ωr
@SMatrix [Dcc Dxc; Dxc Dxx]
end
nonlinearity(u, param) = @SVector [0, param.g * abs2(u[2])]
function pump(r, param, t)
@SVector [param.A * exp(-sum(abs2, r) / param.w^2), 0]
end
# Create the problem
prob = GrossPitaevskiiProblem(u0, lengths; dispersion, nonlinearity, pump, param)CommonSolve.solve — Functionsolve(prob, alg, tspan;
dt,
nsaves,
show_progress=true,
progress=nothing,
save_start=true,
workgroup_size=(),
rng=nothing)This function solves the given prob using the algorithm alg over the time span tspan.
It uses a fixed time step dt and saves the solution nsaves times during the simulation.
The show_progress argument controls whether a progress bar is shown, and progress can be used to provide a custom progress bar from ProgressMeter.jl.
The save_start argument indicates whether the initial condition should be saved. If true, the initial condition is saved as the first entry in the result, and the size of the time dimension of the result is nsaves + save_start.
The workgroup_size argument can be used to specify the workgroup size for the kernel functions.
The rng argument can be used to provide a random number generator for the simulation.
GeneralizedGrossPitaevskii.StrangSplitting — TypeStrangSplitting()The Strang splitting algorithm for solving the Generalized Gross-Pitaevskii equation. It is a fixed time-stepping algorithm that alternates between diffusion and potential/pump/nonlinear steps.