Skip to content

Commit

Permalink
more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
killah-t-cell committed Nov 25, 2021
1 parent e49c332 commit 4147632
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 2 deletions.
53 changes: 53 additions & 0 deletions src/Plasma.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ abstract type AbstractGeometry end
abstract type AbstractDistribution end

abstract type AbstractCoil end

"""
Species holds
q – charge in C
m – mass in Kg
to describe a particle species
"""
struct Species{ T <: Number }
q::T # charge in C
m::T # mass in Kg
Expand All @@ -27,25 +36,69 @@ struct Species{ T <: Number }
)
end
end

"""
Velocity distribution of particles
P – probability function
species – which species of particle
"""
struct Distribution <: AbstractDistribution
P::Function
species::Species
end


"""
Describes the initial geometry of a plasma
f – conditional function
# Example
Geometry(x -> x > 0.4 ? 1. : 0)
"""
struct Geometry{F <: Function} <: AbstractGeometry
f::F

function Geometry(f= _ -> 1)
new{typeof(f)}(f)
end
end

"""
CollisionlessPlasma object that can be passed to Plasma.solve for simulation
It takes a geometry and a vector of distributions (one for every particle).
"""
struct CollisionlessPlasma{ G <: AbstractGeometry } <: AbstractPlasma
distributions::Vector{Distribution}
geometry::G
end

"""
ElectrostaticPlasma object that can be passed to Plasma.solve for simulation
It takes a geometry and a vector of distributions (one for every particle).
"""
struct ElectrostaticPlasma{ G <: AbstractGeometry } <: AbstractPlasma
distributions::Vector{Distribution}
geometry::G
end

"""
Object to hold (and save) the results of Plasma.solve.
It consists of
plasma – CollisionlessPlasma or ElectrostaticPlasma object
vars – dependent variables
dict_vars – dictionary of dependent variables
phi – trained trial solution that approximates plasma movement
res – result of optimization
initθ – weights of the neural network
domains – domains of the simulation
"""
struct PlasmaSolution{ P <: AbstractPlasma, V, DV, PHI, RE, IN, DO }
plasma::P
vars::V
Expand Down
23 changes: 21 additions & 2 deletions src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ function print_loss(prob)
end

"""
Solve dispatch for collisionless plasmas
Simulates a collisionless plasma given:
plasma – Struct of type CollisionlessPlasma
lb – lower bound
ub – upper bound
time_lb – lower time boundary
time_ub – upper time boundary
GPU – whether this should be executed on the GPU or not
inner_layers – how many layers in the neural network
strategy – what NeuralPDE training strategy should be used
"""
function solve(plasma::CollisionlessPlasma;
lb=0.0, ub=1.0, time_lb=lb, time_ub=ub,
Expand Down Expand Up @@ -152,7 +161,17 @@ function solve(plasma::CollisionlessPlasma;
end

"""
Solve dispatch for electrostatic plasmas
Simulates an electrostatic plasma given:
plasma – Struct of type ElectrostaticPlasma
dim – in how many D and V dimensions should the simulation happen
lb – lower bound
ub – upper bound
time_lb – lower time boundary
time_ub – upper time boundary
GPU – whether this should be executed on the GPU or not
inner_layers – how many layers in the neural network
strategy – what NeuralPDE training strategy should be used
"""
function solve(plasma::ElectrostaticPlasma;
lb=0.0, ub=1.0, time_lb=lb, time_ub=ub,
Expand Down

0 comments on commit 4147632

Please sign in to comment.