Skip to content

Commit

Permalink
Introduce constants for dimensions of arrays - comments on naming con…
Browse files Browse the repository at this point in the history
…ventions appreciated.
  • Loading branch information
mrhardman committed Oct 24, 2024
1 parent 578a0c7 commit 6cb6058
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions moment_kinetics/src/moment_kinetics_structs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ module moment_kinetics_structs
using ..communication
using ..type_definitions: mk_float

export ndim_pdf_ion, ndim_pdf_neutral, ndim_pdf_electron
export ndim_field, ndim_moment, ndim_moment_electron
export ndim_v, ndim_v_neutral

# variables to define the number of dimensions in arrays
const ndim_pdf_ion = 5 #(vpa + vperp + z + r + s)
const ndim_pdf_neutral = 6 #(vz + vr + vzeta + z + r + s)
const ndim_pdf_electron = 4 #(vpa + vperp + z + r)
const ndim_field = 2 #(z + r)
const ndim_moment = 3 #(z + r + s)
const ndim_moment_electron = 2 #(z + r)
const ndim_v = 2 #(vpa + vperp)
const ndim_v_neutral = 3 #(vz + vr + vzeta)


"""
"""
struct scratch_pdf{ndim_distribution_ion, ndim_moment, ndim_moment_electron,
Expand Down Expand Up @@ -334,11 +349,11 @@ end
"""
struct pdf_struct
#ion particles: s + r + z + vperp + vpa
ion::pdf_substruct{5}
ion::pdf_substruct{ndim_pdf_ion}
# electron particles: r + z + vperp + vpa
electron::Union{electron_pdf_substruct{4},Nothing}
electron::Union{electron_pdf_substruct{ndim_pdf_electron},Nothing}
#neutral particles: s + r + z + vzeta + vr + vz
neutral::pdf_substruct{6}
neutral::pdf_substruct{ndim_pdf_neutral}
end

"""
Expand All @@ -365,11 +380,11 @@ end
"""
struct boundary_distributions_struct
# knudsen cosine distribution for imposing the neutral wall boundary condition
knudsen::MPISharedArray{mk_float,3}
knudsen::MPISharedArray{mk_float,ndim_v_neutral}
# ion particle r boundary values (vpa,vperp,z,r,s)
pdf_rboundary_ion::MPISharedArray{mk_float,5}
pdf_rboundary_ion::MPISharedArray{mk_float,ndim_pdf_ion}
# neutral particle r boundary values (vz,vr,vzeta,z,r,s)
pdf_rboundary_neutral::MPISharedArray{mk_float,6}
pdf_rboundary_neutral::MPISharedArray{mk_float,ndim_pdf_neutral}
end

"""
Expand Down

0 comments on commit 6cb6058

Please sign in to comment.