licenses
sequencelengths
1
3
version
stringclasses
677 values
tree_hash
stringlengths
40
40
path
stringclasses
1 value
type
stringclasses
2 values
size
stringlengths
2
8
text
stringlengths
25
67.1M
package_name
stringlengths
2
41
repo
stringlengths
33
86
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
6625
function get_variable_info(model::JuMP.Model) varinds = OrderedDict() integer = OrderedDict() lb = OrderedDict() ub = OrderedDict() inits = OrderedDict() for (k, vs) in model.obj_dict if vs isa VariableRef v = vs ind = v.index.value varinds[k] = ind integer[k] = is_binary(v) || is_integer(v) lb[k] = if has_lower_bound(v) lower_bound(v) elseif is_binary(v) 0.0 else -Inf end ub[k] = if has_upper_bound(v) upper_bound(v) elseif is_binary(v) 1.0 else Inf end inits[k] = if start_value(v) !== nothing start_value(v) elseif ub[k] == Inf && lb[k] == -Inf 0.0 elseif ub[k] == Inf lb[k] + 1.0 elseif lb[k] == -Inf lb[k] - 1.0 else (ub[k] + lb[k]) / 2 end elseif vs isa AbstractArray{<:VariableRef} inds = map(v -> v.index.value, vs) if inds isa JuMP.Containers.DenseAxisArray varinds[k] = OrderedDict(inds.data .=> keys(inds)) else varinds[k] = OrderedDict(vec(inds) .=> 1:length(inds)) end integer[k] = map(vs) do v is_binary(v) || is_integer(v) end lb[k] = map(vs) do v if has_lower_bound(v) lower_bound(v) elseif is_binary(v) 0.0 else -Inf end end ub[k] = map(vs) do v if has_upper_bound(v) upper_bound(v) elseif is_binary(v) 1.0 else Inf end end inits[k] = map(vs) do v ind = varinds[k][v.index.value] if start_value(v) !== nothing start_value(v) elseif ub[k][ind] == Inf && lb[k][ind] == -Inf 0.0 elseif ub[k][ind] == Inf lb[k][ind] + 1.0 elseif lb[k][ind] == -Inf lb[k][ind] - 1.0 else (ub[k][ind] + lb[k][ind]) / 2 end end else continue end end sort!(integer) sort!(lb) sort!(ub) sort!(inits) _lb = OrderedDict(k => v for (k, v) in lb) _ub = OrderedDict(k => v for (k, v) in ub) _inits = OrderedDict(k => v for (k, v) in inits) _integer = OrderedDict(k => v for (k, v) in integer) return _lb, _ub, _inits, _integer end function get_constraint_info(model::JuMP.Model, nvars) Iineq = Int[] Jineq = Int[] Vineq = Float64[] bineq = Float64[] Ieq = Int[] Jeq = Int[] Veq = Float64[] beq = Float64[] ineqcounter = 0 eqcounter = 0 inv_geq_constraints = OrderedDict() inv_leq_constraints = OrderedDict() inv_eq_constraints = OrderedDict() for (_, c) in model.obj_dict if c isa ConstraintRef cs = [c] elseif c isa AbstractArray{<:ConstraintRef} cs = c else cs = nothing continue end foreach(cs) do c set = constraint_object(c).set if set isa MOI.GreaterThan inv_geq_constraints[JuMP.index(c).value] = c elseif set isa MOI.LessThan inv_leq_constraints[JuMP.index(c).value] = c elseif set isa MOI.EqualTo inv_eq_constraints[JuMP.index(c).value] = c else throw("Set type not supported.") end end end sort!(inv_geq_constraints) sort!(inv_leq_constraints) sort!(inv_eq_constraints) geq_constraints = values(inv_geq_constraints) leq_constraints = values(inv_leq_constraints) eq_constraints = values(inv_eq_constraints) for c in geq_constraints func = constraint_object(c).func @assert func isa AffExpr set = constraint_object(c).set ineqcounter += 1 push!(bineq, -set.lower) for (var, val) in func.terms push!(Iineq, ineqcounter) push!(Jineq, var.index.value) push!(Vineq, -val) end end for c in leq_constraints func = constraint_object(c).func @assert func isa AffExpr set = constraint_object(c).set ineqcounter += 1 push!(bineq, set.upper) for (var, val) in func.terms push!(Iineq, ineqcounter) push!(Jineq, var.index.value) push!(Vineq, val) end end for c in eq_constraints func = constraint_object(c).func @assert func isa AffExpr set = constraint_object(c).set eqcounter += 1 push!(beq, set.value) for (var, val) in func.terms push!(Ieq, eqcounter) push!(Jeq, var.index.value) push!(Veq, val) end end Aineq = sparse(Iineq, Jineq, Vineq, ineqcounter, nvars) Aeq = sparse(Ieq, Jeq, Veq, eqcounter, nvars) return Aineq, bineq, Aeq, beq end function get_objective_info(model::JuMP.Model, nvars) obj = objective_function(model) @assert obj isa AffExpr sense = objective_sense(model) I = Int[] V = Float64[] for (var, val) in obj.terms push!(I, var.index.value) if sense == MathOptInterface.MIN_SENSE push!(V, val) elseif sense == MathOptInterface.MAX_SENSE push!(V, -val) end end c = sparsevec(I, V, nvars) return c end function DictModel(model::JuMP.Model) lb, ub, inits, integer = get_variable_info(model) nvars = length(flatten(lb)[1]) Aineq, bineq, Aeq, beq = get_constraint_info(model, nvars) c = get_objective_info(model, nvars) ks = collect(keys(inits)) dict_model = DictModel() for k in ks addvar!(dict_model, k, lb[k], ub[k], init = inits[k], integer = integer[k]) end if length(c) > 0 set_objective!(dict_model, x -> dot(c, flatten(x, ks)[1])) end if length(bineq) > 0 add_ineq_constraint!(dict_model, x -> Aineq * flatten(x, ks)[1] - bineq) end if length(beq) > 0 add_eq_constraint!(dict_model, x -> Aeq * flatten(x, ks)[1] - beq) end return dict_model end
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
7347
""" ``` struct Model <: AbstractModel objective::Objective eq_constraints::VectorOfFunctions ineq_constraints::VectorOfFunctions box_min::AbstractVector box_max::AbstractVector init::AbstractVector integer::AbstractVector end ``` The `Model` structs stores information about the nonlinear optimization problem. - `objective`: the objective function of the problem of type [`Objective`](@ref). - `eq_constraints`: the equality constraints of the problem of type [`VectorOfFunctions`](@ref). Each function in `ineq_constraints` can be an instance of [`IneqConstraint`](@ref) or [`AbstractFunction`](@ref). If the function is not an `IneqConstraint`, its right-hand-side bound is assumed to be 0. - `ineq_constraints`: the inequality constraints of the problem of type [`VectorOfFunctions`](@ref). Each function in `ineq_constraints` can be an instance of [`IneqConstraint`](@ref) or [`AbstractFunction`](@ref). If the function is not an `IneqConstraint`, its right-hand-side bound is assumed to be 0. - `sd_constraints`: a list of matrix-valued functions which must be positive semidefinite at any feasible solution. """ mutable struct Model{Tv<:AbstractVector} <: AbstractModel objective::Union{Nothing,Objective} eq_constraints::VectorOfFunctions ineq_constraints::VectorOfFunctions sd_constraints::VectorOfFunctions box_min::Tv box_max::Tv init::Tv integer::AbstractVector end """ Model() Model(f) Constructs an empty model or a model with objective function `f`. The decision variables are assumed to be of type `Vector{Any}`. """ Model(f::Union{Nothing,Function} = x -> 0.0) = Model(Any, f) """ Model(::Type{T}, f::Union{Nothing, Function}) where {T} Constructs an empty model with objective function `f` and decision variable value type `Vector{T}`. `f` can be an instance of `Base.Function` but must return a number, or it can be an intance of [`Objective`](@ref). `f` can also be `nothing` in which case, the objective function can be defined later using [`set_objective!`](@ref). """ Model(::Type{T}, f::Function) where {T} = Model(T, Objective(f)) function Model(::Type{T}, obj::Union{Nothing,Objective}) where {T} return Model( obj, VectorOfFunctions(EqConstraint[]), VectorOfFunctions(IneqConstraint[]), VectorOfFunctions(SDConstraint[]), T[], T[], T[], [], ) end getobjective(m::AbstractModel) = m.objective getineqconstraints(m::AbstractModel) = m.ineq_constraints geteqconstraints(m::AbstractModel) = m.eq_constraints getsdconstraints(m::AbstractModel) = m.sd_constraints function getobjectiveconstraints(m::AbstractModel; sd = false) if sd return VectorOfFunctions(( getobjective(m), getineqconstraints(m), geteqconstraints(m), getsdconstraints(m), )) else return VectorOfFunctions(( getobjective(m), getineqconstraints(m), geteqconstraints(m), )) end end getineqconstraint(m::AbstractModel, i::Integer) = getineqconstraints(m).fs[i] geteqconstraint(m::AbstractModel, i::Integer) = geteqconstraints(m).fs[i] getnineqconstraints(m::AbstractModel) = length(getineqconstraints(m)) getneqconstraints(m::AbstractModel) = length(geteqconstraints(m)) getnsdconstraints(m::AbstractModel) = length(getsdconstraints(m)) function getnconstraints(m::AbstractModel) getnineqconstraints(m) + getneqconstraints(m) + getnsdconstraints(m) end getnvars(m::AbstractModel) = length(getmin(m)) """ getdim(m::AbstractModel) Returns a 2-tuple of the number of constraints and the number of variables in the model `m`. """ getdim(m::AbstractModel) = (getnconstraints(m), getnvars(m)) function reduce_type(d::AbstractVector) return reduce_type.(d) end function reduce_type(d::OrderedDict) OrderedDict(identity.(keys(d)) .=> reduce_type.(values(d))) end reduce_type(d) = d getmin(m::AbstractModel) = m.box_min getmin(m::AbstractModel, i) = getmin(m)[i] Base.isinteger(m::AbstractModel, i) = m.integer[i] getmax(m::AbstractModel) = m.box_max getmax(m::AbstractModel, i) = getmax(m)[i] getinit(model::AbstractModel) = model.init function setmin!(m::AbstractModel, min) getmin(m) .= min return m end function setmin!(m::AbstractModel, i, min) getmin(m)[i] = min return m end function setmax!(m::AbstractModel, max) getmax(m) .= max return m end function setmax!(m::AbstractModel, i, max) getmax(m)[i] = max return m end # Box constraints function setbox!(m::AbstractModel, minb, maxb) getmin(m) .= minb getmax(m) .= maxb return m end function setbox!(m::AbstractModel, i, minb, maxb) getmin(m)[i] = minb getmax(m)[i] = maxb return m end function setinteger!(m::AbstractModel, i, integer) m.integer[i] = integer return m end function addvar!(m::Model, lb, ub; init = deepcopy(lb), integer = false) push!(getmin(m), lb) push!(getmax(m), ub) push!(m.init, init) push!(m.integer, integer) return m end function addvar!( m::Model, lb::Vector, ub::Vector; init = deepcopy(lb), integer = falses(length(lb)), ) append!(getmin(m), lb) append!(getmax(m), ub) append!(m.init, init) append!(m.integer, integer) return m end """ set_objective!(m::AbstractModel, f::Function) Sets the objective of the moodel `m` to the function `f`. `f` must return a scalar. """ function set_objective(m::AbstractModel, f::Function; kwargs...) newm = @set m.objective = Objective(f; kwargs...) return newm end function set_objective!(m::AbstractModel, f::Function; kwargs...) m.objective = Objective(f; kwargs...) return m end function add_ineq_constraint!( m::AbstractModel, f::Function, s = 0.0; dim = length(flatten(f(reduce_type(getinit(m))))[1]), kwargs..., ) return add_ineq_constraint!(m, FunctionWrapper(f, dim), s; kwargs...) end function add_ineq_constraint!(m::AbstractModel, f::AbstractFunction, s = 0.0; kwargs...) return add_ineq_constraint!(m, IneqConstraint(f, s; kwargs...)) end function add_ineq_constraint!(m::AbstractModel, f::IneqConstraint) push!(m.ineq_constraints.fs, f) return m end function add_ineq_constraint!(m::AbstractModel, fs::Vector{<:IneqConstraint}) append!(m.ineq_constraints.fs, fs) return m end function add_eq_constraint!( m::AbstractModel, f::Function, s = 0.0; dim = length(flatten(f(reduce_type(getinit(m))))[1]), kwargs..., ) return add_eq_constraint!(m, FunctionWrapper(f, dim), s; kwargs...) end function add_eq_constraint!(m::AbstractModel, f::AbstractFunction, s = 0.0; kwargs...) return add_eq_constraint!(m, EqConstraint(f, s; kwargs...)) end function add_eq_constraint!(m::AbstractModel, f::EqConstraint) push!(m.eq_constraints.fs, f) return m end function add_eq_constraint!(m::AbstractModel, fs::Vector{<:EqConstraint}) append!(m.eq_constraints.fs, fs) return m end function add_sd_constraint!( m::AbstractModel, f::Function, dim = size(f(reduce_type(getinit(m))), 1), ) return add_sd_constraint!(m, SDConstraint(f, dim)) end function add_sd_constraint!(m::AbstractModel, sd_constraint::AbstractFunction) push!(m.sd_constraints.fs, sd_constraint) return m end
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
3788
""" getobjectiveconstraints(model::AbstractModel) Returns an instance of `AbstractFunction` that when called with input `x` returns the objective and constraint values of `model` at `x` in a single vector. """ getobjectiveconstraints """ getobjective(model::AbstractModel) Returns a that when called with input `x` returns the objective value of `model` at `x`. """ getobjective """ getineqconstraint(model::AbstractModel, i::Integer) Returns a that when called with input `x` returns the constraint violation value of the `i`^th inequality constraint of `model` at `x`. """ getineqconstraint """ geteqconstraint(model::AbstractModel, i::Integer) Returns a that when called with input `x` returns the constraint violation value of the `i`^th equality constraint of `model` at `x`. """ geteqconstraint """ getineqconstraints(model::AbstractModel) Returns a that when called with input `x` returns the constraint violation values of all the inequality constraints of `model` at `x`. """ getineqconstraints """ geteqconstraints(model::AbstractModel) Returns a that when called with input `x` returns the constraint violation values of all the equality constraints of `model` at `x`. """ geteqconstraints """ get_objective_multiple(model::AbstractModel) Returns the factor by which the objective of `model` was scaled. This is 1 by default. """ get_objective_multiple """ set_objective_multiple!(model::AbstractModel, multiple::Number) Set the objective's scaling factor of `model` to `multiple`. """ set_objective_multiple! """ getnconstraints(model::AbstractModel) Returns the total number of constraints in `model`. """ getnconstraints """ getnineqconstraints(model::AbstractModel) Returns the number of inequality constraints in `model`. """ getnineqconstraints """ getneqconstraints(model::AbstractModel) Returns the number of equality constraints in `model`. """ getneqconstraints """ getnvars(model::AbstractModel) Returns the number of variables in `model`. """ getnvars """ getmin(model::AbstractModel) Returns the variables' lower bounds of `model`. """ getmin """ getmax(model::AbstractModel) Returns the variables' upper bounds of `model`. """ getmax """ setmin!(model::AbstractModel, min::Union{Number, AbstractVector}) setmin!(model::AbstractModel, i::Integer, min::Number) Sets the variables' lower bounds in `model` to `min`. Or if `i` is given, it sets the lower bound of the `i`^th variable in `model` to `min`. """ setmin! """ setmax!(model::AbstractModel, max::Union{Number, AbstractVector}) setmax!(model::AbstractModel, i::Integer, max::Number) Sets the variables' upper bound in `model` to `max`. Or if `i` is given, it sets the upper bound of the `i`^th variable in `model` to `max`. """ setmax! """ setbox!(model::AbstractModel, min::Union{Number, AbstractVector}, max::Union{Number, AbstractVector}) setbox!(model::AbstractModel, i::Integer, min::Number, max::Number) Sets the variables' lower and upper bounds in `model` to `min` and `max` respectively. Or if `i` is given, it sets the lower and upper bounds of the `i`^th variable in `model` to `min` and `max` respectively. """ setbox! """ addvar!(model::AbstractModel, lb::Number, ub::Number; init = lb, integer = false) Adds a new variable to `model` with lower and upper bounds `lb` and `ub`, initial value `init` and `integer = true` if the variable is integer. """ addvar! """ add_ineq_constraint!(model::AbstractModel, f::IneqConstraint) add_ineq_constraint!(model::AbstractModel, fs::Vector{<:IneqConstraint}) Adds a new constraint `f` or multiple new constraints `fs` to `model`. """ add_ineq_constraint! """ init!(model::AbstractModel) Initializes the model. """ init!
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
9443
struct JuMPProblem{E,M,V} evaluator::E model::M vars::V end struct JuMPEvaluator{XL,XU,X,CL,CU,O,C,G,J,JS,H,HS} <: MOI.AbstractNLPEvaluator nvars::Int xlb::XL xub::XU x0::X nconstr::Int clb::CL cub::CU njacvalues::Int nhessvalues::Int obj::O eval_g::C eval_grad_f::G eval_jac_g::J jac_structure::JS eval_h::H lag_hess_structure::HS end function get_jump_problem( model::VecModel, x0 = getinit(model); optimizer, first_order, kwargs..., ) integers = model.integer eq = if length(model.eq_constraints.fs) == 0 nothing else model.eq_constraints end ineq = if length(model.ineq_constraints.fs) == 0 nothing else model.ineq_constraints end obj = CountingFunction(getobjective(model)) return get_jump_problem( obj, ineq, eq, x0, integers, getmin(model), getmax(model), first_order, optimizer, ), obj.counter end function get_jump_problem( obj, ineq_constr, eq_constr, x0, integers, xlb, xub, first_order, optimizer, ) nvars = 0 if ineq_constr !== nothing ineqJ0 = Zygote.jacobian(ineq_constr, x0)[1] ineq_nconstr, nvars = size(ineqJ0) Joffset = nvalues(ineqJ0) else ineqJ0 = nothing ineq_nconstr = 0 Joffset = 0 end if eq_constr !== nothing eqJ0 = Zygote.jacobian(eq_constr, x0)[1] eq_nconstr, nvars = size(eqJ0) else eqJ0 = nothing eq_nconstr = 0 end njacvals = nvalues(ineqJ0) + nvalues(eqJ0) @assert nvars > 0 lag(factor, y) = x -> begin factor * obj(x) + _dot(ineq_constr, x, @view(y[1:ineq_nconstr])) + _dot(eq_constr, x, @view(y[ineq_nconstr+1:end])) end clb = [fill(-Inf, ineq_nconstr); zeros(eq_nconstr)] cub = zeros(ineq_nconstr + eq_nconstr) function eval_g(x::AbstractVector{Float64}, g::AbstractVector{Float64}) if ineq_constr !== nothing g[1:ineq_nconstr] .= ineq_constr(x) end if eq_constr !== nothing g[ineq_nconstr+1:end] .= eq_constr(x) end return g end function eval_grad_f(x::AbstractVector{Float64}, grad_f::AbstractVector{Float64}) grad_f .= Zygote.gradient(obj, x)[1] end function jac_structure() rows = fill(0, njacvals) cols = fill(0, njacvals) ineqJ0 === nothing || fill_indices!(rows, cols, ineqJ0) eqJ0 === nothing || fill_indices!(rows, cols, eqJ0, offset = Joffset, row_offset = ineq_nconstr) return tuple.(rows, cols) end function eval_jac_g(x::AbstractVector{Float64}, values::AbstractVector{Float64}) values .= 0 if ineq_constr !== nothing ineqJ = Zygote.jacobian(ineq_constr, x)[1] add_values!(values, ineqJ) end if eq_constr !== nothing eqJ = Zygote.jacobian(eq_constr, x)[1] add_values!(values, eqJ, offset = Joffset) end return values end if first_order eval_h = (x...) -> 0.0 lag_hess_structure = () -> Tuple{Int,Int}[] Hnvalues = 0 else HL0 = LowerTriangular(Zygote.hessian(lag(1.0, ones(ineq_nconstr + eq_nconstr)), x0)) Hnvalues = nvalues(HL0) lag_hess_structure = function () rows = fill(0, Hnvalues) cols = fill(0, Hnvalues) fill_indices!(rows, cols, HL0) return tuple.(rows, cols) end eval_h = function ( x::AbstractVector{Float64}, obj_factor::Float64, lambda::AbstractVector{Float64}, values::AbstractVector{Float64}, ) HL = LowerTriangular(Zygote.hessian(lag(obj_factor, lambda), x)) values .= 0 add_values!(values, HL) return values end end evaluator = JuMPEvaluator( nvars, xlb, xub, x0, ineq_nconstr + eq_nconstr, clb, cub, njacvals, Hnvalues, obj, eval_g, eval_grad_f, eval_jac_g, jac_structure, eval_h, lag_hess_structure, ) jump_model = JuMP.Model(optimizer) moi_model = JuMP.backend(jump_model) MOI.empty!(moi_model) vars = map(1:nvars) do i v = MOI.add_variable(moi_model) if integers[i] if xlb[i] > -1 && xub[i] < 2 MOI.add_constraint(moi_model, v, MOI.ZeroOne()) else MOI.add_constraint(moi_model, v, MOI.Integer()) end end if xub[i] != Inf MOI.add_constraint(moi_model, v, MOI.LessThan(xub[i])) end if xlb[i] != Inf MOI.add_constraint(moi_model, v, MOI.GreaterThan(xlb[i])) end MOI.set(moi_model, MOI.VariablePrimalStart(), v, x0[i]) return v end block_data = MOI.NLPBlockData(MOI.NLPBoundsPair.(clb, cub), evaluator, true) MOI.set(moi_model, MOI.NLPBlock(), block_data) MOI.set(moi_model, MOI.ObjectiveSense(), MOI.MIN_SENSE) return JuMPProblem(evaluator, jump_model, vars) end function MOI.initialize(d::JuMPEvaluator, requested_features::Vector{Symbol}) for feat in requested_features if !(feat in MOI.features_available(d)) error("Unsupported feature $feat") # TODO: implement Jac-vec products for solvers that need them end end end function MOI.features_available(::JuMPEvaluator) return [:Grad, :Jac, :Hess] end MOI.eval_objective(d::JuMPEvaluator, x) = d.obj(x) function MOI.eval_constraint(d::JuMPEvaluator, g, x) d.eval_g(x, g) return end function MOI.eval_objective_gradient(d::JuMPEvaluator, grad_f, x) d.eval_grad_f(x, grad_f) return end function MOI.jacobian_structure(d::JuMPEvaluator) return d.jac_structure() end # lower triangle only function MOI.hessian_lagrangian_structure(d::JuMPEvaluator) return d.lag_hess_structure() end function MOI.eval_constraint_jacobian(d::JuMPEvaluator, J, x) d.eval_jac_g(x, J) return end function MOI.eval_hessian_lagrangian(d::JuMPEvaluator, H, x, σ, μ) d.eval_h(x, σ, μ, H) return end nvalues(::Nothing) = 0 nvalues(J::Matrix) = length(J) nvalues(H::LowerTriangular{<:Real,<:Matrix}) = (size(H, 1) + 1) * size(H, 1) ÷ 2 nvalues(H::SparseMatrixCSC) = length(H.nzval) function nvalues(HL::LowerTriangular{<:Real,<:SparseMatrixCSC}) nvalues = 0 H = HL.data for col = 1:length(H.colptr)-1 indices = [i for i = H.colptr[col]:H.colptr[col+1]-1 if H.rowval[i] >= col] nvalues += length(indices) end return nvalues end # Implement these for sparse matrices function fill_indices!(rows, cols, J0::Matrix; offset = 0, row_offset = 0) nconstr, nvars = size(J0) for j = 1:nvars cols[offset+1:offset+nconstr] .= j rows[offset+1:offset+nconstr] .= row_offset+1:row_offset+nconstr offset += nconstr end return rows, cols end function fill_indices!( rows, cols, HL::LowerTriangular{<:Real,<:Matrix}; offset = 0, row_offset = 0, ) nvars = size(HL, 1) for j = 1:nvars cols[offset+1:offset+nvars-j+1] .= j rows[offset+1:offset+nvars-j+1] .= row_offset+j:row_offset+nvars offset += nvars - j + 1 end return rows, cols end function fill_indices!(rows, cols, HL::SparseMatrixCSC; offset = 0, row_offset = 0) for col = 1:length(HL.colptr)-1 indices = HL.colptr[col]:HL.colptr[col+1]-1 nvars = length(indices) cols[offset+1:offset+nvars] .= col rows[offset+1:offset+nvars] = row_offset .+ HL.rowval[indices] offset += nvars end return rows, cols end function fill_indices!( rows, cols, HL::LowerTriangular{<:Real,<:SparseMatrixCSC}; offset = 0, row_offset = 0, ) H = HL.data for col = 1:length(H.colptr)-1 indices = [i for i = H.colptr[col]:H.colptr[col+1]-1 if H.rowval[i] >= col] nvars = length(indices) cols[offset+1:offset+nvars] .= col rows[offset+1:offset+nvars] = row_offset .+ H.rowval[indices] offset += nvars end return rows, cols end function add_values!(values, J::Matrix; offset = 0) nvars = length(J) values[offset+1:offset+nvars] .+= vec(J) return values end function add_values!(values, HL::LowerTriangular{<:Real,<:Matrix}; factor = 1, offset = 0) nvars = size(HL, 1) for j = 1:nvars values[offset+1:offset+nvars-j+1] .+= HL[j:nvars, j] .* factor offset += nvars - j + 1 end return values end function add_values!(values, HL::SparseMatrixCSC; factor = 1, offset = 0) nvars = length(HL.nzval) values[offset+1:offset+nvars] .= HL.nzval .* factor return values end function add_values!( values, HL::LowerTriangular{<:Real,<:SparseMatrixCSC}; factor = 1, offset = 0, ) H = HL.data for col = 1:length(H.colptr)-1 indices = [i for i = H.colptr[col]:H.colptr[col+1]-1 if H.rowval[i] >= col] nvars = length(indices) values[offset+1:offset+nvars] .= H.nzval[indices] .* factor offset += nvars end return values end _dot(f, x, y) = dot(f(x), y) _dot(::Nothing, ::Any, ::Any) = 0.0
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
4794
mutable struct VecModel{ TO<:Union{Nothing,Objective}, TE<:VectorOfFunctions, TI<:VectorOfFunctions, TS<:VectorOfFunctions, Tv1<:AbstractVector, Tv2<:AbstractVector, Tv3<:AbstractVector, } <: AbstractModel objective::TO eq_constraints::TE ineq_constraints::TI sd_constraints::TS box_min::Tv1 box_max::Tv2 init::Tv3 integer::BitVector end function isfeasible(model::VecModel, x::AbstractVector; ctol = 1e-4) return all(getmin(model) .<= x .<= getmax(model)) && all(getineqconstraints(model)(x) .<= ctol) && all(-ctol .<= geteqconstraints(model)(x) .<= ctol) end function addvar!(m::VecModel, lb::Real, ub::Real; init::Real = lb, integer = false) push!(getmin(m), lb) push!(getmax(m), ub) push!(m.init, init) push!(m.integer, integer) return m end function addvar!( m::VecModel, lb::Vector{<:Real}, ub::Vector{<:Real}; init::Vector{<:Real} = copy(lb), integer = falses(length(lb)), ) append!(getmin(m), lb) append!(getmax(m), ub) append!(m.init, init) append!(m.integer, integer) return m end function getinit(m::VecModel) ma = getmax(m) mi = getmin(m) init = m.init return map(1:length(mi)) do i if isfinite(init[i]) return init[i] else _ma = ma[i] _mi = mi[i] _ma == Inf && _mi == -Inf && return 0.0 _ma == Inf && return _mi + 1.0 _mi == -Inf && return _ma - 1.0 return (_ma + _mi) / 2 end end end get_objective_multiple(model::VecModel) = getobjective(model).multiple[] function set_objective_multiple!(model::VecModel, m) getobjective(model).multiple[] = m return model end """ Generic `optimize` for VecModel """ function optimize(model::VecModel, optimizer::AbstractOptimizer, x0, args...; kwargs...) workspace = Workspace(model, optimizer, copy(x0), args...; kwargs...) return optimize!(workspace) end """ Workspace constructor without x0 """ function optimize(model::VecModel, optimizer::AbstractOptimizer, args...; kwargs...) workspace = Workspace(model, optimizer, args...; kwargs...) return optimize!(workspace) end function tovecfunc(f, x::AbstractVector{<:Real}; flatteny = true) vx = float.(x) y = f(x) if y isa Real || y isa AbstractVector{<:Real} _flatteny = false else _flatteny = flatteny end if _flatteny tmp = maybeflatten(y) unflatteny = Unflatten(y, tmp[2]) return first ∘ maybeflatten ∘ f, vx, unflatteny else return f, vx, identity end end function tovecfunc(f, x...; flatteny = true) vx, _unflattenx = flatten(x) unflattenx = Unflatten(x, _unflattenx) if flatteny y = f(x...) tmp = maybeflatten(y) # should be addressed in maybeflatten if y isa Real unflatteny = identity else unflatteny = Unflatten(y, tmp[2]) end return x -> maybeflatten(f(unflattenx(x)...))[1], float.(vx), unflatteny else return x -> f(unflattenx(x)...), float.(vx), identity end end function tovecmodel(m::AbstractModel, _x0 = getinit(m)) x0 = reduce_type(_x0) box_min = reduce_type(m.box_min) box_max = reduce_type(m.box_max) init = reduce_type(m.init) v, _unflatten = flatten(x0) unflatten = Unflatten(x0, _unflatten) return VecModel( # objective Objective(tovecfunc(m.objective.f, x0)[1], m.objective.multiple, m.objective.flags), # eq_constraints length(m.eq_constraints.fs) != 0 ? VectorOfFunctions( map(Tuple(m.eq_constraints.fs)) do c EqConstraint(tovecfunc(c.f, x0)[1], maybeflatten(c.rhs)[1], c.dim, c.flags) end, ) : VectorOfFunctions(()), # ineq_constraints length(m.ineq_constraints.fs) != 0 ? VectorOfFunctions( map(Tuple(m.ineq_constraints.fs)) do c IneqConstraint( tovecfunc(c.f, x0)[1], maybeflatten(c.rhs)[1], c.dim, c.flags, ) end, ) : VectorOfFunctions(()), # sd_constraints length(m.sd_constraints.fs) != 0 ? VectorOfFunctions( map(Tuple(m.sd_constraints.fs)) do c SDConstraint(tovecfunc(c.f, x0; flatteny = false)[1], c.dim) end, ) : VectorOfFunctions(()), # box_min float.(flatten(box_min)[1]), # box_max float.(flatten(box_max)[1]), # init float.(flatten(init)[1]), # integer convert(BitVector, flatten(m.integer)[1]), ), float.(v), unflatten end
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
4405
""" PlottingCallback A callback function that plots a number of convergence metrics using [ConvergencePlots.jl](https://github.com/mohamed82008/ConvergencePlots.jl). The following are the fields of the struct: - `plot`: an instance of `ConvergencePlots.ConvergencePlot`. - `n`: the number of history points to keep track of. - `iter`: the number of times the callback was called. """ mutable struct PlottingCallback <: Function plot::Any n::Int iter::Int end PlottingCallback(n = 1000) = PlottingCallback(nothing, n, 0) (callback::PlottingCallback)(solution) = nothing """ LazyPlottingCallback A callback function that plots a number of convergence metrics using [ConvergencePlots.jl](https://github.com/mohamed82008/ConvergencePlots.jl) only when `show` is called. The following are the fields of the struct: - `plot`: an instance of `ConvergencePlots.ConvergencePlot`. - `n`: the number of history points to keep track of. - `iter`: the number of times the callback was called. """ mutable struct LazyPlottingCallback <: Function plot::Any n::Int iter::Int show_plot::Bool save_plot::Union{Nothing,String} end LazyPlottingCallback(n = 10^10; show_plot = true, save_plot = nothing) = LazyPlottingCallback(nothing, n, 0, show_plot, save_plot) (callback::LazyPlottingCallback)(solution::Solution; update = false) = nothing struct NoCallback <: Function end (::NoCallback)(args...; kwargs...) = nothing @require ConvergencePlots = "e9c76d45-d282-4a42-92e1-2fa9292d7569" @eval begin using .ConvergencePlots """ (callback::PlottingCallback)(solution::Solution) Updates the convergence plots using the current solution. """ function (callback::PlottingCallback)(solution::Solution) @unpack convstate = solution if callback.iter == 0 callback.plot = ConvergencePlot( callback.n, names = ["KKT residual", "|Δf|", "|Δx|_∞", "Infeasibility"], #names = ["KKT residual", "IPOPT residual", "|Δf|", "|Δx|_∞", "Infeasibility"], options = Dict( "KKT residual" => (color = "black",), #"IPOPT residual" => (color = "blue",), "|Δf|" => (color = "green",), "|Δx|_∞" => (color = "violet",), "Infeasibility" => (color = "red",), ), ) else @unpack plot = callback addpoint!( plot, Dict( "KKT residual" => convstate.kkt_residual, #"IPOPT residual" => convstate.ipopt_residual, "|Δf|" => convstate.Δf, "|Δx|_∞" => convstate.Δx, "Infeasibility" => convstate.infeas, ), ) end callback.iter += 1 end """ (callback::LazyPlottingCallback)(solution::Solution) Updates the convergence plots using the current solution. """ function (callback::LazyPlottingCallback)(solution::Solution; update = false) @unpack convstate = solution if callback.iter == 0 callback.plot = ConvergencePlot( callback.n, names = ["KKT residual", "|Δf|", "|Δx|_∞", "Infeasibility"], #names = ["KKT residual", "IPOPT residual", "|Δf|", "|Δx|_∞", "Infeasibility"], options = Dict( "KKT residual" => (color = "black",), #"IPOPT residual" => (color = "blue",), "|Δf|" => (color = "green",), "|Δx|_∞" => (color = "violet",), "Infeasibility" => (color = "red",), ), show = update && callback.show_plot, ) else @unpack plot = callback addpoint!( plot, Dict( "KKT residual" => convstate.kkt_residual, #"IPOPT residual" => convstate.ipopt_residual, "|Δf|" => convstate.Δf, "|Δx|_∞" => convstate.Δx, "Infeasibility" => convstate.infeas, ), show = callback.show_plot, update = update, filename = callback.save_plot, ) end callback.iter += 1 end end
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
5957
""" hasconverged(s::ConvergenceState) Returns true if `s.converged` is true. """ hasconverged(s::ConvergenceState) = s.converged """ hasconverged(s::Solution) Returns true if `hasconverged(s.convstate)` is true. """ hasconverged(s::Solution) = hasconverged(s.convstate) function assess_convergence!(w::Workspace) assess_convergence!( w.solution, w.model, w.options.tol, w.options.convcriteria, w.options.verbose, w.iter, ) correctsolution!(w.solution, w.model, w.options) return w end """ ``` assess_convergence!( solution::Solution, model::AbstractModel, tol::Tolerance, criteria::ConvergenceCriteria, verbose::Bool, iter::Int ) ``` Evaluates the convergence state `solution.convstate` given the current solution, `solution`, the tolerance, `tol`, and the convergence criteria `criteria`. `solution.convstate.converged` is then updated. If `criteria` is an instance of `GenericCriteria`, `converged = (x_converged || f_converged) && infeas_converged`. `x_converged`, `f_converged` and `infeas_converged` are explained in [`Tolerance`](@ref). If `criteria` is an instance of `KKTCriteria` or `ScaledKKTCriteria`, `converged = kkt_converged && infeas_converged`. `kkt_converged` and `infeas_converged` are explained in [`Tolerance`](@ref). If `criteria` is an instance of `IpoptCriteria`, `converged = ipopt_converged && infeas_converged`. `ipopt_converged` and `infeas_converged` are explained in [`Tolerance`](@ref). """ function assess_convergence!( solution::Solution, model::AbstractModel, tol::Tolerance, criteria::ConvergenceCriteria, verbose::Bool, iter::Int, ) xtol, fabstol, freltol, kkttol, infeastol = tol.x, tol.fabs, tol.frel, tol.kkt, tol.infeas Δx, Δf, infeas, f = getresiduals(solution, model, GenericCriteria()) relΔf = Δf / (abs(f) + freltol) _, kkt_residual, infeas, _ = getresiduals(solution, model, KKTCriteria()) _, ipopt_residual, infeas, _ = getresiduals(solution, model, IpoptCriteria()) x_converged = Δx < xtol fabs_converged = Δf < fabstol frel_converged = relΔf < freltol if criteria isa ScaledKKTCriteria if debugging[] #@show get_objective_multiple(model) end m = get_objective_multiple(model) scaled_kkt_residual = kkt_residual / max(m, 1 / m) else scaled_kkt_residual = kkt_residual end get_kkt_residual(::ScaledKKTCriteria) = scaled_kkt_residual get_kkt_residual(::IpoptCriteria) = ipopt_residual get_kkt_residual(::Any) = kkt_residual if iter == 0 && verbose @info log_header( [:iter, :obj, :Δobj, :violation, :kkt_residual], [Int, Float64, Float64, Float64, Float64], ) end if verbose @info log_row(Any[iter, f, Δf, infeas, get_kkt_residual(criteria)]) end kkt_converged = kkt_residual < kkttol scaled_kkt_converged = scaled_kkt_residual < kkttol ipopt_converged = ipopt_residual < kkttol infeas_converged = infeas <= infeastol f_increased = solution.f > solution.prevf if criteria isa GenericCriteria converged = (x_converged || fabs_converged || frel_converged) && infeas_converged elseif criteria isa KKTCriteria converged = kkt_converged && infeas_converged elseif criteria isa ScaledKKTCriteria converged = scaled_kkt_converged && infeas_converged elseif criteria isa IpoptCriteria converged = ipopt_converged && infeas_converged else throw("Unsupported convergence criteria for MMA.") end kkt_converged = kkt_converged || scaled_kkt_converged @pack! solution.convstate = x_converged, fabs_converged, frel_converged, kkt_converged, ipopt_converged, infeas_converged, Δx, Δf, relΔf, kkt_residual, ipopt_residual, infeas, f_increased, converged return solution end function getresiduals(solution::Solution, ::AbstractModel, ::GenericCriteria) @unpack prevx, x, prevf, f, g = solution Δx = maximum(abs(x[j] - prevx[j]) for j = 1:length(x)) Δf = abs(f - prevf) infeas = length(g) == 0 ? zero(eltype(g)) : max(0, maximum(g)) return Δx, Δf, infeas, f end function getresiduals(solution::Solution, model::AbstractModel, ::KKTCriteria) @unpack ∇f, g, ∇g, λ, x, f = solution xmin, xmax = getmin(model), getmax(model) T = eltype(x) res = maximum(1:length(x)) do j @views temp = ∇f[j] + dot(∇g[:, j], λ) if xmin[j] >= x[j] return abs(min(0, temp)) elseif x[j] >= xmax[j] return max(0, temp) else return abs(temp) end end if debugging[] @show λ, g end res = length(g) == 0 ? res : max(res, maximum(abs.(λ .* g))) if debugging[] @show maximum(abs, g) @show maximum(abs, λ) @show maximum(x) end infeas = length(g) == 0 ? zero(eltype(g)) : max(maximum(g), 0) return missing, res, infeas, f end function getresiduals(solution::Solution, model::AbstractModel, ::IpoptCriteria) @unpack ∇f, g, ∇g, λ, x, f = solution xmin, xmax = getmin(model), getmax(model) T = eltype(x) n, m, s = length(x), length(λ), zero(T) res = maximum(1:n) do j @views temp = ∇f[j] + dot(∇g[:, j], λ) if xmin[j] >= x[j] dj = temp s += max(dj, 0) return abs(min(0, dj)) elseif x[j] >= xmax[j] yj = -temp s += max(yj, 0) return abs(min(0, yj)) else return abs(temp) end end sd = max(100, (sum(abs, λ) + s) / (n + m)) / 100 res = length(g) == 0 ? res : max(res, maximum(abs.(λ .* g))) res = res / sd infeas = length(g) == 0 ? zero(eltype(g)) : max(maximum(g), 0) if debugging[] println("Agg infeas = ", infeas) end return missing, res, infeas, f end
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
1898
""" @params struct_def A macro that changes all fields' types to type parameters while respecting the type bounds specificied by the user. For example: ``` @params struct MyType{T} f1::T f2::AbstractVector{T} f3::AbstractVector{<:Real} f4 end ``` will define: ``` struct MyType{T, T1 <: T, T2 <: AbstractVector{T}, T3 <: AbstractVector{<:Real}, T4} f1::T1 f2::T2 f3::T3 f4::T4 end ``` The default non-parameteric constructor, e.g. `MyType(f1, f2, f3, f4)`, will always work if all the type parameters used in the type header are used in the field types. Using a type parameter in the type header that is not used in the field types such as: ``` struct MyType{T} f1 f2 end ``` is not recommended. """ macro params(struct_expr) header = struct_expr.args[2] fields = @view struct_expr.args[3].args[2:2:end] params = [] for i = 1:length(fields) x = fields[i] T = gensym() if x isa Symbol push!(params, T) fields[i] = :($x::$T) elseif x.head == :(::) abstr = x.args[2] var = x.args[1] push!(params, :($T <: $abstr)) fields[i] = :($var::$T) end end if header isa Symbol && length(params) > 0 struct_expr.args[2] = :($header{$(params...)}) elseif header.head == :curly append!(struct_expr.args[2].args, params) elseif header.head == :<: if struct_expr.args[2].args[1] isa Symbol name = struct_expr.args[2].args[1] struct_expr.args[2].args[1] = :($name{$(params...)}) elseif header.head == :<: && struct_expr.args[2].args[1] isa Expr append!(struct_expr.args[2].args[1].args, params) else error("Unidentified type definition.") end else error("Unidentified type definition.") end esc(struct_expr) end
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
3063
using NonconvexCore, LinearAlgebra, Test, Zygote @testset "OrderedDict of reals" begin f(x) = sqrt(x[:b]) g(x, a, b) = (a * x[:a] + b)^3 - x[:b] m = DictModel(f) addvar!(m, :a, 0.0, 10.0) addvar!(m, :b, 0.0, 10.0) add_ineq_constraint!(m, x -> g(x, 2, 0)) add_ineq_constraint!(m, x -> g(x, -1, 1)) @test getmin(m) == OrderedDict(:a => 0.0, :b => 0.0) @test getmax(m) == OrderedDict(:a => 10.0, :b => 10.0) @test getmin(m, :a) == 0.0 @test getmax(m, :a) == 10.0 @test getmin(m, :b) == 0.0 @test getmax(m, :b) == 10.0 p = OrderedDict(:a => 1.234, :b => 2.345) vec_model, _, un = NonconvexCore.tovecmodel(m) pvec = NonconvexCore.flatten(p)[1] val0, grad0 = NonconvexCore.value_gradient(NonconvexCore.getobjective(vec_model), pvec) @test val0 == f(un(pvec)) @test grad0 == Zygote.gradient(x -> f(un(x)), pvec)[1] val1, grad1 = NonconvexCore.value_gradient(NonconvexCore.getineqconstraint(vec_model, 1), pvec) @test val1 == g(un(pvec), 2, 0) @test grad1 == Zygote.gradient(pvec -> g(un(pvec), 2, 0), pvec)[1] val2, grad2 = NonconvexCore.value_gradient(NonconvexCore.getineqconstraint(vec_model, 2), pvec) @test val2 == g(un(pvec), -1, 1) @test grad2 == Zygote.gradient(pvec -> g(un(pvec), -1, 1), pvec)[1] vals, jac = NonconvexCore.value_jacobian(NonconvexCore.getineqconstraints(vec_model), pvec) @test [val1, val2] == vals @test [grad1 grad2]' == jac vals, jac = NonconvexCore.value_jacobian(NonconvexCore.getobjectiveconstraints(vec_model), pvec) @test [val0, val1, val2] == vals @test [grad0 grad1 grad2]' == jac end struct S a::Any b::Any end @testset "Vector of structs" begin f(x) = sqrt(x[1].b) g(x, a, b) = (a * x[1].a + b)^3 - x[1].b m = Model(f) addvar!(m, S(0.0, 0.0), S(10.0, 10.0)) add_ineq_constraint!(m, x -> g(x, 2, 0)) add_ineq_constraint!(m, x -> g(x, -1, 1)) p = [S(1.234, 2.345)] vec_model, _, un = NonconvexCore.tovecmodel(m) pvec, un = NonconvexCore.flatten(p) val0, grad0 = NonconvexCore.value_gradient(NonconvexCore.getobjective(vec_model), pvec) @test val0 == f(un(pvec)) @test grad0 == Zygote.gradient(x -> f(un(x)), pvec)[1] val1, grad1 = NonconvexCore.value_gradient(NonconvexCore.getineqconstraint(vec_model, 1), pvec) @test val1 == g(un(pvec), 2, 0) @test grad1 == Zygote.gradient(pvec -> g(un(pvec), 2, 0), pvec)[1] val2, grad2 = NonconvexCore.value_gradient(NonconvexCore.getineqconstraint(vec_model, 2), pvec) @test val2 == g(un(pvec), -1, 1) @test grad2 == Zygote.gradient(pvec -> g(un(pvec), -1, 1), pvec)[1] vals, jac = NonconvexCore.value_jacobian(NonconvexCore.getineqconstraints(vec_model), pvec) @test [val1, val2] == vals @test [grad1 grad2]' == jac vals, jac = NonconvexCore.value_jacobian(NonconvexCore.getobjectiveconstraints(vec_model), pvec) @test [val0, val1, val2] == vals @test [grad0 grad1 grad2]' == jac end
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
1986
using NonconvexCore using NonconvexCore: VectorOfFunctions, FunctionWrapper, CountingFunction, getdim, getfunction, getfunctions, Objective, IneqConstraint, EqConstraint, SDConstraint using Test @testset "CountingFunction" begin f = CountingFunction(FunctionWrapper(log, 1)) for i = 1:3 x = rand() @test log(x) == f(x) @test f.counter[] == i end @test getdim(f) == 1 @test getfunction(f) isa FunctionWrapper @test getfunction(getfunction(f)) === log @test length(f) == getdim(f) end @testset "VectorOfFunctions" begin f1 = FunctionWrapper(log, 1) f2 = FunctionWrapper(exp, 1) fs = [f1, f2] f = VectorOfFunctions([f1, f2]) for _ = 1:3 x = rand() @test [log(x), exp(x)] == f(x) end @test getdim(f) == 2 @test getfunctions(f) == fs @test getfunction(f, 1) == fs[1] @test getfunction(f, 2) == fs[2] newf = VectorOfFunctions(Any[f, FunctionWrapper(exp, 1)]) @test getdim(newf) == 3 end @testset "Objective" begin f = Objective(log) @test getdim(f) == 1 for _ = 1:3 x = rand() @test f(x) == log(x) end @test getfunction(f) === log end @testset "IneqConstraint" begin f = IneqConstraint(log, 1.0) for _ = 1:3 x = rand() @test f(x) == log(x) - 1 end @test getdim(f) == 1 @test getfunction(f) === log end @testset "EqConstraint" begin f = EqConstraint(log, 1.0) for _ = 1:3 x = rand() @test f(x) == log(x) - 1 end @test getdim(f) == 1 @test getfunction(f) === log end @testset "SDConstraint" begin f = SDConstraint(exp, 1) for _ = 1:3 x = rand() @test f(x) == exp(x) end @test getdim(f) == 1 @test getfunction(f) === exp f = SDConstraint(exp, 2) for _ = 1:3 x = rand(2, 2) @test f(x) == exp(x) end @test getdim(f) == 2 @test getfunction(f) === exp end
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
6993
using Test, NonconvexCore import JuMP @testset "Symbol variable names" begin model = JuMP.Model() JuMP.@variable(model, x >= 0) JuMP.@variable(model, 0 <= y <= 3) JuMP.@objective(model, Min, 20y) JuMP.@constraint(model, c1, 6x + 8y >= 100) JuMP.@constraint(model, c2, 7x + 12y >= 120) JuMP.@constraint(model, c3, x + y == 25) JuMP.@constraint(model, c4, x + y <= 50) dict_model = DictModel(model) obj = NonconvexCore.getobjective(dict_model) ineq = NonconvexCore.getineqconstraints(dict_model) eq = NonconvexCore.geteqconstraints(dict_model) x = NonconvexCore.getinit(dict_model) @test getmin(dict_model) == OrderedDict(:x => 0.0, :y => 0.0) @test getmax(dict_model) == OrderedDict(:x => Inf, :y => 3.0) @test obj(x) == 20 * x[:y] @test ineq(x) == [100 - 6 * x[:x] - 8 * x[:y], 120 - 7 * x[:x] - 12 * x[:y], x[:x] + x[:y] - 50] @test eq(x) == [x[:x] + x[:y] - 25] vec_model, _, _ = NonconvexCore.tovecmodel(dict_model) vec_x = NonconvexCore.getinit(vec_model) vec_obj = NonconvexCore.getobjective(vec_model) vec_ineq = NonconvexCore.getineqconstraints(vec_model) vec_eq = NonconvexCore.geteqconstraints(vec_model) val0, grad0 = NonconvexCore.value_gradient(vec_obj, vec_x) val1, jac1 = NonconvexCore.value_jacobian(vec_ineq, vec_x) val2, jac2 = NonconvexCore.value_jacobian(vec_eq, vec_x) @test val0 == obj(x) @test val1 == ineq(x) @test val2 == eq(x) @test grad0 == [0, 20] @test jac1 == [-6 -8; -7 -12; 1 1] @test jac2 == [1 1;] end @testset "x[ind] variable names 1" begin model = JuMP.Model() lbs = [0.0, 0.0] ubs = [Inf, 3.0] JuMP.@variable(model, x[i = 1:2], lower_bound = lbs[i], upper_bound = ubs[i]) JuMP.@objective(model, Min, 12x[1]) JuMP.@constraint(model, c1, 6x[1] + 8x[2] >= 100) JuMP.@constraint(model, c2, 7x[1] + 12x[2] >= 120) JuMP.@constraint(model, c3, x[1] + x[2] == 25) JuMP.@constraint(model, c4, x[1] + x[2] <= 50) dict_model = DictModel(model) obj = NonconvexCore.getobjective(dict_model) ineq = NonconvexCore.getineqconstraints(dict_model) eq = NonconvexCore.geteqconstraints(dict_model) x = NonconvexCore.getinit(dict_model) @test getmin(dict_model) == OrderedDict(:x => [0.0, 0.0]) @test getmax(dict_model) == OrderedDict(:x => [Inf, 3.0]) @test obj(x) == 12 * x[:x][1] @test ineq(x) == [ 100 - 6 * x[:x][1] - 8 * x[:x][2], 120 - 7 * x[:x][1] - 12 * x[:x][2], x[:x][1] + x[:x][2] - 50, ] @test eq(x) == [x[:x][1] + x[:x][2] - 25] vec_model, _, _ = NonconvexCore.tovecmodel(dict_model) vec_x = NonconvexCore.getinit(vec_model) vec_obj = NonconvexCore.getobjective(vec_model) vec_ineq = NonconvexCore.getineqconstraints(vec_model) vec_eq = NonconvexCore.geteqconstraints(vec_model) val0, grad0 = NonconvexCore.value_gradient(vec_obj, vec_x) val1, jac1 = NonconvexCore.value_jacobian(vec_ineq, vec_x) val2, jac2 = NonconvexCore.value_jacobian(vec_eq, vec_x) @test val0 == obj(x) @test val1 == ineq(x) @test val2 == eq(x) @test grad0 == [12, 0] @test jac1 == [-6 -8; -7 -12; 1 1] @test jac2 == [1 1;] end @testset "x[ind] variable names 2" begin model = JuMP.Model() lbs = [0.0, 0.0] ubs = [Inf, 3.0] JuMP.@variable(model, x[i = 2:-1:1], lower_bound = lbs[i], upper_bound = ubs[i]) JuMP.@objective(model, Min, 12x[1]) JuMP.@constraint(model, c1, 6x[1] + 8x[2] >= 100) JuMP.@constraint(model, c2, 7x[1] + 12x[2] >= 120) JuMP.@constraint(model, c3, x[1] + x[2] == 25) JuMP.@constraint(model, c4, x[1] + x[2] <= 50) dict_model = DictModel(model) obj = NonconvexCore.getobjective(dict_model) ineq = NonconvexCore.getineqconstraints(dict_model) eq = NonconvexCore.geteqconstraints(dict_model) x = NonconvexCore.getinit(dict_model) @test getmin(dict_model) == OrderedDict(:x => JuMP.Containers.DenseAxisArray(lbs[end:-1:1], 2:-1:1)) @test getmax(dict_model) == OrderedDict(:x => JuMP.Containers.DenseAxisArray(ubs[end:-1:1], 2:-1:1)) @test obj(x) == 12 * x[:x][1] @test ineq(x) == [ 100 - 6 * x[:x][1] - 8 * x[:x][2], 120 - 7 * x[:x][1] - 12 * x[:x][2], x[:x][1] + x[:x][2] - 50, ] @test eq(x) == [x[:x][1] + x[:x][2] - 25] vec_model, _, _ = NonconvexCore.tovecmodel(dict_model) vec_x = NonconvexCore.getinit(vec_model) vec_obj = NonconvexCore.getobjective(vec_model) vec_ineq = NonconvexCore.getineqconstraints(vec_model) vec_eq = NonconvexCore.geteqconstraints(vec_model) val0, grad0 = NonconvexCore.value_gradient(vec_obj, vec_x) val1, jac1 = NonconvexCore.value_jacobian(vec_ineq, vec_x) val2, jac2 = NonconvexCore.value_jacobian(vec_eq, vec_x) @test val0 == obj(x) @test val1 == ineq(x) @test val2 == eq(x) @test grad0 == [0, 12] @test jac1 == [-8 -6; -12 -7; 1 1] @test jac2 == [1 1;] end @testset "x[(ind1, ind2)] variable names" begin model = JuMP.Model() lbs = [0.0, 0.0] ubs = [Inf, 3.0] inds = [(1, 1), (2, 1)] JuMP.@variable( model, x[ind = inds], lower_bound = lbs[ind[1]], upper_bound = ubs[ind[1]] ) JuMP.@objective(model, Min, 12x[(1, 1)] + 20x[(2, 1)]) JuMP.@constraint(model, c1, 6x[(1, 1)] + 8x[(2, 1)] >= 100) JuMP.@constraint(model, c2, 7x[(1, 1)] + 12x[(2, 1)] >= 120) JuMP.@constraint(model, c3, x[(1, 1)] + x[(2, 1)] == 25) JuMP.@constraint(model, c4, x[(1, 1)] + x[(2, 1)] <= 50) dict_model = DictModel(model) obj = NonconvexCore.getobjective(dict_model) ineq = NonconvexCore.getineqconstraints(dict_model) eq = NonconvexCore.geteqconstraints(dict_model) x = NonconvexCore.getinit(dict_model) @test getmin(dict_model) == OrderedDict(:x => JuMP.Containers.DenseAxisArray(lbs, [(1, 1), (2, 1)])) @test getmax(dict_model) == OrderedDict(:x => JuMP.Containers.DenseAxisArray(ubs, [(1, 1), (2, 1)])) @test obj(x) == 12 * x[:x][(1, 1)] + 20 * x[:x][(2, 1)] @test ineq(x) == [ 100 - 6 * x[:x][(1, 1)] - 8 * x[:x][(2, 1)], 120 - 7 * x[:x][(1, 1)] - 12 * x[:x][(2, 1)], x[:x][(1, 1)] + x[:x][(2, 1)] - 50, ] @test eq(x) == [x[:x][(1, 1)] + x[:x][(2, 1)] - 25] vec_model, _, _ = NonconvexCore.tovecmodel(dict_model) vec_x = NonconvexCore.getinit(vec_model) vec_obj = NonconvexCore.getobjective(vec_model) vec_ineq = NonconvexCore.getineqconstraints(vec_model) vec_eq = NonconvexCore.geteqconstraints(vec_model) val0, grad0 = NonconvexCore.value_gradient(vec_obj, vec_x) val1, jac1 = NonconvexCore.value_jacobian(vec_ineq, vec_x) val2, jac2 = NonconvexCore.value_jacobian(vec_eq, vec_x) @test val0 == obj(x) @test val1 == ineq(x) @test val2 == eq(x) @test grad0 == [12, 20] @test jac1 == [-6 -8; -7 -12; 1 1] @test jac2 == [1 1;] end
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
1219
using NonconvexCore, LinearAlgebra, Test, Zygote f(x::AbstractVector) = sqrt(x[2]) g(x::AbstractVector, a, b) = (a * x[1] + b)^3 - x[2] m = Model(f) addvar!(m, [0.0, 0.0], [10.0, 10.0]) add_ineq_constraint!(m, x -> g(x, 2, 0)) add_ineq_constraint!(m, x -> g(x, -1, 1)) @test getmin(m) == fill(0, 2) @test getmax(m) == fill(10, 2) @test getmin(m, 1) == 0.0 @test getmax(m, 1) == 10.0 @test getmin(m, 2) == 0.0 @test getmax(m, 2) == 10.0 p = [1.234, 2.345] val0, grad0 = NonconvexCore.value_gradient(NonconvexCore.getobjective(m), p) @test val0 == f(p) @test grad0 == Zygote.gradient(f, p)[1] val1, grad1 = NonconvexCore.value_gradient(NonconvexCore.getineqconstraint(m, 1), p) @test val1 == g(p, 2, 0) @test grad1 == Zygote.gradient(p -> g(p, 2, 0), p)[1] val2, grad2 = NonconvexCore.value_gradient(NonconvexCore.getineqconstraint(m, 2), p) @test val2 == g(p, -1, 1) @test grad2 == Zygote.gradient(p -> g(p, -1, 1), p)[1] vals, jac = NonconvexCore.value_jacobian(NonconvexCore.getineqconstraints(m), p) @test [val1, val2] == vals @test [grad1 grad2]' == jac vals, jac = NonconvexCore.value_jacobian(NonconvexCore.getobjectiveconstraints(m), p) @test [val0, val1, val2] == vals @test [grad0 grad1 grad2]' == jac
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
code
261
using SafeTestsets, Test @safetestset "Model" begin include("model.jl") end @safetestset "DictModel" begin include("dict_model.jl") end @safetestset "JuMP" begin include("jump.jl") end @safetestset "Functions" begin include("functions.jl") end
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
1.4.3
3ba86f8b385508778d19f52031074ee4c48cedac
docs
324
# NonconvexCore [![Build Status](https://github.com/JuliaNonconvex/NonconvexCore.jl/workflows/CI/badge.svg)](https://github.com/JuliaNonconvex/NonconvexCore.jl/actions) [![Coverage](https://codecov.io/gh/JuliaNonconvex/NonconvexCore.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaNonconvex/NonconvexCore.jl)
NonconvexCore
https://github.com/JuliaNonconvex/NonconvexCore.jl.git
[ "MIT" ]
0.5.4
e5f40bc3e58e5ec770edee817ed19578e4423276
code
329
using Pkg; Pkg.add("Documenter") using Documenter, SpinWeightedSpheroidalHarmonics makedocs( sitename="SpinWeightedSpheroidalHarmonics.jl", format = Documenter.HTML( prettyurls = get(ENV, "CI", nothing) == "true" ) ) deploydocs( repo = "github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.git", )
SpinWeightedSpheroidalHarmonics
https://github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.git
[ "MIT" ]
0.5.4
e5f40bc3e58e5ec770edee817ed19578e4423276
code
6902
module SpinWeightedSpheroidalHarmonics using LinearAlgebra include("harmonic.jl") include("spectral.jl") export spin_weighted_spheroidal_harmonic, spin_weighted_spherical_harmonic, spin_weighted_spheroidal_eigenvalue, spin_weighted_spherical_eigenvalue # Expose these functions to the user export Teukolsky_lambda_const # For backward compatbility struct SpectralDecompositionInputParams s::Int l::Int m::Int c N::Int end struct SpinWeightedSpheroidalHarmonicFunction params::SpectralDecompositionInputParams coeffs spherical_harmonics_l normalization_const lambda end # Implement pretty printing for SpinWeightedSpheroidalHarmonicFunction function Base.show(io::IO, ::MIME"text/plain", swsh_func::SpinWeightedSpheroidalHarmonicFunction) print(io, "SpinWeightedSpheroidalHarmonicFunction(s = $(swsh_func.params.s), l = $(swsh_func.params.l), m = $(swsh_func.params.m), c = $(swsh_func.params.c), lambda = $(swsh_func.lambda))") end # Not really necessary but this is to maintain uniformity struct SpinWeightedSphericalHarmonicFunction s::Int l::Int m::Int lambda end # Implement pretty printing for SpinWeightedSphericalHarmonicFunction function Base.show(io::IO, ::MIME"text/plain", swsh_func::SpinWeightedSphericalHarmonicFunction) print(io, "SpinWeightedSphericalHarmonicFunction(s = $(swsh_func.s), l = $(swsh_func.l), m = $(swsh_func.m), lambda = $(swsh_func.lambda))") end function _unnormalized_spin_weighted_spheroidal_harmonic(coefficients_params, coefficients, theta, phi; theta_derivative::Int=0, phi_derivative::Int=0) # Compute the spin-weighted spherical harmonics needed output = 0.0 spherical_harmonics_l = construct_all_l_in_matrix(coefficients_params.s, coefficients_params.m, coefficients_params.N) for (idx, spherical_harmonic_l) in enumerate(spherical_harmonics_l) output += coefficients[idx] * _nth_derivative_spherical_harmonic(coefficients_params.s, spherical_harmonic_l, coefficients_params.m, theta_derivative, phi_derivative, theta, phi) end output end @doc raw""" spin_weighted_spheroidal_harmonic(s::Int, l::Int, m::Int, c; N::Int=-1) Construct the spectral decomposition of this spin-weighted spheroidal harmonic of spin weight `s`, harmonic index `l`, azimuthal index `m`, and spheroidicity `c` ($c = a\omega$) using `N` spin-weighted *spherical* harmonics. Note that the default value for `N=-1` indicates that a suitable value of `N` will be determined automatically. Return a SpinWeightedSpheroidalHarmonicFunction object that can be evaluated at any point. """ function spin_weighted_spheroidal_harmonic(s::Int, l::Int, m::Int, c; N::Int=-1) if N == -1 N = _determine_matrix_size_N(s, l, m) end coefficients_params = SpectralDecompositionInputParams(s, l, m, c, N) coefficients = spectral_coefficients(c, s, l, m, N) spherical_harmonics_l = construct_all_l_in_matrix(coefficients_params.s, coefficients_params.m, coefficients_params.N) normalization = 1 # already satisfied the normalization cond. \int_{0}^{pi} [nf*S(theta)]^2 sin(theta) d theta = 1 lambda = spin_weighted_spheroidal_eigenvalue(s, l, m, c, N=N) # Not the most efficient way to do this, but it works return SpinWeightedSpheroidalHarmonicFunction(coefficients_params, coefficients, spherical_harmonics_l, normalization, lambda) end # The power of multiple dispatch @doc raw""" SpinWeightedSpheroidalHarmonicFunction(theta, phi; theta_derivative::Int=0, phi_derivative::Int=0, method="auto") Compute the value of the spin-weighted spheroidal harmonic at the point `(theta, phi)`. Additionally compute the `theta_derivative`-th derivative with respect to `theta` and the `phi_derivative`-th derivative with respect to `phi` exactly. By default, the method used to compute the value is chosen automatically based on the value of the harmonic index `l`. When `l < 30`, the direct evaluation method (`method="direct"`) is used where we evaluate the exact analytical solution as shown in Eq. (A8). However, the prefactor in each term of the sum can be very large and thus cause overflow, while the sum itself is finite (of order 1 actually). Therefore, when `l >= 30`, the Chebyshev pseudo-spectral method (`method="chebyshev"`) is used instead. """ (swsh_func::SpinWeightedSpheroidalHarmonicFunction)(theta, phi; theta_derivative::Int=0, phi_derivative::Int=0, method="auto") = begin _unnormalized_spin_weighted_spheroidal_harmonic(swsh_func.params, swsh_func.coeffs, theta, phi; theta_derivative=theta_derivative, phi_derivative=phi_derivative) / swsh_func.normalization_const end @doc raw""" spin_weighted_spherical_harmonic(s::Int, l::Int, m::Int) Construct the spin-weighted spherical harmonic of spin weight `s`, harmonic index `l`, and azimuthal index `m`. Return a SpinWeightedSphericalHarmonicFunction object that can be evaluated at any point. """ function spin_weighted_spherical_harmonic(s::Int, l::Int, m::Int) return SpinWeightedSphericalHarmonicFunction(s, l, m, spin_weighted_spherical_eigenvalue(s, l, m)) end @doc raw""" SpinWeightedSphericalHarmonicFunction(theta, phi; theta_derivative::Int=0, phi_derivative::Int=0) Compute the value of the spin-weighted spherical harmonic at the point `(theta, phi)`. Additionally compute the `theta_derivative`-th derivative with respect to `theta` and the `phi_derivative`-th derivative with respect to `phi` exactly. """ (swsh_func::SpinWeightedSphericalHarmonicFunction)(theta, phi; theta_derivative::Int=0, phi_derivative::Int=0) = begin _nth_derivative_spherical_harmonic(swsh_func.s, swsh_func.l, swsh_func.m, theta_derivative, phi_derivative, theta, phi) end @doc raw""" spin_weighted_spheroidal_eigenvalue(s::Int, l::Int, m::Int, c; N::Int=-1) Compute the eigenvalue of the spin-weighted spheroidal harmonic with spin weight `s`, harmonic index `l`, azimuthal index `m`, and spheroidicity `c` ($c = a\omega$). The optional argument `N` specifies the number of terms to use in the spectral decomposition. The default value is `N=-1`, which indicates that a suitable value of `N` will be determined automatically. This function is simply a wrapper to `Teukolsky_lambda_const` for backward compatbility. """ function spin_weighted_spheroidal_eigenvalue(s::Int, l::Int, m::Int, c; N::Int=-1) if N == -1 N = _determine_matrix_size_N(s, l, m) end Teukolsky_lambda_const(c, s, l, m, N) end @doc raw""" spin_weighted_spherical_eigenvalue(s::Int, l::Int, m::Int=0) Compute the eigenvalue of the spin-weighted spherical harmonic with spin weight `s`, harmonic index `l`, and azimuthal index `m` (but the eigenvalue is independent of `m`). """ function spin_weighted_spherical_eigenvalue(s::Int, l::Int, m::Int=0) # Eigenvalue for the Schwarzschild case does not depend on m Teukolsky_lambda_const(0, s, l, m) end end
SpinWeightedSpheroidalHarmonics
https://github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.git
[ "MIT" ]
0.5.4
e5f40bc3e58e5ec770edee817ed19578e4423276
code
1180
#= This is from one of the examples in AbstractTrees.jl https://github.com/JuliaCollections/AbstractTrees.jl/blob/master/examples/binarytree_core.jl =# using AbstractTrees mutable struct BinaryNode{T} data::T parent::BinaryNode{T} left::BinaryNode{T} right::BinaryNode{T} # Root constructor BinaryNode{T}(data) where T = new{T}(data) # Child node constructor BinaryNode{T}(data, parent::BinaryNode{T}) where T = new{T}(data, parent) end BinaryNode(data) = BinaryNode{typeof(data)}(data) function leftchild(data, parent::BinaryNode) !isdefined(parent, :left) || error("left child is already assigned") node = typeof(parent)(data, parent) parent.left = node end function rightchild(data, parent::BinaryNode) !isdefined(parent, :right) || error("right child is already assigned") node = typeof(parent)(data, parent) parent.right = node end function AbstractTrees.children(node::BinaryNode) if isdefined(node, :left) if isdefined(node, :right) return (node.left, node.right) end return (node.left,) end isdefined(node, :right) && return (node.right,) return () end
SpinWeightedSpheroidalHarmonics
https://github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.git
[ "MIT" ]
0.5.4
e5f40bc3e58e5ec770edee817ed19578e4423276
code
5145
using LinearAlgebra using ApproxFun using TaylorSeries using AbstractTrees include("binarytree.jl") # A tree node struct ct2_st2 coeff::Float64 ct2_power::Int st2_power::Int end function log_factorial(n::Int) if n == 0 return 0 elseif n < 0 return -Inf else return sum(log(k) for k in 1:n) end end function _log_summation_term_prefactor(s::Int, l::Int, m::Int, r::Int) # Note that this does not include the (-1)^(l-r-s) factor # Check for negative arguments if (l-s-r) < 0 || (l-r+m) < 0 || (r+s-m) < 0 # The whole thing is just 0 return -Inf end return begin log_factorial(l-s) - log_factorial(l-s-r) - log_factorial(r) + log_factorial(l+s) - log_factorial(l-r+m) - log_factorial(r+s-m) end end function _summation_term_prefactors(s::Int, l::Int, m::Int) log_prefactors = [_log_summation_term_prefactor(s, l, m, r) for r in 0:l-s] max_val, _ = findmax(log_prefactors) prefactor_signs = [(l-r-s) % 2 == 0 ? 1 : -1 for r in 0:l-s] log_prefactors = log_prefactors .- max_val # Now regularized prefactors = prefactor_signs .* exp.(log_prefactors) return prefactors, max_val end function _nth_derivative_spherical_harmonic(s::Int, l::Int, m::Int, theta_derivative::Int, phi_derivative::Int, theta, phi; method="auto") if method == "auto" _method = l >= 30 ? "chebyshev" : "direct" return _nth_derivative_spherical_harmonic(s, l, m, theta_derivative, phi_derivative, theta, phi; method=_method) elseif method == "direct" return _nth_derivative_spherical_harmonic_direct_eval(s, l, m, theta_derivative, phi_derivative, theta, phi) elseif method == "chebyshev" return _nth_derivative_spherical_harmonic_chebyshev(s, l, m, theta_derivative, phi_derivative, theta, phi) else error("Does not understand method $method") end end function _nth_derivative_spherical_harmonic_chebyshev(s::Int, l::Int, m::Int, theta_derivative::Int, phi_derivative::Int, theta, phi) # Evaluate sYlm(0,0) using the direct method for consistency Y0 = real(_nth_derivative_spherical_harmonic_direct_eval(s, l, m, 0, 0, 0, 0)) # Define the domain # NOTE x=cos(theta), x = -1 when \theta is \pi and x = 1 when \theta is 0 a, b = -1, 1; dom = a..b; # Define the differential operator x = Fun(dom); D = Derivative(dom); L = (1 - x^2)*D^2 - 2*x*D + (s + l*(l+1) - s*(s+1) - (m + s*x)^2/(1-x^2)); bvals = [0, Y0] # Boundary values u = [Dirichlet(dom); L] \ [bvals, 0]; Y(θ) = u(cos(θ)) factorial(theta_derivative)*getcoeff(taylor_expand(Y, theta, order=theta_derivative), theta_derivative) * cis(m*phi) * (m*1im)^phi_derivative end function _nth_derivative_spherical_harmonic_direct_eval(s::Int, l::Int, m::Int, theta_derivative::Int, phi_derivative::Int, theta, phi) ct2 = cos(theta/2) st2 = sin(theta/2) _sum = 0.0 summation_term_prefactors, log_normalization_const = _summation_term_prefactors(s, l, m) for r in max(0, m-s):min(l-s, l+m) _rsum = 0.0 root = BinaryNode(ct2_st2(1, 2*r+s-m, 2*l-2*r-s+m)) # root of the tree # building the binary tree for j in 1:theta_derivative #= Each derivative wrt theta will add two terms one with 1/2 beta ct2^{alpha+1} st2^{beta-1} and one with -1/2 alpha ct2^{alpha-1} st2^{beta+1} =# # now find the appropriate parent # traverse the current tree looking for leaves to add new nodes for leaf in Leaves(root) leftchild(ct2_st2(leaf.data.coeff * 0.5 * leaf.data.st2_power, leaf.data.ct2_power+1, leaf.data.st2_power-1), leaf) rightchild(ct2_st2(leaf.data.coeff * -0.5 * leaf.data.ct2_power, leaf.data.ct2_power-1, leaf.data.st2_power+1), leaf) end end # now traverse the final tree for leaf in Leaves(root) _rsum += leaf.data.coeff * ct2^(leaf.data.ct2_power) * st2^(leaf.data.st2_power) end _rsum *= summation_term_prefactors[r+1] _sum += _rsum end exp(log_normalization_const) * _swsh_prefactor(s, l, m) * _sum * cis(m*phi) * (m*1im)^phi_derivative end function _swsh_prefactor(s::Int, l::Int, m::Int) #= This is consistent with the expression in wikipedia, as well as BHPerturbationToolkit =# # Implement explicit expression here common_factor = (-1)^m * sqrt((2*l+1)/(4*pi)) if abs(s) == abs(m) return common_factor elseif s > m delta = s - m # which is a positive integer out = 1 for i in 0:1:delta-1 j = delta - i out *= ((l-m-i)/(l+m+j)) end return common_factor * sqrt(out) else # in this case s < m delta = m - s # which is a positive integer out = 1 for i in 0:1:delta-1 j = delta - i out *= ((l+s+j)/(l-s-i)) end return common_factor * sqrt(out) end end
SpinWeightedSpheroidalHarmonics
https://github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.git
[ "MIT" ]
0.5.4
e5f40bc3e58e5ec770edee817ed19578e4423276
code
3796
using LinearAlgebra include("utils.jl") function Fslm(s::Int, l::Int, m::Int) # 'Edge' case where l is -1, this can happen when both |m| and |s| are 0 (since lmin = max(|m|, |s|)) (l == -1 && abs(m) == 0 && abs(s) == 0) ? 0 : sqrt( ( (l+1)^2 - m^2 )/( (2*l+3)*(2*l+1) ) ) * sqrt( ( (l+1)^2 - s^2 )/( (l+1)^2 ) ) end function Gslm(s::Int, l::Int, m::Int) l == 0 ? 0 : sqrt( ( l^2 - m^2 )/( 4*l^2 - 1 ) ) * sqrt( ( l^2 - s^2 )/( l^2 ) ) end function Hslm(s::Int, l::Int, m::Int) (l == 0 || s == 0) ? 0 : -m*s/(l*(l+1)) end function Aslm(s::Int, l::Int, m::Int) Fslm(s, l, m)*Fslm(s, l+1, m) end function Bslm(s::Int, l::Int, m::Int) Fslm(s, l, m)*Gslm(s, l+1, m) + Gslm(s, l, m)*Fslm(s, l-1, m) + Hslm(s, l, m)^2 end function Cslm(s::Int, l::Int, m::Int) Gslm(s, l, m)*Gslm(s, l-1, m) end function Dslm(s::Int, l::Int, m::Int) Fslm(s, l, m)*(Hslm(s, l+1, m) + Hslm(s, l, m)) end function Eslm(s::Int, l::Int, m::Int) Gslm(s, l, m)*(Hslm(s, l-1, m) + Hslm(s, l, m)) end function eigenvalue_Schwarzschild(s::Int, l::Int) l*(l+1) - s*(s+1) end function spectral_matrix_coefficient(c, s::Int, m::Int, l::Int, lprime::Int) # This is Eq (55) if lprime == l-2 return -c^2 * Aslm(s, lprime, m) elseif lprime == l-1 return -c^2 * Dslm(s, lprime, m) + 2*c*s*Fslm(s, lprime, m) elseif lprime == l return eigenvalue_Schwarzschild(s, lprime) - c^2 * Bslm(s, lprime, m) + 2*c*s*Hslm(s, lprime, m) elseif lprime == l+1 return -c^2 * Eslm(s, lprime, m) + 2*c*s*Gslm(s, lprime, m) elseif lprime == l+2 return -c^2 * Cslm(s, lprime, m) else return 0 end end function construct_all_l_in_matrix(s::Int, m::Int, N::Int) lmin = max(abs(m), abs(s)) lmax = N + lmin - 1 [k for k in lmin:lmax] end function construct_spectral_matrix(c, s::Int, m::Int, N::Int) all_l_in_matrix = construct_all_l_in_matrix(s, m, N) lmin = all_l_in_matrix[1] lmax = all_l_in_matrix[N] # Matrix is symmetric, fill in only the upper right portion spectral_matrix = zeros(ComplexF64, N, N) for i in lmin:lmax for j in i:lmax spectral_matrix[i-lmin+1, j-lmin+1] = spectral_matrix_coefficient(c, s, m, i, j) end end spectral_matrix = Array(Symmetric(spectral_matrix)) end function angular_sep_const(c, s::Int, l::Int, m::Int, N::Int=-1) if c == 0 # Return the Schwarzschild eigenvalue explicitly return eigenvalue_Schwarzschild(s, l) end if N == -1 N = _determine_matrix_size_N(s, l, m) end all_l_in_matrix = construct_all_l_in_matrix(s, m, N) spectral_matrix = construct_spectral_matrix(c, s, m, N) # Solve the eigenvalue problem eigenvalues = eigvals(spectral_matrix) # The returned eigenvalues are already sorted in ascending order eigenvalues[indexin(l, all_l_in_matrix)[1]] end function spectral_coefficients(c, s::Int, l::Int, m::Int, N::Int=-1) if N == -1 N = _determine_matrix_size_N(s, l, m) end all_l_in_matrix = construct_all_l_in_matrix(s, m, N) spectral_matrix = construct_spectral_matrix(c, s, m, N) # Solve the eigenvalue problem eigenvectors = eigvecs(spectral_matrix) # The returned eigenvectors are already normalized v = eigenvectors[:,indexin(l, all_l_in_matrix)[1]] # Note that the eigenvectors are determined only up to a multiplicative factor # Make sure that when l'=l, it is a positive real number v /= v[indexin(l, all_l_in_matrix)[1]] # Re-normalize the vector return v/sqrt(dot(v,v)) end function Teukolsky_lambda_const(c, s::Int, l::Int, m::Int, N::Int=-1) if N == -1 N = _determine_matrix_size_N(s, l, m) end angular_sep_const(c, s, l, m, N) + c^2 - 2*m*c end
SpinWeightedSpheroidalHarmonics
https://github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.git
[ "MIT" ]
0.5.4
e5f40bc3e58e5ec770edee817ed19578e4423276
code
320
function _determine_matrix_size_N(s::Int, l::Int, m::Int) #= Determine a suitable value of N for the spectral decomposition The value of N calculated here is essentially lmax for the spectral decomposition. Then we apply a 'buffer' of 10 =# N = l - max(abs(m), abs(s)) + 1 return N + 10 end
SpinWeightedSpheroidalHarmonics
https://github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.git
[ "MIT" ]
0.5.4
e5f40bc3e58e5ec770edee817ed19578e4423276
code
133
using SpinWeightedSpheroidalHarmonics using Test @testset "SpinWeightedSpheroidalHarmonics.jl" begin # Nothing here for now end
SpinWeightedSpheroidalHarmonics
https://github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.git
[ "MIT" ]
0.5.4
e5f40bc3e58e5ec770edee817ed19578e4423276
docs
4021
# SpinWeightedSpheroidalHarmonics.jl ![license](https://img.shields.io/github/license/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl) [![GitHub release](https://img.shields.io/github/v/release/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.svg)](https://github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl/releases) [![Documentation](https://img.shields.io/badge/Documentation-ready)](http://ricokaloklo.github.io/SpinWeightedSpheroidalHarmonics.jl) SpinWeightedSpheroidalHarmonics.jl computes spin-weighted spheroidal harmonics and eigenvalues using a spectral decomposition method. As a natural by-product, it also computes spherical-spheroidal mixing coefficients. The two main features are implemented as - `spin_weighted_spheroidal_harmonic` for computing the harmonic $`\,{}_{s} S_{\ell m}(\theta, \phi; c \equiv a \omega)`$, and - `spin_weighted_spheroidal_eigenvalue` for computing the eigenvalue and both supporting complex spheroidicity $c$ (and hence complex frequency $\omega$). See Quick-start below for some simple examples. In particular, we use the following normalization convention: ```math \int_0^{\pi} \left[ _{s} S_{\ell m}(\theta; c) \right]^{2} \sin(\theta) \, d\theta = \frac{1}{2\pi} \; , ``` identical to the convention used in the Mathematica package [SpinWeightedSpheroidalHarmonics](https://bhptoolkit.org/SpinWeightedSpheroidalHarmonics/) from the Black Hole Perturbation Toolkit. Additionally, we provide two similar functions - `spin_weighted_spherical_harmonic` $`\,{}_{s} Y_{\ell m}(\theta, \phi)`$, and - `spin_weighted_spherical_eigenvalue` that return the exact harmonic and eigenvalue respectively. Exact partial derivatives (with respect to either $\theta$ and/or $\phi$) can be evaluated by specifying the derivative order with `theta_derivative` and `phi_derivative` respectively when calling the functions for a harmonic. Note that v0.5.0 is a *breaking* release. ## Installation To install the package using the Julia package manager, simply type the following in the Julia REPL: ```julia using Pkg Pkg.add("SpinWeightedSpheroidalHarmonics") ``` ## Quick-start ### Computing the spin-weighted spheroidal eigenvalue For example, to compute the spin-weighted spheroidal eigenvalue $\lambda$ for the mode $s = -2, \ell = 2, m = 2, a = 0.7, \omega = 0.5$, simply do ``` using SpinWeightedSpheroidalHarmonics s=-2; l=2; m=2; a=0.7; omega=0.5; spin_weighted_spheroidal_eigenvalue(s, l, m, a*omega) ``` ### Computing the spin-weighted spheroidal harmonic For example, to compute the spin-weighted spheroidal harmonic for the mode $s = -2, \ell = 2, m = 2, a = 0.7, \omega = 0.5$ at $\theta = \pi/6, \phi = \pi/3$, simply do ``` using SpinWeightedSpheroidalHarmonics s=-2; l=2; m=2; a=0.7; omega=0.5; theta=π/6; phi=π/3; # Construct the SpinWeightedSpheroidalHarmonicFunction swsh = spin_weighted_spheroidal_harmonic(s, l, m, a*omega) swsh(theta, phi) ``` ### Computing the spherical-spheroidal mixing coefficients For example, to compute the spherical-spheroidal mixing coefficients for the mode $s = -2, \ell = 2, m = 2, a = 0.7, \omega = 0.5$, simply do ``` using SpinWeightedSpheroidalHarmonics s=-2; l=2; m=2; a=0.7; omega=0.5; # Construct the SpinWeightedSpheroidalHarmonicFunction swsh = spin_weighted_spheroidal_harmonic(s, l, m, a*omega) # swsh.spherical_harmonics_l lists which spherical harmonic \ell modes were used in the decomposition # swsh.coeffs lists the mixing coefficients for each of the modes swsh.spherical_harmonics_l, swsh.coeffs ``` ## How to cite If you have used this code in your research that leads to a publication, please cite the following article: ``` @article{Lo:2023fvv, author = "Lo, Rico K. L.", title = "{Recipes for computing radiation from a Kerr black hole using Generalized Sasaki-Nakamura formalism: I. Homogeneous solutions}", eprint = "2306.16469", archivePrefix = "arXiv", primaryClass = "gr-qc", month = "6", year = "2023" } ``` ## License The package is licensed under the MIT License.
SpinWeightedSpheroidalHarmonics
https://github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.git
[ "MIT" ]
0.5.4
e5f40bc3e58e5ec770edee817ed19578e4423276
docs
2702
# APIs There are 4 functions that are exported, namely - [`spin_weighted_spheroidal_eigenvalue`](@ref) - [`spin_weighted_spheroidal_harmonic`](@ref) - [`spin_weighted_spherical_eigenvalue`](@ref) - [`spin_weighted_spherical_harmonic`](@ref) and there are 3 custom types that are exported, i.e. - [SpectralDecompositionInputParams](@ref) - [SpinWeightedSpheroidalHarmonicFunction](@ref) - [SpinWeightedSphericalHarmonicFunction](@ref) ## Functions ```@docs spin_weighted_spheroidal_eigenvalue ``` ```@docs spin_weighted_spheroidal_harmonic ``` ```@docs SpinWeightedSpheroidalHarmonics.SpinWeightedSpheroidalHarmonicFunction ``` ```@docs spin_weighted_spherical_eigenvalue ``` ```@docs spin_weighted_spherical_harmonic ``` ```@docs SpinWeightedSpheroidalHarmonics.SpinWeightedSphericalHarmonicFunction ``` ## Types #### SpectralDecompositionInputParams This is a composite struct type that stores the input parameters for the spectral decomposition of a spin-weighted spheroidal harmonic | field | | | :--- | :--- | | `s` | spin weight $s$ | | `l` | harmonic index $\ell$ | | `m` | azimuthal index $m$ | | `c` | spheroidicity ($c = a\omega$ in the context of BHPT) | | `N` | number of terms to use in the spectral decomposition | #### SpinWeightedSpheroidalHarmonicFunction This is a composite struct type that stores the output from [`spin_weighted_spheroidal_harmonic`](@ref) !!! tip `SpinWeightedSpheroidalHarmonicFunction(theta, phi)` will return the value of the harmonic at the coordinate $(\theta, \phi)$. For more details, see [`SpinWeightedSpheroidalHarmonics.SpinWeightedSpheroidalHarmonicFunction`](@ref) | field | | | :--- | :--- | | `params` | a [SpectralDecompositionInputParams](@ref) object storing the input parameters for the spectral decomposition | | `coeffs` | spectral decomposition coefficients | | `spherical_harmonics_l` | the harmonic index $\ell$ of the spherical harmonics used in the decomposition | | `normalization_const` | normalization constant to be *divided* to ensure the normalization convention is satisfied | | `lambda` | spin-weighted spheroidal eigenvalue $\lambda$ | #### SpinWeightedSphericalHarmonicFunction This is a composite struct type that stores information about a spin-weighted spherical harmonic !!! tip `SpinWeightedSphericalHarmonicFunction(theta, phi)` will return the value of the harmonic at the coordinate $(\theta, \phi)$. For more details, see [`SpinWeightedSpheroidalHarmonics.SpinWeightedSphericalHarmonicFunction`](@ref) | field | | | :--- | :--- | | `s` | spin weight $s$ | | `l` | harmonic index $\ell$ | | `m` | azimuthal index $m$ | | `lambda` | spin-weighted spherical eigenvalue $\lambda$ |
SpinWeightedSpheroidalHarmonics
https://github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.git
[ "MIT" ]
0.5.4
e5f40bc3e58e5ec770edee817ed19578e4423276
docs
1320
# Examples # Example 1: Solving and visualizing a spin-weighted spheroidal harmonic In this example, we solve for the spin-weighted spheroidal harmonic with $s=-2, \ell =2, m = 2, c = a\omega = 0.35$. ```julia using SpinWeightedSpheroidalHarmonics using Plots, LaTeXStrings s=-2; l=2; m=2; a=0.7; omega=0.5; swsh = spin_weighted_spheroidal_harmonic(s, l, m, a*omega) ``` That's it! Now let us visualize the harmonic itself and the first and second partial derivative with respect to $\theta$: ```julia thetas = collect(0:0.01:1) plot(thetas, [real(swsh(theta*pi, 0)) for theta in thetas], linewidth=2, label=L"{}_{-2}S_{2,2}(\theta, 0; c = 0.35)") plot!(thetas, [real(swsh(theta*pi, 0; theta_derivative=1)) for theta in thetas], linewidth=2, label=L"\partial_{\theta} {}_{-2}S_{2,2}(\theta, 0; c = 0.35)") plot!(thetas, [real(swsh(theta*pi, 0; theta_derivative=2)) for theta in thetas], linewidth=2, label=L"\partial_{\theta}^2 {}_{-2}S_{2,2}(\theta, 0; c = 0.35)") plot!( legendfontsize=14, xguidefontsize=14, yguidefontsize=14, xtickfontsize=14, ytickfontsize=14, foreground_color_legend=nothing, background_color_legend=nothing, legend=:bottomright, formatter=:latex, xlabel=L"\theta/\pi", left_margin = 2Plots.mm, right_margin = 3Plots.mm, ) ``` ![SWSH.png](SWSH.png)
SpinWeightedSpheroidalHarmonics
https://github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.git
[ "MIT" ]
0.5.4
e5f40bc3e58e5ec770edee817ed19578e4423276
docs
3016
# Home **SpinWeightedSpheroidalHarmonics.jl** computes spin-weighted spheroidal harmonics and eigenvalues using a spectral decomposition method. The two main features are implemented as - `spin_weighted_spheroidal_harmonic` for computing the harmonic ${}_{s} S_{\ell m}(\theta, \phi; c \equiv a \omega)$, and - `spin_weighted_spheroidal_eigenvalue` for computing the eigenvalue and both supporting complex spheroidicity $c$ (and hence complex frequency $\omega$). See [Quick-start](@ref) below for some simple examples. In particular, we use the following normalization convention: ```math \int_0^{\pi} \left[ _{s} S_{\ell m}(\theta; c) \right]^{2} \sin(\theta) \, d\theta = \frac{1}{2\pi} \; , ``` identical to the convention used in the Mathematica package [SpinWeightedSpheroidalHarmonics](https://bhptoolkit.org/SpinWeightedSpheroidalHarmonics/) from the Black Hole Perturbation Toolkit. Additionally, we provide two similar functions - `spin_weighted_spherical_harmonic` ${}_{s} Y_{\ell m}(\theta, \phi)$, and - `spin_weighted_spherical_eigenvalue` that return the exact harmonic and eigenvalue respectively. Exact partial derivatives (with respect to either $\theta$ and/or $\phi$) can be evaluated by specifying the derivative order with `theta_derivative` and `phi_derivative` respectively when calling the functions for a harmonic. ## Installation To install the package using the Julia package manager, simply type the following in the Julia REPL: ```julia using Pkg Pkg.add("SpinWeightedSpheroidalHarmonics") ``` ## Quick-start ### Computing the spin-weighted spheroidal eigenvalue For example, to compute the spin-weighted spheroidal eigenvalue $\lambda$ for the mode $s = -2, \ell = 2, m = 2, a = 0.7, \omega = 0.5$, simply do ```@repl using SpinWeightedSpheroidalHarmonics s=-2; l=2; m=2; a=0.7; omega=0.5; spin_weighted_spheroidal_eigenvalue(s, l, m, a*omega) ``` ### Computing the spin-weighted spheroidal harmonic For example, to compute the spin-weighted spheroidal harmonic for the mode $s = -2, \ell = 2, m = 2, a = 0.7, \omega = 0.5$ at $\theta = \pi/6, \phi = \pi/3$, simply do ```@repl using SpinWeightedSpheroidalHarmonics s=-2; l=2; m=2; a=0.7; omega=0.5; theta=π/6; phi=π/3; # Construct the SpinWeightedSpheroidalHarmonicFunction swsh = spin_weighted_spheroidal_harmonic(s, l, m, a*omega) swsh(theta, phi) ``` ### Computing the spherical-spheroidal mixing coefficients For example, to compute the spherical-spheroidal mixing coefficients for the mode $s = -2, \ell = 2, m = 2, a = 0.7, \omega = 0.5$, simply do ```@repl using SpinWeightedSpheroidalHarmonics s=-2; l=2; m=2; a=0.7; omega=0.5; # Construct the SpinWeightedSpheroidalHarmonicFunction swsh = spin_weighted_spheroidal_harmonic(s, l, m, a*omega) # swsh.spherical_harmonics_l lists which spherical harmonic \ell modes were used in the decomposition # swsh.coeffs lists the mixing coefficients for each of the modes swsh.spherical_harmonics_l, swsh.coeffs ``` ## License The package is licensed under the MIT License.
SpinWeightedSpheroidalHarmonics
https://github.com/ricokaloklo/SpinWeightedSpheroidalHarmonics.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
565
using Enzyme Enzyme.API.typeWarning!(false) Enzyme.Compiler.RunAttributor[] = false using DJUICE using MAT #Load model from MATLAB file file = matopen(joinpath(@__DIR__, "..", "Data","PIG_Control_drag_dJUICE.mat")) mat = read(file, "md") close(file) md = model(mat) #make model run faster md.stressbalance.maxiter = 20 #Now call AD! md.inversion.iscontrol = 1 md.inversion.independent = md.friction.coefficient md.inversion.independent_string = "FrictionCoefficient" md = solve(md, :grad) # the gradient g = md.results["StressbalanceSolution"]["Gradient"]
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
682
# Julia version of the Ice-sheet and Sea-level System Model # # Author: Mathieu Morlighem # email: [email protected] module DJUICE const userdir = "./usr" const coredir = "./core" include("$userdir/classes.jl") export model, WeertmanFriction, SchoofFriction, DNNFriction include("$userdir/exp.jl") export expread, ContourToNodes include("$userdir/utils.jl") export archread, issmdir include("$userdir/triangle.jl") export triangle include("$userdir/triangle_issm.jl") export triangle_issm include("$userdir/parameterization.jl") export setmask, InterpFromMeshToMesh2d include("$coredir/solve.jl") export solve include("$userdir/plotmodel.jl") export plotmodel end
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
439
#Constraint class definition struct Constraint #{{{ id::Int64 nodeid::Int64 dof::Int8 value::Float64 end# }}} #Constraint functions function ConstrainNode(constraint::Constraint,nodes::Vector{Node},parameters::Parameters) #{{{ #Chase through nodes and find the node to which this SpcStatic apply node = nodes[constraint.nodeid] #Apply Constraint ApplyConstraint(node, constraint.dof, constraint.value) return nothing end# }}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1735
using Enzyme Enzyme.API.looseTypeAnalysis!(false) Enzyme.API.strictAliasing!(false) Enzyme.API.typeWarning!(false) Enzyme.Compiler.RunAttributor[] = false using Optimization, OptimizationOptimJL function Control_Core(md::model, femmodel::FemModel) #{{{ # solve for optimization # TODO: just a first try, need to add all the features α = md.inversion.independent ∂J_∂α = zero(α) n = length(α) # use user defined grad, errors! #optprob = OptimizationFunction(costfunction, Optimization.AutoEnzyme(), grad=computeGradient(∂J_∂α, α, femmodel)) optprob = OptimizationFunction(costfunction, Optimization.AutoEnzyme()) prob = Optimization.OptimizationProblem(optprob, α, femmodel, lb=md.inversion.min_parameters, ub=md.inversion.max_parameters) sol = Optimization.solve(prob, Optim.LBFGS()) independent_enum = StringToEnum(md.inversion.independent_string) InputUpdateFromVectorx(femmodel, sol.u, independent_enum, VertexSIdEnum) RequestedOutputsx(femmodel, [independent_enum]) end#}}} function computeGradient(md::model, femmodel::FemModel) #{{{ #independent variable α = md.inversion.independent #initialize derivative as 0 ∂J_∂α = zero(α) # Compute Gradient computeGradient(∂J_∂α, α, femmodel) #Put gradient in results InputUpdateFromVectorx(femmodel, ∂J_∂α, GradientEnum, VertexSIdEnum) RequestedOutputsx(femmodel, [GradientEnum]) end#}}} function computeGradient(∂J_∂α::Vector{Float64}, α::Vector{Float64}, femmodel::FemModel) #{{{ # zero ALL depth of the model, make sure we get correct gradient dfemmodel = Enzyme.Compiler.make_zero(Base.Core.Typeof(femmodel), IdDict(), femmodel) # compute the gradient autodiff(Enzyme.Reverse, costfunction, Duplicated(α, ∂J_∂α), Duplicated(femmodel,dfemmodel)) end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
2838
function costfunction(α::Vector{Float64}, femmodel::FemModel) #{{{ # get the md.inversion.control_string control_string = FindParam(String, femmodel.parameters, InversionControlParametersEnum) # get the Enum controlvar_enum = StringToEnum(control_string) if isnothing(controlvar_enum) error(control_string, " is not defined in DJUICE, therefore the derivative with respect to ", control_string, " is meaningless") end # compute cost function # TODO: loop through all controls with respect to all the components in the cost function costfunction(α, femmodel, controlvar_enum, VertexSIdEnum) end#}}} function costfunction(α::Vector{Float64}, femmodel::FemModel, controlvar_enum::IssmEnum, SId_enum::IssmEnum) #{{{ #Update FemModel accordingly InputUpdateFromVectorx(femmodel, α, controlvar_enum, SId_enum) #solve PDE analysis = StressbalanceAnalysis() Core(analysis, femmodel) #Compute cost function J = SurfaceAbsVelMisfitx(femmodel) #J += ControlVariableAbsGradientx(femmodel, α, controlvar_enum) #return cost function return J end#}}} # The misfit functions function SurfaceAbsVelMisfitx(femmodel::FemModel) #{{{ #Initialize output J = 0.0 #Sum all element values for i in 1:length(femmodel.elements) #Get current element element = femmodel.elements[i] #Should we skip? if(!IsIceInElement(femmodel.elements[i])) continue end #Retrieve all inputs and parameters xyz_list = GetVerticesCoordinates(element.vertices) vx_input = GetInput(element, VxEnum) vy_input = GetInput(element, VyEnum) vx_obs_input = GetInput(element, VxObsEnum) vy_obs_input = GetInput(element, VyObsEnum) #Start integrating gauss = GaussTria(3) for ig in 1:gauss.numgauss Jdet = JacobianDeterminant(xyz_list, gauss) vx = GetInputValue(vx_input, gauss, ig) vy = GetInputValue(vy_input, gauss, ig) vxobs = GetInputValue(vx_obs_input, gauss, ig) vyobs = GetInputValue(vy_obs_input, gauss, ig) J += gauss.weights[ig]*Jdet*(0.5*(vx-vxobs)^2 + 0.5*(vy-vyobs)^2) end end return J end#}}} function ControlVariableAbsGradientx(femmodel::FemModel, α::Vector{Float64}, controlvar_enum::IssmEnum) #{{{ #Initialize output J = 0.0 #Sum all element values for i in 1:length(femmodel.elements) #Get current element element = femmodel.elements[i] #Should we skip? if(!IsIceInElement(femmodel.elements[i])) continue end #Retrieve all inputs and parameters xyz_list = GetVerticesCoordinates(element.vertices) controlvar_input = GetInput(element, controlvar_enum) #Start integrating gauss = GaussTria(3) for ig in 1:gauss.numgauss Jdet = JacobianDeterminant(xyz_list, gauss) # TODO: add weights dα = GetInputDerivativeValue(controlvar_input, xyz_list, gauss, ig) J += gauss.weights[ig]*0.5*Jdet*sum(dα.*dα) end end return J end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
3245
mutable struct ElementMatrix#{{{ nrows::Int64 gglobaldoflist::Vector{Int64} fglobaldoflist::Vector{Int64} sglobaldoflist::Vector{Int64} values::Matrix{Float64} end #}}} function ElementMatrix(nodes::Vector{Node})#{{{ #Get matrix size nrows = NumberOfDofs(nodes,GsetEnum) #Initialize element matrix with zeros values = zeros(nrows,nrows) #Get dof lists gglobaldoflist=GetGlobalDofList(nodes,nrows,GsetEnum) fglobaldoflist=GetGlobalDofList(nodes,nrows,FsetEnum) sglobaldoflist=GetGlobalDofList(nodes,nrows,SsetEnum) return ElementMatrix(nrows,gglobaldoflist,fglobaldoflist,sglobaldoflist,values) end#}}} function Base.show(io::IO, this::ElementMatrix)# {{{ println(io,"ElementMatrix:") println(io," nrows: ",this.nrows) println(io," gglobaldoflist: ",this.gglobaldoflist) println(io," fglobaldoflist: ",this.fglobaldoflist) println(io," sglobaldoflist: ",this.sglobaldoflist) print(io," values: ") display(this.values) return nothing end# }}} function AddToGlobal!(Ke::ElementMatrix,Kff::IssmMatrix,Kfs::IssmMatrix)#{{{ #First check that the element matrix looks alright CheckConsistency(Ke) #See if we need to do anything is_fset = false is_sset = false for i in 1:Ke.nrows if(Ke.fglobaldoflist[i]>0) is_fset = true end if(Ke.sglobaldoflist[i]>0) is_sset = true end end if is_fset AddValues!(Kff,Ke.nrows,Ke.fglobaldoflist,Ke.nrows,Ke.fglobaldoflist,Ke.values) end if is_sset AddValues!(Kfs,Ke.nrows,Ke.fglobaldoflist,Ke.nrows,Ke.sglobaldoflist,Ke.values) end return nothing end#}}} function CheckConsistency(Ke::ElementMatrix)#{{{ for i in 1:Ke.nrows for j in 1:Ke.nrows if(isnan(Ke.values[i,j])) error("NaN found in Element Matrix") end if(isinf(Ke.values[i,j])) error("Inf found in Element Matrix") end if(abs(Ke.values[i,j])>1.e+50) error("Element Matrix values exceeds 1.e+50") end end end return nothing end#}}} mutable struct ElementVector#{{{ nrows::Int64 fglobaldoflist::Vector{Int64} values::Vector{Float64} end #}}} function ElementVector(nodes::Vector{Node})#{{{ #Get matrix size nrows = NumberOfDofs(nodes,GsetEnum) #Initialize element matrix with zeros values = zeros(nrows) #Get dof list fglobaldoflist=GetGlobalDofList(nodes,nrows,FsetEnum) return ElementVector(nrows,fglobaldoflist,values) end#}}} function Base.show(io::IO, this::ElementVector)# {{{ println(io,"ElementVector:") println(io," nrows: ",this.nrows) println(io," fglobaldoflist: ",this.fglobaldoflist) print(io," values: ") display(this.values) return nothing end# }}} function AddToGlobal!(pe::ElementVector,pf::IssmVector)#{{{ #First check that the element matrix looks alright CheckConsistency(pe) #See if we need to do anything is_fset = false for i in 1:pe.nrows if(pe.fglobaldoflist[i]>0) is_fset = true break end end if is_fset AddValues!(pf,pe.nrows,pe.fglobaldoflist,pe.values) end return nothing end#}}} function CheckConsistency(pe::ElementVector)#{{{ for i in 1:pe.nrows if(isnan(pe.values[i])) error("NaN found in Element Vector") end if(isinf(pe.values[i])) error("Inf found in Element Vector") end if(abs(pe.values[i])>1.e+50) error("Element Vector values exceeds 1.e+50") end end return nothing end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
17333
#Tria class definition mutable struct Tria #{{{ sid::Int64 pid::Int64 #vertexids::Int64[3] #vertices::Vertex[3] vertexids::Vector{Int64} vertices::Vector{Vertex} nodes::Vector{Node} nodes_list::Vector{Vector{Node}} nodes_ids_list::Vector{Vector{Int64}} parameters::Parameters inputs::Inputs end# }}} function Tria(sid::Int64, pid::Int64, vertexids::Vector{Int64}) #{{{ #This is the default constructor, at this point we don't have much information tempparams = Parameters() tempinputs = Inputs(-1,-1,Dict{IssmEnum,Input}()) return Tria(sid, pid, vertexids, Vector{Vertex}(undef,3), Vector{Node}(undef,0), Vector{Vector{Node}}(undef,0), Vector{Vector{Int64}}(undef,0), tempparams, tempinputs) end #}}} #Element functions function InputCreate(element::Tria,inputs::Inputs,data::Vector{Float64},enum::IssmEnum) #{{{ if size(data,1)==inputs.numberofelements SetTriaInput(inputs,enum,P0Enum,element.sid,data[element.sid]) elseif size(data,1)==inputs.numberofvertices SetTriaInput(inputs,enum,P1Enum,element.vertexids,data[element.vertexids]) else error("size ",size(data,1)," not supported for ", enum); end return nothing end #}}} function AddInput(element::Tria,inputenum::IssmEnum,data::Vector{Float64},interpolation::IssmEnum) #{{{ if interpolation==P1Enum @assert length(data)==3 SetTriaInput(element.inputs,inputenum,P1Enum,element.vertexids,data) else error("interpolation ", interpolation, " not supported yet"); end return nothing end #}}} function InputUpdateFromVector(element::Tria, vector::Vector{Float64}, enum::IssmEnum, layout::IssmEnum) #{{{ lidlist = element.vertexids data = Vector{Float64}(undef, 3) if(layout==VertexSIdEnum) for i in 1:3 data[i] = vector[element.vertices[i].sid] @assert isfinite(data[i]) end SetTriaInput(element.inputs, enum, P1Enum, lidlist, data) else error("layout ", layout, " not supported yet"); end return nothing end #}}} function Update(element::Tria, inputs::Inputs, index::Int64, md::model, finiteelement::IssmEnum) #{{{ if finiteelement==P1Enum numnodes = 3 nodeids = Vector{Int64}(undef,numnodes) nodeids[1] = md.mesh.elements[index,1] nodeids[2] = md.mesh.elements[index,2] nodeids[3] = md.mesh.elements[index,3] push!(element.nodes_ids_list, nodeids) push!(element.nodes_list, Vector{Node}(undef, numnodes)) else error("not supported yet") end return nothing end #}}} function Configure(element::Tria,nodes::Vector{Node},vertices::Vector{Vertex},parameters::Parameters,inputs::Inputs,index::Int64) # {{{ #Configure vertices for i in 1:3 element.vertices[i] = vertices[element.vertexids[i]] end #Configure nodes (assuming P1 finite elements) nodes_list = element.nodes_list[index] nodes_ids_list = element.nodes_ids_list[index] for i in 1:3 nodes_list[i] = nodes[nodes_ids_list[i]] end #Point to real datasets element.nodes = element.nodes_list[index] element.parameters = parameters element.inputs = inputs return nothing end # }}} function GetDofList(element::Tria,setenum::IssmEnum) # {{{ #Define number of nodes numnodes = 3 #Determine size of doflist numdofs = 0 for i in 1:numnodes numdofs += GetNumberOfDofs(element.nodes[i],GsetEnum) end #Allocate doflist vector doflist = Vector{Int64}(undef,numdofs) #enter dofs in doflist vector count = 0 for i in 1:numnodes count = GetDofList(element.nodes[i],doflist,count,GsetEnum) end return doflist end # }}} function GetInput(element::Tria,enum::IssmEnum) # {{{ input = GetInput(element.inputs,enum) InputServe!(element,input) return input end # }}} function GetInputListOnNodes!(element::Tria, vector::Vector{Float64}, enum::IssmEnum) # {{{ #Get Input first input = GetInput(element, enum) #Get value at each vertex (i.e. P1 Nodes) gauss=GaussTria(P1Enum) for i in 1:gauss.numgauss vector[i] = GetInputValue(input, gauss, i) end return nothing end # }}} function GetInputValue(element::Tria, vector::Vector{Float64}, gauss::GaussTria, ig::Int64, enum::IssmEnum) # {{{ # Allocate basis functions basis = Vector{Float64}(undef, 3) # Fetch number of nodes numnodes = NumberofNodesTria(enum) @assert numnodes <= 3 # Get basis functions at this point NodalFunctions(element, basis, gauss, ig, enum) # Calculate parameter for this Gauss point value::Float64 = 0.0 for i = 1:3 value += basis[i] * vector[i] end return value end # }}} function GetInputListOnVertices!(element::Tria, vector::Vector{Float64}, enum::IssmEnum) # {{{ #Get Input first input = GetInput(element, enum) #Get value at each vertex (i.e. P1 Nodes) gauss=GaussTria(P1Enum) for i in 1:gauss.numgauss vector[i] = GetInputValue(input, gauss, i) end return nothing end # }}} function FindParam(::Type{T}, element::Tria, enum::IssmEnum) where T # {{{ return FindParam(T, element.parameters, enum) end # }}} function InputServe!(element::Tria,input::Input) # {{{ if input.interp==P0Enum input.element_values[1] = input.values[element.sid] elseif input.interp==P1Enum for i in 1:3 input.element_values[i] = input.values[element.vertices[i].sid] end else error("interpolation ",input.interp," not supported yet") end return nothing end # }}} function GetGroundedPortion(element::Tria, xyz_list::Matrix{Float64}) #{{{ level = Vector{Float64}(undef,3) GetInputListOnVertices!(element, level, MaskOceanLevelsetEnum) #Be sure that values are not zero epsilon = 1.e-15 for i in 1:3 if(level[i]==0.) level[i]=level[i]+epsilon end end if level[1]>0 && level[2]>0 && level[3]>0 #Completely grounded phi = 1.0 elseif level[1]<0 && level[2]<0 && level[3]<0 #Completely floating phi = 0.0 else #Partially floating, if(level[1]*level[2]>0) #Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2 s1=level[3]/(level[3]-level[2]); s2=level[3]/(level[3]-level[1]); elseif(level[2]*level[3]>0) #Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2 s1=level[1]/(level[1]-level[2]); s2=level[1]/(level[1]-level[3]); elseif(level[1]*level[3]>0) #Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2 s1=level[2]/(level[2]-level[1]); s2=level[2]/(level[2]-level[3]); else error("not supposed to be here...") end if(level[1]*level[2]*level[3]>0) phi = s1*s2 else phi = (1-s1*s2) end end return phi end#}}} function InputUpdateFromSolutionOneDof(element::Tria, ug::Vector{Float64},enum::IssmEnum) #{{{ #Get dofs for this finite element doflist = GetDofList(element,GsetEnum) #Get solution vector for this element numdof = 3 values = Vector{Float64}(undef,numdof) for i in 1:numdof values[i]=ug[doflist[i]] end #Add back to Mask AddInput(element, enum, values, P1Enum) return nothing end#}}} function IsIcefront(element::Tria) #{{{ level = Vector{Float64}(undef,3) GetInputListOnVertices!(element, level, MaskIceLevelsetEnum) nbice = 0 for i in 1:3 if(level[i]<0.) nbice+=1 end end if(nbice==1) return true else return false end end#}}} function IsIceInElement(element::Tria) #{{{ #We consider that an element has ice if at least one of its nodes has a negative level set input=GetInput(element, MaskIceLevelsetEnum) if GetInputMin(input)<0 return true else return false end end#}}} function GetIcefrontCoordinates!(element::Tria, xyz_front::Matrix{Float64}, xyz_list::Matrix{Float64}, levelsetenum::IssmEnum) #{{{ #Intermediaries level = Vector{Float64}(undef,3) indicesfront = Vector{Int64}(undef,3) #Recover value of levelset for all vertices GetInputListOnVertices!(element, level, levelsetenum) #Get nodes where there is no ice num_frontnodes = 0 for i in 1:3 if(level[i]>=0.) num_frontnodes += 1 indicesfront[num_frontnodes] = i end end @assert num_frontnodes==2 #Arrange order of frontnodes such that they are oriented counterclockwise NUMVERTICES = 3 if((NUMVERTICES+indicesfront[1]-indicesfront[2])%NUMVERTICES != NUMVERTICES-1) index=indicesfront[1] indicesfront[1]=indicesfront[2] indicesfront[2]=index end #Return nodes xyz_front[1,:]=xyz_list[indicesfront[1],:] xyz_front[2,:]=xyz_list[indicesfront[2],:] return nothing end#}}} function GetArea(element::Tria)#{{{ #Get xyz list xyz_list = GetVerticesCoordinates(element.vertices) x1 = xyz_list[1,1]; y1 = xyz_list[1,2] x2 = xyz_list[2,1]; y2 = xyz_list[2,2] x3 = xyz_list[3,1]; y3 = xyz_list[3,2] @assert x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1>0 return (x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1)/2 end#}}} function GetElementSizes(element::Tria)#{{{ #Get xyz list xyz_list = GetVerticesCoordinates(element.vertices) x1 = xyz_list[1,1]; y1 = xyz_list[1,2] x2 = xyz_list[2,1]; y2 = xyz_list[2,2] x3 = xyz_list[3,1]; y3 = xyz_list[3,2] xmin=xyz_list[1,1]; xmax=xyz_list[1,1]; ymin=xyz_list[1,2]; ymax=xyz_list[1,2]; for i in [2,3] if(xyz_list[i,1]<xmin) xmin=xyz_list[i,1] end if(xyz_list[i,1]>xmax) xmax=xyz_list[i,1] end if(xyz_list[i,2]<ymin) ymin=xyz_list[i,2] end if(xyz_list[i,2]>ymax) ymax=xyz_list[i,2] end end hx = xmax-xmin hy = ymax-ymin hz = 0. return hx, hy, hz end#}}} function NormalSection(element::Tria, xyz_front::Matrix{Float64}) #{{{ #Build output pointing vector nx = xyz_front[2,2] - xyz_front[1,2] ny = -xyz_front[2,1] + xyz_front[1,1] #normalize norm = sqrt(nx^2 + ny^2) nx = nx/norm ny = ny/norm return nx, ny end#}}} function CharacteristicLength(element::Tria) #{{{ return sqrt(2*GetArea(element)) end#}}} function MigrateGroundingLine(element::Tria) #{{{ h = Vector{Float64}(undef,3) s = Vector{Float64}(undef,3) b = Vector{Float64}(undef,3) r = Vector{Float64}(undef,3) phi = Vector{Float64}(undef,3) sl = zeros(3) GetInputListOnVertices!(element, h, ThicknessEnum) GetInputListOnVertices!(element, s, SurfaceEnum) GetInputListOnVertices!(element, b, BaseEnum) GetInputListOnVertices!(element, r, BedEnum) #GetInputListOnVertices(element, sl, SealevelEnum) GetInputListOnVertices!(element, phi, MaskOceanLevelsetEnum) rho_water = FindParam(Float64, element, MaterialsRhoSeawaterEnum) rho_ice = FindParam(Float64, element, MaterialsRhoIceEnum) density = rho_ice/rho_water for i in 1:3 if(phi[i]<=0) #reground if base is below bed if(b[i]<=r[i]) b[i] = r[i] s[i] = b[i]+h[i] end else bed_hydro=-density*h[i]+sl[i]; if (bed_hydro>r[i]) #Unground only if the element is connected to the ice shelf s[i] = (1-density)*h[i]+sl[i] b[i] = -density*h[i]+sl[i] end end #recalculate phi phi[i]=h[i]+(r[i]-sl[i])/density end #Update inputs AddInput(element,MaskOceanLevelsetEnum,phi,P1Enum) AddInput(element,SurfaceEnum,s,P1Enum) AddInput(element,BaseEnum,b,P1Enum) return nothing end#}}} function MovingFrontalVelocity(element::Tria) #{{{ mvx = Vector{Float64}(undef,3) mvy = Vector{Float64}(undef,3) # get cavling law calvinglaw = FindParam(Int64, element, CalvingLawEnum) # load inputs gr_input = GetInput(element, MaskOceanLevelsetEnum) #lsf_slopex_input = GetInput(element, LevelsetfunctionSlopeXEnum) #lsf_slopey_input = GetInput(element, LevelsetfunctionSlopeYEnum) #calvingratex_input= GetInput(element, CalvingratexEnum) #calvingratey_input= GetInput(element, CalvingrateyEnum) vx_input = GetInput(element, VxEnum) vy_input = GetInput(element, VyEnum) calvingrate_input = GetInput(element, CalvingCalvingrateEnum) meltingrate_input = GetInput(element, CalvingMeltingrateEnum) xyz_list = GetVerticesCoordinates(element.vertices) gauss = GaussTria(2) for ig in 1:3 vx = GetInputValue(vx_input, gauss, ig) vy = GetInputValue(vy_input, gauss, ig) groundedice = GetInputValue(gr_input, gauss, ig) dlsf = GetInputDerivativeValue(vx_input,xyz_list,gauss,ig) #TODO: add L2Projection #dlsfx = GetInputValue(lsf_slopex_input, gauss, ig) #dlsfy = GetInputValue(lsf_slopey_input, gauss, ig) #cx = GetInputValue(calvingratex_input, gauss, ig) #cy = GetInputValue(calvingratey_input, gauss, ig) norm_dlsf = sqrt(dlsf[1]^2+dlsf[2]^2) # TODO: depend on which calving law calvingrate = GetInputValue(calvingrate_input, gauss, ig) cx = calvingrate * dlsf[1] /norm_dlsf cy = calvingrate * dlsf[2] /norm_dlsf meltingrate = GetInputValue(meltingrate_input, gauss, ig) if (groundedice < 0) meltingrate = 0; end mx = meltingrate * dlsf[1] /norm_dlsf my = meltingrate * dlsf[2] /norm_dlsf if (norm_dlsf <1e-10) cx = 0; cy = 0 mx = 0; my = 0 end mvx[ig] = vx-cx-mx mvy[ig] = vy-cy-my end #Update inputs AddInput(element,MovingFrontalVxEnum,mvx,P1Enum) AddInput(element,MovingFrontalVyEnum,mvy,P1Enum) return nothing end#}}} function GetXcoord(element::Tria, xyz_list::Matrix{Float64}, gauss::GaussTria, ig::Int64) #{{{ # create a list of x x_list = Vector{Float64}(undef,3) for i in 1:3 x_list[i] = xyz_list[i,1] end # Get value at gauss point return GetInputValue(element, x_list, gauss, ig, P1Enum); end#}}} function GetYcoord(element::Tria, xyz_list::Matrix{Float64}, gauss::GaussTria, ig::Int64) #{{{ # create a list of y y_list = Vector{Float64}(undef,3) for i in 1:3 y_list[i] = xyz_list[i,2] end # Get value at gauss point return GetInputValue(element, y_list, gauss, ig, P1Enum); end#}}} #Finite Element stuff function JacobianDeterminant(xyz_list::Matrix{Float64}, gauss::GaussTria) #{{{ #Get Jacobian Matrix J = Jacobian(xyz_list) #Get its determinant Jdet = Matrix2x2Determinant(J) #check and return if(Jdet<0) error("negative Jacobian Determinant") end return Jdet end#}}} function JacobianDeterminantSurface(xyz_list::Matrix{Float64}, gauss::GaussTria) #{{{ x1 = xyz_list[1,1]; y1 = xyz_list[1,2] x2 = xyz_list[2,1]; y2 = xyz_list[2,2] Jdet = .5*sqrt((x2-x1)^2 + (y2-y1)^2) #check and return if(Jdet<0) error("negative Jacobian Determinant") end return Jdet end#}}} function Jacobian(xyz_list::Matrix{Float64}) #{{{ J = Matrix{Float64}(undef,2,2) x1 = xyz_list[1,1] y1 = xyz_list[1,2] x2 = xyz_list[2,1] y2 = xyz_list[2,2] x3 = xyz_list[3,1] y3 = xyz_list[3,2] J[1,1] = .5*(x2-x1) J[1,2] = .5*(y2-y1) J[2,1] = sqrt(3)/6*(2*x3 -x1 -x2) J[2,2] = sqrt(3)/6*(2*y3 -y1 -y2) return J end#}}} function JacobianInvert(xyz_list::Matrix{Float64}, gauss::GaussTria) #{{{ #Get Jacobian matrix J = Jacobian(xyz_list) #Get its determinant Jinv = Matrix2x2Invert(J) return Jinv end#}}} function NodalFunctions(element::Tria,basis::Vector{Float64}, gauss::GaussTria, ig::Int64, finiteelement::IssmEnum) #{{{ if(finiteelement==P0Enum) #Nodal function 1 basis[1]= 1 elseif(finiteelement==P1Enum) basis[1] = gauss.coords1[ig] basis[2] = gauss.coords2[ig] basis[3] = gauss.coords3[ig] else error("Element type ",finiteelement," not supported yet") end return nothing end#}}} function NodalFunctionsDerivatives(element::Tria,dbasis::Matrix{Float64},xyz_list::Matrix{Float64}, gauss::GaussTria) #{{{ #Get nodal function derivatives in reference element dbasis_ref = Matrix{Float64}(undef,3,2) NodalFunctionsDerivativesReferenceTria(dbasis_ref,gauss,P1Enum) #Get invert of the Jacobian Jinv = JacobianInvert(xyz_list,gauss) #Build dbasis: #[ dNi/dx ] = Jinv * [dNhat_i/dr] #[ dNi/dy ] = [dNhat_i/ds] for i in 1:3 dbasis[i,1] = Jinv[1,1]*dbasis_ref[i,1]+Jinv[1,2]*dbasis_ref[i,2] dbasis[i,2] = Jinv[2,1]*dbasis_ref[i,1]+Jinv[2,2]*dbasis_ref[i,2] end return nothing end#}}} function NodalFunctionsDerivativesReferenceTria(dbasis::Matrix{Float64}, gauss::GaussTria, finiteelement::IssmEnum) #{{{ if(finiteelement==P0Enum) #Nodal function 1 dbasis[1,1]= 0 dbasis[1,2]= 0 elseif(finiteelement==P1Enum) #Nodal function 1 dbasis[1,1]= -.5 dbasis[1,2]= -sqrt(3)/6 #Nodal function 2 dbasis[2,1]= .5 dbasis[2,2]= -sqrt(3)/6 #Nodal function 3 dbasis[3,1]= 0 dbasis[3,2]= sqrt(3)/3 else error("Element type ",finiteelement," not supported yet") end return nothing end#}}} function NumberofNodesTria(finiteelement) #{{{ if (finiteelement==P0Enum) return 0 elseif(finiteelement==P1Enum) return 3 else error("Element type ",finiteelement," not supported yet") end return nothing end#}}} function GaussTria(element::Tria, xyz_list::Matrix{Float64}, xyz_list_front::Matrix{Float64}, order::Int64) #{{{ area_coordinates = Matrix{Float64}(undef,2,3) GetAreaCoordinates!(element, area_coordinates, xyz_list_front, xyz_list) return GaussTria(area_coordinates, order) end# }}} function GetAreaCoordinates!(element::Tria, area_coordinates::Matrix{Float64}, xyz_zero::Matrix{Float64}, xyz_list::Matrix{Float64})#{{{ numpoints = size(area_coordinates,1) area = GetArea(element) #Copy original xyz_list xyz_bis=copy(xyz_list) for i in 1:numpoints for j in 1:3 #Change appropriate line xyz_bis[j,:] = xyz_zero[i,:] #Compute area fraction area_portion=abs(xyz_bis[2,1]*xyz_bis[3,2] - xyz_bis[2,2]*xyz_bis[3,1] + xyz_bis[1,1]*xyz_bis[2,2] - xyz_bis[1,2]*xyz_bis[2,1] + xyz_bis[3,1]*xyz_bis[1,2] - xyz_bis[3,2]*xyz_bis[1,1])/2 area_coordinates[i,j] = area_portion/area #reinitialize xyz_list xyz_bis[j,:] = xyz_list[j,:] end end return nothing end #}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1019
#femmodel class definition mutable struct FemModel #{{{ analyses::Vector{Analysis} elements::Vector{Tria} vertices::Vector{Vertex} nodes::Vector{Node} nodes_list::Vector{Vector{Node}} parameters::Parameters inputs::Inputs constraints::Vector{Constraint} constraints_list::Vector{Vector{Constraint}} #loads::Vector{Loads} results::Vector{Result} end#}}} #femmodel functions function SetCurrentConfiguration!(femmodel::FemModel, analysis::Analysis) #{{{ #Find the index of this analysis index = -1 for i in 1:length(femmodel.analyses) if(typeof(femmodel.analyses[i]) == typeof(analysis)) index = i end end if(index<1) error("Could not find analysis ",analysis, " in femmodel") end #Plug right nodes onto element for i in 1:length(femmodel.elements) femmodel.elements[i].nodes = femmodel.elements[i].nodes_list[index] end #Plug in nodes and other datasets femmodel.nodes = femmodel.nodes_list[index] femmodel.constraints = femmodel.constraints_list[index] return nothing end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
6639
#Friction class definition abstract type CoreFriction end mutable struct CoreBuddFriction <: CoreFriction #{{{ c_input::Input vx_input::Input vy_input::Input p_input::Input q_input::Input H_input::Input b_input::Input rho_ice::Float64 rho_water::Float64 g::Float64 end# }}} struct CoreWeertmanFriction <: CoreFriction#{{{ c_input::Input vx_input::Input vy_input::Input m_input::Input end# }}} mutable struct CoreSchoofFriction <: CoreFriction #{{{ c_input::Input vx_input::Input vy_input::Input m_input::Input Cmax_input::Input H_input::Input b_input::Input rho_ice::Float64 rho_water::Float64 g::Float64 end# }}} mutable struct CoreDNNFriction <: CoreFriction#{{{ dnnChain::Vector{Flux.Chain} dtx::Vector{StatsBase.ZScoreTransform} dty::Vector{StatsBase.ZScoreTransform} xyz_list::Matrix{Float64} vx_input::Input vy_input::Input b_input::Input H_input::Input rho_ice::Float64 rho_water::Float64 g::Float64 end# }}} function CoreFriction(element::Tria, ::Val{frictionlaw}) where frictionlaw #{{{ vx_input = GetInput(element, VxEnum) vy_input = GetInput(element, VyEnum) if frictionlaw==1 H_input = GetInput(element, ThicknessEnum) b_input = GetInput(element, BaseEnum) c_input = GetInput(element, FrictionCoefficientEnum) p_input = GetInput(element, FrictionPEnum) q_input = GetInput(element, FrictionQEnum) rho_ice = FindParam(Float64, element, MaterialsRhoIceEnum) rho_water = FindParam(Float64, element, MaterialsRhoSeawaterEnum) g = FindParam(Float64, element, ConstantsGEnum) return CoreBuddFriction(c_input, vx_input, vy_input, p_input, q_input, H_input, b_input, rho_ice, rho_water, g) elseif frictionlaw==2 c_input = GetInput(element, FrictionCEnum) m_input = GetInput(element, FrictionMEnum) return CoreWeertmanFriction(c_input,vx_input,vy_input,m_input) elseif frictionlaw==11 H_input = GetInput(element, ThicknessEnum) b_input = GetInput(element, BaseEnum) c_input = GetInput(element, FrictionCEnum) m_input = GetInput(element, FrictionMEnum) Cmax_input = GetInput(element, FrictionCmaxEnum) rho_ice = FindParam(Float64, element, MaterialsRhoIceEnum) rho_water = FindParam(Float64, element, MaterialsRhoSeawaterEnum) g = FindParam(Float64, element, ConstantsGEnum) return CoreSchoofFriction(c_input, vx_input, vy_input, m_input, Cmax_input, H_input, b_input, rho_ice, rho_water, g) elseif frictionlaw==20 dnnChain = FindParam(Vector{Flux.Chain{}}, element, FrictionDNNChainEnum) dtx = FindParam(Vector{StatsBase.ZScoreTransform{Float64, Vector{Float64}} }, element, FrictionDNNdtxEnum) dty = FindParam(Vector{StatsBase.ZScoreTransform{Float64, Vector{Float64}} }, element, FrictionDNNdtyEnum) H_input = GetInput(element, ThicknessEnum) b_input = GetInput(element, BaseEnum) ssx_input = GetInput(element, SurfaceSlopeXEnum) ssy_input = GetInput(element, SurfaceSlopeYEnum) bsx_input = GetInput(element, BedSlopeXEnum) bsy_input = GetInput(element, BedSlopeYEnum) xyz_list = GetVerticesCoordinates(element.vertices) rho_ice = FindParam(Float64, element, MaterialsRhoIceEnum) rho_water = FindParam(Float64, element, MaterialsRhoSeawaterEnum) g = FindParam(Float64, element, ConstantsGEnum) return CoreDNNFriction(dnnChain,dtx,dty,xyz_list,vx_input,vy_input,b_input,H_input,rho_ice,rho_water,g) else error("Friction ",typeof(md.friction)," not supported yet") end end#}}} #vertices functions @inline function Alpha2(friction::CoreBuddFriction, gauss::GaussTria, i::Int64) #{{{ # Recover parameters p = GetInputValue(friction.p_input, gauss, i) q = GetInputValue(friction.q_input, gauss, i) # Compute r and s coefficients r = q / p s = 1.0/p c = GetInputValue(friction.c_input, gauss, i) # Get effective pressure N = EffectivePressure(friction, gauss, i) # Get the velocity vmag = VelMag(friction, gauss, i) if(N<0.0) N=0.0 end if (s == 1.0) alpha2 = c^2 * (N^r) else if (vmag == 0.0 && s<1.0) alpha2 = 0.0 else alpha2 = c^2 * (N^r) * vmag^(s-1.0) end end return alpha2 end #}}} @inline function Alpha2(friction::CoreWeertmanFriction, gauss::GaussTria, i::Int64)#{{{ c = GetInputValue(friction.c_input, gauss, i) m = GetInputValue(friction.m_input, gauss, i) vmag = VelMag(friction, gauss, i) if vmag==0.0 && m<1.0 return 0.0 else return c^2*vmag^(m-1) end end#}}} @inline function Alpha2(friction::CoreSchoofFriction, gauss::GaussTria, i::Int64) #{{{ # Recover parameters m = GetInputValue(friction.m_input, gauss, i) c = GetInputValue(friction.c_input, gauss, i) Cmax = GetInputValue(friction.Cmax_input, gauss, i) # Get effective pressure N = EffectivePressure(friction, gauss, i) # Get the velocity vmag = VelMag(friction, gauss, i) if ((vmag<1.0e-20) || (N == 0.0)) alpha2 = 0.0 else alpha2 = (c^2 * vmag^(m-1)) / ((1.0 + (c^2/(Cmax*N))^(1.0/m)*vmag)^m) end return alpha2 end #}}} @inline function Alpha2(friction::CoreDNNFriction, gauss::GaussTria, i::Int64)#{{{ bed = GetInputValue(friction.b_input, gauss, i) H = GetInputValue(friction.H_input, gauss, i) vx = GetInputValue(friction.vx_input, gauss, i) vy = GetInputValue(friction.vy_input, gauss, i) h = bed + H # Get the velocity vmag = VelMag(friction, gauss, i) # velocity gradients dvx = GetInputDerivativeValue(friction.vx_input,friction.xyz_list,gauss,i) dvy = GetInputDerivativeValue(friction.vy_input,friction.xyz_list,gauss,i) vxdx = dvx[1] vxdy = dvx[2] vydx = dvy[1] vydy = dvy[2] # Get effective pressure Neff = EffectivePressure(friction, gauss, i) # need to change according to the construction of DNN alpha2 = 0.0 for i in 1:length(friction.dnnChain) xin = StatsBase.transform(friction.dtx[i], (reshape(vcat(vx, vy, vxdx, vxdy, vydx, vydy, bed, h), 8, :))) pred = StatsBase.reconstruct(friction.dty[i], friction.dnnChain[i](xin)) alpha2 += first(pred) end # Average alpha2 = alpha2 / length(friction.dnnChain) if ( (vmag == 0.0) | (alpha2 < 0.0) ) alpha2 = 0.0 else alpha2 = alpha2 ./ vmag end return alpha2 end#}}} @inline function VelMag(friction::CoreFriction, gauss::GaussTria, i::Int64) #{{{ vx = GetInputValue(friction.vx_input, gauss, i) vy = GetInputValue(friction.vy_input, gauss, i) vmag = sqrt(vx^2+vy^2) end #}}} @inline function EffectivePressure(friction::CoreFriction, gauss::GaussTria, i::Int64) #{{{ # Get effective pressure H = GetInputValue(friction.H_input, gauss, i) b = GetInputValue(friction.b_input, gauss, i) N = friction.rho_ice*friction.g*H + friction.rho_water*friction.g*b if(N<0.0) N=0.0 end return N end #}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
3956
#Gauss class definition struct GaussTria #{{{ numgauss::Int64 weights::Vector{Float64} coords1::Vector{Float64} coords2::Vector{Float64} coords3::Vector{Float64} end #}}} function Base.show(io::IO, this::GaussTria)# {{{ println(io,"GaussTria:") println(io," numgauss: ",this.numgauss) println(io," weights: ",this.weights) println(io," coords1: ",this.coords1) println(io," coords2: ",this.coords2) println(io," coords3: ",this.coords3) return nothing end# }}} #Gauss constructor function GaussTria(order::Int64) #{{{ #=Gauss quadrature points for the triangle. Higher-order points from D.A. Dunavant, "High Degree Efficient Symmetrical Gaussian Quadrature Rules for the Triangle", IJNME, Vol. 21, pp. 1129-1148 (1985), as transcribed for Probe rules3.=# if(order==1) npoints = 1 weights = [1.732050807568877] coords1 = [0.333333333333333] coords2 = [0.333333333333333] coords3 = [0.333333333333333] elseif(order==2) npoints = 3 weights = [0.577350269189625; 0.577350269189625; 0.577350269189625] coords1 = [0.666666666666667; 0.166666666666667; 0.166666666666667] coords2 = [0.166666666666667; 0.666666666666667; 0.166666666666667] coords3 = [0.166666666666667; 0.166666666666667; 0.666666666666667] elseif(order==3) npoints = 4 weights = [-0.974278579257493; 0.902109795608790; 0.902109795608790; 0.902109795608790] coords1 = [ 0.333333333333333; 0.600000000000000; 0.200000000000000; 0.200000000000000] coords2 = [ 0.333333333333333; 0.200000000000000; 0.600000000000000; 0.200000000000000] coords3 = [ 0.333333333333333; 0.200000000000000; 0.200000000000000; 0.600000000000000] else error("order ",order," not supported yet"); end return GaussTria(npoints,weights,coords1,coords2,coords3) end# }}} function GaussTria(finiteelement::IssmEnum) #{{{ if(finiteelement==P0Enum) npoints = 1 weights = [1.] coords1 = [0.333333333333333] coords2 = [0.333333333333333] coords3 = [0.333333333333333] elseif(finiteelement==P1Enum) npoints = 3 weights = 0.333333333333333*ones(3) coords1 = [1.; 0.; 0.] coords2 = [0.; 1.; 0.] coords3 = [0.; 0.; 1.] else error("finite element ", finiteelement," not supported yet"); end return GaussTria(npoints,weights,coords1,coords2,coords3) end# }}} function GaussTria(area_coordinates::Matrix{Float64}, order::Int64) #{{{ #=Gauss-Legendre quadrature points. The recurrence coefficients for Legendre polynomials on (-1,1) are defined (from the ORTHPOL subroutine RECUR with ipoly=1) as: alpha(i)=0. beta (i)=1./(4.-1./(i-1)^2)) For degree p, the required number of Gauss-Legendre points is n>=(p+1)/2.=# if(order==1) npoint = 1 weights = [2.000000000000000] coords = [0.000000000000000] elseif(order==2) npoints = 2 weights = [1.000000000000000, 1.000000000000000] coords = [-0.577350269189626, 0.577350269189626] elseif(order==3) npoints = 3 weights = [0.555555555555556, 0.888888888888889, 0.555555555555556] coords = [-0.774596669241483, 0.000000000000000, 0.774596669241483] elseif(order==4) npoints = 4 weights = [0.347854845137454, 0.652145154862546, 0.652145154862546, 0.347854845137454] coords = [-0.861136311594053,-0.339981043584856, 0.339981043584856, 0.861136311594053] else error("order ",order," not supported yet"); end coords1 = Vector{Float64}(undef,npoints) coords2 = Vector{Float64}(undef,npoints) coords3 = Vector{Float64}(undef,npoints) for i in 1:npoints coords1[i] = 0.5*(area_coordinates[1,1]+area_coordinates[2,1]) + 0.5*coords[i]*(area_coordinates[2,1]-area_coordinates[1,1]); coords2[i] = 0.5*(area_coordinates[1,2]+area_coordinates[2,2]) + 0.5*coords[i]*(area_coordinates[2,2]-area_coordinates[1,2]); coords3[i] = 0.5*(area_coordinates[1,3]+area_coordinates[2,3]) + 0.5*coords[i]*(area_coordinates[2,3]-area_coordinates[1,3]); end return GaussTria(npoints, weights, coords1, coords2, coords3) end# }}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
3872
#Input class definition mutable struct Input#{{{ enum::IssmEnum interp::IssmEnum values::Vector{Float64} element_values::Vector{Float64} end# }}} #Inputs dataset definition mutable struct Inputs #{{{ numberofelements::Int64 numberofvertices::Int64 lookup::Dict{IssmEnum,Input} end# }}} #Inputs functions function GetInput(inputs::Inputs,enum::IssmEnum) #{{{ #Does this input exist if !haskey(inputs.lookup,enum) error("Input ",enum," not found") end #return input return inputs.lookup[enum] end#}}} function SetTriaInput(inputs::Inputs,enum::IssmEnum,interp::IssmEnum,index::Int64,value::Float64) #{{{ #Does this input exist if !haskey(inputs.lookup,enum) #it does not exist yet, we need to create it... @assert inputs.numberofelements > 0 if interp==P0Enum inputs.lookup[enum] = Input(enum,interp,zeros(inputs.numberofelements),Vector{Float64}(undef,1)) elseif interp==P1Enum inputs.lookup[enum] = Input(enum,interp,zeros(inputs.numberofvertices),Vector{Float64}(undef,3)) else error("not supported yet") end end #Get this input and check type input::Input = inputs.lookup[enum] if typeof(input)!=Input error("input type not consistent") end if interp!=input.interp error("input interpolations not consistent") end #set value input.values[index] = value return nothing end#}}} function SetTriaInput(inputs::Inputs,enum::IssmEnum,interp::IssmEnum,indices::Vector{Int64},values::Vector{Float64}) #{{{ #Does this input exist if !haskey(inputs.lookup,enum) #it does not exist yet, we need to create it... @assert inputs.numberofvertices>0 if interp==P1Enum inputs.lookup[enum] = Input(enum,interp,zeros(inputs.numberofvertices),Vector{Float64}(undef,3)) else error("not supported yet") end end #Get this input and check type input::Input = inputs.lookup[enum] if typeof(input)!=Input error("input type not consistent") end if interp!=input.interp error("input interpolations not consistent") end #set value input.values[indices] = values return nothing end#}}} function GetInputAverageValue(input::Input) #{{{ numnodes = NumberofNodesTria(input.interp) value = 0.0 for i in 1:numnodes value+=input.element_values[i] end return value/numnodes end#}}} function GetInputMin(input::Input) #{{{ return minimum(input.element_values) end#}}} function GetInputValue(input::Input,gauss::GaussTria,i::Int64) #{{{ if input.interp==P0Enum return input.element_values[1] elseif input.interp==P1Enum value = input.element_values[1]*gauss.coords1[i] + input.element_values[2]*gauss.coords2[i] + input.element_values[3]*gauss.coords3[i] else error("not implemented yet") end return value end#}}} function GetInputDerivativeValue(input::Input,xyz_list::Matrix{Float64},gauss::GaussTria,i::Int64) #{{{ #Get nodal function derivatives in reference element numnodes = NumberofNodesTria(input.interp) dbasis_ref = Matrix{Float64}(undef,numnodes,2) NodalFunctionsDerivativesReferenceTria(dbasis_ref,gauss,input.interp) #Get invert of the Jacobian Jinv = JacobianInvert(xyz_list,gauss) #Build dbasis: #[ dNi/dx ] = Jinv * [dNhat_i/dr] #[ dNi/dy ] = [dNhat_i/ds] dbasis = Matrix{Float64}(undef,numnodes,2) for i in 1:3 dbasis[i,1] = Jinv[1,1]*dbasis_ref[i,1]+Jinv[1,2]*dbasis_ref[i,2] dbasis[i,2] = Jinv[2,1]*dbasis_ref[i,1]+Jinv[2,2]*dbasis_ref[i,2] end #Get derivatives: dp/dx dp/dy dp = [0.0;0.0] for i in 1:3 dp[1] += dbasis[i,1]*input.element_values[i] dp[2] += dbasis[i,2]*input.element_values[i] end return dp end#}}} function DuplicateInput(inputs::Inputs, old::IssmEnum, new::IssmEnum)#{{{ #Fetch input that needs to be copied oldinput = inputs.lookup[old] if typeof(oldinput)==Input inputs.lookup[new] = Input(new, oldinput.interp, copy(oldinput.values), copy(oldinput.element_values)) end return nothing end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
247162
# WARNING: DO NOT MODIFY THIS FILE # this file has been automatically generated by Synchronize.sh # Please read README for more information @enum IssmEnum begin ParametersSTARTEnum AdolcParamEnum AgeStabilizationEnum AgeNumRequestedOutputsEnum AgeRequestedOutputsEnum AmrDeviatoricErrorGroupThresholdEnum AmrDeviatoricErrorMaximumEnum AmrDeviatoricErrorResolutionEnum AmrDeviatoricErrorThresholdEnum AmrErrEnum AmrFieldEnum AmrGradationEnum AmrGroundingLineDistanceEnum AmrGroundingLineResolutionEnum AmrHmaxEnum AmrHminEnum AmrIceFrontDistanceEnum AmrIceFrontResolutionEnum AmrKeepMetricEnum AmrLagEnum AmrLevelMaxEnum AmrRestartEnum AmrThicknessErrorGroupThresholdEnum AmrThicknessErrorMaximumEnum AmrThicknessErrorResolutionEnum AmrThicknessErrorThresholdEnum AmrTypeEnum AnalysisCounterEnum AnalysisTypeEnum AugmentedLagrangianREnum AugmentedLagrangianRholambdaEnum AugmentedLagrangianRhopEnum AugmentedLagrangianRlambdaEnum AugmentedLagrangianThetaEnum AutodiffCbufsizeEnum AutodiffDependentObjectsEnum AutodiffDriverEnum AutodiffFosForwardIndexEnum AutodiffFosReverseIndexEnum AutodiffFovForwardIndicesEnum AutodiffGcTriggerMaxSizeEnum AutodiffGcTriggerRatioEnum AutodiffIsautodiffEnum AutodiffLbufsizeEnum AutodiffNumDependentsEnum AutodiffNumIndependentsEnum AutodiffObufsizeEnum AutodiffTapeAllocEnum AutodiffTbufsizeEnum AutodiffXpEnum BalancethicknessStabilizationEnum BarystaticContributionsEnum BasalforcingsAutoregressionInitialTimeEnum BasalforcingsAutoregressionTimestepEnum BasalforcingsAutoregressiveOrderEnum BasalforcingsBeta0Enum BasalforcingsBeta1Enum BasalforcingsBottomplumedepthEnum BasalforcingsCrustthicknessEnum BasalforcingsDeepwaterElevationEnum BasalforcingsDeepwaterMeltingRateEnum BasalforcingsDtbgEnum BasalforcingsEnum BasalforcingsIsmip6AverageTfEnum BasalforcingsIsmip6BasinAreaEnum BasalforcingsIsmip6DeltaTEnum BasalforcingsIsmip6Gamma0Enum BasalforcingsIsmip6IsLocalEnum BasalforcingsIsmip6NumBasinsEnum BasalforcingsIsmip6TfDepthsEnum BasalforcingsLinearNumBasinsEnum BasalforcingsLowercrustheatEnum BasalforcingsMantleconductivityEnum BasalforcingsNusseltEnum BasalforcingsPhiEnum BasalforcingsPicoAverageOverturningEnum BasalforcingsPicoAverageSalinityEnum BasalforcingsPicoAverageTemperatureEnum BasalforcingsPicoBoxAreaEnum BasalforcingsPicoFarOceansalinityEnum BasalforcingsPicoFarOceantemperatureEnum BasalforcingsPicoGammaTEnum BasalforcingsPicoIsplumeEnum BasalforcingsPicoMaxboxcountEnum BasalforcingsPicoNumBasinsEnum BasalforcingsPlumeradiusEnum BasalforcingsPlumexEnum BasalforcingsPlumeyEnum BasalforcingsThresholdThicknessEnum BasalforcingsTopplumedepthEnum BasalforcingsUppercrustheatEnum BasalforcingsUppercrustthicknessEnum BasalforcingsUpperdepthMeltEnum BasalforcingsUpperwaterElevationEnum BasalforcingsUpperwaterMeltingRateEnum CalvingCrevasseDepthEnum CalvingCrevasseThresholdEnum CalvingHeightAboveFloatationEnum CalvingLawEnum CalvingMinthicknessEnum CalvingTestSpeedfactorEnum CalvingTestIndependentRateEnum CalvingUseParamEnum CalvingThetaEnum CalvingAlphaEnum CalvingXoffsetEnum CalvingYoffsetEnum CalvingVelLowerboundEnum CalvingVelUpperboundEnum ConfigurationTypeEnum ConstantsGEnum ConstantsNewtonGravityEnum ConstantsReferencetemperatureEnum ConstantsYtsEnum ControlInputSizeMEnum ControlInputSizeNEnum ControlInputInterpolationEnum CumBslcEnum CumBslcIceEnum CumBslcHydroEnum CumBslcOceanEnum CumBslcIcePartitionEnum CumBslcHydroPartitionEnum CumBslcOceanPartitionEnum CumGmtslcEnum CumGmslcEnum DamageC1Enum DamageC2Enum DamageC3Enum DamageC4Enum DamageEnum DamageEquivStressEnum DamageEvolutionNumRequestedOutputsEnum DamageEvolutionRequestedOutputsEnum DamageHealingEnum DamageKappaEnum DamageLawEnum DamageMaxDamageEnum DamageStabilizationEnum DamageStressThresholdEnum DamageStressUBoundEnum DebugProfilingEnum DomainDimensionEnum DomainTypeEnum DslModelEnum DslModelidEnum DslNummodelsEnum SolidearthIsExternalEnum SolidearthExternalNatureEnum SolidearthExternalModelidEnum SolidearthExternalNummodelsEnum SolidearthSettingsComputeBpGrdEnum EarthIdEnum ElasticEnum EplZigZagCounterEnum EsaHElasticEnum EsaHemisphereEnum EsaRequestedOutputsEnum EsaUElasticEnum ExtrapolationVariableEnum FemModelCommEnum FieldsEnum FlowequationFeFSEnum FlowequationIsFSEnum FlowequationIsHOEnum FlowequationIsL1L2Enum FlowequationIsMOLHOEnum FlowequationIsSIAEnum FlowequationIsSSAEnum FlowequationIsNitscheEnum FeFSNitscheGammaEnum FrictionCouplingEnum FrictionDeltaEnum FrictionEffectivePressureLimitEnum FrictionFEnum FrictionGammaEnum FrictionLawEnum FrictionPseudoplasticityExponentEnum FrictionThresholdSpeedEnum FrictionVoidRatioEnum FrontalForcingsBasinIcefrontAreaEnum FrontalForcingsAutoregressionInitialTimeEnum FrontalForcingsAutoregressionTimestepEnum FrontalForcingsAutoregressiveOrderEnum FrontalForcingsBeta0Enum FrontalForcingsBeta1Enum FrontalForcingsNumberofBasinsEnum FrontalForcingsParamEnum FrontalForcingsPhiEnum GrdModelEnum GroundinglineFrictionInterpolationEnum GroundinglineMeltInterpolationEnum GroundinglineMigrationEnum GroundinglineNumRequestedOutputsEnum GroundinglineRequestedOutputsEnum HydrologyAveragingEnum HydrologyCavitySpacingEnum HydrologyChannelConductivityEnum HydrologyChannelSheetWidthEnum HydrologyEnglacialVoidRatioEnum HydrologyIschannelsEnum HydrologyMeltFlagEnum HydrologyModelEnum HydrologyNumRequestedOutputsEnum HydrologyPressureMeltCoefficientEnum HydrologyRelaxationEnum HydrologyRequestedOutputsEnum HydrologySedimentKmaxEnum HydrologyStepsPerStepEnum HydrologyStorageEnum HydrologydcEplColapseThicknessEnum HydrologydcEplConductivityEnum HydrologydcEplInitialThicknessEnum HydrologydcEplLayerCompressibilityEnum HydrologydcEplMaxThicknessEnum HydrologydcEplPoreWaterMassEnum HydrologydcEplThickCompEnum HydrologydcEplflipLockEnum HydrologydcIsefficientlayerEnum HydrologydcLeakageFactorEnum HydrologydcMaxIterEnum HydrologydcPenaltyFactorEnum HydrologydcPenaltyLockEnum HydrologydcRelTolEnum HydrologydcSedimentlimitEnum HydrologydcSedimentlimitFlagEnum HydrologydcSedimentLayerCompressibilityEnum HydrologydcSedimentPoreWaterMassEnum HydrologydcSedimentPorosityEnum HydrologydcSedimentThicknessEnum HydrologyStepAdaptEnum HydrologydcTransferFlagEnum HydrologydcUnconfinedFlagEnum HydrologyshreveStabilizationEnum IcecapToEarthCommEnum IndexEnum InputFileNameEnum DirectoryNameEnum IndicesEnum InputToDepthaverageInEnum InputToDepthaverageOutEnum InputToExtrudeEnum InputToL2ProjectEnum InputToSmoothEnum InversionAlgorithmEnum InversionControlParametersEnum InversionControlScalingFactorsEnum InversionCostFunctionsEnum InversionDxminEnum InversionGatolEnum InversionGradientScalingEnum InversionGrtolEnum InversionGttolEnum InversionIncompleteAdjointEnum InversionIscontrolEnum InversionMaxiterEnum InversionMaxiterPerStepEnum InversionMaxstepsEnum InversionNstepsEnum InversionNumControlParametersEnum InversionNumCostFunctionsEnum InversionStepThresholdEnum InversionTypeEnum IvinsEnum IsSlcCouplingEnum LevelsetKillIcebergsEnum LevelsetReinitFrequencyEnum LevelsetStabilizationEnum LockFileNameEnum LoveAllowLayerDeletionEnum LoveChandlerWobbleEnum LoveCoreMantleBoundaryEnum LoveEarthMassEnum LoveForcingTypeEnum LoveFrequenciesEnum LoveIsTemporalEnum LoveG0Enum LoveGravitationalConstantEnum LoveInnerCoreBoundaryEnum LoveComplexComputationEnum LoveQuadPrecisionEnum LoveIntStepsPerLayerEnum LoveMinIntegrationStepsEnum LoveMaxIntegrationdrEnum LoveKernelsEnum LoveMu0Enum LoveNfreqEnum LoveNTemporalIterationsEnum LoveNYiEquationsEnum LoveR0Enum LoveShNmaxEnum LoveShNminEnum LoveStartingLayerEnum LoveUnderflowTolEnum LovePostWidderThresholdEnum LoveDebugEnum LoveHypergeomNZEnum LoveHypergeomNAlphaEnum MassFluxSegmentsEnum MassFluxSegmentsPresentEnum MasstransportHydrostaticAdjustmentEnum MasstransportIsfreesurfaceEnum MasstransportMinThicknessEnum MasstransportNumRequestedOutputsEnum MasstransportPenaltyFactorEnum MasstransportRequestedOutputsEnum MasstransportStabilizationEnum MaterialsBetaEnum MaterialsEarthDensityEnum MaterialsEffectiveconductivityAveragingEnum MaterialsHeatcapacityEnum MaterialsLatentheatEnum MaterialsMeltingpointEnum MaterialsMixedLayerCapacityEnum MaterialsMuWaterEnum MaterialsRheologyLawEnum MaterialsRhoFreshwaterEnum MaterialsRhoIceEnum MaterialsRhoSeawaterEnum MaterialsTemperateiceconductivityEnum MaterialsThermalExchangeVelocityEnum MaterialsThermalconductivityEnum MeltingOffsetEnum MeshAverageVertexConnectivityEnum MeshElementtypeEnum MeshNumberoflayersEnum MeshNumberofverticesEnum MeshNumberofelementsEnum MigrationMaxEnum ModelIdEnum NbinsEnum NodesEnum NumModelsEnum OceanGridNxEnum OceanGridNyEnum OceanGridXEnum OceanGridYEnum OutputBufferPointerEnum OutputBufferSizePointerEnum OutputFileNameEnum OutputFilePointerEnum OutputdefinitionEnum QmuErrNameEnum QmuInNameEnum QmuIsdakotaEnum QmuOutNameEnum QmuOutputEnum QmuCurrEvalIdEnum QmuNsampleEnum QmuResponsedescriptorsEnum QmuVariableDescriptorsEnum QmuVariablePartitionsEnum QmuVariablePartitionsNpartEnum QmuVariablePartitionsNtEnum QmuResponsePartitionsEnum QmuResponsePartitionsNpartEnum QmuStatisticsEnum QmuNumstatisticsEnum QmuNdirectoriesEnum QmuNfilesPerDirectoryEnum QmuStatisticsMethodEnum QmuMethodsEnum RestartFileNameEnum ResultsEnum RootPathEnum ModelnameEnum SamplingAlphaEnum SamplingNumRequestedOutputsEnum SamplingRequestedOutputsEnum SamplingRobinEnum SamplingSeedEnum SaveResultsEnum SolidearthPartitionIceEnum SolidearthPartitionHydroEnum SolidearthPartitionOceanEnum SolidearthNpartIceEnum SolidearthNpartOceanEnum SolidearthNpartHydroEnum SolidearthPlanetRadiusEnum SolidearthPlanetAreaEnum SolidearthSettingsAbstolEnum SolidearthSettingsCrossSectionShapeEnum SolidearthSettingsElasticEnum SolidearthSettingsViscousEnum SolidearthSettingsSatelliteGraviEnum SolidearthSettingsDegreeAccuracyEnum SealevelchangeGeometryDoneEnum SealevelchangeViscousNumStepsEnum SealevelchangeViscousTimesEnum SealevelchangeViscousIndexEnum SealevelchangeViscousPolarMotionEnum SealevelchangeRunCountEnum SealevelchangeTransitionsEnum SealevelchangeRequestedOutputsEnum RotationalAngularVelocityEnum RotationalEquatorialMoiEnum RotationalPolarMoiEnum LovePolarMotionTransferFunctionColinearEnum LovePolarMotionTransferFunctionOrthogonalEnum TidalLoveHEnum TidalLoveKEnum TidalLoveLEnum TidalLoveK2SecularEnum LoadLoveHEnum LoadLoveKEnum LoadLoveLEnum LoveTimeFreqEnum LoveIsTimeEnum LoveHypergeomZEnum LoveHypergeomTable1Enum LoveHypergeomTable2Enum SealevelchangeGSelfAttractionEnum SealevelchangeGViscoElasticEnum SealevelchangeUViscoElasticEnum SealevelchangeHViscoElasticEnum SealevelchangePolarMotionTransferFunctionColinearEnum SealevelchangePolarMotionTransferFunctionOrthogonalEnum SealevelchangePolarMotionTransferFunctionZEnum SealevelchangeTidalK2Enum SealevelchangeTidalH2Enum SealevelchangeTidalL2Enum SolidearthSettingsSealevelLoadingEnum SolidearthSettingsGRDEnum SolidearthSettingsRunFrequencyEnum SolidearthSettingsTimeAccEnum SolidearthSettingsHorizEnum SolidearthSettingsMaxiterEnum SolidearthSettingsGrdOceanEnum SolidearthSettingsOceanAreaScalingEnum StochasticForcingCovarianceEnum StochasticForcingDefaultDimensionEnum StochasticForcingDimensionsEnum StochasticForcingFieldsEnum StochasticForcingIsEffectivePressureEnum StochasticForcingIsStochasticForcingEnum StochasticForcingIsWaterPressureEnum StochasticForcingNoisetermsEnum StochasticForcingNumFieldsEnum StochasticForcingRandomflagEnum StochasticForcingTimestepEnum SolidearthSettingsReltolEnum SolidearthSettingsSelfAttractionEnum SolidearthSettingsRotationEnum SolidearthSettingsMaxSHCoeffEnum SettingsIoGatherEnum SettingsNumResultsOnNodesEnum SettingsOutputFrequencyEnum SettingsCheckpointFrequencyEnum SettingsResultsOnNodesEnum SettingsSbCouplingFrequencyEnum SettingsSolverResidueThresholdEnum SettingsWaitonlockEnum SmbAIceEnum SmbAIdxEnum SmbASnowEnum SmbAccualtiEnum SmbAccugradEnum SmbAccurefEnum SmbAdThreshEnum SmbAutoregressionInitialTimeEnum SmbAutoregressionTimestepEnum SmbAutoregressiveOrderEnum SmbAveragingEnum SmbBeta0Enum SmbBeta1Enum SmbDesfacEnum SmbDpermilEnum SmbDsnowIdxEnum SmbElevationBinsEnum SmbCldFracEnum SmbDelta18oEnum SmbDelta18oSurfaceEnum SmbDenIdxEnum SmbDtEnum SmbEnum SmbEIdxEnum SmbFEnum SmbInitDensityScalingEnum SmbIsaccumulationEnum SmbIsalbedoEnum SmbIsconstrainsurfaceTEnum SmbIsd18opdEnum SmbIsdelta18oEnum SmbIsdensificationEnum SmbIsdeltaLWupEnum SmbIsfirnwarmingEnum SmbIsgraingrowthEnum SmbIsmeltEnum SmbIsmungsmEnum SmbIsprecipscaledEnum SmbIssetpddfacEnum SmbIsshortwaveEnum SmbIstemperaturescaledEnum SmbIsthermalEnum SmbIsturbulentfluxEnum SmbKEnum SmbLapseRatesEnum SmbNumBasinsEnum SmbNumElevationBinsEnum SmbNumRequestedOutputsEnum SmbPfacEnum SmbPhiEnum SmbRdlEnum SmbRefElevationEnum SmbRequestedOutputsEnum SmbRlapsEnum SmbRlapslgmEnum SmbRunoffaltiEnum SmbRunoffgradEnum SmbRunoffrefEnum SmbSealevEnum SmbStepsPerStepEnum SmbSwIdxEnum SmbT0dryEnum SmbT0wetEnum SmbTcIdxEnum SmbTeThreshEnum SmbTdiffEnum SmbThermoDeltaTScalingEnum SmbTemperaturesReconstructedYearsEnum SmbPrecipitationsReconstructedYearsEnum SmoothThicknessMultiplierEnum SolutionTypeEnum SteadystateMaxiterEnum SteadystateNumRequestedOutputsEnum SteadystateReltolEnum SteadystateRequestedOutputsEnum StepEnum StepsEnum StressbalanceAbstolEnum StressbalanceFSreconditioningEnum StressbalanceIsnewtonEnum StressbalanceMaxiterEnum StressbalanceNumRequestedOutputsEnum StressbalancePenaltyFactorEnum StressbalanceReltolEnum StressbalanceRequestedOutputsEnum StressbalanceRestolEnum StressbalanceRiftPenaltyThresholdEnum StressbalanceShelfDampeningEnum ThermalIsdrainicecolumnEnum ThermalIsdynamicbasalspcEnum ThermalIsenthalpyEnum ThermalMaxiterEnum ThermalNumRequestedOutputsEnum ThermalPenaltyFactorEnum ThermalPenaltyLockEnum ThermalPenaltyThresholdEnum ThermalReltolEnum ThermalRequestedOutputsEnum ThermalStabilizationEnum ThermalWatercolumnUpperlimitEnum TimeEnum TimesteppingAverageForcingEnum TimesteppingCflCoefficientEnum TimesteppingCouplingTimeEnum TimesteppingFinalTimeEnum TimesteppingInterpForcingEnum TimesteppingCycleForcingEnum TimesteppingStartTimeEnum TimesteppingTimeStepEnum TimesteppingTimeStepMaxEnum TimesteppingTimeStepMinEnum TimesteppingTypeEnum ToMITgcmCommEnum ToolkitsFileNameEnum ToolkitsOptionsAnalysesEnum ToolkitsOptionsStringsEnum ToolkitsTypesEnum TransientAmrFrequencyEnum TransientIsageEnum TransientIsdamageevolutionEnum TransientIsesaEnum TransientIsgiaEnum TransientIsgroundinglineEnum TransientIshydrologyEnum TransientIsmasstransportEnum TransientIsoceantransportEnum TransientIsmovingfrontEnum TransientIsoceancouplingEnum TransientIssamplingEnum TransientIsslcEnum TransientIssmbEnum TransientIsstressbalanceEnum TransientIsthermalEnum TransientNumRequestedOutputsEnum TransientRequestedOutputsEnum VelocityEnum XxeEnum YyeEnum ZzeEnum AreaeEnum WorldCommEnum ParametersENDEnum InputsSTARTEnum AccumulatedDeltaBottomPressureEnum AccumulatedDeltaIceThicknessEnum AccumulatedDeltaTwsEnum AdjointEnum AdjointpEnum AdjointxEnum AdjointxBaseEnum AdjointxShearEnum AdjointyEnum AdjointyBaseEnum AdjointyShearEnum AdjointzEnum AgeEnum AirEnum ApproximationEnum BalancethicknessMisfitEnum BalancethicknessOmega0Enum BalancethicknessOmegaEnum BalancethicknessSpcthicknessEnum BalancethicknessThickeningRateEnum BasalCrevasseEnum BasalforcingsDeepwaterMeltingRateAutoregressionEnum BasalforcingsDeepwaterMeltingRateNoiseEnum BasalforcingsDeepwaterMeltingRateValuesAutoregressionEnum BasalforcingsFloatingiceMeltingRateEnum BasalforcingsGeothermalfluxEnum BasalforcingsGroundediceMeltingRateEnum BasalforcingsLinearBasinIdEnum BasalforcingsPerturbationMeltingRateEnum BasalforcingsSpatialDeepwaterElevationEnum BasalforcingsSpatialDeepwaterMeltingRateEnum BasalforcingsSpatialUpperwaterElevationEnum BasalforcingsSpatialUpperwaterMeltingRateEnum BasalforcingsIsmip6BasinIdEnum BasalforcingsIsmip6TfEnum BasalforcingsIsmip6TfShelfEnum BasalforcingsIsmip6MeltAnomalyEnum BasalforcingsMeltrateFactorEnum BasalforcingsOceanSalinityEnum BasalforcingsOceanTempEnum BasalforcingsPicoBasinIdEnum BasalforcingsPicoBoxIdEnum BasalforcingsPicoOverturningCoeffEnum BasalforcingsPicoSubShelfOceanOverturningEnum BasalforcingsPicoSubShelfOceanSalinityEnum BasalforcingsPicoSubShelfOceanTempEnum BasalStressxEnum BasalStressyEnum BasalStressEnum BaseEnum BaseOldEnum BaseSlopeXEnum BaseSlopeYEnum BaselineBasalforcingsFloatingiceMeltingRateEnum BaselineBasalforcingsSpatialDeepwaterMeltingRateEnum BaselineCalvingCalvingrateEnum BaselineFrictionEffectivePressureEnum BaselineSmbMassBalanceEnum BedEnum BedGRDEnum BedEastEnum BedEastGRDEnum BedNorthEnum BedNorthGRDEnum BedSlopeXEnum BedSlopeYEnum BottomPressureEnum BottomPressureOldEnum CalvingCalvingrateEnum CalvingHabFractionEnum CalvingAblationrateEnum CalvingMeltingrateEnum CalvingStressThresholdFloatingiceEnum CalvingStressThresholdGroundediceEnum CalvinglevermannCoeffEnum CalvingratexEnum CalvingrateyEnum CalvingFluxLevelsetEnum CalvingMeltingFluxLevelsetEnum ConvergedEnum CrevasseDepthEnum DamageDEnum DamageDOldEnum DamageDbarEnum DamageDbarOldEnum DamageFEnum DegreeOfChannelizationEnum DepthBelowSurfaceEnum DeltaIceThicknessEnum DeltaTwsEnum DeltaBottomPressureEnum DeltaDslEnum DslOldEnum DslEnum DeltaStrEnum StrOldEnum StrEnum DeviatoricStresseffectiveEnum DeviatoricStressxxEnum DeviatoricStressxyEnum DeviatoricStressxzEnum DeviatoricStressyyEnum DeviatoricStressyzEnum DeviatoricStresszzEnum DeviatoricStress1Enum DeviatoricStress2Enum DistanceToCalvingfrontEnum DistanceToGroundinglineEnum Domain2DhorizontalEnum Domain2DverticalEnum Domain3DEnum DragCoefficientAbsGradientEnum DrivingStressXEnum DrivingStressYEnum DummyEnum EffectivePressureEnum EffectivePressureSubstepEnum EffectivePressureTransientEnum EnthalpyEnum EnthalpyPicardEnum EplHeadEnum EplHeadOldEnum EplHeadSlopeXEnum EplHeadSlopeYEnum EplHeadSubstepEnum EplHeadTransientEnum EsaEmotionEnum EsaNmotionEnum EsaRotationrateEnum EsaStrainratexxEnum EsaStrainratexyEnum EsaStrainrateyyEnum EsaUmotionEnum EsaXmotionEnum EsaYmotionEnum EtaDiffEnum FlowequationBorderFSEnum FrictionAsEnum FrictionCEnum FrictionCmaxEnum FrictionCoefficientEnum FrictionCoefficientcoulombEnum FrictionCoulombWaterPressureEnum FrictionEffectivePressureEnum FrictionMEnum FrictionPEnum FrictionPressureAdjustedTemperatureEnum FrictionQEnum FrictionSedimentCompressibilityCoefficientEnum FrictionTillFrictionAngleEnum FrictionSchoofWaterPressureEnum FrictionWaterLayerEnum FrictionWaterPressureEnum FrictionfEnum FrontalForcingsBasinIdEnum FrontalForcingsSubglacialDischargeEnum FrontalForcingsThermalForcingEnum GeometryHydrostaticRatioEnum NGiaEnum NGiaRateEnum UGiaEnum UGiaRateEnum GradientEnum GroundinglineHeightEnum HydraulicPotentialEnum HydraulicPotentialOldEnum HydrologyBasalFluxEnum HydrologyBumpHeightEnum HydrologyBumpSpacingEnum HydrologydcBasalMoulinInputEnum HydrologydcEplThicknessEnum HydrologydcEplThicknessOldEnum HydrologydcEplThicknessSubstepEnum HydrologydcEplThicknessTransientEnum HydrologydcMaskEplactiveEltEnum HydrologydcMaskEplactiveNodeEnum HydrologydcMaskThawedEltEnum HydrologydcMaskThawedNodeEnum HydrologydcSedimentTransmitivityEnum HydrologyDrainageRateEnum HydrologyEnglacialInputEnum HydrologyGapHeightEnum HydrologyGapHeightXEnum HydrologyGapHeightXXEnum HydrologyGapHeightYEnum HydrologyGapHeightYYEnum HydrologyHeadEnum HydrologyHeadOldEnum HydrologyMoulinInputEnum HydrologyNeumannfluxEnum HydrologyReynoldsEnum HydrologySheetConductivityEnum HydrologySheetThicknessEnum HydrologySheetThicknessOldEnum HydrologyTwsEnum HydrologyTwsSpcEnum HydrologyTwsAnalysisEnum HydrologyWatercolumnMaxEnum HydrologyWaterVxEnum HydrologyWaterVyEnum IceEnum IceMaskNodeActivationEnum InputEnum InversionCostFunctionsCoefficientsEnum InversionSurfaceObsEnum InversionThicknessObsEnum InversionVelObsEnum InversionVxObsEnum InversionVyObsEnum LevelsetfunctionSlopeXEnum LevelsetfunctionSlopeYEnum LevelsetObservationEnum LoadingforceXEnum LoadingforceYEnum LoadingforceZEnum MaskOceanLevelsetEnum MaskIceLevelsetEnum MaskIceRefLevelsetEnum MasstransportSpcthicknessEnum MaterialsRheologyBEnum MaterialsRheologyBbarEnum MaterialsRheologyEEnum MaterialsRheologyEbarEnum MaterialsRheologyEcEnum MaterialsRheologyEcbarEnum MaterialsRheologyEsEnum MaterialsRheologyEsbarEnum MaterialsRheologyNEnum MeshScaleFactorEnum MeshVertexonbaseEnum MeshVertexonboundaryEnum MeshVertexonsurfaceEnum MisfitEnum MovingFrontalVxEnum MovingFrontalVyEnum NeumannfluxEnum NewDamageEnum NodeEnum OmegaAbsGradientEnum OceantransportSpcbottompressureEnum OceantransportSpcstrEnum OceantransportSpcdslEnum P0Enum P1Enum PartitioningEnum PressureEnum RadarEnum RadarAttenuationMacGregorEnum RadarAttenuationWolffEnum RadarIcePeriodEnum RadarPowerMacGregorEnum RadarPowerWolffEnum RheologyBAbsGradientEnum RheologyBInitialguessEnum RheologyBInitialguessMisfitEnum RheologyBbarAbsGradientEnum SampleEnum SampleOldEnum SampleNoiseEnum SamplingBetaEnum SamplingKappaEnum SamplingPhiEnum SamplingTauEnum SealevelEnum SealevelGRDEnum SatGraviGRDEnum SealevelBarystaticMaskEnum SealevelBarystaticIceMaskEnum SealevelBarystaticIceWeightsEnum SealevelBarystaticIceAreaEnum SealevelBarystaticIceLatbarEnum SealevelBarystaticIceLongbarEnum SealevelBarystaticIceLoadEnum SealevelBarystaticHydroMaskEnum SealevelBarystaticHydroWeightsEnum SealevelBarystaticHydroAreaEnum SealevelBarystaticHydroLatbarEnum SealevelBarystaticHydroLongbarEnum SealevelBarystaticHydroLoadEnum SealevelBarystaticBpMaskEnum SealevelBarystaticBpWeightsEnum SealevelBarystaticBpAreaEnum SealevelBarystaticBpLoadEnum SealevelBarystaticOceanMaskEnum SealevelBarystaticOceanWeightsEnum SealevelBarystaticOceanAreaEnum SealevelBarystaticOceanLatbarEnum SealevelBarystaticOceanLongbarEnum SealevelBarystaticOceanLoadEnum SealevelNEsaEnum SealevelNEsaRateEnum SealevelRSLEnum BslcEnum BslcIceEnum BslcHydroEnum BslcOceanEnum BslcRateEnum GmtslcEnum SealevelRSLBarystaticEnum SealevelRSLRateEnum SealevelUGrdEnum SealevelNGrdEnum SealevelUEastEsaEnum SealevelUNorthEsaEnum SealevelchangeIndicesEnum SealevelchangeAlphaIndexEnum SealevelchangeAzimuthIndexEnum SealevelchangeGrotEnum SealevelchangeGSatGravirotEnum SealevelchangeGUrotEnum SealevelchangeGNrotEnum SealevelchangeGErotEnum SealevelchangeAlphaIndexOceanEnum SealevelchangeAlphaIndexIceEnum SealevelchangeAlphaIndexHydroEnum SealevelchangeAzimuthIndexOceanEnum SealevelchangeAzimuthIndexIceEnum SealevelchangeAzimuthIndexHydroEnum SealevelchangeViscousRSLEnum SealevelchangeViscousSGEnum SealevelchangeViscousUEnum SealevelchangeViscousNEnum SealevelchangeViscousEEnum SedimentHeadEnum SedimentHeadOldEnum SedimentHeadSubstepEnum SedimentHeadTransientEnum SedimentHeadResidualEnum SedimentHeadStackedEnum SigmaNNEnum SigmaVMEnum SmbAccumulatedECEnum SmbAccumulatedMassBalanceEnum SmbAccumulatedMeltEnum SmbAccumulatedPrecipitationEnum SmbAccumulatedRainEnum SmbAccumulatedRefreezeEnum SmbAccumulatedRunoffEnum SmbAEnum SmbAdiffEnum SmbAValueEnum SmbAccumulationEnum SmbAdiffiniEnum SmbAiniEnum SmbAutoregressionNoiseEnum SmbBasinsIdEnum SmbBMaxEnum SmbBMinEnum SmbBNegEnum SmbBPosEnum SmbCEnum SmbCcsnowValueEnum SmbCciceValueEnum SmbCotValueEnum SmbDEnum SmbDailyairdensityEnum SmbDailyairhumidityEnum SmbDailydlradiationEnum SmbDailydsradiationEnum SmbDailypressureEnum SmbDailyrainfallEnum SmbDailysnowfallEnum SmbDailytemperatureEnum SmbDailywindspeedEnum SmbDiniEnum SmbDlwrfEnum SmbDulwrfValueEnum SmbDswrfEnum SmbDswdiffrfEnum SmbDzAddEnum SmbDzEnum SmbDzMinEnum SmbDzTopEnum SmbDziniEnum SmbEAirEnum SmbECEnum SmbECDtEnum SmbECiniEnum SmbElaEnum SmbEvaporationEnum SmbFACEnum SmbGdnEnum SmbGdniniEnum SmbGspEnum SmbGspiniEnum SmbHrefEnum SmbIsInitializedEnum SmbMAddEnum SmbMassBalanceEnum SmbMassBalanceSubstepEnum SmbMassBalanceTransientEnum SmbMeanLHFEnum SmbMeanSHFEnum SmbMeanULWEnum SmbMeltEnum SmbMonthlytemperaturesEnum SmbMSurfEnum SmbNetLWEnum SmbNetSWEnum SmbPAirEnum SmbPEnum SmbPddfacIceEnum SmbPddfacSnowEnum SmbPrecipitationEnum SmbPrecipitationsAnomalyEnum SmbPrecipitationsLgmEnum SmbPrecipitationsPresentdayEnum SmbPrecipitationsReconstructedEnum SmbRainEnum SmbReEnum SmbRefreezeEnum SmbReiniEnum SmbRunoffEnum SmbRunoffSubstepEnum SmbRunoffTransientEnum SmbS0gcmEnum SmbS0pEnum SmbS0tEnum SmbSizeiniEnum SmbSmbCorrEnum SmbSmbrefEnum SmbSzaValueEnum SmbTEnum SmbTaEnum SmbTeValueEnum SmbTemperaturesAnomalyEnum SmbTemperaturesLgmEnum SmbTemperaturesPresentdayEnum SmbTemperaturesReconstructedEnum SmbTiniEnum SmbTmeanEnum SmbTzEnum SmbValuesAutoregressionEnum SmbVEnum SmbVmeanEnum SmbVzEnum SmbWEnum SmbWAddEnum SmbWiniEnum SmbZMaxEnum SmbZMinEnum SmbZTopEnum SmbZYEnum SolidearthExternalDisplacementEastRateEnum SolidearthExternalDisplacementNorthRateEnum SolidearthExternalDisplacementUpRateEnum SolidearthExternalGeoidRateEnum StochasticForcingDefaultIdEnum StrainRateeffectiveEnum StrainRateparallelEnum StrainRateperpendicularEnum StrainRatexxEnum StrainRatexyEnum StrainRatexzEnum StrainRateyyEnum StrainRateyzEnum StrainRatezzEnum StressMaxPrincipalEnum StressTensorxxEnum StressTensorxyEnum StressTensorxzEnum StressTensoryyEnum StressTensoryzEnum StressTensorzzEnum SurfaceAbsMisfitEnum SurfaceAbsVelMisfitEnum AreaEnum SealevelAreaEnum SurfaceAreaEnum SurfaceAverageVelMisfitEnum SurfaceCrevasseEnum SurfaceEnum SurfaceOldEnum SurfaceLogVelMisfitEnum SurfaceLogVxVyMisfitEnum SurfaceObservationEnum SurfaceRelVelMisfitEnum SurfaceSlopeXEnum SurfaceSlopeYEnum TemperatureEnum TemperaturePDDEnum TemperaturePicardEnum TemperatureSEMICEnum ThermalforcingAutoregressionNoiseEnum ThermalforcingValuesAutoregressionEnum ThermalSpctemperatureEnum ThicknessAbsGradientEnum ThicknessAbsMisfitEnum ThicknessAcrossGradientEnum ThicknessAlongGradientEnum ThicknessEnum ThicknessOldEnum ThicknessPositiveEnum ThicknessResidualEnum TransientAccumulatedDeltaIceThicknessEnum VelEnum VxAverageEnum VxBaseEnum VxEnum VxMeshEnum VxObsEnum VxShearEnum VxSurfaceEnum VyAverageEnum VyBaseEnum VyEnum VyMeshEnum VyObsEnum VyShearEnum VySurfaceEnum VzEnum VzFSEnum VzHOEnum VzMeshEnum VzSSAEnum WaterColumnOldEnum WatercolumnEnum WaterfractionDrainageEnum WaterfractionDrainageIntegratedEnum WaterfractionEnum WaterheightEnum WeightsLevelsetObservationEnum WeightsSurfaceObservationEnum OldAccumulatedDeltaBottomPressureEnum OldAccumulatedDeltaIceThicknessEnum OldAccumulatedDeltaTwsEnum Outputdefinition1Enum Outputdefinition10Enum Outputdefinition11Enum Outputdefinition12Enum Outputdefinition13Enum Outputdefinition14Enum Outputdefinition15Enum Outputdefinition16Enum Outputdefinition17Enum Outputdefinition18Enum Outputdefinition19Enum Outputdefinition20Enum Outputdefinition21Enum Outputdefinition22Enum Outputdefinition23Enum Outputdefinition24Enum Outputdefinition25Enum Outputdefinition26Enum Outputdefinition27Enum Outputdefinition28Enum Outputdefinition29Enum Outputdefinition2Enum Outputdefinition30Enum Outputdefinition31Enum Outputdefinition32Enum Outputdefinition33Enum Outputdefinition34Enum Outputdefinition35Enum Outputdefinition36Enum Outputdefinition37Enum Outputdefinition38Enum Outputdefinition39Enum Outputdefinition3Enum Outputdefinition40Enum Outputdefinition41Enum Outputdefinition42Enum Outputdefinition43Enum Outputdefinition44Enum Outputdefinition45Enum Outputdefinition46Enum Outputdefinition47Enum Outputdefinition48Enum Outputdefinition49Enum Outputdefinition4Enum Outputdefinition50Enum Outputdefinition51Enum Outputdefinition52Enum Outputdefinition53Enum Outputdefinition54Enum Outputdefinition55Enum Outputdefinition56Enum Outputdefinition57Enum Outputdefinition58Enum Outputdefinition59Enum Outputdefinition5Enum Outputdefinition60Enum Outputdefinition61Enum Outputdefinition62Enum Outputdefinition63Enum Outputdefinition64Enum Outputdefinition65Enum Outputdefinition66Enum Outputdefinition67Enum Outputdefinition68Enum Outputdefinition69Enum Outputdefinition6Enum Outputdefinition70Enum Outputdefinition71Enum Outputdefinition72Enum Outputdefinition73Enum Outputdefinition74Enum Outputdefinition75Enum Outputdefinition76Enum Outputdefinition77Enum Outputdefinition78Enum Outputdefinition79Enum Outputdefinition7Enum Outputdefinition80Enum Outputdefinition81Enum Outputdefinition82Enum Outputdefinition83Enum Outputdefinition84Enum Outputdefinition85Enum Outputdefinition86Enum Outputdefinition87Enum Outputdefinition88Enum Outputdefinition89Enum Outputdefinition8Enum Outputdefinition90Enum Outputdefinition91Enum Outputdefinition92Enum Outputdefinition93Enum Outputdefinition94Enum Outputdefinition95Enum Outputdefinition96Enum Outputdefinition97Enum Outputdefinition98Enum Outputdefinition99Enum Outputdefinition9Enum Outputdefinition100Enum InputsENDEnum AbsoluteEnum AdaptiveTimesteppingEnum AdjointBalancethickness2AnalysisEnum AdjointBalancethicknessAnalysisEnum AdjointHorizAnalysisEnum AgeAnalysisEnum AggressiveMigrationEnum AmrBamgEnum AmrNeopzEnum AndroidFrictionCoefficientEnum ArrheniusEnum AutodiffJacobianEnum AutoregressionLinearFloatingMeltRateEnum Balancethickness2AnalysisEnum Balancethickness2SolutionEnum BalancethicknessAnalysisEnum BalancethicknessApparentMassbalanceEnum BalancethicknessSoftAnalysisEnum BalancethicknessSoftSolutionEnum BalancethicknessSolutionEnum BalancevelocityAnalysisEnum BalancevelocitySolutionEnum BasalforcingsIsmip6Enum BasalforcingsPicoEnum BeckmannGoosseFloatingMeltRateEnum BedSlopeSolutionEnum BoolExternalResultEnum BoolInputEnum IntInputEnum DoubleInputEnum BoolParamEnum BoundaryEnum BuddJackaEnum CalvingDev2Enum CalvingHabEnum CalvingLevermannEnum CalvingTestEnum CalvingParameterizationEnum CalvingVonmisesEnum CfdragcoeffabsgradEnum CfsurfacelogvelEnum CfsurfacesquareEnum CflevelsetmisfitEnum ChannelEnum ChannelAreaEnum ChannelAreaOldEnum ChannelDischargeEnum ClosedEnum ColinearEnum ConstraintsEnum ContactEnum ContourEnum ContoursEnum ControlInputEnum ControlInputGradEnum ControlInputMaxsEnum ControlInputMinsEnum ControlInputValuesEnum CrouzeixRaviartEnum CuffeyEnum CuffeyTemperateEnum DamageEvolutionAnalysisEnum DamageEvolutionSolutionEnum DataSetEnum DataSetParamEnum DatasetInputEnum DefaultAnalysisEnum DefaultCalvingEnum DenseEnum DependentObjectEnum DepthAverageAnalysisEnum DeviatoricStressErrorEstimatorEnum DivergenceEnum Domain3DsurfaceEnum DoubleArrayInputEnum ArrayInputEnum IntArrayInputEnum DoubleExternalResultEnum DoubleMatArrayParamEnum DoubleMatExternalResultEnum DoubleMatParamEnum DoubleParamEnum DoubleVecParamEnum ElementEnum ElementHookEnum ElementSIdEnum EnthalpyAnalysisEnum EsaAnalysisEnum EsaSolutionEnum EsaTransitionsEnum ExternalResultEnum ExtrapolationAnalysisEnum ExtrudeFromBaseAnalysisEnum ExtrudeFromTopAnalysisEnum FSApproximationEnum FSSolverEnum FSpressureEnum FSvelocityEnum FemModelEnum FileParamEnum FixedTimesteppingEnum FloatingAreaEnum FloatingAreaScaledEnum FloatingMeltRateEnum FreeEnum FreeSurfaceBaseAnalysisEnum FreeSurfaceTopAnalysisEnum FrontalForcingsDefaultEnum FrontalForcingsRignotEnum FrontalForcingsRignotAutoregressionEnum FsetEnum FullMeltOnPartiallyFloatingEnum GLheightadvectionAnalysisEnum GaussPentaEnum GaussSegEnum GaussTetraEnum GaussTriaEnum GenericOptionEnum GenericParamEnum GenericExternalResultEnum Gradient1Enum Gradient2Enum Gradient3Enum Gradient4Enum GroundedAreaEnum GroundedAreaScaledEnum GroundingOnlyEnum GroundinglineMassFluxEnum GsetEnum GslEnum HOApproximationEnum HOFSApproximationEnum HookEnum HydrologyDCEfficientAnalysisEnum HydrologyDCInefficientAnalysisEnum HydrologyGlaDSAnalysisEnum HydrologyGlaDSEnum HydrologyPismAnalysisEnum HydrologyShaktiAnalysisEnum HydrologyShreveAnalysisEnum HydrologySolutionEnum HydrologySubstepsEnum HydrologySubTimeEnum HydrologydcEnum HydrologypismEnum HydrologyshaktiEnum HydrologyshreveEnum IceMassEnum IceMassScaledEnum IceVolumeAboveFloatationEnum IceVolumeAboveFloatationScaledEnum IceVolumeEnum IceVolumeScaledEnum IcefrontMassFluxEnum IcefrontMassFluxLevelsetEnum IncrementalEnum IndexedEnum IntExternalResultEnum ElementInputEnum IntMatExternalResultEnum IntMatParamEnum IntParamEnum IntVecParamEnum InputsEnum InternalEnum IntersectEnum InversionVzObsEnum JEnum L1L2ApproximationEnum MOLHOApproximationEnum L2ProjectionBaseAnalysisEnum L2ProjectionEPLAnalysisEnum LACrouzeixRaviartEnum LATaylorHoodEnum LambdaSEnum LevelsetAnalysisEnum LevelsetfunctionPicardEnum LinearFloatingMeltRateEnum LliboutryDuvalEnum LoadsEnum LoveAnalysisEnum LoveHfEnum LoveHtEnum LoveKernelsImagEnum LoveKernelsRealEnum LoveKfEnum LoveKtEnum LoveLfEnum LoveLtEnum LoveTidalHtEnum LoveTidalKtEnum LoveTidalLtEnum LovePMTF1tEnum LovePMTF2tEnum LoveYiEnum LoveRhsEnum LoveSolutionEnum MINIEnum MINIcondensedEnum MantlePlumeGeothermalFluxEnum MassFluxEnum MassconEnum MassconaxpbyEnum MassfluxatgateEnum MasstransportAnalysisEnum MasstransportSolutionEnum MatdamageiceEnum MatenhancediceEnum MaterialsEnum MatestarEnum MaticeEnum MatlithoEnum MathydroEnum MatrixParamEnum MaxAbsVxEnum MaxAbsVyEnum MaxAbsVzEnum MaxDivergenceEnum MaxVelEnum MaxVxEnum MaxVyEnum MaxVzEnum MelangeEnum MeltingAnalysisEnum MeshElementsEnum MeshXEnum MeshYEnum MinVelEnum MinVxEnum MinVyEnum MinVzEnum MismipFloatingMeltRateEnum MoulinEnum MpiDenseEnum MpiEnum MpiSparseEnum MumpsEnum NoFrictionOnPartiallyFloatingEnum NoMeltOnPartiallyFloatingEnum NodalEnum NodalvalueEnum NodeSIdEnum NoneApproximationEnum NoneEnum NumberedcostfunctionEnum NyeCO2Enum NyeH2OEnum NumericalfluxEnum OceantransportAnalysisEnum OceantransportSolutionEnum OldGradientEnum OneLayerP4zEnum OpenEnum OptionEnum ParamEnum ParametersEnum P0ArrayEnum P0DGEnum P1DGEnum P1P1Enum P1P1GLSEnum P1bubbleEnum P1bubblecondensedEnum P1xP2Enum P1xP3Enum P1xP4Enum P2Enum P2bubbleEnum P2bubblecondensedEnum P2xP1Enum P2xP4Enum PatersonEnum PengridEnum PenpairEnum PentaEnum PentaInputEnum ProfilerEnum ProfilingCurrentFlopsEnum ProfilingCurrentMemEnum ProfilingSolutionTimeEnum RegionaloutputEnum RegularEnum RecoveryAnalysisEnum RiftfrontEnum SamplingAnalysisEnum SamplingSolutionEnum SIAApproximationEnum SMBautoregressionEnum SMBcomponentsEnum SMBd18opddEnum SMBforcingEnum SMBgcmEnum SMBgembEnum SMBgradientsEnum SMBgradientscomponentsEnum SMBgradientselaEnum SMBhenningEnum SMBmeltcomponentsEnum SMBpddEnum SMBpddSicopolisEnum SMBsemicEnum SSAApproximationEnum SSAFSApproximationEnum SSAHOApproximationEnum ScaledEnum SealevelAbsoluteEnum SealevelEmotionEnum SealevelchangePolarMotionXEnum SealevelchangePolarMotionYEnum SealevelchangePolarMotionZEnum SealevelchangePolarMotionEnum SealevelNmotionEnum SealevelUmotionEnum SealevelchangeAnalysisEnum SegEnum SegInputEnum SegmentEnum SegmentRiftfrontEnum SeparateEnum SeqEnum SmbAnalysisEnum SmbSolutionEnum SmoothAnalysisEnum SoftMigrationEnum SpatialLinearFloatingMeltRateEnum SpcDynamicEnum SpcStaticEnum SpcTransientEnum SsetEnum StatisticsSolutionEnum SteadystateSolutionEnum StressIntensityFactorEnum StressbalanceAnalysisEnum StressbalanceConvergenceNumStepsEnum StressbalanceSIAAnalysisEnum StressbalanceSolutionEnum StressbalanceVerticalAnalysisEnum StringArrayParamEnum StringExternalResultEnum StringParamEnum SubelementFriction1Enum SubelementFriction2Enum SubelementMelt1Enum SubelementMelt2Enum SubelementMigrationEnum SurfaceSlopeSolutionEnum TaylorHoodEnum TetraEnum TetraInputEnum ThermalAnalysisEnum ThermalSolutionEnum ThicknessErrorEstimatorEnum TotalCalvingFluxLevelsetEnum TotalCalvingMeltingFluxLevelsetEnum TotalFloatingBmbEnum TotalFloatingBmbScaledEnum TotalGroundedBmbEnum TotalGroundedBmbScaledEnum TotalSmbEnum TotalSmbScaledEnum TransientArrayParamEnum TransientInputEnum TransientParamEnum TransientSolutionEnum TriaEnum TriaInputEnum UzawaPressureAnalysisEnum VectorParamEnum VertexEnum VertexLIdEnum VertexPIdEnum VertexSIdEnum VerticesEnum ViscousHeatingEnum WaterEnum XTaylorHoodEnum XYEnum XYZEnum BalancethicknessD0Enum BalancethicknessDiffusionCoefficientEnum BilinearInterpEnum CalvingdevCoeffEnum DeviatoricStressEnum EtaAbsGradientEnum MeshZEnum NearestInterpEnum OutputdefinitionListEnum SealevelObsEnum SealevelWeightsEnum StrainRateEnum StressTensorEnum StressbalanceViscosityOvershootEnum SubelementMigration4Enum TimesteppingTimeAdaptEnum TriangleInterpEnum MaximumNumberOfDefinitionsEnum end function EnumToString(enum::IssmEnum) if(enum==ParametersSTARTEnum) return "ParametersSTART" end if(enum==AdolcParamEnum) return "AdolcParam" end if(enum==AgeStabilizationEnum) return "AgeStabilization" end if(enum==AgeNumRequestedOutputsEnum) return "AgeNumRequestedOutputs" end if(enum==AgeRequestedOutputsEnum) return "AgeRequestedOutputs" end if(enum==AmrDeviatoricErrorGroupThresholdEnum) return "AmrDeviatoricErrorGroupThreshold" end if(enum==AmrDeviatoricErrorMaximumEnum) return "AmrDeviatoricErrorMaximum" end if(enum==AmrDeviatoricErrorResolutionEnum) return "AmrDeviatoricErrorResolution" end if(enum==AmrDeviatoricErrorThresholdEnum) return "AmrDeviatoricErrorThreshold" end if(enum==AmrErrEnum) return "AmrErr" end if(enum==AmrFieldEnum) return "AmrField" end if(enum==AmrGradationEnum) return "AmrGradation" end if(enum==AmrGroundingLineDistanceEnum) return "AmrGroundingLineDistance" end if(enum==AmrGroundingLineResolutionEnum) return "AmrGroundingLineResolution" end if(enum==AmrHmaxEnum) return "AmrHmax" end if(enum==AmrHminEnum) return "AmrHmin" end if(enum==AmrIceFrontDistanceEnum) return "AmrIceFrontDistance" end if(enum==AmrIceFrontResolutionEnum) return "AmrIceFrontResolution" end if(enum==AmrKeepMetricEnum) return "AmrKeepMetric" end if(enum==AmrLagEnum) return "AmrLag" end if(enum==AmrLevelMaxEnum) return "AmrLevelMax" end if(enum==AmrRestartEnum) return "AmrRestart" end if(enum==AmrThicknessErrorGroupThresholdEnum) return "AmrThicknessErrorGroupThreshold" end if(enum==AmrThicknessErrorMaximumEnum) return "AmrThicknessErrorMaximum" end if(enum==AmrThicknessErrorResolutionEnum) return "AmrThicknessErrorResolution" end if(enum==AmrThicknessErrorThresholdEnum) return "AmrThicknessErrorThreshold" end if(enum==AmrTypeEnum) return "AmrType" end if(enum==AnalysisCounterEnum) return "AnalysisCounter" end if(enum==AnalysisTypeEnum) return "AnalysisType" end if(enum==AugmentedLagrangianREnum) return "AugmentedLagrangianR" end if(enum==AugmentedLagrangianRholambdaEnum) return "AugmentedLagrangianRholambda" end if(enum==AugmentedLagrangianRhopEnum) return "AugmentedLagrangianRhop" end if(enum==AugmentedLagrangianRlambdaEnum) return "AugmentedLagrangianRlambda" end if(enum==AugmentedLagrangianThetaEnum) return "AugmentedLagrangianTheta" end if(enum==AutodiffCbufsizeEnum) return "AutodiffCbufsize" end if(enum==AutodiffDependentObjectsEnum) return "AutodiffDependentObjects" end if(enum==AutodiffDriverEnum) return "AutodiffDriver" end if(enum==AutodiffFosForwardIndexEnum) return "AutodiffFosForwardIndex" end if(enum==AutodiffFosReverseIndexEnum) return "AutodiffFosReverseIndex" end if(enum==AutodiffFovForwardIndicesEnum) return "AutodiffFovForwardIndices" end if(enum==AutodiffGcTriggerMaxSizeEnum) return "AutodiffGcTriggerMaxSize" end if(enum==AutodiffGcTriggerRatioEnum) return "AutodiffGcTriggerRatio" end if(enum==AutodiffIsautodiffEnum) return "AutodiffIsautodiff" end if(enum==AutodiffLbufsizeEnum) return "AutodiffLbufsize" end if(enum==AutodiffNumDependentsEnum) return "AutodiffNumDependents" end if(enum==AutodiffNumIndependentsEnum) return "AutodiffNumIndependents" end if(enum==AutodiffObufsizeEnum) return "AutodiffObufsize" end if(enum==AutodiffTapeAllocEnum) return "AutodiffTapeAlloc" end if(enum==AutodiffTbufsizeEnum) return "AutodiffTbufsize" end if(enum==AutodiffXpEnum) return "AutodiffXp" end if(enum==BalancethicknessStabilizationEnum) return "BalancethicknessStabilization" end if(enum==BarystaticContributionsEnum) return "BarystaticContributions" end if(enum==BasalforcingsAutoregressionInitialTimeEnum) return "BasalforcingsAutoregressionInitialTime" end if(enum==BasalforcingsAutoregressionTimestepEnum) return "BasalforcingsAutoregressionTimestep" end if(enum==BasalforcingsAutoregressiveOrderEnum) return "BasalforcingsAutoregressiveOrder" end if(enum==BasalforcingsBeta0Enum) return "BasalforcingsBeta0" end if(enum==BasalforcingsBeta1Enum) return "BasalforcingsBeta1" end if(enum==BasalforcingsBottomplumedepthEnum) return "BasalforcingsBottomplumedepth" end if(enum==BasalforcingsCrustthicknessEnum) return "BasalforcingsCrustthickness" end if(enum==BasalforcingsDeepwaterElevationEnum) return "BasalforcingsDeepwaterElevation" end if(enum==BasalforcingsDeepwaterMeltingRateEnum) return "BasalforcingsDeepwaterMeltingRate" end if(enum==BasalforcingsDtbgEnum) return "BasalforcingsDtbg" end if(enum==BasalforcingsEnum) return "Basalforcings" end if(enum==BasalforcingsIsmip6AverageTfEnum) return "BasalforcingsIsmip6AverageTf" end if(enum==BasalforcingsIsmip6BasinAreaEnum) return "BasalforcingsIsmip6BasinArea" end if(enum==BasalforcingsIsmip6DeltaTEnum) return "BasalforcingsIsmip6DeltaT" end if(enum==BasalforcingsIsmip6Gamma0Enum) return "BasalforcingsIsmip6Gamma0" end if(enum==BasalforcingsIsmip6IsLocalEnum) return "BasalforcingsIsmip6IsLocal" end if(enum==BasalforcingsIsmip6NumBasinsEnum) return "BasalforcingsIsmip6NumBasins" end if(enum==BasalforcingsIsmip6TfDepthsEnum) return "BasalforcingsIsmip6TfDepths" end if(enum==BasalforcingsLinearNumBasinsEnum) return "BasalforcingsLinearNumBasins" end if(enum==BasalforcingsLowercrustheatEnum) return "BasalforcingsLowercrustheat" end if(enum==BasalforcingsMantleconductivityEnum) return "BasalforcingsMantleconductivity" end if(enum==BasalforcingsNusseltEnum) return "BasalforcingsNusselt" end if(enum==BasalforcingsPhiEnum) return "BasalforcingsPhi" end if(enum==BasalforcingsPicoAverageOverturningEnum) return "BasalforcingsPicoAverageOverturning" end if(enum==BasalforcingsPicoAverageSalinityEnum) return "BasalforcingsPicoAverageSalinity" end if(enum==BasalforcingsPicoAverageTemperatureEnum) return "BasalforcingsPicoAverageTemperature" end if(enum==BasalforcingsPicoBoxAreaEnum) return "BasalforcingsPicoBoxArea" end if(enum==BasalforcingsPicoFarOceansalinityEnum) return "BasalforcingsPicoFarOceansalinity" end if(enum==BasalforcingsPicoFarOceantemperatureEnum) return "BasalforcingsPicoFarOceantemperature" end if(enum==BasalforcingsPicoGammaTEnum) return "BasalforcingsPicoGammaT" end if(enum==BasalforcingsPicoIsplumeEnum) return "BasalforcingsPicoIsplume" end if(enum==BasalforcingsPicoMaxboxcountEnum) return "BasalforcingsPicoMaxboxcount" end if(enum==BasalforcingsPicoNumBasinsEnum) return "BasalforcingsPicoNumBasins" end if(enum==BasalforcingsPlumeradiusEnum) return "BasalforcingsPlumeradius" end if(enum==BasalforcingsPlumexEnum) return "BasalforcingsPlumex" end if(enum==BasalforcingsPlumeyEnum) return "BasalforcingsPlumey" end if(enum==BasalforcingsThresholdThicknessEnum) return "BasalforcingsThresholdThickness" end if(enum==BasalforcingsTopplumedepthEnum) return "BasalforcingsTopplumedepth" end if(enum==BasalforcingsUppercrustheatEnum) return "BasalforcingsUppercrustheat" end if(enum==BasalforcingsUppercrustthicknessEnum) return "BasalforcingsUppercrustthickness" end if(enum==BasalforcingsUpperdepthMeltEnum) return "BasalforcingsUpperdepthMelt" end if(enum==BasalforcingsUpperwaterElevationEnum) return "BasalforcingsUpperwaterElevation" end if(enum==BasalforcingsUpperwaterMeltingRateEnum) return "BasalforcingsUpperwaterMeltingRate" end if(enum==CalvingCrevasseDepthEnum) return "CalvingCrevasseDepth" end if(enum==CalvingCrevasseThresholdEnum) return "CalvingCrevasseThreshold" end if(enum==CalvingHeightAboveFloatationEnum) return "CalvingHeightAboveFloatation" end if(enum==CalvingLawEnum) return "CalvingLaw" end if(enum==CalvingMinthicknessEnum) return "CalvingMinthickness" end if(enum==CalvingTestSpeedfactorEnum) return "CalvingTestSpeedfactor" end if(enum==CalvingTestIndependentRateEnum) return "CalvingTestIndependentRate" end if(enum==CalvingUseParamEnum) return "CalvingUseParam" end if(enum==CalvingThetaEnum) return "CalvingTheta" end if(enum==CalvingAlphaEnum) return "CalvingAlpha" end if(enum==CalvingXoffsetEnum) return "CalvingXoffset" end if(enum==CalvingYoffsetEnum) return "CalvingYoffset" end if(enum==CalvingVelLowerboundEnum) return "CalvingVelLowerbound" end if(enum==CalvingVelUpperboundEnum) return "CalvingVelUpperbound" end if(enum==ConfigurationTypeEnum) return "ConfigurationType" end if(enum==ConstantsGEnum) return "ConstantsG" end if(enum==ConstantsNewtonGravityEnum) return "ConstantsNewtonGravity" end if(enum==ConstantsReferencetemperatureEnum) return "ConstantsReferencetemperature" end if(enum==ConstantsYtsEnum) return "ConstantsYts" end if(enum==ControlInputSizeMEnum) return "ControlInputSizeM" end if(enum==ControlInputSizeNEnum) return "ControlInputSizeN" end if(enum==ControlInputInterpolationEnum) return "ControlInputInterpolation" end if(enum==CumBslcEnum) return "CumBslc" end if(enum==CumBslcIceEnum) return "CumBslcIce" end if(enum==CumBslcHydroEnum) return "CumBslcHydro" end if(enum==CumBslcOceanEnum) return "CumBslcOcean" end if(enum==CumBslcIcePartitionEnum) return "CumBslcIcePartition" end if(enum==CumBslcHydroPartitionEnum) return "CumBslcHydroPartition" end if(enum==CumBslcOceanPartitionEnum) return "CumBslcOceanPartition" end if(enum==CumGmtslcEnum) return "CumGmtslc" end if(enum==CumGmslcEnum) return "CumGmslc" end if(enum==DamageC1Enum) return "DamageC1" end if(enum==DamageC2Enum) return "DamageC2" end if(enum==DamageC3Enum) return "DamageC3" end if(enum==DamageC4Enum) return "DamageC4" end if(enum==DamageEnum) return "Damage" end if(enum==DamageEquivStressEnum) return "DamageEquivStress" end if(enum==DamageEvolutionNumRequestedOutputsEnum) return "DamageEvolutionNumRequestedOutputs" end if(enum==DamageEvolutionRequestedOutputsEnum) return "DamageEvolutionRequestedOutputs" end if(enum==DamageHealingEnum) return "DamageHealing" end if(enum==DamageKappaEnum) return "DamageKappa" end if(enum==DamageLawEnum) return "DamageLaw" end if(enum==DamageMaxDamageEnum) return "DamageMaxDamage" end if(enum==DamageStabilizationEnum) return "DamageStabilization" end if(enum==DamageStressThresholdEnum) return "DamageStressThreshold" end if(enum==DamageStressUBoundEnum) return "DamageStressUBound" end if(enum==DebugProfilingEnum) return "DebugProfiling" end if(enum==DomainDimensionEnum) return "DomainDimension" end if(enum==DomainTypeEnum) return "DomainType" end if(enum==DslModelEnum) return "DslModel" end if(enum==DslModelidEnum) return "DslModelid" end if(enum==DslNummodelsEnum) return "DslNummodels" end if(enum==SolidearthIsExternalEnum) return "SolidearthIsExternal" end if(enum==SolidearthExternalNatureEnum) return "SolidearthExternalNature" end if(enum==SolidearthExternalModelidEnum) return "SolidearthExternalModelid" end if(enum==SolidearthExternalNummodelsEnum) return "SolidearthExternalNummodels" end if(enum==SolidearthSettingsComputeBpGrdEnum) return "SolidearthSettingsComputeBpGrd" end if(enum==EarthIdEnum) return "EarthId" end if(enum==ElasticEnum) return "Elastic" end if(enum==EplZigZagCounterEnum) return "EplZigZagCounter" end if(enum==EsaHElasticEnum) return "EsaHElastic" end if(enum==EsaHemisphereEnum) return "EsaHemisphere" end if(enum==EsaRequestedOutputsEnum) return "EsaRequestedOutputs" end if(enum==EsaUElasticEnum) return "EsaUElastic" end if(enum==ExtrapolationVariableEnum) return "ExtrapolationVariable" end if(enum==FemModelCommEnum) return "FemModelComm" end if(enum==FieldsEnum) return "Fields" end if(enum==FlowequationFeFSEnum) return "FlowequationFeFS" end if(enum==FlowequationIsFSEnum) return "FlowequationIsFS" end if(enum==FlowequationIsHOEnum) return "FlowequationIsHO" end if(enum==FlowequationIsL1L2Enum) return "FlowequationIsL1L2" end if(enum==FlowequationIsMOLHOEnum) return "FlowequationIsMOLHO" end if(enum==FlowequationIsSIAEnum) return "FlowequationIsSIA" end if(enum==FlowequationIsSSAEnum) return "FlowequationIsSSA" end if(enum==FlowequationIsNitscheEnum) return "FlowequationIsNitsche" end if(enum==FeFSNitscheGammaEnum) return "FeFSNitscheGamma" end if(enum==FrictionCouplingEnum) return "FrictionCoupling" end if(enum==FrictionDeltaEnum) return "FrictionDelta" end if(enum==FrictionEffectivePressureLimitEnum) return "FrictionEffectivePressureLimit" end if(enum==FrictionFEnum) return "FrictionF" end if(enum==FrictionGammaEnum) return "FrictionGamma" end if(enum==FrictionLawEnum) return "FrictionLaw" end if(enum==FrictionPseudoplasticityExponentEnum) return "FrictionPseudoplasticityExponent" end if(enum==FrictionThresholdSpeedEnum) return "FrictionThresholdSpeed" end if(enum==FrictionVoidRatioEnum) return "FrictionVoidRatio" end if(enum==FrontalForcingsBasinIcefrontAreaEnum) return "FrontalForcingsBasinIcefrontArea" end if(enum==FrontalForcingsAutoregressionInitialTimeEnum) return "FrontalForcingsAutoregressionInitialTime" end if(enum==FrontalForcingsAutoregressionTimestepEnum) return "FrontalForcingsAutoregressionTimestep" end if(enum==FrontalForcingsAutoregressiveOrderEnum) return "FrontalForcingsAutoregressiveOrder" end if(enum==FrontalForcingsBeta0Enum) return "FrontalForcingsBeta0" end if(enum==FrontalForcingsBeta1Enum) return "FrontalForcingsBeta1" end if(enum==FrontalForcingsNumberofBasinsEnum) return "FrontalForcingsNumberofBasins" end if(enum==FrontalForcingsParamEnum) return "FrontalForcingsParam" end if(enum==FrontalForcingsPhiEnum) return "FrontalForcingsPhi" end if(enum==GrdModelEnum) return "GrdModel" end if(enum==GroundinglineFrictionInterpolationEnum) return "GroundinglineFrictionInterpolation" end if(enum==GroundinglineMeltInterpolationEnum) return "GroundinglineMeltInterpolation" end if(enum==GroundinglineMigrationEnum) return "GroundinglineMigration" end if(enum==GroundinglineNumRequestedOutputsEnum) return "GroundinglineNumRequestedOutputs" end if(enum==GroundinglineRequestedOutputsEnum) return "GroundinglineRequestedOutputs" end if(enum==HydrologyAveragingEnum) return "HydrologyAveraging" end if(enum==HydrologyCavitySpacingEnum) return "HydrologyCavitySpacing" end if(enum==HydrologyChannelConductivityEnum) return "HydrologyChannelConductivity" end if(enum==HydrologyChannelSheetWidthEnum) return "HydrologyChannelSheetWidth" end if(enum==HydrologyEnglacialVoidRatioEnum) return "HydrologyEnglacialVoidRatio" end if(enum==HydrologyIschannelsEnum) return "HydrologyIschannels" end if(enum==HydrologyMeltFlagEnum) return "HydrologyMeltFlag" end if(enum==HydrologyModelEnum) return "HydrologyModel" end if(enum==HydrologyNumRequestedOutputsEnum) return "HydrologyNumRequestedOutputs" end if(enum==HydrologyPressureMeltCoefficientEnum) return "HydrologyPressureMeltCoefficient" end if(enum==HydrologyRelaxationEnum) return "HydrologyRelaxation" end if(enum==HydrologyRequestedOutputsEnum) return "HydrologyRequestedOutputs" end if(enum==HydrologySedimentKmaxEnum) return "HydrologySedimentKmax" end if(enum==HydrologyStepsPerStepEnum) return "HydrologyStepsPerStep" end if(enum==HydrologyStorageEnum) return "HydrologyStorage" end if(enum==HydrologydcEplColapseThicknessEnum) return "HydrologydcEplColapseThickness" end if(enum==HydrologydcEplConductivityEnum) return "HydrologydcEplConductivity" end if(enum==HydrologydcEplInitialThicknessEnum) return "HydrologydcEplInitialThickness" end if(enum==HydrologydcEplLayerCompressibilityEnum) return "HydrologydcEplLayerCompressibility" end if(enum==HydrologydcEplMaxThicknessEnum) return "HydrologydcEplMaxThickness" end if(enum==HydrologydcEplPoreWaterMassEnum) return "HydrologydcEplPoreWaterMass" end if(enum==HydrologydcEplThickCompEnum) return "HydrologydcEplThickComp" end if(enum==HydrologydcEplflipLockEnum) return "HydrologydcEplflipLock" end if(enum==HydrologydcIsefficientlayerEnum) return "HydrologydcIsefficientlayer" end if(enum==HydrologydcLeakageFactorEnum) return "HydrologydcLeakageFactor" end if(enum==HydrologydcMaxIterEnum) return "HydrologydcMaxIter" end if(enum==HydrologydcPenaltyFactorEnum) return "HydrologydcPenaltyFactor" end if(enum==HydrologydcPenaltyLockEnum) return "HydrologydcPenaltyLock" end if(enum==HydrologydcRelTolEnum) return "HydrologydcRelTol" end if(enum==HydrologydcSedimentlimitEnum) return "HydrologydcSedimentlimit" end if(enum==HydrologydcSedimentlimitFlagEnum) return "HydrologydcSedimentlimitFlag" end if(enum==HydrologydcSedimentLayerCompressibilityEnum) return "HydrologydcSedimentLayerCompressibility" end if(enum==HydrologydcSedimentPoreWaterMassEnum) return "HydrologydcSedimentPoreWaterMass" end if(enum==HydrologydcSedimentPorosityEnum) return "HydrologydcSedimentPorosity" end if(enum==HydrologydcSedimentThicknessEnum) return "HydrologydcSedimentThickness" end if(enum==HydrologyStepAdaptEnum) return "HydrologyStepAdapt" end if(enum==HydrologydcTransferFlagEnum) return "HydrologydcTransferFlag" end if(enum==HydrologydcUnconfinedFlagEnum) return "HydrologydcUnconfinedFlag" end if(enum==HydrologyshreveStabilizationEnum) return "HydrologyshreveStabilization" end if(enum==IcecapToEarthCommEnum) return "IcecapToEarthComm" end if(enum==IndexEnum) return "Index" end if(enum==InputFileNameEnum) return "InputFileName" end if(enum==DirectoryNameEnum) return "DirectoryName" end if(enum==IndicesEnum) return "Indices" end if(enum==InputToDepthaverageInEnum) return "InputToDepthaverageIn" end if(enum==InputToDepthaverageOutEnum) return "InputToDepthaverageOut" end if(enum==InputToExtrudeEnum) return "InputToExtrude" end if(enum==InputToL2ProjectEnum) return "InputToL2Project" end if(enum==InputToSmoothEnum) return "InputToSmooth" end if(enum==InversionAlgorithmEnum) return "InversionAlgorithm" end if(enum==InversionControlParametersEnum) return "InversionControlParameters" end if(enum==InversionControlScalingFactorsEnum) return "InversionControlScalingFactors" end if(enum==InversionCostFunctionsEnum) return "InversionCostFunctions" end if(enum==InversionDxminEnum) return "InversionDxmin" end if(enum==InversionGatolEnum) return "InversionGatol" end if(enum==InversionGradientScalingEnum) return "InversionGradientScaling" end if(enum==InversionGrtolEnum) return "InversionGrtol" end if(enum==InversionGttolEnum) return "InversionGttol" end if(enum==InversionIncompleteAdjointEnum) return "InversionIncompleteAdjoint" end if(enum==InversionIscontrolEnum) return "InversionIscontrol" end if(enum==InversionMaxiterEnum) return "InversionMaxiter" end if(enum==InversionMaxiterPerStepEnum) return "InversionMaxiterPerStep" end if(enum==InversionMaxstepsEnum) return "InversionMaxsteps" end if(enum==InversionNstepsEnum) return "InversionNsteps" end if(enum==InversionNumControlParametersEnum) return "InversionNumControlParameters" end if(enum==InversionNumCostFunctionsEnum) return "InversionNumCostFunctions" end if(enum==InversionStepThresholdEnum) return "InversionStepThreshold" end if(enum==InversionTypeEnum) return "InversionType" end if(enum==IvinsEnum) return "Ivins" end if(enum==IsSlcCouplingEnum) return "IsSlcCoupling" end if(enum==LevelsetKillIcebergsEnum) return "LevelsetKillIcebergs" end if(enum==LevelsetReinitFrequencyEnum) return "LevelsetReinitFrequency" end if(enum==LevelsetStabilizationEnum) return "LevelsetStabilization" end if(enum==LockFileNameEnum) return "LockFileName" end if(enum==LoveAllowLayerDeletionEnum) return "LoveAllowLayerDeletion" end if(enum==LoveChandlerWobbleEnum) return "LoveChandlerWobble" end if(enum==LoveCoreMantleBoundaryEnum) return "LoveCoreMantleBoundary" end if(enum==LoveEarthMassEnum) return "LoveEarthMass" end if(enum==LoveForcingTypeEnum) return "LoveForcingType" end if(enum==LoveFrequenciesEnum) return "LoveFrequencies" end if(enum==LoveIsTemporalEnum) return "LoveIsTemporal" end if(enum==LoveG0Enum) return "LoveG0" end if(enum==LoveGravitationalConstantEnum) return "LoveGravitationalConstant" end if(enum==LoveInnerCoreBoundaryEnum) return "LoveInnerCoreBoundary" end if(enum==LoveComplexComputationEnum) return "LoveComplexComputation" end if(enum==LoveQuadPrecisionEnum) return "LoveQuadPrecision" end if(enum==LoveIntStepsPerLayerEnum) return "LoveIntStepsPerLayer" end if(enum==LoveMinIntegrationStepsEnum) return "LoveMinIntegrationSteps" end if(enum==LoveMaxIntegrationdrEnum) return "LoveMaxIntegrationdr" end if(enum==LoveKernelsEnum) return "LoveKernels" end if(enum==LoveMu0Enum) return "LoveMu0" end if(enum==LoveNfreqEnum) return "LoveNfreq" end if(enum==LoveNTemporalIterationsEnum) return "LoveNTemporalIterations" end if(enum==LoveNYiEquationsEnum) return "LoveNYiEquations" end if(enum==LoveR0Enum) return "LoveR0" end if(enum==LoveShNmaxEnum) return "LoveShNmax" end if(enum==LoveShNminEnum) return "LoveShNmin" end if(enum==LoveStartingLayerEnum) return "LoveStartingLayer" end if(enum==LoveUnderflowTolEnum) return "LoveUnderflowTol" end if(enum==LovePostWidderThresholdEnum) return "LovePostWidderThreshold" end if(enum==LoveDebugEnum) return "LoveDebug" end if(enum==LoveHypergeomNZEnum) return "LoveHypergeomNZ" end if(enum==LoveHypergeomNAlphaEnum) return "LoveHypergeomNAlpha" end if(enum==MassFluxSegmentsEnum) return "MassFluxSegments" end if(enum==MassFluxSegmentsPresentEnum) return "MassFluxSegmentsPresent" end if(enum==MasstransportHydrostaticAdjustmentEnum) return "MasstransportHydrostaticAdjustment" end if(enum==MasstransportIsfreesurfaceEnum) return "MasstransportIsfreesurface" end if(enum==MasstransportMinThicknessEnum) return "MasstransportMinThickness" end if(enum==MasstransportNumRequestedOutputsEnum) return "MasstransportNumRequestedOutputs" end if(enum==MasstransportPenaltyFactorEnum) return "MasstransportPenaltyFactor" end if(enum==MasstransportRequestedOutputsEnum) return "MasstransportRequestedOutputs" end if(enum==MasstransportStabilizationEnum) return "MasstransportStabilization" end if(enum==MaterialsBetaEnum) return "MaterialsBeta" end if(enum==MaterialsEarthDensityEnum) return "MaterialsEarthDensity" end if(enum==MaterialsEffectiveconductivityAveragingEnum) return "MaterialsEffectiveconductivityAveraging" end if(enum==MaterialsHeatcapacityEnum) return "MaterialsHeatcapacity" end if(enum==MaterialsLatentheatEnum) return "MaterialsLatentheat" end if(enum==MaterialsMeltingpointEnum) return "MaterialsMeltingpoint" end if(enum==MaterialsMixedLayerCapacityEnum) return "MaterialsMixedLayerCapacity" end if(enum==MaterialsMuWaterEnum) return "MaterialsMuWater" end if(enum==MaterialsRheologyLawEnum) return "MaterialsRheologyLaw" end if(enum==MaterialsRhoFreshwaterEnum) return "MaterialsRhoFreshwater" end if(enum==MaterialsRhoIceEnum) return "MaterialsRhoIce" end if(enum==MaterialsRhoSeawaterEnum) return "MaterialsRhoSeawater" end if(enum==MaterialsTemperateiceconductivityEnum) return "MaterialsTemperateiceconductivity" end if(enum==MaterialsThermalExchangeVelocityEnum) return "MaterialsThermalExchangeVelocity" end if(enum==MaterialsThermalconductivityEnum) return "MaterialsThermalconductivity" end if(enum==MeltingOffsetEnum) return "MeltingOffset" end if(enum==MeshAverageVertexConnectivityEnum) return "MeshAverageVertexConnectivity" end if(enum==MeshElementtypeEnum) return "MeshElementtype" end if(enum==MeshNumberoflayersEnum) return "MeshNumberoflayers" end if(enum==MeshNumberofverticesEnum) return "MeshNumberofvertices" end if(enum==MeshNumberofelementsEnum) return "MeshNumberofelements" end if(enum==MigrationMaxEnum) return "MigrationMax" end if(enum==ModelIdEnum) return "ModelId" end if(enum==NbinsEnum) return "Nbins" end if(enum==NodesEnum) return "Nodes" end if(enum==NumModelsEnum) return "NumModels" end if(enum==OceanGridNxEnum) return "OceanGridNx" end if(enum==OceanGridNyEnum) return "OceanGridNy" end if(enum==OceanGridXEnum) return "OceanGridX" end if(enum==OceanGridYEnum) return "OceanGridY" end if(enum==OutputBufferPointerEnum) return "OutputBufferPointer" end if(enum==OutputBufferSizePointerEnum) return "OutputBufferSizePointer" end if(enum==OutputFileNameEnum) return "OutputFileName" end if(enum==OutputFilePointerEnum) return "OutputFilePointer" end if(enum==OutputdefinitionEnum) return "Outputdefinition" end if(enum==QmuErrNameEnum) return "QmuErrName" end if(enum==QmuInNameEnum) return "QmuInName" end if(enum==QmuIsdakotaEnum) return "QmuIsdakota" end if(enum==QmuOutNameEnum) return "QmuOutName" end if(enum==QmuOutputEnum) return "QmuOutput" end if(enum==QmuCurrEvalIdEnum) return "QmuCurrEvalId" end if(enum==QmuNsampleEnum) return "QmuNsample" end if(enum==QmuResponsedescriptorsEnum) return "QmuResponsedescriptors" end if(enum==QmuVariableDescriptorsEnum) return "QmuVariableDescriptors" end if(enum==QmuVariablePartitionsEnum) return "QmuVariablePartitions" end if(enum==QmuVariablePartitionsNpartEnum) return "QmuVariablePartitionsNpart" end if(enum==QmuVariablePartitionsNtEnum) return "QmuVariablePartitionsNt" end if(enum==QmuResponsePartitionsEnum) return "QmuResponsePartitions" end if(enum==QmuResponsePartitionsNpartEnum) return "QmuResponsePartitionsNpart" end if(enum==QmuStatisticsEnum) return "QmuStatistics" end if(enum==QmuNumstatisticsEnum) return "QmuNumstatistics" end if(enum==QmuNdirectoriesEnum) return "QmuNdirectories" end if(enum==QmuNfilesPerDirectoryEnum) return "QmuNfilesPerDirectory" end if(enum==QmuStatisticsMethodEnum) return "QmuStatisticsMethod" end if(enum==QmuMethodsEnum) return "QmuMethods" end if(enum==RestartFileNameEnum) return "RestartFileName" end if(enum==ResultsEnum) return "Results" end if(enum==RootPathEnum) return "RootPath" end if(enum==ModelnameEnum) return "Modelname" end if(enum==SamplingAlphaEnum) return "SamplingAlpha" end if(enum==SamplingNumRequestedOutputsEnum) return "SamplingNumRequestedOutputs" end if(enum==SamplingRequestedOutputsEnum) return "SamplingRequestedOutputs" end if(enum==SamplingRobinEnum) return "SamplingRobin" end if(enum==SamplingSeedEnum) return "SamplingSeed" end if(enum==SaveResultsEnum) return "SaveResults" end if(enum==SolidearthPartitionIceEnum) return "SolidearthPartitionIce" end if(enum==SolidearthPartitionHydroEnum) return "SolidearthPartitionHydro" end if(enum==SolidearthPartitionOceanEnum) return "SolidearthPartitionOcean" end if(enum==SolidearthNpartIceEnum) return "SolidearthNpartIce" end if(enum==SolidearthNpartOceanEnum) return "SolidearthNpartOcean" end if(enum==SolidearthNpartHydroEnum) return "SolidearthNpartHydro" end if(enum==SolidearthPlanetRadiusEnum) return "SolidearthPlanetRadius" end if(enum==SolidearthPlanetAreaEnum) return "SolidearthPlanetArea" end if(enum==SolidearthSettingsAbstolEnum) return "SolidearthSettingsAbstol" end if(enum==SolidearthSettingsCrossSectionShapeEnum) return "SolidearthSettingsCrossSectionShape" end if(enum==SolidearthSettingsElasticEnum) return "SolidearthSettingsElastic" end if(enum==SolidearthSettingsViscousEnum) return "SolidearthSettingsViscous" end if(enum==SolidearthSettingsSatelliteGraviEnum) return "SolidearthSettingsSatelliteGravi" end if(enum==SolidearthSettingsDegreeAccuracyEnum) return "SolidearthSettingsDegreeAccuracy" end if(enum==SealevelchangeGeometryDoneEnum) return "SealevelchangeGeometryDone" end if(enum==SealevelchangeViscousNumStepsEnum) return "SealevelchangeViscousNumSteps" end if(enum==SealevelchangeViscousTimesEnum) return "SealevelchangeViscousTimes" end if(enum==SealevelchangeViscousIndexEnum) return "SealevelchangeViscousIndex" end if(enum==SealevelchangeViscousPolarMotionEnum) return "SealevelchangeViscousPolarMotion" end if(enum==SealevelchangeRunCountEnum) return "SealevelchangeRunCount" end if(enum==SealevelchangeTransitionsEnum) return "SealevelchangeTransitions" end if(enum==SealevelchangeRequestedOutputsEnum) return "SealevelchangeRequestedOutputs" end if(enum==RotationalAngularVelocityEnum) return "RotationalAngularVelocity" end if(enum==RotationalEquatorialMoiEnum) return "RotationalEquatorialMoi" end if(enum==RotationalPolarMoiEnum) return "RotationalPolarMoi" end if(enum==LovePolarMotionTransferFunctionColinearEnum) return "LovePolarMotionTransferFunctionColinear" end if(enum==LovePolarMotionTransferFunctionOrthogonalEnum) return "LovePolarMotionTransferFunctionOrthogonal" end if(enum==TidalLoveHEnum) return "TidalLoveH" end if(enum==TidalLoveKEnum) return "TidalLoveK" end if(enum==TidalLoveLEnum) return "TidalLoveL" end if(enum==TidalLoveK2SecularEnum) return "TidalLoveK2Secular" end if(enum==LoadLoveHEnum) return "LoadLoveH" end if(enum==LoadLoveKEnum) return "LoadLoveK" end if(enum==LoadLoveLEnum) return "LoadLoveL" end if(enum==LoveTimeFreqEnum) return "LoveTimeFreq" end if(enum==LoveIsTimeEnum) return "LoveIsTime" end if(enum==LoveHypergeomZEnum) return "LoveHypergeomZ" end if(enum==LoveHypergeomTable1Enum) return "LoveHypergeomTable1" end if(enum==LoveHypergeomTable2Enum) return "LoveHypergeomTable2" end if(enum==SealevelchangeGSelfAttractionEnum) return "SealevelchangeGSelfAttraction" end if(enum==SealevelchangeGViscoElasticEnum) return "SealevelchangeGViscoElastic" end if(enum==SealevelchangeUViscoElasticEnum) return "SealevelchangeUViscoElastic" end if(enum==SealevelchangeHViscoElasticEnum) return "SealevelchangeHViscoElastic" end if(enum==SealevelchangePolarMotionTransferFunctionColinearEnum) return "SealevelchangePolarMotionTransferFunctionColinear" end if(enum==SealevelchangePolarMotionTransferFunctionOrthogonalEnum) return "SealevelchangePolarMotionTransferFunctionOrthogonal" end if(enum==SealevelchangePolarMotionTransferFunctionZEnum) return "SealevelchangePolarMotionTransferFunctionZ" end if(enum==SealevelchangeTidalK2Enum) return "SealevelchangeTidalK2" end if(enum==SealevelchangeTidalH2Enum) return "SealevelchangeTidalH2" end if(enum==SealevelchangeTidalL2Enum) return "SealevelchangeTidalL2" end if(enum==SolidearthSettingsSealevelLoadingEnum) return "SolidearthSettingsSealevelLoading" end if(enum==SolidearthSettingsGRDEnum) return "SolidearthSettingsGRD" end if(enum==SolidearthSettingsRunFrequencyEnum) return "SolidearthSettingsRunFrequency" end if(enum==SolidearthSettingsTimeAccEnum) return "SolidearthSettingsTimeAcc" end if(enum==SolidearthSettingsHorizEnum) return "SolidearthSettingsHoriz" end if(enum==SolidearthSettingsMaxiterEnum) return "SolidearthSettingsMaxiter" end if(enum==SolidearthSettingsGrdOceanEnum) return "SolidearthSettingsGrdOcean" end if(enum==SolidearthSettingsOceanAreaScalingEnum) return "SolidearthSettingsOceanAreaScaling" end if(enum==StochasticForcingCovarianceEnum) return "StochasticForcingCovariance" end if(enum==StochasticForcingDefaultDimensionEnum) return "StochasticForcingDefaultDimension" end if(enum==StochasticForcingDimensionsEnum) return "StochasticForcingDimensions" end if(enum==StochasticForcingFieldsEnum) return "StochasticForcingFields" end if(enum==StochasticForcingIsEffectivePressureEnum) return "StochasticForcingIsEffectivePressure" end if(enum==StochasticForcingIsStochasticForcingEnum) return "StochasticForcingIsStochasticForcing" end if(enum==StochasticForcingIsWaterPressureEnum) return "StochasticForcingIsWaterPressure" end if(enum==StochasticForcingNoisetermsEnum) return "StochasticForcingNoiseterms" end if(enum==StochasticForcingNumFieldsEnum) return "StochasticForcingNumFields" end if(enum==StochasticForcingRandomflagEnum) return "StochasticForcingRandomflag" end if(enum==StochasticForcingTimestepEnum) return "StochasticForcingTimestep" end if(enum==SolidearthSettingsReltolEnum) return "SolidearthSettingsReltol" end if(enum==SolidearthSettingsSelfAttractionEnum) return "SolidearthSettingsSelfAttraction" end if(enum==SolidearthSettingsRotationEnum) return "SolidearthSettingsRotation" end if(enum==SolidearthSettingsMaxSHCoeffEnum) return "SolidearthSettingsMaxSHCoeff" end if(enum==SettingsIoGatherEnum) return "SettingsIoGather" end if(enum==SettingsNumResultsOnNodesEnum) return "SettingsNumResultsOnNodes" end if(enum==SettingsOutputFrequencyEnum) return "SettingsOutputFrequency" end if(enum==SettingsCheckpointFrequencyEnum) return "SettingsCheckpointFrequency" end if(enum==SettingsResultsOnNodesEnum) return "SettingsResultsOnNodes" end if(enum==SettingsSbCouplingFrequencyEnum) return "SettingsSbCouplingFrequency" end if(enum==SettingsSolverResidueThresholdEnum) return "SettingsSolverResidueThreshold" end if(enum==SettingsWaitonlockEnum) return "SettingsWaitonlock" end if(enum==SmbAIceEnum) return "SmbAIce" end if(enum==SmbAIdxEnum) return "SmbAIdx" end if(enum==SmbASnowEnum) return "SmbASnow" end if(enum==SmbAccualtiEnum) return "SmbAccualti" end if(enum==SmbAccugradEnum) return "SmbAccugrad" end if(enum==SmbAccurefEnum) return "SmbAccuref" end if(enum==SmbAdThreshEnum) return "SmbAdThresh" end if(enum==SmbAutoregressionInitialTimeEnum) return "SmbAutoregressionInitialTime" end if(enum==SmbAutoregressionTimestepEnum) return "SmbAutoregressionTimestep" end if(enum==SmbAutoregressiveOrderEnum) return "SmbAutoregressiveOrder" end if(enum==SmbAveragingEnum) return "SmbAveraging" end if(enum==SmbBeta0Enum) return "SmbBeta0" end if(enum==SmbBeta1Enum) return "SmbBeta1" end if(enum==SmbDesfacEnum) return "SmbDesfac" end if(enum==SmbDpermilEnum) return "SmbDpermil" end if(enum==SmbDsnowIdxEnum) return "SmbDsnowIdx" end if(enum==SmbElevationBinsEnum) return "SmbElevationBins" end if(enum==SmbCldFracEnum) return "SmbCldFrac" end if(enum==SmbDelta18oEnum) return "SmbDelta18o" end if(enum==SmbDelta18oSurfaceEnum) return "SmbDelta18oSurface" end if(enum==SmbDenIdxEnum) return "SmbDenIdx" end if(enum==SmbDtEnum) return "SmbDt" end if(enum==SmbEnum) return "Smb" end if(enum==SmbEIdxEnum) return "SmbEIdx" end if(enum==SmbFEnum) return "SmbF" end if(enum==SmbInitDensityScalingEnum) return "SmbInitDensityScaling" end if(enum==SmbIsaccumulationEnum) return "SmbIsaccumulation" end if(enum==SmbIsalbedoEnum) return "SmbIsalbedo" end if(enum==SmbIsconstrainsurfaceTEnum) return "SmbIsconstrainsurfaceT" end if(enum==SmbIsd18opdEnum) return "SmbIsd18opd" end if(enum==SmbIsdelta18oEnum) return "SmbIsdelta18o" end if(enum==SmbIsdensificationEnum) return "SmbIsdensification" end if(enum==SmbIsdeltaLWupEnum) return "SmbIsdeltaLWup" end if(enum==SmbIsfirnwarmingEnum) return "SmbIsfirnwarming" end if(enum==SmbIsgraingrowthEnum) return "SmbIsgraingrowth" end if(enum==SmbIsmeltEnum) return "SmbIsmelt" end if(enum==SmbIsmungsmEnum) return "SmbIsmungsm" end if(enum==SmbIsprecipscaledEnum) return "SmbIsprecipscaled" end if(enum==SmbIssetpddfacEnum) return "SmbIssetpddfac" end if(enum==SmbIsshortwaveEnum) return "SmbIsshortwave" end if(enum==SmbIstemperaturescaledEnum) return "SmbIstemperaturescaled" end if(enum==SmbIsthermalEnum) return "SmbIsthermal" end if(enum==SmbIsturbulentfluxEnum) return "SmbIsturbulentflux" end if(enum==SmbKEnum) return "SmbK" end if(enum==SmbLapseRatesEnum) return "SmbLapseRates" end if(enum==SmbNumBasinsEnum) return "SmbNumBasins" end if(enum==SmbNumElevationBinsEnum) return "SmbNumElevationBins" end if(enum==SmbNumRequestedOutputsEnum) return "SmbNumRequestedOutputs" end if(enum==SmbPfacEnum) return "SmbPfac" end if(enum==SmbPhiEnum) return "SmbPhi" end if(enum==SmbRdlEnum) return "SmbRdl" end if(enum==SmbRefElevationEnum) return "SmbRefElevation" end if(enum==SmbRequestedOutputsEnum) return "SmbRequestedOutputs" end if(enum==SmbRlapsEnum) return "SmbRlaps" end if(enum==SmbRlapslgmEnum) return "SmbRlapslgm" end if(enum==SmbRunoffaltiEnum) return "SmbRunoffalti" end if(enum==SmbRunoffgradEnum) return "SmbRunoffgrad" end if(enum==SmbRunoffrefEnum) return "SmbRunoffref" end if(enum==SmbSealevEnum) return "SmbSealev" end if(enum==SmbStepsPerStepEnum) return "SmbStepsPerStep" end if(enum==SmbSwIdxEnum) return "SmbSwIdx" end if(enum==SmbT0dryEnum) return "SmbT0dry" end if(enum==SmbT0wetEnum) return "SmbT0wet" end if(enum==SmbTcIdxEnum) return "SmbTcIdx" end if(enum==SmbTeThreshEnum) return "SmbTeThresh" end if(enum==SmbTdiffEnum) return "SmbTdiff" end if(enum==SmbThermoDeltaTScalingEnum) return "SmbThermoDeltaTScaling" end if(enum==SmbTemperaturesReconstructedYearsEnum) return "SmbTemperaturesReconstructedYears" end if(enum==SmbPrecipitationsReconstructedYearsEnum) return "SmbPrecipitationsReconstructedYears" end if(enum==SmoothThicknessMultiplierEnum) return "SmoothThicknessMultiplier" end if(enum==SolutionTypeEnum) return "SolutionType" end if(enum==SteadystateMaxiterEnum) return "SteadystateMaxiter" end if(enum==SteadystateNumRequestedOutputsEnum) return "SteadystateNumRequestedOutputs" end if(enum==SteadystateReltolEnum) return "SteadystateReltol" end if(enum==SteadystateRequestedOutputsEnum) return "SteadystateRequestedOutputs" end if(enum==StepEnum) return "Step" end if(enum==StepsEnum) return "Steps" end if(enum==StressbalanceAbstolEnum) return "StressbalanceAbstol" end if(enum==StressbalanceFSreconditioningEnum) return "StressbalanceFSreconditioning" end if(enum==StressbalanceIsnewtonEnum) return "StressbalanceIsnewton" end if(enum==StressbalanceMaxiterEnum) return "StressbalanceMaxiter" end if(enum==StressbalanceNumRequestedOutputsEnum) return "StressbalanceNumRequestedOutputs" end if(enum==StressbalancePenaltyFactorEnum) return "StressbalancePenaltyFactor" end if(enum==StressbalanceReltolEnum) return "StressbalanceReltol" end if(enum==StressbalanceRequestedOutputsEnum) return "StressbalanceRequestedOutputs" end if(enum==StressbalanceRestolEnum) return "StressbalanceRestol" end if(enum==StressbalanceRiftPenaltyThresholdEnum) return "StressbalanceRiftPenaltyThreshold" end if(enum==StressbalanceShelfDampeningEnum) return "StressbalanceShelfDampening" end if(enum==ThermalIsdrainicecolumnEnum) return "ThermalIsdrainicecolumn" end if(enum==ThermalIsdynamicbasalspcEnum) return "ThermalIsdynamicbasalspc" end if(enum==ThermalIsenthalpyEnum) return "ThermalIsenthalpy" end if(enum==ThermalMaxiterEnum) return "ThermalMaxiter" end if(enum==ThermalNumRequestedOutputsEnum) return "ThermalNumRequestedOutputs" end if(enum==ThermalPenaltyFactorEnum) return "ThermalPenaltyFactor" end if(enum==ThermalPenaltyLockEnum) return "ThermalPenaltyLock" end if(enum==ThermalPenaltyThresholdEnum) return "ThermalPenaltyThreshold" end if(enum==ThermalReltolEnum) return "ThermalReltol" end if(enum==ThermalRequestedOutputsEnum) return "ThermalRequestedOutputs" end if(enum==ThermalStabilizationEnum) return "ThermalStabilization" end if(enum==ThermalWatercolumnUpperlimitEnum) return "ThermalWatercolumnUpperlimit" end if(enum==TimeEnum) return "Time" end if(enum==TimesteppingAverageForcingEnum) return "TimesteppingAverageForcing" end if(enum==TimesteppingCflCoefficientEnum) return "TimesteppingCflCoefficient" end if(enum==TimesteppingCouplingTimeEnum) return "TimesteppingCouplingTime" end if(enum==TimesteppingFinalTimeEnum) return "TimesteppingFinalTime" end if(enum==TimesteppingInterpForcingEnum) return "TimesteppingInterpForcing" end if(enum==TimesteppingCycleForcingEnum) return "TimesteppingCycleForcing" end if(enum==TimesteppingStartTimeEnum) return "TimesteppingStartTime" end if(enum==TimesteppingTimeStepEnum) return "TimesteppingTimeStep" end if(enum==TimesteppingTimeStepMaxEnum) return "TimesteppingTimeStepMax" end if(enum==TimesteppingTimeStepMinEnum) return "TimesteppingTimeStepMin" end if(enum==TimesteppingTypeEnum) return "TimesteppingType" end if(enum==ToMITgcmCommEnum) return "ToMITgcmComm" end if(enum==ToolkitsFileNameEnum) return "ToolkitsFileName" end if(enum==ToolkitsOptionsAnalysesEnum) return "ToolkitsOptionsAnalyses" end if(enum==ToolkitsOptionsStringsEnum) return "ToolkitsOptionsStrings" end if(enum==ToolkitsTypesEnum) return "ToolkitsTypes" end if(enum==TransientAmrFrequencyEnum) return "TransientAmrFrequency" end if(enum==TransientIsageEnum) return "TransientIsage" end if(enum==TransientIsdamageevolutionEnum) return "TransientIsdamageevolution" end if(enum==TransientIsesaEnum) return "TransientIsesa" end if(enum==TransientIsgiaEnum) return "TransientIsgia" end if(enum==TransientIsgroundinglineEnum) return "TransientIsgroundingline" end if(enum==TransientIshydrologyEnum) return "TransientIshydrology" end if(enum==TransientIsmasstransportEnum) return "TransientIsmasstransport" end if(enum==TransientIsoceantransportEnum) return "TransientIsoceantransport" end if(enum==TransientIsmovingfrontEnum) return "TransientIsmovingfront" end if(enum==TransientIsoceancouplingEnum) return "TransientIsoceancoupling" end if(enum==TransientIssamplingEnum) return "TransientIssampling" end if(enum==TransientIsslcEnum) return "TransientIsslc" end if(enum==TransientIssmbEnum) return "TransientIssmb" end if(enum==TransientIsstressbalanceEnum) return "TransientIsstressbalance" end if(enum==TransientIsthermalEnum) return "TransientIsthermal" end if(enum==TransientNumRequestedOutputsEnum) return "TransientNumRequestedOutputs" end if(enum==TransientRequestedOutputsEnum) return "TransientRequestedOutputs" end if(enum==VelocityEnum) return "Velocity" end if(enum==XxeEnum) return "Xxe" end if(enum==YyeEnum) return "Yye" end if(enum==ZzeEnum) return "Zze" end if(enum==AreaeEnum) return "Areae" end if(enum==WorldCommEnum) return "WorldComm" end if(enum==ParametersENDEnum) return "ParametersEND" end if(enum==InputsSTARTEnum) return "InputsSTART" end if(enum==AccumulatedDeltaBottomPressureEnum) return "AccumulatedDeltaBottomPressure" end if(enum==AccumulatedDeltaIceThicknessEnum) return "AccumulatedDeltaIceThickness" end if(enum==AccumulatedDeltaTwsEnum) return "AccumulatedDeltaTws" end if(enum==AdjointEnum) return "Adjoint" end if(enum==AdjointpEnum) return "Adjointp" end if(enum==AdjointxEnum) return "Adjointx" end if(enum==AdjointxBaseEnum) return "AdjointxBase" end if(enum==AdjointxShearEnum) return "AdjointxShear" end if(enum==AdjointyEnum) return "Adjointy" end if(enum==AdjointyBaseEnum) return "AdjointyBase" end if(enum==AdjointyShearEnum) return "AdjointyShear" end if(enum==AdjointzEnum) return "Adjointz" end if(enum==AgeEnum) return "Age" end if(enum==AirEnum) return "Air" end if(enum==ApproximationEnum) return "Approximation" end if(enum==BalancethicknessMisfitEnum) return "BalancethicknessMisfit" end if(enum==BalancethicknessOmega0Enum) return "BalancethicknessOmega0" end if(enum==BalancethicknessOmegaEnum) return "BalancethicknessOmega" end if(enum==BalancethicknessSpcthicknessEnum) return "BalancethicknessSpcthickness" end if(enum==BalancethicknessThickeningRateEnum) return "BalancethicknessThickeningRate" end if(enum==BasalCrevasseEnum) return "BasalCrevasse" end if(enum==BasalforcingsDeepwaterMeltingRateAutoregressionEnum) return "BasalforcingsDeepwaterMeltingRateAutoregression" end if(enum==BasalforcingsDeepwaterMeltingRateNoiseEnum) return "BasalforcingsDeepwaterMeltingRateNoise" end if(enum==BasalforcingsDeepwaterMeltingRateValuesAutoregressionEnum) return "BasalforcingsDeepwaterMeltingRateValuesAutoregression" end if(enum==BasalforcingsFloatingiceMeltingRateEnum) return "BasalforcingsFloatingiceMeltingRate" end if(enum==BasalforcingsGeothermalfluxEnum) return "BasalforcingsGeothermalflux" end if(enum==BasalforcingsGroundediceMeltingRateEnum) return "BasalforcingsGroundediceMeltingRate" end if(enum==BasalforcingsLinearBasinIdEnum) return "BasalforcingsLinearBasinId" end if(enum==BasalforcingsPerturbationMeltingRateEnum) return "BasalforcingsPerturbationMeltingRate" end if(enum==BasalforcingsSpatialDeepwaterElevationEnum) return "BasalforcingsSpatialDeepwaterElevation" end if(enum==BasalforcingsSpatialDeepwaterMeltingRateEnum) return "BasalforcingsSpatialDeepwaterMeltingRate" end if(enum==BasalforcingsSpatialUpperwaterElevationEnum) return "BasalforcingsSpatialUpperwaterElevation" end if(enum==BasalforcingsSpatialUpperwaterMeltingRateEnum) return "BasalforcingsSpatialUpperwaterMeltingRate" end if(enum==BasalforcingsIsmip6BasinIdEnum) return "BasalforcingsIsmip6BasinId" end if(enum==BasalforcingsIsmip6TfEnum) return "BasalforcingsIsmip6Tf" end if(enum==BasalforcingsIsmip6TfShelfEnum) return "BasalforcingsIsmip6TfShelf" end if(enum==BasalforcingsIsmip6MeltAnomalyEnum) return "BasalforcingsIsmip6MeltAnomaly" end if(enum==BasalforcingsMeltrateFactorEnum) return "BasalforcingsMeltrateFactor" end if(enum==BasalforcingsOceanSalinityEnum) return "BasalforcingsOceanSalinity" end if(enum==BasalforcingsOceanTempEnum) return "BasalforcingsOceanTemp" end if(enum==BasalforcingsPicoBasinIdEnum) return "BasalforcingsPicoBasinId" end if(enum==BasalforcingsPicoBoxIdEnum) return "BasalforcingsPicoBoxId" end if(enum==BasalforcingsPicoOverturningCoeffEnum) return "BasalforcingsPicoOverturningCoeff" end if(enum==BasalforcingsPicoSubShelfOceanOverturningEnum) return "BasalforcingsPicoSubShelfOceanOverturning" end if(enum==BasalforcingsPicoSubShelfOceanSalinityEnum) return "BasalforcingsPicoSubShelfOceanSalinity" end if(enum==BasalforcingsPicoSubShelfOceanTempEnum) return "BasalforcingsPicoSubShelfOceanTemp" end if(enum==BasalStressxEnum) return "BasalStressx" end if(enum==BasalStressyEnum) return "BasalStressy" end if(enum==BasalStressEnum) return "BasalStress" end if(enum==BaseEnum) return "Base" end if(enum==BaseOldEnum) return "BaseOld" end if(enum==BaseSlopeXEnum) return "BaseSlopeX" end if(enum==BaseSlopeYEnum) return "BaseSlopeY" end if(enum==BaselineBasalforcingsFloatingiceMeltingRateEnum) return "BaselineBasalforcingsFloatingiceMeltingRate" end if(enum==BaselineBasalforcingsSpatialDeepwaterMeltingRateEnum) return "BaselineBasalforcingsSpatialDeepwaterMeltingRate" end if(enum==BaselineCalvingCalvingrateEnum) return "BaselineCalvingCalvingrate" end if(enum==BaselineFrictionEffectivePressureEnum) return "BaselineFrictionEffectivePressure" end if(enum==BaselineSmbMassBalanceEnum) return "BaselineSmbMassBalance" end if(enum==BedEnum) return "Bed" end if(enum==BedGRDEnum) return "BedGRD" end if(enum==BedEastEnum) return "BedEast" end if(enum==BedEastGRDEnum) return "BedEastGRD" end if(enum==BedNorthEnum) return "BedNorth" end if(enum==BedNorthGRDEnum) return "BedNorthGRD" end if(enum==BedSlopeXEnum) return "BedSlopeX" end if(enum==BedSlopeYEnum) return "BedSlopeY" end if(enum==BottomPressureEnum) return "BottomPressure" end if(enum==BottomPressureOldEnum) return "BottomPressureOld" end if(enum==CalvingCalvingrateEnum) return "CalvingCalvingrate" end if(enum==CalvingHabFractionEnum) return "CalvingHabFraction" end if(enum==CalvingAblationrateEnum) return "CalvingAblationrate" end if(enum==CalvingMeltingrateEnum) return "CalvingMeltingrate" end if(enum==CalvingStressThresholdFloatingiceEnum) return "CalvingStressThresholdFloatingice" end if(enum==CalvingStressThresholdGroundediceEnum) return "CalvingStressThresholdGroundedice" end if(enum==CalvinglevermannCoeffEnum) return "CalvinglevermannCoeff" end if(enum==CalvingratexEnum) return "Calvingratex" end if(enum==CalvingrateyEnum) return "Calvingratey" end if(enum==CalvingFluxLevelsetEnum) return "CalvingFluxLevelset" end if(enum==CalvingMeltingFluxLevelsetEnum) return "CalvingMeltingFluxLevelset" end if(enum==ConvergedEnum) return "Converged" end if(enum==CrevasseDepthEnum) return "CrevasseDepth" end if(enum==DamageDEnum) return "DamageD" end if(enum==DamageDOldEnum) return "DamageDOld" end if(enum==DamageDbarEnum) return "DamageDbar" end if(enum==DamageDbarOldEnum) return "DamageDbarOld" end if(enum==DamageFEnum) return "DamageF" end if(enum==DegreeOfChannelizationEnum) return "DegreeOfChannelization" end if(enum==DepthBelowSurfaceEnum) return "DepthBelowSurface" end if(enum==DeltaIceThicknessEnum) return "DeltaIceThickness" end if(enum==DeltaTwsEnum) return "DeltaTws" end if(enum==DeltaBottomPressureEnum) return "DeltaBottomPressure" end if(enum==DeltaDslEnum) return "DeltaDsl" end if(enum==DslOldEnum) return "DslOld" end if(enum==DslEnum) return "Dsl" end if(enum==DeltaStrEnum) return "DeltaStr" end if(enum==StrOldEnum) return "StrOld" end if(enum==StrEnum) return "Str" end if(enum==DeviatoricStresseffectiveEnum) return "DeviatoricStresseffective" end if(enum==DeviatoricStressxxEnum) return "DeviatoricStressxx" end if(enum==DeviatoricStressxyEnum) return "DeviatoricStressxy" end if(enum==DeviatoricStressxzEnum) return "DeviatoricStressxz" end if(enum==DeviatoricStressyyEnum) return "DeviatoricStressyy" end if(enum==DeviatoricStressyzEnum) return "DeviatoricStressyz" end if(enum==DeviatoricStresszzEnum) return "DeviatoricStresszz" end if(enum==DeviatoricStress1Enum) return "DeviatoricStress1" end if(enum==DeviatoricStress2Enum) return "DeviatoricStress2" end if(enum==DistanceToCalvingfrontEnum) return "DistanceToCalvingfront" end if(enum==DistanceToGroundinglineEnum) return "DistanceToGroundingline" end if(enum==Domain2DhorizontalEnum) return "Domain2Dhorizontal" end if(enum==Domain2DverticalEnum) return "Domain2Dvertical" end if(enum==Domain3DEnum) return "Domain3D" end if(enum==DragCoefficientAbsGradientEnum) return "DragCoefficientAbsGradient" end if(enum==DrivingStressXEnum) return "DrivingStressX" end if(enum==DrivingStressYEnum) return "DrivingStressY" end if(enum==DummyEnum) return "Dummy" end if(enum==EffectivePressureEnum) return "EffectivePressure" end if(enum==EffectivePressureSubstepEnum) return "EffectivePressureSubstep" end if(enum==EffectivePressureTransientEnum) return "EffectivePressureTransient" end if(enum==EnthalpyEnum) return "Enthalpy" end if(enum==EnthalpyPicardEnum) return "EnthalpyPicard" end if(enum==EplHeadEnum) return "EplHead" end if(enum==EplHeadOldEnum) return "EplHeadOld" end if(enum==EplHeadSlopeXEnum) return "EplHeadSlopeX" end if(enum==EplHeadSlopeYEnum) return "EplHeadSlopeY" end if(enum==EplHeadSubstepEnum) return "EplHeadSubstep" end if(enum==EplHeadTransientEnum) return "EplHeadTransient" end if(enum==EsaEmotionEnum) return "EsaEmotion" end if(enum==EsaNmotionEnum) return "EsaNmotion" end if(enum==EsaRotationrateEnum) return "EsaRotationrate" end if(enum==EsaStrainratexxEnum) return "EsaStrainratexx" end if(enum==EsaStrainratexyEnum) return "EsaStrainratexy" end if(enum==EsaStrainrateyyEnum) return "EsaStrainrateyy" end if(enum==EsaUmotionEnum) return "EsaUmotion" end if(enum==EsaXmotionEnum) return "EsaXmotion" end if(enum==EsaYmotionEnum) return "EsaYmotion" end if(enum==EtaDiffEnum) return "EtaDiff" end if(enum==FlowequationBorderFSEnum) return "FlowequationBorderFS" end if(enum==FrictionAsEnum) return "FrictionAs" end if(enum==FrictionCEnum) return "FrictionC" end if(enum==FrictionCmaxEnum) return "FrictionCmax" end if(enum==FrictionCoefficientEnum) return "FrictionCoefficient" end if(enum==FrictionCoefficientcoulombEnum) return "FrictionCoefficientcoulomb" end if(enum==FrictionCoulombWaterPressureEnum) return "FrictionCoulombWaterPressure" end if(enum==FrictionEffectivePressureEnum) return "FrictionEffectivePressure" end if(enum==FrictionMEnum) return "FrictionM" end if(enum==FrictionPEnum) return "FrictionP" end if(enum==FrictionPressureAdjustedTemperatureEnum) return "FrictionPressureAdjustedTemperature" end if(enum==FrictionQEnum) return "FrictionQ" end if(enum==FrictionSedimentCompressibilityCoefficientEnum) return "FrictionSedimentCompressibilityCoefficient" end if(enum==FrictionTillFrictionAngleEnum) return "FrictionTillFrictionAngle" end if(enum==FrictionSchoofWaterPressureEnum) return "FrictionSchoofWaterPressure" end if(enum==FrictionWaterLayerEnum) return "FrictionWaterLayer" end if(enum==FrictionWaterPressureEnum) return "FrictionWaterPressure" end if(enum==FrictionfEnum) return "Frictionf" end if(enum==FrontalForcingsBasinIdEnum) return "FrontalForcingsBasinId" end if(enum==FrontalForcingsSubglacialDischargeEnum) return "FrontalForcingsSubglacialDischarge" end if(enum==FrontalForcingsThermalForcingEnum) return "FrontalForcingsThermalForcing" end if(enum==GeometryHydrostaticRatioEnum) return "GeometryHydrostaticRatio" end if(enum==NGiaEnum) return "NGia" end if(enum==NGiaRateEnum) return "NGiaRate" end if(enum==UGiaEnum) return "UGia" end if(enum==UGiaRateEnum) return "UGiaRate" end if(enum==GradientEnum) return "Gradient" end if(enum==GroundinglineHeightEnum) return "GroundinglineHeight" end if(enum==HydraulicPotentialEnum) return "HydraulicPotential" end if(enum==HydraulicPotentialOldEnum) return "HydraulicPotentialOld" end if(enum==HydrologyBasalFluxEnum) return "HydrologyBasalFlux" end if(enum==HydrologyBumpHeightEnum) return "HydrologyBumpHeight" end if(enum==HydrologyBumpSpacingEnum) return "HydrologyBumpSpacing" end if(enum==HydrologydcBasalMoulinInputEnum) return "HydrologydcBasalMoulinInput" end if(enum==HydrologydcEplThicknessEnum) return "HydrologydcEplThickness" end if(enum==HydrologydcEplThicknessOldEnum) return "HydrologydcEplThicknessOld" end if(enum==HydrologydcEplThicknessSubstepEnum) return "HydrologydcEplThicknessSubstep" end if(enum==HydrologydcEplThicknessTransientEnum) return "HydrologydcEplThicknessTransient" end if(enum==HydrologydcMaskEplactiveEltEnum) return "HydrologydcMaskEplactiveElt" end if(enum==HydrologydcMaskEplactiveNodeEnum) return "HydrologydcMaskEplactiveNode" end if(enum==HydrologydcMaskThawedEltEnum) return "HydrologydcMaskThawedElt" end if(enum==HydrologydcMaskThawedNodeEnum) return "HydrologydcMaskThawedNode" end if(enum==HydrologydcSedimentTransmitivityEnum) return "HydrologydcSedimentTransmitivity" end if(enum==HydrologyDrainageRateEnum) return "HydrologyDrainageRate" end if(enum==HydrologyEnglacialInputEnum) return "HydrologyEnglacialInput" end if(enum==HydrologyGapHeightEnum) return "HydrologyGapHeight" end if(enum==HydrologyGapHeightXEnum) return "HydrologyGapHeightX" end if(enum==HydrologyGapHeightXXEnum) return "HydrologyGapHeightXX" end if(enum==HydrologyGapHeightYEnum) return "HydrologyGapHeightY" end if(enum==HydrologyGapHeightYYEnum) return "HydrologyGapHeightYY" end if(enum==HydrologyHeadEnum) return "HydrologyHead" end if(enum==HydrologyHeadOldEnum) return "HydrologyHeadOld" end if(enum==HydrologyMoulinInputEnum) return "HydrologyMoulinInput" end if(enum==HydrologyNeumannfluxEnum) return "HydrologyNeumannflux" end if(enum==HydrologyReynoldsEnum) return "HydrologyReynolds" end if(enum==HydrologySheetConductivityEnum) return "HydrologySheetConductivity" end if(enum==HydrologySheetThicknessEnum) return "HydrologySheetThickness" end if(enum==HydrologySheetThicknessOldEnum) return "HydrologySheetThicknessOld" end if(enum==HydrologyTwsEnum) return "HydrologyTws" end if(enum==HydrologyTwsSpcEnum) return "HydrologyTwsSpc" end if(enum==HydrologyTwsAnalysisEnum) return "HydrologyTwsAnalysis" end if(enum==HydrologyWatercolumnMaxEnum) return "HydrologyWatercolumnMax" end if(enum==HydrologyWaterVxEnum) return "HydrologyWaterVx" end if(enum==HydrologyWaterVyEnum) return "HydrologyWaterVy" end if(enum==IceEnum) return "Ice" end if(enum==IceMaskNodeActivationEnum) return "IceMaskNodeActivation" end if(enum==InputEnum) return "Input" end if(enum==InversionCostFunctionsCoefficientsEnum) return "InversionCostFunctionsCoefficients" end if(enum==InversionSurfaceObsEnum) return "InversionSurfaceObs" end if(enum==InversionThicknessObsEnum) return "InversionThicknessObs" end if(enum==InversionVelObsEnum) return "InversionVelObs" end if(enum==InversionVxObsEnum) return "InversionVxObs" end if(enum==InversionVyObsEnum) return "InversionVyObs" end if(enum==LevelsetfunctionSlopeXEnum) return "LevelsetfunctionSlopeX" end if(enum==LevelsetfunctionSlopeYEnum) return "LevelsetfunctionSlopeY" end if(enum==LevelsetObservationEnum) return "LevelsetObservation" end if(enum==LoadingforceXEnum) return "LoadingforceX" end if(enum==LoadingforceYEnum) return "LoadingforceY" end if(enum==LoadingforceZEnum) return "LoadingforceZ" end if(enum==MaskOceanLevelsetEnum) return "MaskOceanLevelset" end if(enum==MaskIceLevelsetEnum) return "MaskIceLevelset" end if(enum==MaskIceRefLevelsetEnum) return "MaskIceRefLevelset" end if(enum==MasstransportSpcthicknessEnum) return "MasstransportSpcthickness" end if(enum==MaterialsRheologyBEnum) return "MaterialsRheologyB" end if(enum==MaterialsRheologyBbarEnum) return "MaterialsRheologyBbar" end if(enum==MaterialsRheologyEEnum) return "MaterialsRheologyE" end if(enum==MaterialsRheologyEbarEnum) return "MaterialsRheologyEbar" end if(enum==MaterialsRheologyEcEnum) return "MaterialsRheologyEc" end if(enum==MaterialsRheologyEcbarEnum) return "MaterialsRheologyEcbar" end if(enum==MaterialsRheologyEsEnum) return "MaterialsRheologyEs" end if(enum==MaterialsRheologyEsbarEnum) return "MaterialsRheologyEsbar" end if(enum==MaterialsRheologyNEnum) return "MaterialsRheologyN" end if(enum==MeshScaleFactorEnum) return "MeshScaleFactor" end if(enum==MeshVertexonbaseEnum) return "MeshVertexonbase" end if(enum==MeshVertexonboundaryEnum) return "MeshVertexonboundary" end if(enum==MeshVertexonsurfaceEnum) return "MeshVertexonsurface" end if(enum==MisfitEnum) return "Misfit" end if(enum==MovingFrontalVxEnum) return "MovingFrontalVx" end if(enum==MovingFrontalVyEnum) return "MovingFrontalVy" end if(enum==NeumannfluxEnum) return "Neumannflux" end if(enum==NewDamageEnum) return "NewDamage" end if(enum==NodeEnum) return "Node" end if(enum==OmegaAbsGradientEnum) return "OmegaAbsGradient" end if(enum==OceantransportSpcbottompressureEnum) return "OceantransportSpcbottompressure" end if(enum==OceantransportSpcstrEnum) return "OceantransportSpcstr" end if(enum==OceantransportSpcdslEnum) return "OceantransportSpcdsl" end if(enum==P0Enum) return "P0" end if(enum==P1Enum) return "P1" end if(enum==PartitioningEnum) return "Partitioning" end if(enum==PressureEnum) return "Pressure" end if(enum==RadarEnum) return "Radar" end if(enum==RadarAttenuationMacGregorEnum) return "RadarAttenuationMacGregor" end if(enum==RadarAttenuationWolffEnum) return "RadarAttenuationWolff" end if(enum==RadarIcePeriodEnum) return "RadarIcePeriod" end if(enum==RadarPowerMacGregorEnum) return "RadarPowerMacGregor" end if(enum==RadarPowerWolffEnum) return "RadarPowerWolff" end if(enum==RheologyBAbsGradientEnum) return "RheologyBAbsGradient" end if(enum==RheologyBInitialguessEnum) return "RheologyBInitialguess" end if(enum==RheologyBInitialguessMisfitEnum) return "RheologyBInitialguessMisfit" end if(enum==RheologyBbarAbsGradientEnum) return "RheologyBbarAbsGradient" end if(enum==SampleEnum) return "Sample" end if(enum==SampleOldEnum) return "SampleOld" end if(enum==SampleNoiseEnum) return "SampleNoise" end if(enum==SamplingBetaEnum) return "SamplingBeta" end if(enum==SamplingKappaEnum) return "SamplingKappa" end if(enum==SamplingPhiEnum) return "SamplingPhi" end if(enum==SamplingTauEnum) return "SamplingTau" end if(enum==SealevelEnum) return "Sealevel" end if(enum==SealevelGRDEnum) return "SealevelGRD" end if(enum==SatGraviGRDEnum) return "SatGraviGRD" end if(enum==SealevelBarystaticMaskEnum) return "SealevelBarystaticMask" end if(enum==SealevelBarystaticIceMaskEnum) return "SealevelBarystaticIceMask" end if(enum==SealevelBarystaticIceWeightsEnum) return "SealevelBarystaticIceWeights" end if(enum==SealevelBarystaticIceAreaEnum) return "SealevelBarystaticIceArea" end if(enum==SealevelBarystaticIceLatbarEnum) return "SealevelBarystaticIceLatbar" end if(enum==SealevelBarystaticIceLongbarEnum) return "SealevelBarystaticIceLongbar" end if(enum==SealevelBarystaticIceLoadEnum) return "SealevelBarystaticIceLoad" end if(enum==SealevelBarystaticHydroMaskEnum) return "SealevelBarystaticHydroMask" end if(enum==SealevelBarystaticHydroWeightsEnum) return "SealevelBarystaticHydroWeights" end if(enum==SealevelBarystaticHydroAreaEnum) return "SealevelBarystaticHydroArea" end if(enum==SealevelBarystaticHydroLatbarEnum) return "SealevelBarystaticHydroLatbar" end if(enum==SealevelBarystaticHydroLongbarEnum) return "SealevelBarystaticHydroLongbar" end if(enum==SealevelBarystaticHydroLoadEnum) return "SealevelBarystaticHydroLoad" end if(enum==SealevelBarystaticBpMaskEnum) return "SealevelBarystaticBpMask" end if(enum==SealevelBarystaticBpWeightsEnum) return "SealevelBarystaticBpWeights" end if(enum==SealevelBarystaticBpAreaEnum) return "SealevelBarystaticBpArea" end if(enum==SealevelBarystaticBpLoadEnum) return "SealevelBarystaticBpLoad" end if(enum==SealevelBarystaticOceanMaskEnum) return "SealevelBarystaticOceanMask" end if(enum==SealevelBarystaticOceanWeightsEnum) return "SealevelBarystaticOceanWeights" end if(enum==SealevelBarystaticOceanAreaEnum) return "SealevelBarystaticOceanArea" end if(enum==SealevelBarystaticOceanLatbarEnum) return "SealevelBarystaticOceanLatbar" end if(enum==SealevelBarystaticOceanLongbarEnum) return "SealevelBarystaticOceanLongbar" end if(enum==SealevelBarystaticOceanLoadEnum) return "SealevelBarystaticOceanLoad" end if(enum==SealevelNEsaEnum) return "SealevelNEsa" end if(enum==SealevelNEsaRateEnum) return "SealevelNEsaRate" end if(enum==SealevelRSLEnum) return "SealevelRSL" end if(enum==BslcEnum) return "Bslc" end if(enum==BslcIceEnum) return "BslcIce" end if(enum==BslcHydroEnum) return "BslcHydro" end if(enum==BslcOceanEnum) return "BslcOcean" end if(enum==BslcRateEnum) return "BslcRate" end if(enum==GmtslcEnum) return "Gmtslc" end if(enum==SealevelRSLBarystaticEnum) return "SealevelRSLBarystatic" end if(enum==SealevelRSLRateEnum) return "SealevelRSLRate" end if(enum==SealevelUGrdEnum) return "SealevelUGrd" end if(enum==SealevelNGrdEnum) return "SealevelNGrd" end if(enum==SealevelUEastEsaEnum) return "SealevelUEastEsa" end if(enum==SealevelUNorthEsaEnum) return "SealevelUNorthEsa" end if(enum==SealevelchangeIndicesEnum) return "SealevelchangeIndices" end if(enum==SealevelchangeAlphaIndexEnum) return "SealevelchangeAlphaIndex" end if(enum==SealevelchangeAzimuthIndexEnum) return "SealevelchangeAzimuthIndex" end if(enum==SealevelchangeGrotEnum) return "SealevelchangeGrot" end if(enum==SealevelchangeGSatGravirotEnum) return "SealevelchangeGSatGravirot" end if(enum==SealevelchangeGUrotEnum) return "SealevelchangeGUrot" end if(enum==SealevelchangeGNrotEnum) return "SealevelchangeGNrot" end if(enum==SealevelchangeGErotEnum) return "SealevelchangeGErot" end if(enum==SealevelchangeAlphaIndexOceanEnum) return "SealevelchangeAlphaIndexOcean" end if(enum==SealevelchangeAlphaIndexIceEnum) return "SealevelchangeAlphaIndexIce" end if(enum==SealevelchangeAlphaIndexHydroEnum) return "SealevelchangeAlphaIndexHydro" end if(enum==SealevelchangeAzimuthIndexOceanEnum) return "SealevelchangeAzimuthIndexOcean" end if(enum==SealevelchangeAzimuthIndexIceEnum) return "SealevelchangeAzimuthIndexIce" end if(enum==SealevelchangeAzimuthIndexHydroEnum) return "SealevelchangeAzimuthIndexHydro" end if(enum==SealevelchangeViscousRSLEnum) return "SealevelchangeViscousRSL" end if(enum==SealevelchangeViscousSGEnum) return "SealevelchangeViscousSG" end if(enum==SealevelchangeViscousUEnum) return "SealevelchangeViscousU" end if(enum==SealevelchangeViscousNEnum) return "SealevelchangeViscousN" end if(enum==SealevelchangeViscousEEnum) return "SealevelchangeViscousE" end if(enum==SedimentHeadEnum) return "SedimentHead" end if(enum==SedimentHeadOldEnum) return "SedimentHeadOld" end if(enum==SedimentHeadSubstepEnum) return "SedimentHeadSubstep" end if(enum==SedimentHeadTransientEnum) return "SedimentHeadTransient" end if(enum==SedimentHeadResidualEnum) return "SedimentHeadResidual" end if(enum==SedimentHeadStackedEnum) return "SedimentHeadStacked" end if(enum==SigmaNNEnum) return "SigmaNN" end if(enum==SigmaVMEnum) return "SigmaVM" end if(enum==SmbAccumulatedECEnum) return "SmbAccumulatedEC" end if(enum==SmbAccumulatedMassBalanceEnum) return "SmbAccumulatedMassBalance" end if(enum==SmbAccumulatedMeltEnum) return "SmbAccumulatedMelt" end if(enum==SmbAccumulatedPrecipitationEnum) return "SmbAccumulatedPrecipitation" end if(enum==SmbAccumulatedRainEnum) return "SmbAccumulatedRain" end if(enum==SmbAccumulatedRefreezeEnum) return "SmbAccumulatedRefreeze" end if(enum==SmbAccumulatedRunoffEnum) return "SmbAccumulatedRunoff" end if(enum==SmbAEnum) return "SmbA" end if(enum==SmbAdiffEnum) return "SmbAdiff" end if(enum==SmbAValueEnum) return "SmbAValue" end if(enum==SmbAccumulationEnum) return "SmbAccumulation" end if(enum==SmbAdiffiniEnum) return "SmbAdiffini" end if(enum==SmbAiniEnum) return "SmbAini" end if(enum==SmbAutoregressionNoiseEnum) return "SmbAutoregressionNoise" end if(enum==SmbBasinsIdEnum) return "SmbBasinsId" end if(enum==SmbBMaxEnum) return "SmbBMax" end if(enum==SmbBMinEnum) return "SmbBMin" end if(enum==SmbBNegEnum) return "SmbBNeg" end if(enum==SmbBPosEnum) return "SmbBPos" end if(enum==SmbCEnum) return "SmbC" end if(enum==SmbCcsnowValueEnum) return "SmbCcsnowValue" end if(enum==SmbCciceValueEnum) return "SmbCciceValue" end if(enum==SmbCotValueEnum) return "SmbCotValue" end if(enum==SmbDEnum) return "SmbD" end if(enum==SmbDailyairdensityEnum) return "SmbDailyairdensity" end if(enum==SmbDailyairhumidityEnum) return "SmbDailyairhumidity" end if(enum==SmbDailydlradiationEnum) return "SmbDailydlradiation" end if(enum==SmbDailydsradiationEnum) return "SmbDailydsradiation" end if(enum==SmbDailypressureEnum) return "SmbDailypressure" end if(enum==SmbDailyrainfallEnum) return "SmbDailyrainfall" end if(enum==SmbDailysnowfallEnum) return "SmbDailysnowfall" end if(enum==SmbDailytemperatureEnum) return "SmbDailytemperature" end if(enum==SmbDailywindspeedEnum) return "SmbDailywindspeed" end if(enum==SmbDiniEnum) return "SmbDini" end if(enum==SmbDlwrfEnum) return "SmbDlwrf" end if(enum==SmbDulwrfValueEnum) return "SmbDulwrfValue" end if(enum==SmbDswrfEnum) return "SmbDswrf" end if(enum==SmbDswdiffrfEnum) return "SmbDswdiffrf" end if(enum==SmbDzAddEnum) return "SmbDzAdd" end if(enum==SmbDzEnum) return "SmbDz" end if(enum==SmbDzMinEnum) return "SmbDzMin" end if(enum==SmbDzTopEnum) return "SmbDzTop" end if(enum==SmbDziniEnum) return "SmbDzini" end if(enum==SmbEAirEnum) return "SmbEAir" end if(enum==SmbECEnum) return "SmbEC" end if(enum==SmbECDtEnum) return "SmbECDt" end if(enum==SmbECiniEnum) return "SmbECini" end if(enum==SmbElaEnum) return "SmbEla" end if(enum==SmbEvaporationEnum) return "SmbEvaporation" end if(enum==SmbFACEnum) return "SmbFAC" end if(enum==SmbGdnEnum) return "SmbGdn" end if(enum==SmbGdniniEnum) return "SmbGdnini" end if(enum==SmbGspEnum) return "SmbGsp" end if(enum==SmbGspiniEnum) return "SmbGspini" end if(enum==SmbHrefEnum) return "SmbHref" end if(enum==SmbIsInitializedEnum) return "SmbIsInitialized" end if(enum==SmbMAddEnum) return "SmbMAdd" end if(enum==SmbMassBalanceEnum) return "SmbMassBalance" end if(enum==SmbMassBalanceSubstepEnum) return "SmbMassBalanceSubstep" end if(enum==SmbMassBalanceTransientEnum) return "SmbMassBalanceTransient" end if(enum==SmbMeanLHFEnum) return "SmbMeanLHF" end if(enum==SmbMeanSHFEnum) return "SmbMeanSHF" end if(enum==SmbMeanULWEnum) return "SmbMeanULW" end if(enum==SmbMeltEnum) return "SmbMelt" end if(enum==SmbMonthlytemperaturesEnum) return "SmbMonthlytemperatures" end if(enum==SmbMSurfEnum) return "SmbMSurf" end if(enum==SmbNetLWEnum) return "SmbNetLW" end if(enum==SmbNetSWEnum) return "SmbNetSW" end if(enum==SmbPAirEnum) return "SmbPAir" end if(enum==SmbPEnum) return "SmbP" end if(enum==SmbPddfacIceEnum) return "SmbPddfacIce" end if(enum==SmbPddfacSnowEnum) return "SmbPddfacSnow" end if(enum==SmbPrecipitationEnum) return "SmbPrecipitation" end if(enum==SmbPrecipitationsAnomalyEnum) return "SmbPrecipitationsAnomaly" end if(enum==SmbPrecipitationsLgmEnum) return "SmbPrecipitationsLgm" end if(enum==SmbPrecipitationsPresentdayEnum) return "SmbPrecipitationsPresentday" end if(enum==SmbPrecipitationsReconstructedEnum) return "SmbPrecipitationsReconstructed" end if(enum==SmbRainEnum) return "SmbRain" end if(enum==SmbReEnum) return "SmbRe" end if(enum==SmbRefreezeEnum) return "SmbRefreeze" end if(enum==SmbReiniEnum) return "SmbReini" end if(enum==SmbRunoffEnum) return "SmbRunoff" end if(enum==SmbRunoffSubstepEnum) return "SmbRunoffSubstep" end if(enum==SmbRunoffTransientEnum) return "SmbRunoffTransient" end if(enum==SmbS0gcmEnum) return "SmbS0gcm" end if(enum==SmbS0pEnum) return "SmbS0p" end if(enum==SmbS0tEnum) return "SmbS0t" end if(enum==SmbSizeiniEnum) return "SmbSizeini" end if(enum==SmbSmbCorrEnum) return "SmbSmbCorr" end if(enum==SmbSmbrefEnum) return "SmbSmbref" end if(enum==SmbSzaValueEnum) return "SmbSzaValue" end if(enum==SmbTEnum) return "SmbT" end if(enum==SmbTaEnum) return "SmbTa" end if(enum==SmbTeValueEnum) return "SmbTeValue" end if(enum==SmbTemperaturesAnomalyEnum) return "SmbTemperaturesAnomaly" end if(enum==SmbTemperaturesLgmEnum) return "SmbTemperaturesLgm" end if(enum==SmbTemperaturesPresentdayEnum) return "SmbTemperaturesPresentday" end if(enum==SmbTemperaturesReconstructedEnum) return "SmbTemperaturesReconstructed" end if(enum==SmbTiniEnum) return "SmbTini" end if(enum==SmbTmeanEnum) return "SmbTmean" end if(enum==SmbTzEnum) return "SmbTz" end if(enum==SmbValuesAutoregressionEnum) return "SmbValuesAutoregression" end if(enum==SmbVEnum) return "SmbV" end if(enum==SmbVmeanEnum) return "SmbVmean" end if(enum==SmbVzEnum) return "SmbVz" end if(enum==SmbWEnum) return "SmbW" end if(enum==SmbWAddEnum) return "SmbWAdd" end if(enum==SmbWiniEnum) return "SmbWini" end if(enum==SmbZMaxEnum) return "SmbZMax" end if(enum==SmbZMinEnum) return "SmbZMin" end if(enum==SmbZTopEnum) return "SmbZTop" end if(enum==SmbZYEnum) return "SmbZY" end if(enum==SolidearthExternalDisplacementEastRateEnum) return "SolidearthExternalDisplacementEastRate" end if(enum==SolidearthExternalDisplacementNorthRateEnum) return "SolidearthExternalDisplacementNorthRate" end if(enum==SolidearthExternalDisplacementUpRateEnum) return "SolidearthExternalDisplacementUpRate" end if(enum==SolidearthExternalGeoidRateEnum) return "SolidearthExternalGeoidRate" end if(enum==StochasticForcingDefaultIdEnum) return "StochasticForcingDefaultId" end if(enum==StrainRateeffectiveEnum) return "StrainRateeffective" end if(enum==StrainRateparallelEnum) return "StrainRateparallel" end if(enum==StrainRateperpendicularEnum) return "StrainRateperpendicular" end if(enum==StrainRatexxEnum) return "StrainRatexx" end if(enum==StrainRatexyEnum) return "StrainRatexy" end if(enum==StrainRatexzEnum) return "StrainRatexz" end if(enum==StrainRateyyEnum) return "StrainRateyy" end if(enum==StrainRateyzEnum) return "StrainRateyz" end if(enum==StrainRatezzEnum) return "StrainRatezz" end if(enum==StressMaxPrincipalEnum) return "StressMaxPrincipal" end if(enum==StressTensorxxEnum) return "StressTensorxx" end if(enum==StressTensorxyEnum) return "StressTensorxy" end if(enum==StressTensorxzEnum) return "StressTensorxz" end if(enum==StressTensoryyEnum) return "StressTensoryy" end if(enum==StressTensoryzEnum) return "StressTensoryz" end if(enum==StressTensorzzEnum) return "StressTensorzz" end if(enum==SurfaceAbsMisfitEnum) return "SurfaceAbsMisfit" end if(enum==SurfaceAbsVelMisfitEnum) return "SurfaceAbsVelMisfit" end if(enum==AreaEnum) return "Area" end if(enum==SealevelAreaEnum) return "SealevelArea" end if(enum==SurfaceAreaEnum) return "SurfaceArea" end if(enum==SurfaceAverageVelMisfitEnum) return "SurfaceAverageVelMisfit" end if(enum==SurfaceCrevasseEnum) return "SurfaceCrevasse" end if(enum==SurfaceEnum) return "Surface" end if(enum==SurfaceOldEnum) return "SurfaceOld" end if(enum==SurfaceLogVelMisfitEnum) return "SurfaceLogVelMisfit" end if(enum==SurfaceLogVxVyMisfitEnum) return "SurfaceLogVxVyMisfit" end if(enum==SurfaceObservationEnum) return "SurfaceObservation" end if(enum==SurfaceRelVelMisfitEnum) return "SurfaceRelVelMisfit" end if(enum==SurfaceSlopeXEnum) return "SurfaceSlopeX" end if(enum==SurfaceSlopeYEnum) return "SurfaceSlopeY" end if(enum==TemperatureEnum) return "Temperature" end if(enum==TemperaturePDDEnum) return "TemperaturePDD" end if(enum==TemperaturePicardEnum) return "TemperaturePicard" end if(enum==TemperatureSEMICEnum) return "TemperatureSEMIC" end if(enum==ThermalforcingAutoregressionNoiseEnum) return "ThermalforcingAutoregressionNoise" end if(enum==ThermalforcingValuesAutoregressionEnum) return "ThermalforcingValuesAutoregression" end if(enum==ThermalSpctemperatureEnum) return "ThermalSpctemperature" end if(enum==ThicknessAbsGradientEnum) return "ThicknessAbsGradient" end if(enum==ThicknessAbsMisfitEnum) return "ThicknessAbsMisfit" end if(enum==ThicknessAcrossGradientEnum) return "ThicknessAcrossGradient" end if(enum==ThicknessAlongGradientEnum) return "ThicknessAlongGradient" end if(enum==ThicknessEnum) return "Thickness" end if(enum==ThicknessOldEnum) return "ThicknessOld" end if(enum==ThicknessPositiveEnum) return "ThicknessPositive" end if(enum==ThicknessResidualEnum) return "ThicknessResidual" end if(enum==TransientAccumulatedDeltaIceThicknessEnum) return "TransientAccumulatedDeltaIceThickness" end if(enum==VelEnum) return "Vel" end if(enum==VxAverageEnum) return "VxAverage" end if(enum==VxBaseEnum) return "VxBase" end if(enum==VxEnum) return "Vx" end if(enum==VxMeshEnum) return "VxMesh" end if(enum==VxObsEnum) return "VxObs" end if(enum==VxShearEnum) return "VxShear" end if(enum==VxSurfaceEnum) return "VxSurface" end if(enum==VyAverageEnum) return "VyAverage" end if(enum==VyBaseEnum) return "VyBase" end if(enum==VyEnum) return "Vy" end if(enum==VyMeshEnum) return "VyMesh" end if(enum==VyObsEnum) return "VyObs" end if(enum==VyShearEnum) return "VyShear" end if(enum==VySurfaceEnum) return "VySurface" end if(enum==VzEnum) return "Vz" end if(enum==VzFSEnum) return "VzFS" end if(enum==VzHOEnum) return "VzHO" end if(enum==VzMeshEnum) return "VzMesh" end if(enum==VzSSAEnum) return "VzSSA" end if(enum==WaterColumnOldEnum) return "WaterColumnOld" end if(enum==WatercolumnEnum) return "Watercolumn" end if(enum==WaterfractionDrainageEnum) return "WaterfractionDrainage" end if(enum==WaterfractionDrainageIntegratedEnum) return "WaterfractionDrainageIntegrated" end if(enum==WaterfractionEnum) return "Waterfraction" end if(enum==WaterheightEnum) return "Waterheight" end if(enum==WeightsLevelsetObservationEnum) return "WeightsLevelsetObservation" end if(enum==WeightsSurfaceObservationEnum) return "WeightsSurfaceObservation" end if(enum==OldAccumulatedDeltaBottomPressureEnum) return "OldAccumulatedDeltaBottomPressure" end if(enum==OldAccumulatedDeltaIceThicknessEnum) return "OldAccumulatedDeltaIceThickness" end if(enum==OldAccumulatedDeltaTwsEnum) return "OldAccumulatedDeltaTws" end if(enum==Outputdefinition1Enum) return "Outputdefinition1" end if(enum==Outputdefinition10Enum) return "Outputdefinition10" end if(enum==Outputdefinition11Enum) return "Outputdefinition11" end if(enum==Outputdefinition12Enum) return "Outputdefinition12" end if(enum==Outputdefinition13Enum) return "Outputdefinition13" end if(enum==Outputdefinition14Enum) return "Outputdefinition14" end if(enum==Outputdefinition15Enum) return "Outputdefinition15" end if(enum==Outputdefinition16Enum) return "Outputdefinition16" end if(enum==Outputdefinition17Enum) return "Outputdefinition17" end if(enum==Outputdefinition18Enum) return "Outputdefinition18" end if(enum==Outputdefinition19Enum) return "Outputdefinition19" end if(enum==Outputdefinition20Enum) return "Outputdefinition20" end if(enum==Outputdefinition21Enum) return "Outputdefinition21" end if(enum==Outputdefinition22Enum) return "Outputdefinition22" end if(enum==Outputdefinition23Enum) return "Outputdefinition23" end if(enum==Outputdefinition24Enum) return "Outputdefinition24" end if(enum==Outputdefinition25Enum) return "Outputdefinition25" end if(enum==Outputdefinition26Enum) return "Outputdefinition26" end if(enum==Outputdefinition27Enum) return "Outputdefinition27" end if(enum==Outputdefinition28Enum) return "Outputdefinition28" end if(enum==Outputdefinition29Enum) return "Outputdefinition29" end if(enum==Outputdefinition2Enum) return "Outputdefinition2" end if(enum==Outputdefinition30Enum) return "Outputdefinition30" end if(enum==Outputdefinition31Enum) return "Outputdefinition31" end if(enum==Outputdefinition32Enum) return "Outputdefinition32" end if(enum==Outputdefinition33Enum) return "Outputdefinition33" end if(enum==Outputdefinition34Enum) return "Outputdefinition34" end if(enum==Outputdefinition35Enum) return "Outputdefinition35" end if(enum==Outputdefinition36Enum) return "Outputdefinition36" end if(enum==Outputdefinition37Enum) return "Outputdefinition37" end if(enum==Outputdefinition38Enum) return "Outputdefinition38" end if(enum==Outputdefinition39Enum) return "Outputdefinition39" end if(enum==Outputdefinition3Enum) return "Outputdefinition3" end if(enum==Outputdefinition40Enum) return "Outputdefinition40" end if(enum==Outputdefinition41Enum) return "Outputdefinition41" end if(enum==Outputdefinition42Enum) return "Outputdefinition42" end if(enum==Outputdefinition43Enum) return "Outputdefinition43" end if(enum==Outputdefinition44Enum) return "Outputdefinition44" end if(enum==Outputdefinition45Enum) return "Outputdefinition45" end if(enum==Outputdefinition46Enum) return "Outputdefinition46" end if(enum==Outputdefinition47Enum) return "Outputdefinition47" end if(enum==Outputdefinition48Enum) return "Outputdefinition48" end if(enum==Outputdefinition49Enum) return "Outputdefinition49" end if(enum==Outputdefinition4Enum) return "Outputdefinition4" end if(enum==Outputdefinition50Enum) return "Outputdefinition50" end if(enum==Outputdefinition51Enum) return "Outputdefinition51" end if(enum==Outputdefinition52Enum) return "Outputdefinition52" end if(enum==Outputdefinition53Enum) return "Outputdefinition53" end if(enum==Outputdefinition54Enum) return "Outputdefinition54" end if(enum==Outputdefinition55Enum) return "Outputdefinition55" end if(enum==Outputdefinition56Enum) return "Outputdefinition56" end if(enum==Outputdefinition57Enum) return "Outputdefinition57" end if(enum==Outputdefinition58Enum) return "Outputdefinition58" end if(enum==Outputdefinition59Enum) return "Outputdefinition59" end if(enum==Outputdefinition5Enum) return "Outputdefinition5" end if(enum==Outputdefinition60Enum) return "Outputdefinition60" end if(enum==Outputdefinition61Enum) return "Outputdefinition61" end if(enum==Outputdefinition62Enum) return "Outputdefinition62" end if(enum==Outputdefinition63Enum) return "Outputdefinition63" end if(enum==Outputdefinition64Enum) return "Outputdefinition64" end if(enum==Outputdefinition65Enum) return "Outputdefinition65" end if(enum==Outputdefinition66Enum) return "Outputdefinition66" end if(enum==Outputdefinition67Enum) return "Outputdefinition67" end if(enum==Outputdefinition68Enum) return "Outputdefinition68" end if(enum==Outputdefinition69Enum) return "Outputdefinition69" end if(enum==Outputdefinition6Enum) return "Outputdefinition6" end if(enum==Outputdefinition70Enum) return "Outputdefinition70" end if(enum==Outputdefinition71Enum) return "Outputdefinition71" end if(enum==Outputdefinition72Enum) return "Outputdefinition72" end if(enum==Outputdefinition73Enum) return "Outputdefinition73" end if(enum==Outputdefinition74Enum) return "Outputdefinition74" end if(enum==Outputdefinition75Enum) return "Outputdefinition75" end if(enum==Outputdefinition76Enum) return "Outputdefinition76" end if(enum==Outputdefinition77Enum) return "Outputdefinition77" end if(enum==Outputdefinition78Enum) return "Outputdefinition78" end if(enum==Outputdefinition79Enum) return "Outputdefinition79" end if(enum==Outputdefinition7Enum) return "Outputdefinition7" end if(enum==Outputdefinition80Enum) return "Outputdefinition80" end if(enum==Outputdefinition81Enum) return "Outputdefinition81" end if(enum==Outputdefinition82Enum) return "Outputdefinition82" end if(enum==Outputdefinition83Enum) return "Outputdefinition83" end if(enum==Outputdefinition84Enum) return "Outputdefinition84" end if(enum==Outputdefinition85Enum) return "Outputdefinition85" end if(enum==Outputdefinition86Enum) return "Outputdefinition86" end if(enum==Outputdefinition87Enum) return "Outputdefinition87" end if(enum==Outputdefinition88Enum) return "Outputdefinition88" end if(enum==Outputdefinition89Enum) return "Outputdefinition89" end if(enum==Outputdefinition8Enum) return "Outputdefinition8" end if(enum==Outputdefinition90Enum) return "Outputdefinition90" end if(enum==Outputdefinition91Enum) return "Outputdefinition91" end if(enum==Outputdefinition92Enum) return "Outputdefinition92" end if(enum==Outputdefinition93Enum) return "Outputdefinition93" end if(enum==Outputdefinition94Enum) return "Outputdefinition94" end if(enum==Outputdefinition95Enum) return "Outputdefinition95" end if(enum==Outputdefinition96Enum) return "Outputdefinition96" end if(enum==Outputdefinition97Enum) return "Outputdefinition97" end if(enum==Outputdefinition98Enum) return "Outputdefinition98" end if(enum==Outputdefinition99Enum) return "Outputdefinition99" end if(enum==Outputdefinition9Enum) return "Outputdefinition9" end if(enum==Outputdefinition100Enum) return "Outputdefinition100" end if(enum==InputsENDEnum) return "InputsEND" end if(enum==AbsoluteEnum) return "Absolute" end if(enum==AdaptiveTimesteppingEnum) return "AdaptiveTimestepping" end if(enum==AdjointBalancethickness2AnalysisEnum) return "AdjointBalancethickness2Analysis" end if(enum==AdjointBalancethicknessAnalysisEnum) return "AdjointBalancethicknessAnalysis" end if(enum==AdjointHorizAnalysisEnum) return "AdjointHorizAnalysis" end if(enum==AgeAnalysisEnum) return "AgeAnalysis" end if(enum==AggressiveMigrationEnum) return "AggressiveMigration" end if(enum==AmrBamgEnum) return "AmrBamg" end if(enum==AmrNeopzEnum) return "AmrNeopz" end if(enum==AndroidFrictionCoefficientEnum) return "AndroidFrictionCoefficient" end if(enum==ArrheniusEnum) return "Arrhenius" end if(enum==AutodiffJacobianEnum) return "AutodiffJacobian" end if(enum==AutoregressionLinearFloatingMeltRateEnum) return "AutoregressionLinearFloatingMeltRate" end if(enum==Balancethickness2AnalysisEnum) return "Balancethickness2Analysis" end if(enum==Balancethickness2SolutionEnum) return "Balancethickness2Solution" end if(enum==BalancethicknessAnalysisEnum) return "BalancethicknessAnalysis" end if(enum==BalancethicknessApparentMassbalanceEnum) return "BalancethicknessApparentMassbalance" end if(enum==BalancethicknessSoftAnalysisEnum) return "BalancethicknessSoftAnalysis" end if(enum==BalancethicknessSoftSolutionEnum) return "BalancethicknessSoftSolution" end if(enum==BalancethicknessSolutionEnum) return "BalancethicknessSolution" end if(enum==BalancevelocityAnalysisEnum) return "BalancevelocityAnalysis" end if(enum==BalancevelocitySolutionEnum) return "BalancevelocitySolution" end if(enum==BasalforcingsIsmip6Enum) return "BasalforcingsIsmip6" end if(enum==BasalforcingsPicoEnum) return "BasalforcingsPico" end if(enum==BeckmannGoosseFloatingMeltRateEnum) return "BeckmannGoosseFloatingMeltRate" end if(enum==BedSlopeSolutionEnum) return "BedSlopeSolution" end if(enum==BoolExternalResultEnum) return "BoolExternalResult" end if(enum==BoolInputEnum) return "BoolInput" end if(enum==IntInputEnum) return "IntInput" end if(enum==DoubleInputEnum) return "DoubleInput" end if(enum==BoolParamEnum) return "BoolParam" end if(enum==BoundaryEnum) return "Boundary" end if(enum==BuddJackaEnum) return "BuddJacka" end if(enum==CalvingDev2Enum) return "CalvingDev2" end if(enum==CalvingHabEnum) return "CalvingHab" end if(enum==CalvingLevermannEnum) return "CalvingLevermann" end if(enum==CalvingTestEnum) return "CalvingTest" end if(enum==CalvingParameterizationEnum) return "CalvingParameterization" end if(enum==CalvingVonmisesEnum) return "CalvingVonmises" end if(enum==CfdragcoeffabsgradEnum) return "Cfdragcoeffabsgrad" end if(enum==CfsurfacelogvelEnum) return "Cfsurfacelogvel" end if(enum==CfsurfacesquareEnum) return "Cfsurfacesquare" end if(enum==CflevelsetmisfitEnum) return "Cflevelsetmisfit" end if(enum==ChannelEnum) return "Channel" end if(enum==ChannelAreaEnum) return "ChannelArea" end if(enum==ChannelAreaOldEnum) return "ChannelAreaOld" end if(enum==ChannelDischargeEnum) return "ChannelDischarge" end if(enum==ClosedEnum) return "Closed" end if(enum==ColinearEnum) return "Colinear" end if(enum==ConstraintsEnum) return "Constraints" end if(enum==ContactEnum) return "Contact" end if(enum==ContourEnum) return "Contour" end if(enum==ContoursEnum) return "Contours" end if(enum==ControlInputEnum) return "ControlInput" end if(enum==ControlInputGradEnum) return "ControlInputGrad" end if(enum==ControlInputMaxsEnum) return "ControlInputMaxs" end if(enum==ControlInputMinsEnum) return "ControlInputMins" end if(enum==ControlInputValuesEnum) return "ControlInputValues" end if(enum==CrouzeixRaviartEnum) return "CrouzeixRaviart" end if(enum==CuffeyEnum) return "Cuffey" end if(enum==CuffeyTemperateEnum) return "CuffeyTemperate" end if(enum==DamageEvolutionAnalysisEnum) return "DamageEvolutionAnalysis" end if(enum==DamageEvolutionSolutionEnum) return "DamageEvolutionSolution" end if(enum==DataSetEnum) return "DataSet" end if(enum==DataSetParamEnum) return "DataSetParam" end if(enum==DatasetInputEnum) return "DatasetInput" end if(enum==DefaultAnalysisEnum) return "DefaultAnalysis" end if(enum==DefaultCalvingEnum) return "DefaultCalving" end if(enum==DenseEnum) return "Dense" end if(enum==DependentObjectEnum) return "DependentObject" end if(enum==DepthAverageAnalysisEnum) return "DepthAverageAnalysis" end if(enum==DeviatoricStressErrorEstimatorEnum) return "DeviatoricStressErrorEstimator" end if(enum==DivergenceEnum) return "Divergence" end if(enum==Domain3DsurfaceEnum) return "Domain3Dsurface" end if(enum==DoubleArrayInputEnum) return "DoubleArrayInput" end if(enum==ArrayInputEnum) return "ArrayInput" end if(enum==IntArrayInputEnum) return "IntArrayInput" end if(enum==DoubleExternalResultEnum) return "DoubleExternalResult" end if(enum==DoubleMatArrayParamEnum) return "DoubleMatArrayParam" end if(enum==DoubleMatExternalResultEnum) return "DoubleMatExternalResult" end if(enum==DoubleMatParamEnum) return "DoubleMatParam" end if(enum==DoubleParamEnum) return "DoubleParam" end if(enum==DoubleVecParamEnum) return "DoubleVecParam" end if(enum==ElementEnum) return "Element" end if(enum==ElementHookEnum) return "ElementHook" end if(enum==ElementSIdEnum) return "ElementSId" end if(enum==EnthalpyAnalysisEnum) return "EnthalpyAnalysis" end if(enum==EsaAnalysisEnum) return "EsaAnalysis" end if(enum==EsaSolutionEnum) return "EsaSolution" end if(enum==EsaTransitionsEnum) return "EsaTransitions" end if(enum==ExternalResultEnum) return "ExternalResult" end if(enum==ExtrapolationAnalysisEnum) return "ExtrapolationAnalysis" end if(enum==ExtrudeFromBaseAnalysisEnum) return "ExtrudeFromBaseAnalysis" end if(enum==ExtrudeFromTopAnalysisEnum) return "ExtrudeFromTopAnalysis" end if(enum==FSApproximationEnum) return "FSApproximation" end if(enum==FSSolverEnum) return "FSSolver" end if(enum==FSpressureEnum) return "FSpressure" end if(enum==FSvelocityEnum) return "FSvelocity" end if(enum==FemModelEnum) return "FemModel" end if(enum==FileParamEnum) return "FileParam" end if(enum==FixedTimesteppingEnum) return "FixedTimestepping" end if(enum==FloatingAreaEnum) return "FloatingArea" end if(enum==FloatingAreaScaledEnum) return "FloatingAreaScaled" end if(enum==FloatingMeltRateEnum) return "FloatingMeltRate" end if(enum==FreeEnum) return "Free" end if(enum==FreeSurfaceBaseAnalysisEnum) return "FreeSurfaceBaseAnalysis" end if(enum==FreeSurfaceTopAnalysisEnum) return "FreeSurfaceTopAnalysis" end if(enum==FrontalForcingsDefaultEnum) return "FrontalForcingsDefault" end if(enum==FrontalForcingsRignotEnum) return "FrontalForcingsRignot" end if(enum==FrontalForcingsRignotAutoregressionEnum) return "FrontalForcingsRignotAutoregression" end if(enum==FsetEnum) return "Fset" end if(enum==FullMeltOnPartiallyFloatingEnum) return "FullMeltOnPartiallyFloating" end if(enum==GLheightadvectionAnalysisEnum) return "GLheightadvectionAnalysis" end if(enum==GaussPentaEnum) return "GaussPenta" end if(enum==GaussSegEnum) return "GaussSeg" end if(enum==GaussTetraEnum) return "GaussTetra" end if(enum==GaussTriaEnum) return "GaussTria" end if(enum==GenericOptionEnum) return "GenericOption" end if(enum==GenericParamEnum) return "GenericParam" end if(enum==GenericExternalResultEnum) return "GenericExternalResult" end if(enum==Gradient1Enum) return "Gradient1" end if(enum==Gradient2Enum) return "Gradient2" end if(enum==Gradient3Enum) return "Gradient3" end if(enum==Gradient4Enum) return "Gradient4" end if(enum==GroundedAreaEnum) return "GroundedArea" end if(enum==GroundedAreaScaledEnum) return "GroundedAreaScaled" end if(enum==GroundingOnlyEnum) return "GroundingOnly" end if(enum==GroundinglineMassFluxEnum) return "GroundinglineMassFlux" end if(enum==GsetEnum) return "Gset" end if(enum==GslEnum) return "Gsl" end if(enum==HOApproximationEnum) return "HOApproximation" end if(enum==HOFSApproximationEnum) return "HOFSApproximation" end if(enum==HookEnum) return "Hook" end if(enum==HydrologyDCEfficientAnalysisEnum) return "HydrologyDCEfficientAnalysis" end if(enum==HydrologyDCInefficientAnalysisEnum) return "HydrologyDCInefficientAnalysis" end if(enum==HydrologyGlaDSAnalysisEnum) return "HydrologyGlaDSAnalysis" end if(enum==HydrologyGlaDSEnum) return "HydrologyGlaDS" end if(enum==HydrologyPismAnalysisEnum) return "HydrologyPismAnalysis" end if(enum==HydrologyShaktiAnalysisEnum) return "HydrologyShaktiAnalysis" end if(enum==HydrologyShreveAnalysisEnum) return "HydrologyShreveAnalysis" end if(enum==HydrologySolutionEnum) return "HydrologySolution" end if(enum==HydrologySubstepsEnum) return "HydrologySubsteps" end if(enum==HydrologySubTimeEnum) return "HydrologySubTime" end if(enum==HydrologydcEnum) return "Hydrologydc" end if(enum==HydrologypismEnum) return "Hydrologypism" end if(enum==HydrologyshaktiEnum) return "Hydrologyshakti" end if(enum==HydrologyshreveEnum) return "Hydrologyshreve" end if(enum==IceMassEnum) return "IceMass" end if(enum==IceMassScaledEnum) return "IceMassScaled" end if(enum==IceVolumeAboveFloatationEnum) return "IceVolumeAboveFloatation" end if(enum==IceVolumeAboveFloatationScaledEnum) return "IceVolumeAboveFloatationScaled" end if(enum==IceVolumeEnum) return "IceVolume" end if(enum==IceVolumeScaledEnum) return "IceVolumeScaled" end if(enum==IcefrontMassFluxEnum) return "IcefrontMassFlux" end if(enum==IcefrontMassFluxLevelsetEnum) return "IcefrontMassFluxLevelset" end if(enum==IncrementalEnum) return "Incremental" end if(enum==IndexedEnum) return "Indexed" end if(enum==IntExternalResultEnum) return "IntExternalResult" end if(enum==ElementInputEnum) return "ElementInput" end if(enum==IntMatExternalResultEnum) return "IntMatExternalResult" end if(enum==IntMatParamEnum) return "IntMatParam" end if(enum==IntParamEnum) return "IntParam" end if(enum==IntVecParamEnum) return "IntVecParam" end if(enum==InputsEnum) return "Inputs" end if(enum==InternalEnum) return "Internal" end if(enum==IntersectEnum) return "Intersect" end if(enum==InversionVzObsEnum) return "InversionVzObs" end if(enum==JEnum) return "J" end if(enum==L1L2ApproximationEnum) return "L1L2Approximation" end if(enum==MOLHOApproximationEnum) return "MOLHOApproximation" end if(enum==L2ProjectionBaseAnalysisEnum) return "L2ProjectionBaseAnalysis" end if(enum==L2ProjectionEPLAnalysisEnum) return "L2ProjectionEPLAnalysis" end if(enum==LACrouzeixRaviartEnum) return "LACrouzeixRaviart" end if(enum==LATaylorHoodEnum) return "LATaylorHood" end if(enum==LambdaSEnum) return "LambdaS" end if(enum==LevelsetAnalysisEnum) return "LevelsetAnalysis" end if(enum==LevelsetfunctionPicardEnum) return "LevelsetfunctionPicard" end if(enum==LinearFloatingMeltRateEnum) return "LinearFloatingMeltRate" end if(enum==LliboutryDuvalEnum) return "LliboutryDuval" end if(enum==LoadsEnum) return "Loads" end if(enum==LoveAnalysisEnum) return "LoveAnalysis" end if(enum==LoveHfEnum) return "LoveHf" end if(enum==LoveHtEnum) return "LoveHt" end if(enum==LoveKernelsImagEnum) return "LoveKernelsImag" end if(enum==LoveKernelsRealEnum) return "LoveKernelsReal" end if(enum==LoveKfEnum) return "LoveKf" end if(enum==LoveKtEnum) return "LoveKt" end if(enum==LoveLfEnum) return "LoveLf" end if(enum==LoveLtEnum) return "LoveLt" end if(enum==LoveTidalHtEnum) return "LoveTidalHt" end if(enum==LoveTidalKtEnum) return "LoveTidalKt" end if(enum==LoveTidalLtEnum) return "LoveTidalLt" end if(enum==LovePMTF1tEnum) return "LovePMTF1t" end if(enum==LovePMTF2tEnum) return "LovePMTF2t" end if(enum==LoveYiEnum) return "LoveYi" end if(enum==LoveRhsEnum) return "LoveRhs" end if(enum==LoveSolutionEnum) return "LoveSolution" end if(enum==MINIEnum) return "MINI" end if(enum==MINIcondensedEnum) return "MINIcondensed" end if(enum==MantlePlumeGeothermalFluxEnum) return "MantlePlumeGeothermalFlux" end if(enum==MassFluxEnum) return "MassFlux" end if(enum==MassconEnum) return "Masscon" end if(enum==MassconaxpbyEnum) return "Massconaxpby" end if(enum==MassfluxatgateEnum) return "Massfluxatgate" end if(enum==MasstransportAnalysisEnum) return "MasstransportAnalysis" end if(enum==MasstransportSolutionEnum) return "MasstransportSolution" end if(enum==MatdamageiceEnum) return "Matdamageice" end if(enum==MatenhancediceEnum) return "Matenhancedice" end if(enum==MaterialsEnum) return "Materials" end if(enum==MatestarEnum) return "Matestar" end if(enum==MaticeEnum) return "Matice" end if(enum==MatlithoEnum) return "Matlitho" end if(enum==MathydroEnum) return "Mathydro" end if(enum==MatrixParamEnum) return "MatrixParam" end if(enum==MaxAbsVxEnum) return "MaxAbsVx" end if(enum==MaxAbsVyEnum) return "MaxAbsVy" end if(enum==MaxAbsVzEnum) return "MaxAbsVz" end if(enum==MaxDivergenceEnum) return "MaxDivergence" end if(enum==MaxVelEnum) return "MaxVel" end if(enum==MaxVxEnum) return "MaxVx" end if(enum==MaxVyEnum) return "MaxVy" end if(enum==MaxVzEnum) return "MaxVz" end if(enum==MelangeEnum) return "Melange" end if(enum==MeltingAnalysisEnum) return "MeltingAnalysis" end if(enum==MeshElementsEnum) return "MeshElements" end if(enum==MeshXEnum) return "MeshX" end if(enum==MeshYEnum) return "MeshY" end if(enum==MinVelEnum) return "MinVel" end if(enum==MinVxEnum) return "MinVx" end if(enum==MinVyEnum) return "MinVy" end if(enum==MinVzEnum) return "MinVz" end if(enum==MismipFloatingMeltRateEnum) return "MismipFloatingMeltRate" end if(enum==MoulinEnum) return "Moulin" end if(enum==MpiDenseEnum) return "MpiDense" end if(enum==MpiEnum) return "Mpi" end if(enum==MpiSparseEnum) return "MpiSparse" end if(enum==MumpsEnum) return "Mumps" end if(enum==NoFrictionOnPartiallyFloatingEnum) return "NoFrictionOnPartiallyFloating" end if(enum==NoMeltOnPartiallyFloatingEnum) return "NoMeltOnPartiallyFloating" end if(enum==NodalEnum) return "Nodal" end if(enum==NodalvalueEnum) return "Nodalvalue" end if(enum==NodeSIdEnum) return "NodeSId" end if(enum==NoneApproximationEnum) return "NoneApproximation" end if(enum==NoneEnum) return "None" end if(enum==NumberedcostfunctionEnum) return "Numberedcostfunction" end if(enum==NyeCO2Enum) return "NyeCO2" end if(enum==NyeH2OEnum) return "NyeH2O" end if(enum==NumericalfluxEnum) return "Numericalflux" end if(enum==OceantransportAnalysisEnum) return "OceantransportAnalysis" end if(enum==OceantransportSolutionEnum) return "OceantransportSolution" end if(enum==OldGradientEnum) return "OldGradient" end if(enum==OneLayerP4zEnum) return "OneLayerP4z" end if(enum==OpenEnum) return "Open" end if(enum==OptionEnum) return "Option" end if(enum==ParamEnum) return "Param" end if(enum==ParametersEnum) return "Parameters" end if(enum==P0ArrayEnum) return "P0Array" end if(enum==P0DGEnum) return "P0DG" end if(enum==P1DGEnum) return "P1DG" end if(enum==P1P1Enum) return "P1P1" end if(enum==P1P1GLSEnum) return "P1P1GLS" end if(enum==P1bubbleEnum) return "P1bubble" end if(enum==P1bubblecondensedEnum) return "P1bubblecondensed" end if(enum==P1xP2Enum) return "P1xP2" end if(enum==P1xP3Enum) return "P1xP3" end if(enum==P1xP4Enum) return "P1xP4" end if(enum==P2Enum) return "P2" end if(enum==P2bubbleEnum) return "P2bubble" end if(enum==P2bubblecondensedEnum) return "P2bubblecondensed" end if(enum==P2xP1Enum) return "P2xP1" end if(enum==P2xP4Enum) return "P2xP4" end if(enum==PatersonEnum) return "Paterson" end if(enum==PengridEnum) return "Pengrid" end if(enum==PenpairEnum) return "Penpair" end if(enum==PentaEnum) return "Penta" end if(enum==PentaInputEnum) return "PentaInput" end if(enum==ProfilerEnum) return "Profiler" end if(enum==ProfilingCurrentFlopsEnum) return "ProfilingCurrentFlops" end if(enum==ProfilingCurrentMemEnum) return "ProfilingCurrentMem" end if(enum==ProfilingSolutionTimeEnum) return "ProfilingSolutionTime" end if(enum==RegionaloutputEnum) return "Regionaloutput" end if(enum==RegularEnum) return "Regular" end if(enum==RecoveryAnalysisEnum) return "RecoveryAnalysis" end if(enum==RiftfrontEnum) return "Riftfront" end if(enum==SamplingAnalysisEnum) return "SamplingAnalysis" end if(enum==SamplingSolutionEnum) return "SamplingSolution" end if(enum==SIAApproximationEnum) return "SIAApproximation" end if(enum==SMBautoregressionEnum) return "SMBautoregression" end if(enum==SMBcomponentsEnum) return "SMBcomponents" end if(enum==SMBd18opddEnum) return "SMBd18opdd" end if(enum==SMBforcingEnum) return "SMBforcing" end if(enum==SMBgcmEnum) return "SMBgcm" end if(enum==SMBgembEnum) return "SMBgemb" end if(enum==SMBgradientsEnum) return "SMBgradients" end if(enum==SMBgradientscomponentsEnum) return "SMBgradientscomponents" end if(enum==SMBgradientselaEnum) return "SMBgradientsela" end if(enum==SMBhenningEnum) return "SMBhenning" end if(enum==SMBmeltcomponentsEnum) return "SMBmeltcomponents" end if(enum==SMBpddEnum) return "SMBpdd" end if(enum==SMBpddSicopolisEnum) return "SMBpddSicopolis" end if(enum==SMBsemicEnum) return "SMBsemic" end if(enum==SSAApproximationEnum) return "SSAApproximation" end if(enum==SSAFSApproximationEnum) return "SSAFSApproximation" end if(enum==SSAHOApproximationEnum) return "SSAHOApproximation" end if(enum==ScaledEnum) return "Scaled" end if(enum==SealevelAbsoluteEnum) return "SealevelAbsolute" end if(enum==SealevelEmotionEnum) return "SealevelEmotion" end if(enum==SealevelchangePolarMotionXEnum) return "SealevelchangePolarMotionX" end if(enum==SealevelchangePolarMotionYEnum) return "SealevelchangePolarMotionY" end if(enum==SealevelchangePolarMotionZEnum) return "SealevelchangePolarMotionZ" end if(enum==SealevelchangePolarMotionEnum) return "SealevelchangePolarMotion" end if(enum==SealevelNmotionEnum) return "SealevelNmotion" end if(enum==SealevelUmotionEnum) return "SealevelUmotion" end if(enum==SealevelchangeAnalysisEnum) return "SealevelchangeAnalysis" end if(enum==SegEnum) return "Seg" end if(enum==SegInputEnum) return "SegInput" end if(enum==SegmentEnum) return "Segment" end if(enum==SegmentRiftfrontEnum) return "SegmentRiftfront" end if(enum==SeparateEnum) return "Separate" end if(enum==SeqEnum) return "Seq" end if(enum==SmbAnalysisEnum) return "SmbAnalysis" end if(enum==SmbSolutionEnum) return "SmbSolution" end if(enum==SmoothAnalysisEnum) return "SmoothAnalysis" end if(enum==SoftMigrationEnum) return "SoftMigration" end if(enum==SpatialLinearFloatingMeltRateEnum) return "SpatialLinearFloatingMeltRate" end if(enum==SpcDynamicEnum) return "SpcDynamic" end if(enum==SpcStaticEnum) return "SpcStatic" end if(enum==SpcTransientEnum) return "SpcTransient" end if(enum==SsetEnum) return "Sset" end if(enum==StatisticsSolutionEnum) return "StatisticsSolution" end if(enum==SteadystateSolutionEnum) return "SteadystateSolution" end if(enum==StressIntensityFactorEnum) return "StressIntensityFactor" end if(enum==StressbalanceAnalysisEnum) return "StressbalanceAnalysis" end if(enum==StressbalanceConvergenceNumStepsEnum) return "StressbalanceConvergenceNumSteps" end if(enum==StressbalanceSIAAnalysisEnum) return "StressbalanceSIAAnalysis" end if(enum==StressbalanceSolutionEnum) return "StressbalanceSolution" end if(enum==StressbalanceVerticalAnalysisEnum) return "StressbalanceVerticalAnalysis" end if(enum==StringArrayParamEnum) return "StringArrayParam" end if(enum==StringExternalResultEnum) return "StringExternalResult" end if(enum==StringParamEnum) return "StringParam" end if(enum==SubelementFriction1Enum) return "SubelementFriction1" end if(enum==SubelementFriction2Enum) return "SubelementFriction2" end if(enum==SubelementMelt1Enum) return "SubelementMelt1" end if(enum==SubelementMelt2Enum) return "SubelementMelt2" end if(enum==SubelementMigrationEnum) return "SubelementMigration" end if(enum==SurfaceSlopeSolutionEnum) return "SurfaceSlopeSolution" end if(enum==TaylorHoodEnum) return "TaylorHood" end if(enum==TetraEnum) return "Tetra" end if(enum==TetraInputEnum) return "TetraInput" end if(enum==ThermalAnalysisEnum) return "ThermalAnalysis" end if(enum==ThermalSolutionEnum) return "ThermalSolution" end if(enum==ThicknessErrorEstimatorEnum) return "ThicknessErrorEstimator" end if(enum==TotalCalvingFluxLevelsetEnum) return "TotalCalvingFluxLevelset" end if(enum==TotalCalvingMeltingFluxLevelsetEnum) return "TotalCalvingMeltingFluxLevelset" end if(enum==TotalFloatingBmbEnum) return "TotalFloatingBmb" end if(enum==TotalFloatingBmbScaledEnum) return "TotalFloatingBmbScaled" end if(enum==TotalGroundedBmbEnum) return "TotalGroundedBmb" end if(enum==TotalGroundedBmbScaledEnum) return "TotalGroundedBmbScaled" end if(enum==TotalSmbEnum) return "TotalSmb" end if(enum==TotalSmbScaledEnum) return "TotalSmbScaled" end if(enum==TransientArrayParamEnum) return "TransientArrayParam" end if(enum==TransientInputEnum) return "TransientInput" end if(enum==TransientParamEnum) return "TransientParam" end if(enum==TransientSolutionEnum) return "TransientSolution" end if(enum==TriaEnum) return "Tria" end if(enum==TriaInputEnum) return "TriaInput" end if(enum==UzawaPressureAnalysisEnum) return "UzawaPressureAnalysis" end if(enum==VectorParamEnum) return "VectorParam" end if(enum==VertexEnum) return "Vertex" end if(enum==VertexLIdEnum) return "VertexLId" end if(enum==VertexPIdEnum) return "VertexPId" end if(enum==VertexSIdEnum) return "VertexSId" end if(enum==VerticesEnum) return "Vertices" end if(enum==ViscousHeatingEnum) return "ViscousHeating" end if(enum==WaterEnum) return "Water" end if(enum==XTaylorHoodEnum) return "XTaylorHood" end if(enum==XYEnum) return "XY" end if(enum==XYZEnum) return "XYZ" end if(enum==BalancethicknessD0Enum) return "BalancethicknessD0" end if(enum==BalancethicknessDiffusionCoefficientEnum) return "BalancethicknessDiffusionCoefficient" end if(enum==BilinearInterpEnum) return "BilinearInterp" end if(enum==CalvingdevCoeffEnum) return "CalvingdevCoeff" end if(enum==DeviatoricStressEnum) return "DeviatoricStress" end if(enum==EtaAbsGradientEnum) return "EtaAbsGradient" end if(enum==MeshZEnum) return "MeshZ" end if(enum==NearestInterpEnum) return "NearestInterp" end if(enum==OutputdefinitionListEnum) return "OutputdefinitionList" end if(enum==SealevelObsEnum) return "SealevelObs" end if(enum==SealevelWeightsEnum) return "SealevelWeights" end if(enum==StrainRateEnum) return "StrainRate" end if(enum==StressTensorEnum) return "StressTensor" end if(enum==StressbalanceViscosityOvershootEnum) return "StressbalanceViscosityOvershoot" end if(enum==SubelementMigration4Enum) return "SubelementMigration4" end if(enum==TimesteppingTimeAdaptEnum) return "TimesteppingTimeAdapt" end if(enum==TriangleInterpEnum) return "TriangleInterp" end if(enum==MaximumNumberOfDefinitionsEnum) return "MaximumNumberOfDefinitions" end end function StringToEnum(name::String) if(name=="ParametersSTART") return ParametersSTARTEnum end if(name=="AdolcParam") return AdolcParamEnum end if(name=="AgeStabilization") return AgeStabilizationEnum end if(name=="AgeNumRequestedOutputs") return AgeNumRequestedOutputsEnum end if(name=="AgeRequestedOutputs") return AgeRequestedOutputsEnum end if(name=="AmrDeviatoricErrorGroupThreshold") return AmrDeviatoricErrorGroupThresholdEnum end if(name=="AmrDeviatoricErrorMaximum") return AmrDeviatoricErrorMaximumEnum end if(name=="AmrDeviatoricErrorResolution") return AmrDeviatoricErrorResolutionEnum end if(name=="AmrDeviatoricErrorThreshold") return AmrDeviatoricErrorThresholdEnum end if(name=="AmrErr") return AmrErrEnum end if(name=="AmrField") return AmrFieldEnum end if(name=="AmrGradation") return AmrGradationEnum end if(name=="AmrGroundingLineDistance") return AmrGroundingLineDistanceEnum end if(name=="AmrGroundingLineResolution") return AmrGroundingLineResolutionEnum end if(name=="AmrHmax") return AmrHmaxEnum end if(name=="AmrHmin") return AmrHminEnum end if(name=="AmrIceFrontDistance") return AmrIceFrontDistanceEnum end if(name=="AmrIceFrontResolution") return AmrIceFrontResolutionEnum end if(name=="AmrKeepMetric") return AmrKeepMetricEnum end if(name=="AmrLag") return AmrLagEnum end if(name=="AmrLevelMax") return AmrLevelMaxEnum end if(name=="AmrRestart") return AmrRestartEnum end if(name=="AmrThicknessErrorGroupThreshold") return AmrThicknessErrorGroupThresholdEnum end if(name=="AmrThicknessErrorMaximum") return AmrThicknessErrorMaximumEnum end if(name=="AmrThicknessErrorResolution") return AmrThicknessErrorResolutionEnum end if(name=="AmrThicknessErrorThreshold") return AmrThicknessErrorThresholdEnum end if(name=="AmrType") return AmrTypeEnum end if(name=="AnalysisCounter") return AnalysisCounterEnum end if(name=="AnalysisType") return AnalysisTypeEnum end if(name=="AugmentedLagrangianR") return AugmentedLagrangianREnum end if(name=="AugmentedLagrangianRholambda") return AugmentedLagrangianRholambdaEnum end if(name=="AugmentedLagrangianRhop") return AugmentedLagrangianRhopEnum end if(name=="AugmentedLagrangianRlambda") return AugmentedLagrangianRlambdaEnum end if(name=="AugmentedLagrangianTheta") return AugmentedLagrangianThetaEnum end if(name=="AutodiffCbufsize") return AutodiffCbufsizeEnum end if(name=="AutodiffDependentObjects") return AutodiffDependentObjectsEnum end if(name=="AutodiffDriver") return AutodiffDriverEnum end if(name=="AutodiffFosForwardIndex") return AutodiffFosForwardIndexEnum end if(name=="AutodiffFosReverseIndex") return AutodiffFosReverseIndexEnum end if(name=="AutodiffFovForwardIndices") return AutodiffFovForwardIndicesEnum end if(name=="AutodiffGcTriggerMaxSize") return AutodiffGcTriggerMaxSizeEnum end if(name=="AutodiffGcTriggerRatio") return AutodiffGcTriggerRatioEnum end if(name=="AutodiffIsautodiff") return AutodiffIsautodiffEnum end if(name=="AutodiffLbufsize") return AutodiffLbufsizeEnum end if(name=="AutodiffNumDependents") return AutodiffNumDependentsEnum end if(name=="AutodiffNumIndependents") return AutodiffNumIndependentsEnum end if(name=="AutodiffObufsize") return AutodiffObufsizeEnum end if(name=="AutodiffTapeAlloc") return AutodiffTapeAllocEnum end if(name=="AutodiffTbufsize") return AutodiffTbufsizeEnum end if(name=="AutodiffXp") return AutodiffXpEnum end if(name=="BalancethicknessStabilization") return BalancethicknessStabilizationEnum end if(name=="BarystaticContributions") return BarystaticContributionsEnum end if(name=="BasalforcingsAutoregressionInitialTime") return BasalforcingsAutoregressionInitialTimeEnum end if(name=="BasalforcingsAutoregressionTimestep") return BasalforcingsAutoregressionTimestepEnum end if(name=="BasalforcingsAutoregressiveOrder") return BasalforcingsAutoregressiveOrderEnum end if(name=="BasalforcingsBeta0") return BasalforcingsBeta0Enum end if(name=="BasalforcingsBeta1") return BasalforcingsBeta1Enum end if(name=="BasalforcingsBottomplumedepth") return BasalforcingsBottomplumedepthEnum end if(name=="BasalforcingsCrustthickness") return BasalforcingsCrustthicknessEnum end if(name=="BasalforcingsDeepwaterElevation") return BasalforcingsDeepwaterElevationEnum end if(name=="BasalforcingsDeepwaterMeltingRate") return BasalforcingsDeepwaterMeltingRateEnum end if(name=="BasalforcingsDtbg") return BasalforcingsDtbgEnum end if(name=="Basalforcings") return BasalforcingsEnum end if(name=="BasalforcingsIsmip6AverageTf") return BasalforcingsIsmip6AverageTfEnum end if(name=="BasalforcingsIsmip6BasinArea") return BasalforcingsIsmip6BasinAreaEnum end if(name=="BasalforcingsIsmip6DeltaT") return BasalforcingsIsmip6DeltaTEnum end if(name=="BasalforcingsIsmip6Gamma0") return BasalforcingsIsmip6Gamma0Enum end if(name=="BasalforcingsIsmip6IsLocal") return BasalforcingsIsmip6IsLocalEnum end if(name=="BasalforcingsIsmip6NumBasins") return BasalforcingsIsmip6NumBasinsEnum end if(name=="BasalforcingsIsmip6TfDepths") return BasalforcingsIsmip6TfDepthsEnum end if(name=="BasalforcingsLinearNumBasins") return BasalforcingsLinearNumBasinsEnum end if(name=="BasalforcingsLowercrustheat") return BasalforcingsLowercrustheatEnum end if(name=="BasalforcingsMantleconductivity") return BasalforcingsMantleconductivityEnum end if(name=="BasalforcingsNusselt") return BasalforcingsNusseltEnum end if(name=="BasalforcingsPhi") return BasalforcingsPhiEnum end if(name=="BasalforcingsPicoAverageOverturning") return BasalforcingsPicoAverageOverturningEnum end if(name=="BasalforcingsPicoAverageSalinity") return BasalforcingsPicoAverageSalinityEnum end if(name=="BasalforcingsPicoAverageTemperature") return BasalforcingsPicoAverageTemperatureEnum end if(name=="BasalforcingsPicoBoxArea") return BasalforcingsPicoBoxAreaEnum end if(name=="BasalforcingsPicoFarOceansalinity") return BasalforcingsPicoFarOceansalinityEnum end if(name=="BasalforcingsPicoFarOceantemperature") return BasalforcingsPicoFarOceantemperatureEnum end if(name=="BasalforcingsPicoGammaT") return BasalforcingsPicoGammaTEnum end if(name=="BasalforcingsPicoIsplume") return BasalforcingsPicoIsplumeEnum end if(name=="BasalforcingsPicoMaxboxcount") return BasalforcingsPicoMaxboxcountEnum end if(name=="BasalforcingsPicoNumBasins") return BasalforcingsPicoNumBasinsEnum end if(name=="BasalforcingsPlumeradius") return BasalforcingsPlumeradiusEnum end if(name=="BasalforcingsPlumex") return BasalforcingsPlumexEnum end if(name=="BasalforcingsPlumey") return BasalforcingsPlumeyEnum end if(name=="BasalforcingsThresholdThickness") return BasalforcingsThresholdThicknessEnum end if(name=="BasalforcingsTopplumedepth") return BasalforcingsTopplumedepthEnum end if(name=="BasalforcingsUppercrustheat") return BasalforcingsUppercrustheatEnum end if(name=="BasalforcingsUppercrustthickness") return BasalforcingsUppercrustthicknessEnum end if(name=="BasalforcingsUpperdepthMelt") return BasalforcingsUpperdepthMeltEnum end if(name=="BasalforcingsUpperwaterElevation") return BasalforcingsUpperwaterElevationEnum end if(name=="BasalforcingsUpperwaterMeltingRate") return BasalforcingsUpperwaterMeltingRateEnum end if(name=="CalvingCrevasseDepth") return CalvingCrevasseDepthEnum end if(name=="CalvingCrevasseThreshold") return CalvingCrevasseThresholdEnum end if(name=="CalvingHeightAboveFloatation") return CalvingHeightAboveFloatationEnum end if(name=="CalvingLaw") return CalvingLawEnum end if(name=="CalvingMinthickness") return CalvingMinthicknessEnum end if(name=="CalvingTestSpeedfactor") return CalvingTestSpeedfactorEnum end if(name=="CalvingTestIndependentRate") return CalvingTestIndependentRateEnum end if(name=="CalvingUseParam") return CalvingUseParamEnum end if(name=="CalvingTheta") return CalvingThetaEnum end if(name=="CalvingAlpha") return CalvingAlphaEnum end if(name=="CalvingXoffset") return CalvingXoffsetEnum end if(name=="CalvingYoffset") return CalvingYoffsetEnum end if(name=="CalvingVelLowerbound") return CalvingVelLowerboundEnum end if(name=="CalvingVelUpperbound") return CalvingVelUpperboundEnum end if(name=="ConfigurationType") return ConfigurationTypeEnum end if(name=="ConstantsG") return ConstantsGEnum end if(name=="ConstantsNewtonGravity") return ConstantsNewtonGravityEnum end if(name=="ConstantsReferencetemperature") return ConstantsReferencetemperatureEnum end if(name=="ConstantsYts") return ConstantsYtsEnum end if(name=="ControlInputSizeM") return ControlInputSizeMEnum end if(name=="ControlInputSizeN") return ControlInputSizeNEnum end if(name=="ControlInputInterpolation") return ControlInputInterpolationEnum end if(name=="CumBslc") return CumBslcEnum end if(name=="CumBslcIce") return CumBslcIceEnum end if(name=="CumBslcHydro") return CumBslcHydroEnum end if(name=="CumBslcOcean") return CumBslcOceanEnum end if(name=="CumBslcIcePartition") return CumBslcIcePartitionEnum end if(name=="CumBslcHydroPartition") return CumBslcHydroPartitionEnum end if(name=="CumBslcOceanPartition") return CumBslcOceanPartitionEnum end if(name=="CumGmtslc") return CumGmtslcEnum end if(name=="CumGmslc") return CumGmslcEnum end if(name=="DamageC1") return DamageC1Enum end if(name=="DamageC2") return DamageC2Enum end if(name=="DamageC3") return DamageC3Enum end if(name=="DamageC4") return DamageC4Enum end if(name=="Damage") return DamageEnum end if(name=="DamageEquivStress") return DamageEquivStressEnum end if(name=="DamageEvolutionNumRequestedOutputs") return DamageEvolutionNumRequestedOutputsEnum end if(name=="DamageEvolutionRequestedOutputs") return DamageEvolutionRequestedOutputsEnum end if(name=="DamageHealing") return DamageHealingEnum end if(name=="DamageKappa") return DamageKappaEnum end if(name=="DamageLaw") return DamageLawEnum end if(name=="DamageMaxDamage") return DamageMaxDamageEnum end if(name=="DamageStabilization") return DamageStabilizationEnum end if(name=="DamageStressThreshold") return DamageStressThresholdEnum end if(name=="DamageStressUBound") return DamageStressUBoundEnum end if(name=="DebugProfiling") return DebugProfilingEnum end if(name=="DomainDimension") return DomainDimensionEnum end if(name=="DomainType") return DomainTypeEnum end if(name=="DslModel") return DslModelEnum end if(name=="DslModelid") return DslModelidEnum end if(name=="DslNummodels") return DslNummodelsEnum end if(name=="SolidearthIsExternal") return SolidearthIsExternalEnum end if(name=="SolidearthExternalNature") return SolidearthExternalNatureEnum end if(name=="SolidearthExternalModelid") return SolidearthExternalModelidEnum end if(name=="SolidearthExternalNummodels") return SolidearthExternalNummodelsEnum end if(name=="SolidearthSettingsComputeBpGrd") return SolidearthSettingsComputeBpGrdEnum end if(name=="EarthId") return EarthIdEnum end if(name=="Elastic") return ElasticEnum end if(name=="EplZigZagCounter") return EplZigZagCounterEnum end if(name=="EsaHElastic") return EsaHElasticEnum end if(name=="EsaHemisphere") return EsaHemisphereEnum end if(name=="EsaRequestedOutputs") return EsaRequestedOutputsEnum end if(name=="EsaUElastic") return EsaUElasticEnum end if(name=="ExtrapolationVariable") return ExtrapolationVariableEnum end if(name=="FemModelComm") return FemModelCommEnum end if(name=="Fields") return FieldsEnum end if(name=="FlowequationFeFS") return FlowequationFeFSEnum end if(name=="FlowequationIsFS") return FlowequationIsFSEnum end if(name=="FlowequationIsHO") return FlowequationIsHOEnum end if(name=="FlowequationIsL1L2") return FlowequationIsL1L2Enum end if(name=="FlowequationIsMOLHO") return FlowequationIsMOLHOEnum end if(name=="FlowequationIsSIA") return FlowequationIsSIAEnum end if(name=="FlowequationIsSSA") return FlowequationIsSSAEnum end if(name=="FlowequationIsNitsche") return FlowequationIsNitscheEnum end if(name=="FeFSNitscheGamma") return FeFSNitscheGammaEnum end if(name=="FrictionCoupling") return FrictionCouplingEnum end if(name=="FrictionDelta") return FrictionDeltaEnum end if(name=="FrictionEffectivePressureLimit") return FrictionEffectivePressureLimitEnum end if(name=="FrictionF") return FrictionFEnum end if(name=="FrictionGamma") return FrictionGammaEnum end if(name=="FrictionLaw") return FrictionLawEnum end if(name=="FrictionPseudoplasticityExponent") return FrictionPseudoplasticityExponentEnum end if(name=="FrictionThresholdSpeed") return FrictionThresholdSpeedEnum end if(name=="FrictionVoidRatio") return FrictionVoidRatioEnum end if(name=="FrontalForcingsBasinIcefrontArea") return FrontalForcingsBasinIcefrontAreaEnum end if(name=="FrontalForcingsAutoregressionInitialTime") return FrontalForcingsAutoregressionInitialTimeEnum end if(name=="FrontalForcingsAutoregressionTimestep") return FrontalForcingsAutoregressionTimestepEnum end if(name=="FrontalForcingsAutoregressiveOrder") return FrontalForcingsAutoregressiveOrderEnum end if(name=="FrontalForcingsBeta0") return FrontalForcingsBeta0Enum end if(name=="FrontalForcingsBeta1") return FrontalForcingsBeta1Enum end if(name=="FrontalForcingsNumberofBasins") return FrontalForcingsNumberofBasinsEnum end if(name=="FrontalForcingsParam") return FrontalForcingsParamEnum end if(name=="FrontalForcingsPhi") return FrontalForcingsPhiEnum end if(name=="GrdModel") return GrdModelEnum end if(name=="GroundinglineFrictionInterpolation") return GroundinglineFrictionInterpolationEnum end if(name=="GroundinglineMeltInterpolation") return GroundinglineMeltInterpolationEnum end if(name=="GroundinglineMigration") return GroundinglineMigrationEnum end if(name=="GroundinglineNumRequestedOutputs") return GroundinglineNumRequestedOutputsEnum end if(name=="GroundinglineRequestedOutputs") return GroundinglineRequestedOutputsEnum end if(name=="HydrologyAveraging") return HydrologyAveragingEnum end if(name=="HydrologyCavitySpacing") return HydrologyCavitySpacingEnum end if(name=="HydrologyChannelConductivity") return HydrologyChannelConductivityEnum end if(name=="HydrologyChannelSheetWidth") return HydrologyChannelSheetWidthEnum end if(name=="HydrologyEnglacialVoidRatio") return HydrologyEnglacialVoidRatioEnum end if(name=="HydrologyIschannels") return HydrologyIschannelsEnum end if(name=="HydrologyMeltFlag") return HydrologyMeltFlagEnum end if(name=="HydrologyModel") return HydrologyModelEnum end if(name=="HydrologyNumRequestedOutputs") return HydrologyNumRequestedOutputsEnum end if(name=="HydrologyPressureMeltCoefficient") return HydrologyPressureMeltCoefficientEnum end if(name=="HydrologyRelaxation") return HydrologyRelaxationEnum end if(name=="HydrologyRequestedOutputs") return HydrologyRequestedOutputsEnum end if(name=="HydrologySedimentKmax") return HydrologySedimentKmaxEnum end if(name=="HydrologyStepsPerStep") return HydrologyStepsPerStepEnum end if(name=="HydrologyStorage") return HydrologyStorageEnum end if(name=="HydrologydcEplColapseThickness") return HydrologydcEplColapseThicknessEnum end if(name=="HydrologydcEplConductivity") return HydrologydcEplConductivityEnum end if(name=="HydrologydcEplInitialThickness") return HydrologydcEplInitialThicknessEnum end if(name=="HydrologydcEplLayerCompressibility") return HydrologydcEplLayerCompressibilityEnum end if(name=="HydrologydcEplMaxThickness") return HydrologydcEplMaxThicknessEnum end if(name=="HydrologydcEplPoreWaterMass") return HydrologydcEplPoreWaterMassEnum end if(name=="HydrologydcEplThickComp") return HydrologydcEplThickCompEnum end if(name=="HydrologydcEplflipLock") return HydrologydcEplflipLockEnum end if(name=="HydrologydcIsefficientlayer") return HydrologydcIsefficientlayerEnum end if(name=="HydrologydcLeakageFactor") return HydrologydcLeakageFactorEnum end if(name=="HydrologydcMaxIter") return HydrologydcMaxIterEnum end if(name=="HydrologydcPenaltyFactor") return HydrologydcPenaltyFactorEnum end if(name=="HydrologydcPenaltyLock") return HydrologydcPenaltyLockEnum end if(name=="HydrologydcRelTol") return HydrologydcRelTolEnum end if(name=="HydrologydcSedimentlimit") return HydrologydcSedimentlimitEnum end if(name=="HydrologydcSedimentlimitFlag") return HydrologydcSedimentlimitFlagEnum end if(name=="HydrologydcSedimentLayerCompressibility") return HydrologydcSedimentLayerCompressibilityEnum end if(name=="HydrologydcSedimentPoreWaterMass") return HydrologydcSedimentPoreWaterMassEnum end if(name=="HydrologydcSedimentPorosity") return HydrologydcSedimentPorosityEnum end if(name=="HydrologydcSedimentThickness") return HydrologydcSedimentThicknessEnum end if(name=="HydrologyStepAdapt") return HydrologyStepAdaptEnum end if(name=="HydrologydcTransferFlag") return HydrologydcTransferFlagEnum end if(name=="HydrologydcUnconfinedFlag") return HydrologydcUnconfinedFlagEnum end if(name=="HydrologyshreveStabilization") return HydrologyshreveStabilizationEnum end if(name=="IcecapToEarthComm") return IcecapToEarthCommEnum end if(name=="Index") return IndexEnum end if(name=="InputFileName") return InputFileNameEnum end if(name=="DirectoryName") return DirectoryNameEnum end if(name=="Indices") return IndicesEnum end if(name=="InputToDepthaverageIn") return InputToDepthaverageInEnum end if(name=="InputToDepthaverageOut") return InputToDepthaverageOutEnum end if(name=="InputToExtrude") return InputToExtrudeEnum end if(name=="InputToL2Project") return InputToL2ProjectEnum end if(name=="InputToSmooth") return InputToSmoothEnum end if(name=="InversionAlgorithm") return InversionAlgorithmEnum end if(name=="InversionControlParameters") return InversionControlParametersEnum end if(name=="InversionControlScalingFactors") return InversionControlScalingFactorsEnum end if(name=="InversionCostFunctions") return InversionCostFunctionsEnum end if(name=="InversionDxmin") return InversionDxminEnum end if(name=="InversionGatol") return InversionGatolEnum end if(name=="InversionGradientScaling") return InversionGradientScalingEnum end if(name=="InversionGrtol") return InversionGrtolEnum end if(name=="InversionGttol") return InversionGttolEnum end if(name=="InversionIncompleteAdjoint") return InversionIncompleteAdjointEnum end if(name=="InversionIscontrol") return InversionIscontrolEnum end if(name=="InversionMaxiter") return InversionMaxiterEnum end if(name=="InversionMaxiterPerStep") return InversionMaxiterPerStepEnum end if(name=="InversionMaxsteps") return InversionMaxstepsEnum end if(name=="InversionNsteps") return InversionNstepsEnum end if(name=="InversionNumControlParameters") return InversionNumControlParametersEnum end if(name=="InversionNumCostFunctions") return InversionNumCostFunctionsEnum end if(name=="InversionStepThreshold") return InversionStepThresholdEnum end if(name=="InversionType") return InversionTypeEnum end if(name=="Ivins") return IvinsEnum end if(name=="IsSlcCoupling") return IsSlcCouplingEnum end if(name=="LevelsetKillIcebergs") return LevelsetKillIcebergsEnum end if(name=="LevelsetReinitFrequency") return LevelsetReinitFrequencyEnum end if(name=="LevelsetStabilization") return LevelsetStabilizationEnum end if(name=="LockFileName") return LockFileNameEnum end if(name=="LoveAllowLayerDeletion") return LoveAllowLayerDeletionEnum end if(name=="LoveChandlerWobble") return LoveChandlerWobbleEnum end if(name=="LoveCoreMantleBoundary") return LoveCoreMantleBoundaryEnum end if(name=="LoveEarthMass") return LoveEarthMassEnum end if(name=="LoveForcingType") return LoveForcingTypeEnum end if(name=="LoveFrequencies") return LoveFrequenciesEnum end if(name=="LoveIsTemporal") return LoveIsTemporalEnum end if(name=="LoveG0") return LoveG0Enum end if(name=="LoveGravitationalConstant") return LoveGravitationalConstantEnum end if(name=="LoveInnerCoreBoundary") return LoveInnerCoreBoundaryEnum end if(name=="LoveComplexComputation") return LoveComplexComputationEnum end if(name=="LoveQuadPrecision") return LoveQuadPrecisionEnum end if(name=="LoveIntStepsPerLayer") return LoveIntStepsPerLayerEnum end if(name=="LoveMinIntegrationSteps") return LoveMinIntegrationStepsEnum end if(name=="LoveMaxIntegrationdr") return LoveMaxIntegrationdrEnum end if(name=="LoveKernels") return LoveKernelsEnum end if(name=="LoveMu0") return LoveMu0Enum end if(name=="LoveNfreq") return LoveNfreqEnum end if(name=="LoveNTemporalIterations") return LoveNTemporalIterationsEnum end if(name=="LoveNYiEquations") return LoveNYiEquationsEnum end if(name=="LoveR0") return LoveR0Enum end if(name=="LoveShNmax") return LoveShNmaxEnum end if(name=="LoveShNmin") return LoveShNminEnum end if(name=="LoveStartingLayer") return LoveStartingLayerEnum end if(name=="LoveUnderflowTol") return LoveUnderflowTolEnum end if(name=="LovePostWidderThreshold") return LovePostWidderThresholdEnum end if(name=="LoveDebug") return LoveDebugEnum end if(name=="LoveHypergeomNZ") return LoveHypergeomNZEnum end if(name=="LoveHypergeomNAlpha") return LoveHypergeomNAlphaEnum end if(name=="MassFluxSegments") return MassFluxSegmentsEnum end if(name=="MassFluxSegmentsPresent") return MassFluxSegmentsPresentEnum end if(name=="MasstransportHydrostaticAdjustment") return MasstransportHydrostaticAdjustmentEnum end if(name=="MasstransportIsfreesurface") return MasstransportIsfreesurfaceEnum end if(name=="MasstransportMinThickness") return MasstransportMinThicknessEnum end if(name=="MasstransportNumRequestedOutputs") return MasstransportNumRequestedOutputsEnum end if(name=="MasstransportPenaltyFactor") return MasstransportPenaltyFactorEnum end if(name=="MasstransportRequestedOutputs") return MasstransportRequestedOutputsEnum end if(name=="MasstransportStabilization") return MasstransportStabilizationEnum end if(name=="MaterialsBeta") return MaterialsBetaEnum end if(name=="MaterialsEarthDensity") return MaterialsEarthDensityEnum end if(name=="MaterialsEffectiveconductivityAveraging") return MaterialsEffectiveconductivityAveragingEnum end if(name=="MaterialsHeatcapacity") return MaterialsHeatcapacityEnum end if(name=="MaterialsLatentheat") return MaterialsLatentheatEnum end if(name=="MaterialsMeltingpoint") return MaterialsMeltingpointEnum end if(name=="MaterialsMixedLayerCapacity") return MaterialsMixedLayerCapacityEnum end if(name=="MaterialsMuWater") return MaterialsMuWaterEnum end if(name=="MaterialsRheologyLaw") return MaterialsRheologyLawEnum end if(name=="MaterialsRhoFreshwater") return MaterialsRhoFreshwaterEnum end if(name=="MaterialsRhoIce") return MaterialsRhoIceEnum end if(name=="MaterialsRhoSeawater") return MaterialsRhoSeawaterEnum end if(name=="MaterialsTemperateiceconductivity") return MaterialsTemperateiceconductivityEnum end if(name=="MaterialsThermalExchangeVelocity") return MaterialsThermalExchangeVelocityEnum end if(name=="MaterialsThermalconductivity") return MaterialsThermalconductivityEnum end if(name=="MeltingOffset") return MeltingOffsetEnum end if(name=="MeshAverageVertexConnectivity") return MeshAverageVertexConnectivityEnum end if(name=="MeshElementtype") return MeshElementtypeEnum end if(name=="MeshNumberoflayers") return MeshNumberoflayersEnum end if(name=="MeshNumberofvertices") return MeshNumberofverticesEnum end if(name=="MeshNumberofelements") return MeshNumberofelementsEnum end if(name=="MigrationMax") return MigrationMaxEnum end if(name=="ModelId") return ModelIdEnum end if(name=="Nbins") return NbinsEnum end if(name=="Nodes") return NodesEnum end if(name=="NumModels") return NumModelsEnum end if(name=="OceanGridNx") return OceanGridNxEnum end if(name=="OceanGridNy") return OceanGridNyEnum end if(name=="OceanGridX") return OceanGridXEnum end if(name=="OceanGridY") return OceanGridYEnum end if(name=="OutputBufferPointer") return OutputBufferPointerEnum end if(name=="OutputBufferSizePointer") return OutputBufferSizePointerEnum end if(name=="OutputFileName") return OutputFileNameEnum end if(name=="OutputFilePointer") return OutputFilePointerEnum end if(name=="Outputdefinition") return OutputdefinitionEnum end if(name=="QmuErrName") return QmuErrNameEnum end if(name=="QmuInName") return QmuInNameEnum end if(name=="QmuIsdakota") return QmuIsdakotaEnum end if(name=="QmuOutName") return QmuOutNameEnum end if(name=="QmuOutput") return QmuOutputEnum end if(name=="QmuCurrEvalId") return QmuCurrEvalIdEnum end if(name=="QmuNsample") return QmuNsampleEnum end if(name=="QmuResponsedescriptors") return QmuResponsedescriptorsEnum end if(name=="QmuVariableDescriptors") return QmuVariableDescriptorsEnum end if(name=="QmuVariablePartitions") return QmuVariablePartitionsEnum end if(name=="QmuVariablePartitionsNpart") return QmuVariablePartitionsNpartEnum end if(name=="QmuVariablePartitionsNt") return QmuVariablePartitionsNtEnum end if(name=="QmuResponsePartitions") return QmuResponsePartitionsEnum end if(name=="QmuResponsePartitionsNpart") return QmuResponsePartitionsNpartEnum end if(name=="QmuStatistics") return QmuStatisticsEnum end if(name=="QmuNumstatistics") return QmuNumstatisticsEnum end if(name=="QmuNdirectories") return QmuNdirectoriesEnum end if(name=="QmuNfilesPerDirectory") return QmuNfilesPerDirectoryEnum end if(name=="QmuStatisticsMethod") return QmuStatisticsMethodEnum end if(name=="QmuMethods") return QmuMethodsEnum end if(name=="RestartFileName") return RestartFileNameEnum end if(name=="Results") return ResultsEnum end if(name=="RootPath") return RootPathEnum end if(name=="Modelname") return ModelnameEnum end if(name=="SamplingAlpha") return SamplingAlphaEnum end if(name=="SamplingNumRequestedOutputs") return SamplingNumRequestedOutputsEnum end if(name=="SamplingRequestedOutputs") return SamplingRequestedOutputsEnum end if(name=="SamplingRobin") return SamplingRobinEnum end if(name=="SamplingSeed") return SamplingSeedEnum end if(name=="SaveResults") return SaveResultsEnum end if(name=="SolidearthPartitionIce") return SolidearthPartitionIceEnum end if(name=="SolidearthPartitionHydro") return SolidearthPartitionHydroEnum end if(name=="SolidearthPartitionOcean") return SolidearthPartitionOceanEnum end if(name=="SolidearthNpartIce") return SolidearthNpartIceEnum end if(name=="SolidearthNpartOcean") return SolidearthNpartOceanEnum end if(name=="SolidearthNpartHydro") return SolidearthNpartHydroEnum end if(name=="SolidearthPlanetRadius") return SolidearthPlanetRadiusEnum end if(name=="SolidearthPlanetArea") return SolidearthPlanetAreaEnum end if(name=="SolidearthSettingsAbstol") return SolidearthSettingsAbstolEnum end if(name=="SolidearthSettingsCrossSectionShape") return SolidearthSettingsCrossSectionShapeEnum end if(name=="SolidearthSettingsElastic") return SolidearthSettingsElasticEnum end if(name=="SolidearthSettingsViscous") return SolidearthSettingsViscousEnum end if(name=="SolidearthSettingsSatelliteGravi") return SolidearthSettingsSatelliteGraviEnum end if(name=="SolidearthSettingsDegreeAccuracy") return SolidearthSettingsDegreeAccuracyEnum end if(name=="SealevelchangeGeometryDone") return SealevelchangeGeometryDoneEnum end if(name=="SealevelchangeViscousNumSteps") return SealevelchangeViscousNumStepsEnum end if(name=="SealevelchangeViscousTimes") return SealevelchangeViscousTimesEnum end if(name=="SealevelchangeViscousIndex") return SealevelchangeViscousIndexEnum end if(name=="SealevelchangeViscousPolarMotion") return SealevelchangeViscousPolarMotionEnum end if(name=="SealevelchangeRunCount") return SealevelchangeRunCountEnum end if(name=="SealevelchangeTransitions") return SealevelchangeTransitionsEnum end if(name=="SealevelchangeRequestedOutputs") return SealevelchangeRequestedOutputsEnum end if(name=="RotationalAngularVelocity") return RotationalAngularVelocityEnum end if(name=="RotationalEquatorialMoi") return RotationalEquatorialMoiEnum end if(name=="RotationalPolarMoi") return RotationalPolarMoiEnum end if(name=="LovePolarMotionTransferFunctionColinear") return LovePolarMotionTransferFunctionColinearEnum end if(name=="LovePolarMotionTransferFunctionOrthogonal") return LovePolarMotionTransferFunctionOrthogonalEnum end if(name=="TidalLoveH") return TidalLoveHEnum end if(name=="TidalLoveK") return TidalLoveKEnum end if(name=="TidalLoveL") return TidalLoveLEnum end if(name=="TidalLoveK2Secular") return TidalLoveK2SecularEnum end if(name=="LoadLoveH") return LoadLoveHEnum end if(name=="LoadLoveK") return LoadLoveKEnum end if(name=="LoadLoveL") return LoadLoveLEnum end if(name=="LoveTimeFreq") return LoveTimeFreqEnum end if(name=="LoveIsTime") return LoveIsTimeEnum end if(name=="LoveHypergeomZ") return LoveHypergeomZEnum end if(name=="LoveHypergeomTable1") return LoveHypergeomTable1Enum end if(name=="LoveHypergeomTable2") return LoveHypergeomTable2Enum end if(name=="SealevelchangeGSelfAttraction") return SealevelchangeGSelfAttractionEnum end if(name=="SealevelchangeGViscoElastic") return SealevelchangeGViscoElasticEnum end if(name=="SealevelchangeUViscoElastic") return SealevelchangeUViscoElasticEnum end if(name=="SealevelchangeHViscoElastic") return SealevelchangeHViscoElasticEnum end if(name=="SealevelchangePolarMotionTransferFunctionColinear") return SealevelchangePolarMotionTransferFunctionColinearEnum end if(name=="SealevelchangePolarMotionTransferFunctionOrthogonal") return SealevelchangePolarMotionTransferFunctionOrthogonalEnum end if(name=="SealevelchangePolarMotionTransferFunctionZ") return SealevelchangePolarMotionTransferFunctionZEnum end if(name=="SealevelchangeTidalK2") return SealevelchangeTidalK2Enum end if(name=="SealevelchangeTidalH2") return SealevelchangeTidalH2Enum end if(name=="SealevelchangeTidalL2") return SealevelchangeTidalL2Enum end if(name=="SolidearthSettingsSealevelLoading") return SolidearthSettingsSealevelLoadingEnum end if(name=="SolidearthSettingsGRD") return SolidearthSettingsGRDEnum end if(name=="SolidearthSettingsRunFrequency") return SolidearthSettingsRunFrequencyEnum end if(name=="SolidearthSettingsTimeAcc") return SolidearthSettingsTimeAccEnum end if(name=="SolidearthSettingsHoriz") return SolidearthSettingsHorizEnum end if(name=="SolidearthSettingsMaxiter") return SolidearthSettingsMaxiterEnum end if(name=="SolidearthSettingsGrdOcean") return SolidearthSettingsGrdOceanEnum end if(name=="SolidearthSettingsOceanAreaScaling") return SolidearthSettingsOceanAreaScalingEnum end if(name=="StochasticForcingCovariance") return StochasticForcingCovarianceEnum end if(name=="StochasticForcingDefaultDimension") return StochasticForcingDefaultDimensionEnum end if(name=="StochasticForcingDimensions") return StochasticForcingDimensionsEnum end if(name=="StochasticForcingFields") return StochasticForcingFieldsEnum end if(name=="StochasticForcingIsEffectivePressure") return StochasticForcingIsEffectivePressureEnum end if(name=="StochasticForcingIsStochasticForcing") return StochasticForcingIsStochasticForcingEnum end if(name=="StochasticForcingIsWaterPressure") return StochasticForcingIsWaterPressureEnum end if(name=="StochasticForcingNoiseterms") return StochasticForcingNoisetermsEnum end if(name=="StochasticForcingNumFields") return StochasticForcingNumFieldsEnum end if(name=="StochasticForcingRandomflag") return StochasticForcingRandomflagEnum end if(name=="StochasticForcingTimestep") return StochasticForcingTimestepEnum end if(name=="SolidearthSettingsReltol") return SolidearthSettingsReltolEnum end if(name=="SolidearthSettingsSelfAttraction") return SolidearthSettingsSelfAttractionEnum end if(name=="SolidearthSettingsRotation") return SolidearthSettingsRotationEnum end if(name=="SolidearthSettingsMaxSHCoeff") return SolidearthSettingsMaxSHCoeffEnum end if(name=="SettingsIoGather") return SettingsIoGatherEnum end if(name=="SettingsNumResultsOnNodes") return SettingsNumResultsOnNodesEnum end if(name=="SettingsOutputFrequency") return SettingsOutputFrequencyEnum end if(name=="SettingsCheckpointFrequency") return SettingsCheckpointFrequencyEnum end if(name=="SettingsResultsOnNodes") return SettingsResultsOnNodesEnum end if(name=="SettingsSbCouplingFrequency") return SettingsSbCouplingFrequencyEnum end if(name=="SettingsSolverResidueThreshold") return SettingsSolverResidueThresholdEnum end if(name=="SettingsWaitonlock") return SettingsWaitonlockEnum end if(name=="SmbAIce") return SmbAIceEnum end if(name=="SmbAIdx") return SmbAIdxEnum end if(name=="SmbASnow") return SmbASnowEnum end if(name=="SmbAccualti") return SmbAccualtiEnum end if(name=="SmbAccugrad") return SmbAccugradEnum end if(name=="SmbAccuref") return SmbAccurefEnum end if(name=="SmbAdThresh") return SmbAdThreshEnum end if(name=="SmbAutoregressionInitialTime") return SmbAutoregressionInitialTimeEnum end if(name=="SmbAutoregressionTimestep") return SmbAutoregressionTimestepEnum end if(name=="SmbAutoregressiveOrder") return SmbAutoregressiveOrderEnum end if(name=="SmbAveraging") return SmbAveragingEnum end if(name=="SmbBeta0") return SmbBeta0Enum end if(name=="SmbBeta1") return SmbBeta1Enum end if(name=="SmbDesfac") return SmbDesfacEnum end if(name=="SmbDpermil") return SmbDpermilEnum end if(name=="SmbDsnowIdx") return SmbDsnowIdxEnum end if(name=="SmbElevationBins") return SmbElevationBinsEnum end if(name=="SmbCldFrac") return SmbCldFracEnum end if(name=="SmbDelta18o") return SmbDelta18oEnum end if(name=="SmbDelta18oSurface") return SmbDelta18oSurfaceEnum end if(name=="SmbDenIdx") return SmbDenIdxEnum end if(name=="SmbDt") return SmbDtEnum end if(name=="Smb") return SmbEnum end if(name=="SmbEIdx") return SmbEIdxEnum end if(name=="SmbF") return SmbFEnum end if(name=="SmbInitDensityScaling") return SmbInitDensityScalingEnum end if(name=="SmbIsaccumulation") return SmbIsaccumulationEnum end if(name=="SmbIsalbedo") return SmbIsalbedoEnum end if(name=="SmbIsconstrainsurfaceT") return SmbIsconstrainsurfaceTEnum end if(name=="SmbIsd18opd") return SmbIsd18opdEnum end if(name=="SmbIsdelta18o") return SmbIsdelta18oEnum end if(name=="SmbIsdensification") return SmbIsdensificationEnum end if(name=="SmbIsdeltaLWup") return SmbIsdeltaLWupEnum end if(name=="SmbIsfirnwarming") return SmbIsfirnwarmingEnum end if(name=="SmbIsgraingrowth") return SmbIsgraingrowthEnum end if(name=="SmbIsmelt") return SmbIsmeltEnum end if(name=="SmbIsmungsm") return SmbIsmungsmEnum end if(name=="SmbIsprecipscaled") return SmbIsprecipscaledEnum end if(name=="SmbIssetpddfac") return SmbIssetpddfacEnum end if(name=="SmbIsshortwave") return SmbIsshortwaveEnum end if(name=="SmbIstemperaturescaled") return SmbIstemperaturescaledEnum end if(name=="SmbIsthermal") return SmbIsthermalEnum end if(name=="SmbIsturbulentflux") return SmbIsturbulentfluxEnum end if(name=="SmbK") return SmbKEnum end if(name=="SmbLapseRates") return SmbLapseRatesEnum end if(name=="SmbNumBasins") return SmbNumBasinsEnum end if(name=="SmbNumElevationBins") return SmbNumElevationBinsEnum end if(name=="SmbNumRequestedOutputs") return SmbNumRequestedOutputsEnum end if(name=="SmbPfac") return SmbPfacEnum end if(name=="SmbPhi") return SmbPhiEnum end if(name=="SmbRdl") return SmbRdlEnum end if(name=="SmbRefElevation") return SmbRefElevationEnum end if(name=="SmbRequestedOutputs") return SmbRequestedOutputsEnum end if(name=="SmbRlaps") return SmbRlapsEnum end if(name=="SmbRlapslgm") return SmbRlapslgmEnum end if(name=="SmbRunoffalti") return SmbRunoffaltiEnum end if(name=="SmbRunoffgrad") return SmbRunoffgradEnum end if(name=="SmbRunoffref") return SmbRunoffrefEnum end if(name=="SmbSealev") return SmbSealevEnum end if(name=="SmbStepsPerStep") return SmbStepsPerStepEnum end if(name=="SmbSwIdx") return SmbSwIdxEnum end if(name=="SmbT0dry") return SmbT0dryEnum end if(name=="SmbT0wet") return SmbT0wetEnum end if(name=="SmbTcIdx") return SmbTcIdxEnum end if(name=="SmbTeThresh") return SmbTeThreshEnum end if(name=="SmbTdiff") return SmbTdiffEnum end if(name=="SmbThermoDeltaTScaling") return SmbThermoDeltaTScalingEnum end if(name=="SmbTemperaturesReconstructedYears") return SmbTemperaturesReconstructedYearsEnum end if(name=="SmbPrecipitationsReconstructedYears") return SmbPrecipitationsReconstructedYearsEnum end if(name=="SmoothThicknessMultiplier") return SmoothThicknessMultiplierEnum end if(name=="SolutionType") return SolutionTypeEnum end if(name=="SteadystateMaxiter") return SteadystateMaxiterEnum end if(name=="SteadystateNumRequestedOutputs") return SteadystateNumRequestedOutputsEnum end if(name=="SteadystateReltol") return SteadystateReltolEnum end if(name=="SteadystateRequestedOutputs") return SteadystateRequestedOutputsEnum end if(name=="Step") return StepEnum end if(name=="Steps") return StepsEnum end if(name=="StressbalanceAbstol") return StressbalanceAbstolEnum end if(name=="StressbalanceFSreconditioning") return StressbalanceFSreconditioningEnum end if(name=="StressbalanceIsnewton") return StressbalanceIsnewtonEnum end if(name=="StressbalanceMaxiter") return StressbalanceMaxiterEnum end if(name=="StressbalanceNumRequestedOutputs") return StressbalanceNumRequestedOutputsEnum end if(name=="StressbalancePenaltyFactor") return StressbalancePenaltyFactorEnum end if(name=="StressbalanceReltol") return StressbalanceReltolEnum end if(name=="StressbalanceRequestedOutputs") return StressbalanceRequestedOutputsEnum end if(name=="StressbalanceRestol") return StressbalanceRestolEnum end if(name=="StressbalanceRiftPenaltyThreshold") return StressbalanceRiftPenaltyThresholdEnum end if(name=="StressbalanceShelfDampening") return StressbalanceShelfDampeningEnum end if(name=="ThermalIsdrainicecolumn") return ThermalIsdrainicecolumnEnum end if(name=="ThermalIsdynamicbasalspc") return ThermalIsdynamicbasalspcEnum end if(name=="ThermalIsenthalpy") return ThermalIsenthalpyEnum end if(name=="ThermalMaxiter") return ThermalMaxiterEnum end if(name=="ThermalNumRequestedOutputs") return ThermalNumRequestedOutputsEnum end if(name=="ThermalPenaltyFactor") return ThermalPenaltyFactorEnum end if(name=="ThermalPenaltyLock") return ThermalPenaltyLockEnum end if(name=="ThermalPenaltyThreshold") return ThermalPenaltyThresholdEnum end if(name=="ThermalReltol") return ThermalReltolEnum end if(name=="ThermalRequestedOutputs") return ThermalRequestedOutputsEnum end if(name=="ThermalStabilization") return ThermalStabilizationEnum end if(name=="ThermalWatercolumnUpperlimit") return ThermalWatercolumnUpperlimitEnum end if(name=="Time") return TimeEnum end if(name=="TimesteppingAverageForcing") return TimesteppingAverageForcingEnum end if(name=="TimesteppingCflCoefficient") return TimesteppingCflCoefficientEnum end if(name=="TimesteppingCouplingTime") return TimesteppingCouplingTimeEnum end if(name=="TimesteppingFinalTime") return TimesteppingFinalTimeEnum end if(name=="TimesteppingInterpForcing") return TimesteppingInterpForcingEnum end if(name=="TimesteppingCycleForcing") return TimesteppingCycleForcingEnum end if(name=="TimesteppingStartTime") return TimesteppingStartTimeEnum end if(name=="TimesteppingTimeStep") return TimesteppingTimeStepEnum end if(name=="TimesteppingTimeStepMax") return TimesteppingTimeStepMaxEnum end if(name=="TimesteppingTimeStepMin") return TimesteppingTimeStepMinEnum end if(name=="TimesteppingType") return TimesteppingTypeEnum end if(name=="ToMITgcmComm") return ToMITgcmCommEnum end if(name=="ToolkitsFileName") return ToolkitsFileNameEnum end if(name=="ToolkitsOptionsAnalyses") return ToolkitsOptionsAnalysesEnum end if(name=="ToolkitsOptionsStrings") return ToolkitsOptionsStringsEnum end if(name=="ToolkitsTypes") return ToolkitsTypesEnum end if(name=="TransientAmrFrequency") return TransientAmrFrequencyEnum end if(name=="TransientIsage") return TransientIsageEnum end if(name=="TransientIsdamageevolution") return TransientIsdamageevolutionEnum end if(name=="TransientIsesa") return TransientIsesaEnum end if(name=="TransientIsgia") return TransientIsgiaEnum end if(name=="TransientIsgroundingline") return TransientIsgroundinglineEnum end if(name=="TransientIshydrology") return TransientIshydrologyEnum end if(name=="TransientIsmasstransport") return TransientIsmasstransportEnum end if(name=="TransientIsoceantransport") return TransientIsoceantransportEnum end if(name=="TransientIsmovingfront") return TransientIsmovingfrontEnum end if(name=="TransientIsoceancoupling") return TransientIsoceancouplingEnum end if(name=="TransientIssampling") return TransientIssamplingEnum end if(name=="TransientIsslc") return TransientIsslcEnum end if(name=="TransientIssmb") return TransientIssmbEnum end if(name=="TransientIsstressbalance") return TransientIsstressbalanceEnum end if(name=="TransientIsthermal") return TransientIsthermalEnum end if(name=="TransientNumRequestedOutputs") return TransientNumRequestedOutputsEnum end if(name=="TransientRequestedOutputs") return TransientRequestedOutputsEnum end if(name=="Velocity") return VelocityEnum end if(name=="Xxe") return XxeEnum end if(name=="Yye") return YyeEnum end if(name=="Zze") return ZzeEnum end if(name=="Areae") return AreaeEnum end if(name=="WorldComm") return WorldCommEnum end if(name=="ParametersEND") return ParametersENDEnum end if(name=="InputsSTART") return InputsSTARTEnum end if(name=="AccumulatedDeltaBottomPressure") return AccumulatedDeltaBottomPressureEnum end if(name=="AccumulatedDeltaIceThickness") return AccumulatedDeltaIceThicknessEnum end if(name=="AccumulatedDeltaTws") return AccumulatedDeltaTwsEnum end if(name=="Adjoint") return AdjointEnum end if(name=="Adjointp") return AdjointpEnum end if(name=="Adjointx") return AdjointxEnum end if(name=="AdjointxBase") return AdjointxBaseEnum end if(name=="AdjointxShear") return AdjointxShearEnum end if(name=="Adjointy") return AdjointyEnum end if(name=="AdjointyBase") return AdjointyBaseEnum end if(name=="AdjointyShear") return AdjointyShearEnum end if(name=="Adjointz") return AdjointzEnum end if(name=="Age") return AgeEnum end if(name=="Air") return AirEnum end if(name=="Approximation") return ApproximationEnum end if(name=="BalancethicknessMisfit") return BalancethicknessMisfitEnum end if(name=="BalancethicknessOmega0") return BalancethicknessOmega0Enum end if(name=="BalancethicknessOmega") return BalancethicknessOmegaEnum end if(name=="BalancethicknessSpcthickness") return BalancethicknessSpcthicknessEnum end if(name=="BalancethicknessThickeningRate") return BalancethicknessThickeningRateEnum end if(name=="BasalCrevasse") return BasalCrevasseEnum end if(name=="BasalforcingsDeepwaterMeltingRateAutoregression") return BasalforcingsDeepwaterMeltingRateAutoregressionEnum end if(name=="BasalforcingsDeepwaterMeltingRateNoise") return BasalforcingsDeepwaterMeltingRateNoiseEnum end if(name=="BasalforcingsDeepwaterMeltingRateValuesAutoregression") return BasalforcingsDeepwaterMeltingRateValuesAutoregressionEnum end if(name=="BasalforcingsFloatingiceMeltingRate") return BasalforcingsFloatingiceMeltingRateEnum end if(name=="BasalforcingsGeothermalflux") return BasalforcingsGeothermalfluxEnum end if(name=="BasalforcingsGroundediceMeltingRate") return BasalforcingsGroundediceMeltingRateEnum end if(name=="BasalforcingsLinearBasinId") return BasalforcingsLinearBasinIdEnum end if(name=="BasalforcingsPerturbationMeltingRate") return BasalforcingsPerturbationMeltingRateEnum end if(name=="BasalforcingsSpatialDeepwaterElevation") return BasalforcingsSpatialDeepwaterElevationEnum end if(name=="BasalforcingsSpatialDeepwaterMeltingRate") return BasalforcingsSpatialDeepwaterMeltingRateEnum end if(name=="BasalforcingsSpatialUpperwaterElevation") return BasalforcingsSpatialUpperwaterElevationEnum end if(name=="BasalforcingsSpatialUpperwaterMeltingRate") return BasalforcingsSpatialUpperwaterMeltingRateEnum end if(name=="BasalforcingsIsmip6BasinId") return BasalforcingsIsmip6BasinIdEnum end if(name=="BasalforcingsIsmip6Tf") return BasalforcingsIsmip6TfEnum end if(name=="BasalforcingsIsmip6TfShelf") return BasalforcingsIsmip6TfShelfEnum end if(name=="BasalforcingsIsmip6MeltAnomaly") return BasalforcingsIsmip6MeltAnomalyEnum end if(name=="BasalforcingsMeltrateFactor") return BasalforcingsMeltrateFactorEnum end if(name=="BasalforcingsOceanSalinity") return BasalforcingsOceanSalinityEnum end if(name=="BasalforcingsOceanTemp") return BasalforcingsOceanTempEnum end if(name=="BasalforcingsPicoBasinId") return BasalforcingsPicoBasinIdEnum end if(name=="BasalforcingsPicoBoxId") return BasalforcingsPicoBoxIdEnum end if(name=="BasalforcingsPicoOverturningCoeff") return BasalforcingsPicoOverturningCoeffEnum end if(name=="BasalforcingsPicoSubShelfOceanOverturning") return BasalforcingsPicoSubShelfOceanOverturningEnum end if(name=="BasalforcingsPicoSubShelfOceanSalinity") return BasalforcingsPicoSubShelfOceanSalinityEnum end if(name=="BasalforcingsPicoSubShelfOceanTemp") return BasalforcingsPicoSubShelfOceanTempEnum end if(name=="BasalStressx") return BasalStressxEnum end if(name=="BasalStressy") return BasalStressyEnum end if(name=="BasalStress") return BasalStressEnum end if(name=="Base") return BaseEnum end if(name=="BaseOld") return BaseOldEnum end if(name=="BaseSlopeX") return BaseSlopeXEnum end if(name=="BaseSlopeY") return BaseSlopeYEnum end if(name=="BaselineBasalforcingsFloatingiceMeltingRate") return BaselineBasalforcingsFloatingiceMeltingRateEnum end if(name=="BaselineBasalforcingsSpatialDeepwaterMeltingRate") return BaselineBasalforcingsSpatialDeepwaterMeltingRateEnum end if(name=="BaselineCalvingCalvingrate") return BaselineCalvingCalvingrateEnum end if(name=="BaselineFrictionEffectivePressure") return BaselineFrictionEffectivePressureEnum end if(name=="BaselineSmbMassBalance") return BaselineSmbMassBalanceEnum end if(name=="Bed") return BedEnum end if(name=="BedGRD") return BedGRDEnum end if(name=="BedEast") return BedEastEnum end if(name=="BedEastGRD") return BedEastGRDEnum end if(name=="BedNorth") return BedNorthEnum end if(name=="BedNorthGRD") return BedNorthGRDEnum end if(name=="BedSlopeX") return BedSlopeXEnum end if(name=="BedSlopeY") return BedSlopeYEnum end if(name=="BottomPressure") return BottomPressureEnum end if(name=="BottomPressureOld") return BottomPressureOldEnum end if(name=="CalvingCalvingrate") return CalvingCalvingrateEnum end if(name=="CalvingHabFraction") return CalvingHabFractionEnum end if(name=="CalvingAblationrate") return CalvingAblationrateEnum end if(name=="CalvingMeltingrate") return CalvingMeltingrateEnum end if(name=="CalvingStressThresholdFloatingice") return CalvingStressThresholdFloatingiceEnum end if(name=="CalvingStressThresholdGroundedice") return CalvingStressThresholdGroundediceEnum end if(name=="CalvinglevermannCoeff") return CalvinglevermannCoeffEnum end if(name=="Calvingratex") return CalvingratexEnum end if(name=="Calvingratey") return CalvingrateyEnum end if(name=="CalvingFluxLevelset") return CalvingFluxLevelsetEnum end if(name=="CalvingMeltingFluxLevelset") return CalvingMeltingFluxLevelsetEnum end if(name=="Converged") return ConvergedEnum end if(name=="CrevasseDepth") return CrevasseDepthEnum end if(name=="DamageD") return DamageDEnum end if(name=="DamageDOld") return DamageDOldEnum end if(name=="DamageDbar") return DamageDbarEnum end if(name=="DamageDbarOld") return DamageDbarOldEnum end if(name=="DamageF") return DamageFEnum end if(name=="DegreeOfChannelization") return DegreeOfChannelizationEnum end if(name=="DepthBelowSurface") return DepthBelowSurfaceEnum end if(name=="DeltaIceThickness") return DeltaIceThicknessEnum end if(name=="DeltaTws") return DeltaTwsEnum end if(name=="DeltaBottomPressure") return DeltaBottomPressureEnum end if(name=="DeltaDsl") return DeltaDslEnum end if(name=="DslOld") return DslOldEnum end if(name=="Dsl") return DslEnum end if(name=="DeltaStr") return DeltaStrEnum end if(name=="StrOld") return StrOldEnum end if(name=="Str") return StrEnum end if(name=="DeviatoricStresseffective") return DeviatoricStresseffectiveEnum end if(name=="DeviatoricStressxx") return DeviatoricStressxxEnum end if(name=="DeviatoricStressxy") return DeviatoricStressxyEnum end if(name=="DeviatoricStressxz") return DeviatoricStressxzEnum end if(name=="DeviatoricStressyy") return DeviatoricStressyyEnum end if(name=="DeviatoricStressyz") return DeviatoricStressyzEnum end if(name=="DeviatoricStresszz") return DeviatoricStresszzEnum end if(name=="DeviatoricStress1") return DeviatoricStress1Enum end if(name=="DeviatoricStress2") return DeviatoricStress2Enum end if(name=="DistanceToCalvingfront") return DistanceToCalvingfrontEnum end if(name=="DistanceToGroundingline") return DistanceToGroundinglineEnum end if(name=="Domain2Dhorizontal") return Domain2DhorizontalEnum end if(name=="Domain2Dvertical") return Domain2DverticalEnum end if(name=="Domain3D") return Domain3DEnum end if(name=="DragCoefficientAbsGradient") return DragCoefficientAbsGradientEnum end if(name=="DrivingStressX") return DrivingStressXEnum end if(name=="DrivingStressY") return DrivingStressYEnum end if(name=="Dummy") return DummyEnum end if(name=="EffectivePressure") return EffectivePressureEnum end if(name=="EffectivePressureSubstep") return EffectivePressureSubstepEnum end if(name=="EffectivePressureTransient") return EffectivePressureTransientEnum end if(name=="Enthalpy") return EnthalpyEnum end if(name=="EnthalpyPicard") return EnthalpyPicardEnum end if(name=="EplHead") return EplHeadEnum end if(name=="EplHeadOld") return EplHeadOldEnum end if(name=="EplHeadSlopeX") return EplHeadSlopeXEnum end if(name=="EplHeadSlopeY") return EplHeadSlopeYEnum end if(name=="EplHeadSubstep") return EplHeadSubstepEnum end if(name=="EplHeadTransient") return EplHeadTransientEnum end if(name=="EsaEmotion") return EsaEmotionEnum end if(name=="EsaNmotion") return EsaNmotionEnum end if(name=="EsaRotationrate") return EsaRotationrateEnum end if(name=="EsaStrainratexx") return EsaStrainratexxEnum end if(name=="EsaStrainratexy") return EsaStrainratexyEnum end if(name=="EsaStrainrateyy") return EsaStrainrateyyEnum end if(name=="EsaUmotion") return EsaUmotionEnum end if(name=="EsaXmotion") return EsaXmotionEnum end if(name=="EsaYmotion") return EsaYmotionEnum end if(name=="EtaDiff") return EtaDiffEnum end if(name=="FlowequationBorderFS") return FlowequationBorderFSEnum end if(name=="FrictionAs") return FrictionAsEnum end if(name=="FrictionC") return FrictionCEnum end if(name=="FrictionCmax") return FrictionCmaxEnum end if(name=="FrictionCoefficient") return FrictionCoefficientEnum end if(name=="FrictionCoefficientcoulomb") return FrictionCoefficientcoulombEnum end if(name=="FrictionCoulombWaterPressure") return FrictionCoulombWaterPressureEnum end if(name=="FrictionEffectivePressure") return FrictionEffectivePressureEnum end if(name=="FrictionM") return FrictionMEnum end if(name=="FrictionP") return FrictionPEnum end if(name=="FrictionPressureAdjustedTemperature") return FrictionPressureAdjustedTemperatureEnum end if(name=="FrictionQ") return FrictionQEnum end if(name=="FrictionSedimentCompressibilityCoefficient") return FrictionSedimentCompressibilityCoefficientEnum end if(name=="FrictionTillFrictionAngle") return FrictionTillFrictionAngleEnum end if(name=="FrictionSchoofWaterPressure") return FrictionSchoofWaterPressureEnum end if(name=="FrictionWaterLayer") return FrictionWaterLayerEnum end if(name=="FrictionWaterPressure") return FrictionWaterPressureEnum end if(name=="Frictionf") return FrictionfEnum end if(name=="FrontalForcingsBasinId") return FrontalForcingsBasinIdEnum end if(name=="FrontalForcingsSubglacialDischarge") return FrontalForcingsSubglacialDischargeEnum end if(name=="FrontalForcingsThermalForcing") return FrontalForcingsThermalForcingEnum end if(name=="GeometryHydrostaticRatio") return GeometryHydrostaticRatioEnum end if(name=="NGia") return NGiaEnum end if(name=="NGiaRate") return NGiaRateEnum end if(name=="UGia") return UGiaEnum end if(name=="UGiaRate") return UGiaRateEnum end if(name=="Gradient") return GradientEnum end if(name=="GroundinglineHeight") return GroundinglineHeightEnum end if(name=="HydraulicPotential") return HydraulicPotentialEnum end if(name=="HydraulicPotentialOld") return HydraulicPotentialOldEnum end if(name=="HydrologyBasalFlux") return HydrologyBasalFluxEnum end if(name=="HydrologyBumpHeight") return HydrologyBumpHeightEnum end if(name=="HydrologyBumpSpacing") return HydrologyBumpSpacingEnum end if(name=="HydrologydcBasalMoulinInput") return HydrologydcBasalMoulinInputEnum end if(name=="HydrologydcEplThickness") return HydrologydcEplThicknessEnum end if(name=="HydrologydcEplThicknessOld") return HydrologydcEplThicknessOldEnum end if(name=="HydrologydcEplThicknessSubstep") return HydrologydcEplThicknessSubstepEnum end if(name=="HydrologydcEplThicknessTransient") return HydrologydcEplThicknessTransientEnum end if(name=="HydrologydcMaskEplactiveElt") return HydrologydcMaskEplactiveEltEnum end if(name=="HydrologydcMaskEplactiveNode") return HydrologydcMaskEplactiveNodeEnum end if(name=="HydrologydcMaskThawedElt") return HydrologydcMaskThawedEltEnum end if(name=="HydrologydcMaskThawedNode") return HydrologydcMaskThawedNodeEnum end if(name=="HydrologydcSedimentTransmitivity") return HydrologydcSedimentTransmitivityEnum end if(name=="HydrologyDrainageRate") return HydrologyDrainageRateEnum end if(name=="HydrologyEnglacialInput") return HydrologyEnglacialInputEnum end if(name=="HydrologyGapHeight") return HydrologyGapHeightEnum end if(name=="HydrologyGapHeightX") return HydrologyGapHeightXEnum end if(name=="HydrologyGapHeightXX") return HydrologyGapHeightXXEnum end if(name=="HydrologyGapHeightY") return HydrologyGapHeightYEnum end if(name=="HydrologyGapHeightYY") return HydrologyGapHeightYYEnum end if(name=="HydrologyHead") return HydrologyHeadEnum end if(name=="HydrologyHeadOld") return HydrologyHeadOldEnum end if(name=="HydrologyMoulinInput") return HydrologyMoulinInputEnum end if(name=="HydrologyNeumannflux") return HydrologyNeumannfluxEnum end if(name=="HydrologyReynolds") return HydrologyReynoldsEnum end if(name=="HydrologySheetConductivity") return HydrologySheetConductivityEnum end if(name=="HydrologySheetThickness") return HydrologySheetThicknessEnum end if(name=="HydrologySheetThicknessOld") return HydrologySheetThicknessOldEnum end if(name=="HydrologyTws") return HydrologyTwsEnum end if(name=="HydrologyTwsSpc") return HydrologyTwsSpcEnum end if(name=="HydrologyTwsAnalysis") return HydrologyTwsAnalysisEnum end if(name=="HydrologyWatercolumnMax") return HydrologyWatercolumnMaxEnum end if(name=="HydrologyWaterVx") return HydrologyWaterVxEnum end if(name=="HydrologyWaterVy") return HydrologyWaterVyEnum end if(name=="Ice") return IceEnum end if(name=="IceMaskNodeActivation") return IceMaskNodeActivationEnum end if(name=="Input") return InputEnum end if(name=="InversionCostFunctionsCoefficients") return InversionCostFunctionsCoefficientsEnum end if(name=="InversionSurfaceObs") return InversionSurfaceObsEnum end if(name=="InversionThicknessObs") return InversionThicknessObsEnum end if(name=="InversionVelObs") return InversionVelObsEnum end if(name=="InversionVxObs") return InversionVxObsEnum end if(name=="InversionVyObs") return InversionVyObsEnum end if(name=="LevelsetfunctionSlopeX") return LevelsetfunctionSlopeXEnum end if(name=="LevelsetfunctionSlopeY") return LevelsetfunctionSlopeYEnum end if(name=="LevelsetObservation") return LevelsetObservationEnum end if(name=="LoadingforceX") return LoadingforceXEnum end if(name=="LoadingforceY") return LoadingforceYEnum end if(name=="LoadingforceZ") return LoadingforceZEnum end if(name=="MaskOceanLevelset") return MaskOceanLevelsetEnum end if(name=="MaskIceLevelset") return MaskIceLevelsetEnum end if(name=="MaskIceRefLevelset") return MaskIceRefLevelsetEnum end if(name=="MasstransportSpcthickness") return MasstransportSpcthicknessEnum end if(name=="MaterialsRheologyB") return MaterialsRheologyBEnum end if(name=="MaterialsRheologyBbar") return MaterialsRheologyBbarEnum end if(name=="MaterialsRheologyE") return MaterialsRheologyEEnum end if(name=="MaterialsRheologyEbar") return MaterialsRheologyEbarEnum end if(name=="MaterialsRheologyEc") return MaterialsRheologyEcEnum end if(name=="MaterialsRheologyEcbar") return MaterialsRheologyEcbarEnum end if(name=="MaterialsRheologyEs") return MaterialsRheologyEsEnum end if(name=="MaterialsRheologyEsbar") return MaterialsRheologyEsbarEnum end if(name=="MaterialsRheologyN") return MaterialsRheologyNEnum end if(name=="MeshScaleFactor") return MeshScaleFactorEnum end if(name=="MeshVertexonbase") return MeshVertexonbaseEnum end if(name=="MeshVertexonboundary") return MeshVertexonboundaryEnum end if(name=="MeshVertexonsurface") return MeshVertexonsurfaceEnum end if(name=="Misfit") return MisfitEnum end if(name=="MovingFrontalVx") return MovingFrontalVxEnum end if(name=="MovingFrontalVy") return MovingFrontalVyEnum end if(name=="Neumannflux") return NeumannfluxEnum end if(name=="NewDamage") return NewDamageEnum end if(name=="Node") return NodeEnum end if(name=="OmegaAbsGradient") return OmegaAbsGradientEnum end if(name=="OceantransportSpcbottompressure") return OceantransportSpcbottompressureEnum end if(name=="OceantransportSpcstr") return OceantransportSpcstrEnum end if(name=="OceantransportSpcdsl") return OceantransportSpcdslEnum end if(name=="P0") return P0Enum end if(name=="P1") return P1Enum end if(name=="Partitioning") return PartitioningEnum end if(name=="Pressure") return PressureEnum end if(name=="Radar") return RadarEnum end if(name=="RadarAttenuationMacGregor") return RadarAttenuationMacGregorEnum end if(name=="RadarAttenuationWolff") return RadarAttenuationWolffEnum end if(name=="RadarIcePeriod") return RadarIcePeriodEnum end if(name=="RadarPowerMacGregor") return RadarPowerMacGregorEnum end if(name=="RadarPowerWolff") return RadarPowerWolffEnum end if(name=="RheologyBAbsGradient") return RheologyBAbsGradientEnum end if(name=="RheologyBInitialguess") return RheologyBInitialguessEnum end if(name=="RheologyBInitialguessMisfit") return RheologyBInitialguessMisfitEnum end if(name=="RheologyBbarAbsGradient") return RheologyBbarAbsGradientEnum end if(name=="Sample") return SampleEnum end if(name=="SampleOld") return SampleOldEnum end if(name=="SampleNoise") return SampleNoiseEnum end if(name=="SamplingBeta") return SamplingBetaEnum end if(name=="SamplingKappa") return SamplingKappaEnum end if(name=="SamplingPhi") return SamplingPhiEnum end if(name=="SamplingTau") return SamplingTauEnum end if(name=="Sealevel") return SealevelEnum end if(name=="SealevelGRD") return SealevelGRDEnum end if(name=="SatGraviGRD") return SatGraviGRDEnum end if(name=="SealevelBarystaticMask") return SealevelBarystaticMaskEnum end if(name=="SealevelBarystaticIceMask") return SealevelBarystaticIceMaskEnum end if(name=="SealevelBarystaticIceWeights") return SealevelBarystaticIceWeightsEnum end if(name=="SealevelBarystaticIceArea") return SealevelBarystaticIceAreaEnum end if(name=="SealevelBarystaticIceLatbar") return SealevelBarystaticIceLatbarEnum end if(name=="SealevelBarystaticIceLongbar") return SealevelBarystaticIceLongbarEnum end if(name=="SealevelBarystaticIceLoad") return SealevelBarystaticIceLoadEnum end if(name=="SealevelBarystaticHydroMask") return SealevelBarystaticHydroMaskEnum end if(name=="SealevelBarystaticHydroWeights") return SealevelBarystaticHydroWeightsEnum end if(name=="SealevelBarystaticHydroArea") return SealevelBarystaticHydroAreaEnum end if(name=="SealevelBarystaticHydroLatbar") return SealevelBarystaticHydroLatbarEnum end if(name=="SealevelBarystaticHydroLongbar") return SealevelBarystaticHydroLongbarEnum end if(name=="SealevelBarystaticHydroLoad") return SealevelBarystaticHydroLoadEnum end if(name=="SealevelBarystaticBpMask") return SealevelBarystaticBpMaskEnum end if(name=="SealevelBarystaticBpWeights") return SealevelBarystaticBpWeightsEnum end if(name=="SealevelBarystaticBpArea") return SealevelBarystaticBpAreaEnum end if(name=="SealevelBarystaticBpLoad") return SealevelBarystaticBpLoadEnum end if(name=="SealevelBarystaticOceanMask") return SealevelBarystaticOceanMaskEnum end if(name=="SealevelBarystaticOceanWeights") return SealevelBarystaticOceanWeightsEnum end if(name=="SealevelBarystaticOceanArea") return SealevelBarystaticOceanAreaEnum end if(name=="SealevelBarystaticOceanLatbar") return SealevelBarystaticOceanLatbarEnum end if(name=="SealevelBarystaticOceanLongbar") return SealevelBarystaticOceanLongbarEnum end if(name=="SealevelBarystaticOceanLoad") return SealevelBarystaticOceanLoadEnum end if(name=="SealevelNEsa") return SealevelNEsaEnum end if(name=="SealevelNEsaRate") return SealevelNEsaRateEnum end if(name=="SealevelRSL") return SealevelRSLEnum end if(name=="Bslc") return BslcEnum end if(name=="BslcIce") return BslcIceEnum end if(name=="BslcHydro") return BslcHydroEnum end if(name=="BslcOcean") return BslcOceanEnum end if(name=="BslcRate") return BslcRateEnum end if(name=="Gmtslc") return GmtslcEnum end if(name=="SealevelRSLBarystatic") return SealevelRSLBarystaticEnum end if(name=="SealevelRSLRate") return SealevelRSLRateEnum end if(name=="SealevelUGrd") return SealevelUGrdEnum end if(name=="SealevelNGrd") return SealevelNGrdEnum end if(name=="SealevelUEastEsa") return SealevelUEastEsaEnum end if(name=="SealevelUNorthEsa") return SealevelUNorthEsaEnum end if(name=="SealevelchangeIndices") return SealevelchangeIndicesEnum end if(name=="SealevelchangeAlphaIndex") return SealevelchangeAlphaIndexEnum end if(name=="SealevelchangeAzimuthIndex") return SealevelchangeAzimuthIndexEnum end if(name=="SealevelchangeGrot") return SealevelchangeGrotEnum end if(name=="SealevelchangeGSatGravirot") return SealevelchangeGSatGravirotEnum end if(name=="SealevelchangeGUrot") return SealevelchangeGUrotEnum end if(name=="SealevelchangeGNrot") return SealevelchangeGNrotEnum end if(name=="SealevelchangeGErot") return SealevelchangeGErotEnum end if(name=="SealevelchangeAlphaIndexOcean") return SealevelchangeAlphaIndexOceanEnum end if(name=="SealevelchangeAlphaIndexIce") return SealevelchangeAlphaIndexIceEnum end if(name=="SealevelchangeAlphaIndexHydro") return SealevelchangeAlphaIndexHydroEnum end if(name=="SealevelchangeAzimuthIndexOcean") return SealevelchangeAzimuthIndexOceanEnum end if(name=="SealevelchangeAzimuthIndexIce") return SealevelchangeAzimuthIndexIceEnum end if(name=="SealevelchangeAzimuthIndexHydro") return SealevelchangeAzimuthIndexHydroEnum end if(name=="SealevelchangeViscousRSL") return SealevelchangeViscousRSLEnum end if(name=="SealevelchangeViscousSG") return SealevelchangeViscousSGEnum end if(name=="SealevelchangeViscousU") return SealevelchangeViscousUEnum end if(name=="SealevelchangeViscousN") return SealevelchangeViscousNEnum end if(name=="SealevelchangeViscousE") return SealevelchangeViscousEEnum end if(name=="SedimentHead") return SedimentHeadEnum end if(name=="SedimentHeadOld") return SedimentHeadOldEnum end if(name=="SedimentHeadSubstep") return SedimentHeadSubstepEnum end if(name=="SedimentHeadTransient") return SedimentHeadTransientEnum end if(name=="SedimentHeadResidual") return SedimentHeadResidualEnum end if(name=="SedimentHeadStacked") return SedimentHeadStackedEnum end if(name=="SigmaNN") return SigmaNNEnum end if(name=="SigmaVM") return SigmaVMEnum end if(name=="SmbAccumulatedEC") return SmbAccumulatedECEnum end if(name=="SmbAccumulatedMassBalance") return SmbAccumulatedMassBalanceEnum end if(name=="SmbAccumulatedMelt") return SmbAccumulatedMeltEnum end if(name=="SmbAccumulatedPrecipitation") return SmbAccumulatedPrecipitationEnum end if(name=="SmbAccumulatedRain") return SmbAccumulatedRainEnum end if(name=="SmbAccumulatedRefreeze") return SmbAccumulatedRefreezeEnum end if(name=="SmbAccumulatedRunoff") return SmbAccumulatedRunoffEnum end if(name=="SmbA") return SmbAEnum end if(name=="SmbAdiff") return SmbAdiffEnum end if(name=="SmbAValue") return SmbAValueEnum end if(name=="SmbAccumulation") return SmbAccumulationEnum end if(name=="SmbAdiffini") return SmbAdiffiniEnum end if(name=="SmbAini") return SmbAiniEnum end if(name=="SmbAutoregressionNoise") return SmbAutoregressionNoiseEnum end if(name=="SmbBasinsId") return SmbBasinsIdEnum end if(name=="SmbBMax") return SmbBMaxEnum end if(name=="SmbBMin") return SmbBMinEnum end if(name=="SmbBNeg") return SmbBNegEnum end if(name=="SmbBPos") return SmbBPosEnum end if(name=="SmbC") return SmbCEnum end if(name=="SmbCcsnowValue") return SmbCcsnowValueEnum end if(name=="SmbCciceValue") return SmbCciceValueEnum end if(name=="SmbCotValue") return SmbCotValueEnum end if(name=="SmbD") return SmbDEnum end if(name=="SmbDailyairdensity") return SmbDailyairdensityEnum end if(name=="SmbDailyairhumidity") return SmbDailyairhumidityEnum end if(name=="SmbDailydlradiation") return SmbDailydlradiationEnum end if(name=="SmbDailydsradiation") return SmbDailydsradiationEnum end if(name=="SmbDailypressure") return SmbDailypressureEnum end if(name=="SmbDailyrainfall") return SmbDailyrainfallEnum end if(name=="SmbDailysnowfall") return SmbDailysnowfallEnum end if(name=="SmbDailytemperature") return SmbDailytemperatureEnum end if(name=="SmbDailywindspeed") return SmbDailywindspeedEnum end if(name=="SmbDini") return SmbDiniEnum end if(name=="SmbDlwrf") return SmbDlwrfEnum end if(name=="SmbDulwrfValue") return SmbDulwrfValueEnum end if(name=="SmbDswrf") return SmbDswrfEnum end if(name=="SmbDswdiffrf") return SmbDswdiffrfEnum end if(name=="SmbDzAdd") return SmbDzAddEnum end if(name=="SmbDz") return SmbDzEnum end if(name=="SmbDzMin") return SmbDzMinEnum end if(name=="SmbDzTop") return SmbDzTopEnum end if(name=="SmbDzini") return SmbDziniEnum end if(name=="SmbEAir") return SmbEAirEnum end if(name=="SmbEC") return SmbECEnum end if(name=="SmbECDt") return SmbECDtEnum end if(name=="SmbECini") return SmbECiniEnum end if(name=="SmbEla") return SmbElaEnum end if(name=="SmbEvaporation") return SmbEvaporationEnum end if(name=="SmbFAC") return SmbFACEnum end if(name=="SmbGdn") return SmbGdnEnum end if(name=="SmbGdnini") return SmbGdniniEnum end if(name=="SmbGsp") return SmbGspEnum end if(name=="SmbGspini") return SmbGspiniEnum end if(name=="SmbHref") return SmbHrefEnum end if(name=="SmbIsInitialized") return SmbIsInitializedEnum end if(name=="SmbMAdd") return SmbMAddEnum end if(name=="SmbMassBalance") return SmbMassBalanceEnum end if(name=="SmbMassBalanceSubstep") return SmbMassBalanceSubstepEnum end if(name=="SmbMassBalanceTransient") return SmbMassBalanceTransientEnum end if(name=="SmbMeanLHF") return SmbMeanLHFEnum end if(name=="SmbMeanSHF") return SmbMeanSHFEnum end if(name=="SmbMeanULW") return SmbMeanULWEnum end if(name=="SmbMelt") return SmbMeltEnum end if(name=="SmbMonthlytemperatures") return SmbMonthlytemperaturesEnum end if(name=="SmbMSurf") return SmbMSurfEnum end if(name=="SmbNetLW") return SmbNetLWEnum end if(name=="SmbNetSW") return SmbNetSWEnum end if(name=="SmbPAir") return SmbPAirEnum end if(name=="SmbP") return SmbPEnum end if(name=="SmbPddfacIce") return SmbPddfacIceEnum end if(name=="SmbPddfacSnow") return SmbPddfacSnowEnum end if(name=="SmbPrecipitation") return SmbPrecipitationEnum end if(name=="SmbPrecipitationsAnomaly") return SmbPrecipitationsAnomalyEnum end if(name=="SmbPrecipitationsLgm") return SmbPrecipitationsLgmEnum end if(name=="SmbPrecipitationsPresentday") return SmbPrecipitationsPresentdayEnum end if(name=="SmbPrecipitationsReconstructed") return SmbPrecipitationsReconstructedEnum end if(name=="SmbRain") return SmbRainEnum end if(name=="SmbRe") return SmbReEnum end if(name=="SmbRefreeze") return SmbRefreezeEnum end if(name=="SmbReini") return SmbReiniEnum end if(name=="SmbRunoff") return SmbRunoffEnum end if(name=="SmbRunoffSubstep") return SmbRunoffSubstepEnum end if(name=="SmbRunoffTransient") return SmbRunoffTransientEnum end if(name=="SmbS0gcm") return SmbS0gcmEnum end if(name=="SmbS0p") return SmbS0pEnum end if(name=="SmbS0t") return SmbS0tEnum end if(name=="SmbSizeini") return SmbSizeiniEnum end if(name=="SmbSmbCorr") return SmbSmbCorrEnum end if(name=="SmbSmbref") return SmbSmbrefEnum end if(name=="SmbSzaValue") return SmbSzaValueEnum end if(name=="SmbT") return SmbTEnum end if(name=="SmbTa") return SmbTaEnum end if(name=="SmbTeValue") return SmbTeValueEnum end if(name=="SmbTemperaturesAnomaly") return SmbTemperaturesAnomalyEnum end if(name=="SmbTemperaturesLgm") return SmbTemperaturesLgmEnum end if(name=="SmbTemperaturesPresentday") return SmbTemperaturesPresentdayEnum end if(name=="SmbTemperaturesReconstructed") return SmbTemperaturesReconstructedEnum end if(name=="SmbTini") return SmbTiniEnum end if(name=="SmbTmean") return SmbTmeanEnum end if(name=="SmbTz") return SmbTzEnum end if(name=="SmbValuesAutoregression") return SmbValuesAutoregressionEnum end if(name=="SmbV") return SmbVEnum end if(name=="SmbVmean") return SmbVmeanEnum end if(name=="SmbVz") return SmbVzEnum end if(name=="SmbW") return SmbWEnum end if(name=="SmbWAdd") return SmbWAddEnum end if(name=="SmbWini") return SmbWiniEnum end if(name=="SmbZMax") return SmbZMaxEnum end if(name=="SmbZMin") return SmbZMinEnum end if(name=="SmbZTop") return SmbZTopEnum end if(name=="SmbZY") return SmbZYEnum end if(name=="SolidearthExternalDisplacementEastRate") return SolidearthExternalDisplacementEastRateEnum end if(name=="SolidearthExternalDisplacementNorthRate") return SolidearthExternalDisplacementNorthRateEnum end if(name=="SolidearthExternalDisplacementUpRate") return SolidearthExternalDisplacementUpRateEnum end if(name=="SolidearthExternalGeoidRate") return SolidearthExternalGeoidRateEnum end if(name=="StochasticForcingDefaultId") return StochasticForcingDefaultIdEnum end if(name=="StrainRateeffective") return StrainRateeffectiveEnum end if(name=="StrainRateparallel") return StrainRateparallelEnum end if(name=="StrainRateperpendicular") return StrainRateperpendicularEnum end if(name=="StrainRatexx") return StrainRatexxEnum end if(name=="StrainRatexy") return StrainRatexyEnum end if(name=="StrainRatexz") return StrainRatexzEnum end if(name=="StrainRateyy") return StrainRateyyEnum end if(name=="StrainRateyz") return StrainRateyzEnum end if(name=="StrainRatezz") return StrainRatezzEnum end if(name=="StressMaxPrincipal") return StressMaxPrincipalEnum end if(name=="StressTensorxx") return StressTensorxxEnum end if(name=="StressTensorxy") return StressTensorxyEnum end if(name=="StressTensorxz") return StressTensorxzEnum end if(name=="StressTensoryy") return StressTensoryyEnum end if(name=="StressTensoryz") return StressTensoryzEnum end if(name=="StressTensorzz") return StressTensorzzEnum end if(name=="SurfaceAbsMisfit") return SurfaceAbsMisfitEnum end if(name=="SurfaceAbsVelMisfit") return SurfaceAbsVelMisfitEnum end if(name=="Area") return AreaEnum end if(name=="SealevelArea") return SealevelAreaEnum end if(name=="SurfaceArea") return SurfaceAreaEnum end if(name=="SurfaceAverageVelMisfit") return SurfaceAverageVelMisfitEnum end if(name=="SurfaceCrevasse") return SurfaceCrevasseEnum end if(name=="Surface") return SurfaceEnum end if(name=="SurfaceOld") return SurfaceOldEnum end if(name=="SurfaceLogVelMisfit") return SurfaceLogVelMisfitEnum end if(name=="SurfaceLogVxVyMisfit") return SurfaceLogVxVyMisfitEnum end if(name=="SurfaceObservation") return SurfaceObservationEnum end if(name=="SurfaceRelVelMisfit") return SurfaceRelVelMisfitEnum end if(name=="SurfaceSlopeX") return SurfaceSlopeXEnum end if(name=="SurfaceSlopeY") return SurfaceSlopeYEnum end if(name=="Temperature") return TemperatureEnum end if(name=="TemperaturePDD") return TemperaturePDDEnum end if(name=="TemperaturePicard") return TemperaturePicardEnum end if(name=="TemperatureSEMIC") return TemperatureSEMICEnum end if(name=="ThermalforcingAutoregressionNoise") return ThermalforcingAutoregressionNoiseEnum end if(name=="ThermalforcingValuesAutoregression") return ThermalforcingValuesAutoregressionEnum end if(name=="ThermalSpctemperature") return ThermalSpctemperatureEnum end if(name=="ThicknessAbsGradient") return ThicknessAbsGradientEnum end if(name=="ThicknessAbsMisfit") return ThicknessAbsMisfitEnum end if(name=="ThicknessAcrossGradient") return ThicknessAcrossGradientEnum end if(name=="ThicknessAlongGradient") return ThicknessAlongGradientEnum end if(name=="Thickness") return ThicknessEnum end if(name=="ThicknessOld") return ThicknessOldEnum end if(name=="ThicknessPositive") return ThicknessPositiveEnum end if(name=="ThicknessResidual") return ThicknessResidualEnum end if(name=="TransientAccumulatedDeltaIceThickness") return TransientAccumulatedDeltaIceThicknessEnum end if(name=="Vel") return VelEnum end if(name=="VxAverage") return VxAverageEnum end if(name=="VxBase") return VxBaseEnum end if(name=="Vx") return VxEnum end if(name=="VxMesh") return VxMeshEnum end if(name=="VxObs") return VxObsEnum end if(name=="VxShear") return VxShearEnum end if(name=="VxSurface") return VxSurfaceEnum end if(name=="VyAverage") return VyAverageEnum end if(name=="VyBase") return VyBaseEnum end if(name=="Vy") return VyEnum end if(name=="VyMesh") return VyMeshEnum end if(name=="VyObs") return VyObsEnum end if(name=="VyShear") return VyShearEnum end if(name=="VySurface") return VySurfaceEnum end if(name=="Vz") return VzEnum end if(name=="VzFS") return VzFSEnum end if(name=="VzHO") return VzHOEnum end if(name=="VzMesh") return VzMeshEnum end if(name=="VzSSA") return VzSSAEnum end if(name=="WaterColumnOld") return WaterColumnOldEnum end if(name=="Watercolumn") return WatercolumnEnum end if(name=="WaterfractionDrainage") return WaterfractionDrainageEnum end if(name=="WaterfractionDrainageIntegrated") return WaterfractionDrainageIntegratedEnum end if(name=="Waterfraction") return WaterfractionEnum end if(name=="Waterheight") return WaterheightEnum end if(name=="WeightsLevelsetObservation") return WeightsLevelsetObservationEnum end if(name=="WeightsSurfaceObservation") return WeightsSurfaceObservationEnum end if(name=="OldAccumulatedDeltaBottomPressure") return OldAccumulatedDeltaBottomPressureEnum end if(name=="OldAccumulatedDeltaIceThickness") return OldAccumulatedDeltaIceThicknessEnum end if(name=="OldAccumulatedDeltaTws") return OldAccumulatedDeltaTwsEnum end if(name=="Outputdefinition1") return Outputdefinition1Enum end if(name=="Outputdefinition10") return Outputdefinition10Enum end if(name=="Outputdefinition11") return Outputdefinition11Enum end if(name=="Outputdefinition12") return Outputdefinition12Enum end if(name=="Outputdefinition13") return Outputdefinition13Enum end if(name=="Outputdefinition14") return Outputdefinition14Enum end if(name=="Outputdefinition15") return Outputdefinition15Enum end if(name=="Outputdefinition16") return Outputdefinition16Enum end if(name=="Outputdefinition17") return Outputdefinition17Enum end if(name=="Outputdefinition18") return Outputdefinition18Enum end if(name=="Outputdefinition19") return Outputdefinition19Enum end if(name=="Outputdefinition20") return Outputdefinition20Enum end if(name=="Outputdefinition21") return Outputdefinition21Enum end if(name=="Outputdefinition22") return Outputdefinition22Enum end if(name=="Outputdefinition23") return Outputdefinition23Enum end if(name=="Outputdefinition24") return Outputdefinition24Enum end if(name=="Outputdefinition25") return Outputdefinition25Enum end if(name=="Outputdefinition26") return Outputdefinition26Enum end if(name=="Outputdefinition27") return Outputdefinition27Enum end if(name=="Outputdefinition28") return Outputdefinition28Enum end if(name=="Outputdefinition29") return Outputdefinition29Enum end if(name=="Outputdefinition2") return Outputdefinition2Enum end if(name=="Outputdefinition30") return Outputdefinition30Enum end if(name=="Outputdefinition31") return Outputdefinition31Enum end if(name=="Outputdefinition32") return Outputdefinition32Enum end if(name=="Outputdefinition33") return Outputdefinition33Enum end if(name=="Outputdefinition34") return Outputdefinition34Enum end if(name=="Outputdefinition35") return Outputdefinition35Enum end if(name=="Outputdefinition36") return Outputdefinition36Enum end if(name=="Outputdefinition37") return Outputdefinition37Enum end if(name=="Outputdefinition38") return Outputdefinition38Enum end if(name=="Outputdefinition39") return Outputdefinition39Enum end if(name=="Outputdefinition3") return Outputdefinition3Enum end if(name=="Outputdefinition40") return Outputdefinition40Enum end if(name=="Outputdefinition41") return Outputdefinition41Enum end if(name=="Outputdefinition42") return Outputdefinition42Enum end if(name=="Outputdefinition43") return Outputdefinition43Enum end if(name=="Outputdefinition44") return Outputdefinition44Enum end if(name=="Outputdefinition45") return Outputdefinition45Enum end if(name=="Outputdefinition46") return Outputdefinition46Enum end if(name=="Outputdefinition47") return Outputdefinition47Enum end if(name=="Outputdefinition48") return Outputdefinition48Enum end if(name=="Outputdefinition49") return Outputdefinition49Enum end if(name=="Outputdefinition4") return Outputdefinition4Enum end if(name=="Outputdefinition50") return Outputdefinition50Enum end if(name=="Outputdefinition51") return Outputdefinition51Enum end if(name=="Outputdefinition52") return Outputdefinition52Enum end if(name=="Outputdefinition53") return Outputdefinition53Enum end if(name=="Outputdefinition54") return Outputdefinition54Enum end if(name=="Outputdefinition55") return Outputdefinition55Enum end if(name=="Outputdefinition56") return Outputdefinition56Enum end if(name=="Outputdefinition57") return Outputdefinition57Enum end if(name=="Outputdefinition58") return Outputdefinition58Enum end if(name=="Outputdefinition59") return Outputdefinition59Enum end if(name=="Outputdefinition5") return Outputdefinition5Enum end if(name=="Outputdefinition60") return Outputdefinition60Enum end if(name=="Outputdefinition61") return Outputdefinition61Enum end if(name=="Outputdefinition62") return Outputdefinition62Enum end if(name=="Outputdefinition63") return Outputdefinition63Enum end if(name=="Outputdefinition64") return Outputdefinition64Enum end if(name=="Outputdefinition65") return Outputdefinition65Enum end if(name=="Outputdefinition66") return Outputdefinition66Enum end if(name=="Outputdefinition67") return Outputdefinition67Enum end if(name=="Outputdefinition68") return Outputdefinition68Enum end if(name=="Outputdefinition69") return Outputdefinition69Enum end if(name=="Outputdefinition6") return Outputdefinition6Enum end if(name=="Outputdefinition70") return Outputdefinition70Enum end if(name=="Outputdefinition71") return Outputdefinition71Enum end if(name=="Outputdefinition72") return Outputdefinition72Enum end if(name=="Outputdefinition73") return Outputdefinition73Enum end if(name=="Outputdefinition74") return Outputdefinition74Enum end if(name=="Outputdefinition75") return Outputdefinition75Enum end if(name=="Outputdefinition76") return Outputdefinition76Enum end if(name=="Outputdefinition77") return Outputdefinition77Enum end if(name=="Outputdefinition78") return Outputdefinition78Enum end if(name=="Outputdefinition79") return Outputdefinition79Enum end if(name=="Outputdefinition7") return Outputdefinition7Enum end if(name=="Outputdefinition80") return Outputdefinition80Enum end if(name=="Outputdefinition81") return Outputdefinition81Enum end if(name=="Outputdefinition82") return Outputdefinition82Enum end if(name=="Outputdefinition83") return Outputdefinition83Enum end if(name=="Outputdefinition84") return Outputdefinition84Enum end if(name=="Outputdefinition85") return Outputdefinition85Enum end if(name=="Outputdefinition86") return Outputdefinition86Enum end if(name=="Outputdefinition87") return Outputdefinition87Enum end if(name=="Outputdefinition88") return Outputdefinition88Enum end if(name=="Outputdefinition89") return Outputdefinition89Enum end if(name=="Outputdefinition8") return Outputdefinition8Enum end if(name=="Outputdefinition90") return Outputdefinition90Enum end if(name=="Outputdefinition91") return Outputdefinition91Enum end if(name=="Outputdefinition92") return Outputdefinition92Enum end if(name=="Outputdefinition93") return Outputdefinition93Enum end if(name=="Outputdefinition94") return Outputdefinition94Enum end if(name=="Outputdefinition95") return Outputdefinition95Enum end if(name=="Outputdefinition96") return Outputdefinition96Enum end if(name=="Outputdefinition97") return Outputdefinition97Enum end if(name=="Outputdefinition98") return Outputdefinition98Enum end if(name=="Outputdefinition99") return Outputdefinition99Enum end if(name=="Outputdefinition9") return Outputdefinition9Enum end if(name=="Outputdefinition100") return Outputdefinition100Enum end if(name=="InputsEND") return InputsENDEnum end if(name=="Absolute") return AbsoluteEnum end if(name=="AdaptiveTimestepping") return AdaptiveTimesteppingEnum end if(name=="AdjointBalancethickness2Analysis") return AdjointBalancethickness2AnalysisEnum end if(name=="AdjointBalancethicknessAnalysis") return AdjointBalancethicknessAnalysisEnum end if(name=="AdjointHorizAnalysis") return AdjointHorizAnalysisEnum end if(name=="AgeAnalysis") return AgeAnalysisEnum end if(name=="AggressiveMigration") return AggressiveMigrationEnum end if(name=="AmrBamg") return AmrBamgEnum end if(name=="AmrNeopz") return AmrNeopzEnum end if(name=="AndroidFrictionCoefficient") return AndroidFrictionCoefficientEnum end if(name=="Arrhenius") return ArrheniusEnum end if(name=="AutodiffJacobian") return AutodiffJacobianEnum end if(name=="AutoregressionLinearFloatingMeltRate") return AutoregressionLinearFloatingMeltRateEnum end if(name=="Balancethickness2Analysis") return Balancethickness2AnalysisEnum end if(name=="Balancethickness2Solution") return Balancethickness2SolutionEnum end if(name=="BalancethicknessAnalysis") return BalancethicknessAnalysisEnum end if(name=="BalancethicknessApparentMassbalance") return BalancethicknessApparentMassbalanceEnum end if(name=="BalancethicknessSoftAnalysis") return BalancethicknessSoftAnalysisEnum end if(name=="BalancethicknessSoftSolution") return BalancethicknessSoftSolutionEnum end if(name=="BalancethicknessSolution") return BalancethicknessSolutionEnum end if(name=="BalancevelocityAnalysis") return BalancevelocityAnalysisEnum end if(name=="BalancevelocitySolution") return BalancevelocitySolutionEnum end if(name=="BasalforcingsIsmip6") return BasalforcingsIsmip6Enum end if(name=="BasalforcingsPico") return BasalforcingsPicoEnum end if(name=="BeckmannGoosseFloatingMeltRate") return BeckmannGoosseFloatingMeltRateEnum end if(name=="BedSlopeSolution") return BedSlopeSolutionEnum end if(name=="BoolExternalResult") return BoolExternalResultEnum end if(name=="BoolInput") return BoolInputEnum end if(name=="IntInput") return IntInputEnum end if(name=="DoubleInput") return DoubleInputEnum end if(name=="BoolParam") return BoolParamEnum end if(name=="Boundary") return BoundaryEnum end if(name=="BuddJacka") return BuddJackaEnum end if(name=="CalvingDev2") return CalvingDev2Enum end if(name=="CalvingHab") return CalvingHabEnum end if(name=="CalvingLevermann") return CalvingLevermannEnum end if(name=="CalvingTest") return CalvingTestEnum end if(name=="CalvingParameterization") return CalvingParameterizationEnum end if(name=="CalvingVonmises") return CalvingVonmisesEnum end if(name=="Cfdragcoeffabsgrad") return CfdragcoeffabsgradEnum end if(name=="Cfsurfacelogvel") return CfsurfacelogvelEnum end if(name=="Cfsurfacesquare") return CfsurfacesquareEnum end if(name=="Cflevelsetmisfit") return CflevelsetmisfitEnum end if(name=="Channel") return ChannelEnum end if(name=="ChannelArea") return ChannelAreaEnum end if(name=="ChannelAreaOld") return ChannelAreaOldEnum end if(name=="ChannelDischarge") return ChannelDischargeEnum end if(name=="Closed") return ClosedEnum end if(name=="Colinear") return ColinearEnum end if(name=="Constraints") return ConstraintsEnum end if(name=="Contact") return ContactEnum end if(name=="Contour") return ContourEnum end if(name=="Contours") return ContoursEnum end if(name=="ControlInput") return ControlInputEnum end if(name=="ControlInputGrad") return ControlInputGradEnum end if(name=="ControlInputMaxs") return ControlInputMaxsEnum end if(name=="ControlInputMins") return ControlInputMinsEnum end if(name=="ControlInputValues") return ControlInputValuesEnum end if(name=="CrouzeixRaviart") return CrouzeixRaviartEnum end if(name=="Cuffey") return CuffeyEnum end if(name=="CuffeyTemperate") return CuffeyTemperateEnum end if(name=="DamageEvolutionAnalysis") return DamageEvolutionAnalysisEnum end if(name=="DamageEvolutionSolution") return DamageEvolutionSolutionEnum end if(name=="DataSet") return DataSetEnum end if(name=="DataSetParam") return DataSetParamEnum end if(name=="DatasetInput") return DatasetInputEnum end if(name=="DefaultAnalysis") return DefaultAnalysisEnum end if(name=="DefaultCalving") return DefaultCalvingEnum end if(name=="Dense") return DenseEnum end if(name=="DependentObject") return DependentObjectEnum end if(name=="DepthAverageAnalysis") return DepthAverageAnalysisEnum end if(name=="DeviatoricStressErrorEstimator") return DeviatoricStressErrorEstimatorEnum end if(name=="Divergence") return DivergenceEnum end if(name=="Domain3Dsurface") return Domain3DsurfaceEnum end if(name=="DoubleArrayInput") return DoubleArrayInputEnum end if(name=="ArrayInput") return ArrayInputEnum end if(name=="IntArrayInput") return IntArrayInputEnum end if(name=="DoubleExternalResult") return DoubleExternalResultEnum end if(name=="DoubleMatArrayParam") return DoubleMatArrayParamEnum end if(name=="DoubleMatExternalResult") return DoubleMatExternalResultEnum end if(name=="DoubleMatParam") return DoubleMatParamEnum end if(name=="DoubleParam") return DoubleParamEnum end if(name=="DoubleVecParam") return DoubleVecParamEnum end if(name=="Element") return ElementEnum end if(name=="ElementHook") return ElementHookEnum end if(name=="ElementSId") return ElementSIdEnum end if(name=="EnthalpyAnalysis") return EnthalpyAnalysisEnum end if(name=="EsaAnalysis") return EsaAnalysisEnum end if(name=="EsaSolution") return EsaSolutionEnum end if(name=="EsaTransitions") return EsaTransitionsEnum end if(name=="ExternalResult") return ExternalResultEnum end if(name=="ExtrapolationAnalysis") return ExtrapolationAnalysisEnum end if(name=="ExtrudeFromBaseAnalysis") return ExtrudeFromBaseAnalysisEnum end if(name=="ExtrudeFromTopAnalysis") return ExtrudeFromTopAnalysisEnum end if(name=="FSApproximation") return FSApproximationEnum end if(name=="FSSolver") return FSSolverEnum end if(name=="FSpressure") return FSpressureEnum end if(name=="FSvelocity") return FSvelocityEnum end if(name=="FemModel") return FemModelEnum end if(name=="FileParam") return FileParamEnum end if(name=="FixedTimestepping") return FixedTimesteppingEnum end if(name=="FloatingArea") return FloatingAreaEnum end if(name=="FloatingAreaScaled") return FloatingAreaScaledEnum end if(name=="FloatingMeltRate") return FloatingMeltRateEnum end if(name=="Free") return FreeEnum end if(name=="FreeSurfaceBaseAnalysis") return FreeSurfaceBaseAnalysisEnum end if(name=="FreeSurfaceTopAnalysis") return FreeSurfaceTopAnalysisEnum end if(name=="FrontalForcingsDefault") return FrontalForcingsDefaultEnum end if(name=="FrontalForcingsRignot") return FrontalForcingsRignotEnum end if(name=="FrontalForcingsRignotAutoregression") return FrontalForcingsRignotAutoregressionEnum end if(name=="Fset") return FsetEnum end if(name=="FullMeltOnPartiallyFloating") return FullMeltOnPartiallyFloatingEnum end if(name=="GLheightadvectionAnalysis") return GLheightadvectionAnalysisEnum end if(name=="GaussPenta") return GaussPentaEnum end if(name=="GaussSeg") return GaussSegEnum end if(name=="GaussTetra") return GaussTetraEnum end if(name=="GaussTria") return GaussTriaEnum end if(name=="GenericOption") return GenericOptionEnum end if(name=="GenericParam") return GenericParamEnum end if(name=="GenericExternalResult") return GenericExternalResultEnum end if(name=="Gradient1") return Gradient1Enum end if(name=="Gradient2") return Gradient2Enum end if(name=="Gradient3") return Gradient3Enum end if(name=="Gradient4") return Gradient4Enum end if(name=="GroundedArea") return GroundedAreaEnum end if(name=="GroundedAreaScaled") return GroundedAreaScaledEnum end if(name=="GroundingOnly") return GroundingOnlyEnum end if(name=="GroundinglineMassFlux") return GroundinglineMassFluxEnum end if(name=="Gset") return GsetEnum end if(name=="Gsl") return GslEnum end if(name=="HOApproximation") return HOApproximationEnum end if(name=="HOFSApproximation") return HOFSApproximationEnum end if(name=="Hook") return HookEnum end if(name=="HydrologyDCEfficientAnalysis") return HydrologyDCEfficientAnalysisEnum end if(name=="HydrologyDCInefficientAnalysis") return HydrologyDCInefficientAnalysisEnum end if(name=="HydrologyGlaDSAnalysis") return HydrologyGlaDSAnalysisEnum end if(name=="HydrologyGlaDS") return HydrologyGlaDSEnum end if(name=="HydrologyPismAnalysis") return HydrologyPismAnalysisEnum end if(name=="HydrologyShaktiAnalysis") return HydrologyShaktiAnalysisEnum end if(name=="HydrologyShreveAnalysis") return HydrologyShreveAnalysisEnum end if(name=="HydrologySolution") return HydrologySolutionEnum end if(name=="HydrologySubsteps") return HydrologySubstepsEnum end if(name=="HydrologySubTime") return HydrologySubTimeEnum end if(name=="Hydrologydc") return HydrologydcEnum end if(name=="Hydrologypism") return HydrologypismEnum end if(name=="Hydrologyshakti") return HydrologyshaktiEnum end if(name=="Hydrologyshreve") return HydrologyshreveEnum end if(name=="IceMass") return IceMassEnum end if(name=="IceMassScaled") return IceMassScaledEnum end if(name=="IceVolumeAboveFloatation") return IceVolumeAboveFloatationEnum end if(name=="IceVolumeAboveFloatationScaled") return IceVolumeAboveFloatationScaledEnum end if(name=="IceVolume") return IceVolumeEnum end if(name=="IceVolumeScaled") return IceVolumeScaledEnum end if(name=="IcefrontMassFlux") return IcefrontMassFluxEnum end if(name=="IcefrontMassFluxLevelset") return IcefrontMassFluxLevelsetEnum end if(name=="Incremental") return IncrementalEnum end if(name=="Indexed") return IndexedEnum end if(name=="IntExternalResult") return IntExternalResultEnum end if(name=="ElementInput") return ElementInputEnum end if(name=="IntMatExternalResult") return IntMatExternalResultEnum end if(name=="IntMatParam") return IntMatParamEnum end if(name=="IntParam") return IntParamEnum end if(name=="IntVecParam") return IntVecParamEnum end if(name=="Inputs") return InputsEnum end if(name=="Internal") return InternalEnum end if(name=="Intersect") return IntersectEnum end if(name=="InversionVzObs") return InversionVzObsEnum end if(name=="J") return JEnum end if(name=="L1L2Approximation") return L1L2ApproximationEnum end if(name=="MOLHOApproximation") return MOLHOApproximationEnum end if(name=="L2ProjectionBaseAnalysis") return L2ProjectionBaseAnalysisEnum end if(name=="L2ProjectionEPLAnalysis") return L2ProjectionEPLAnalysisEnum end if(name=="LACrouzeixRaviart") return LACrouzeixRaviartEnum end if(name=="LATaylorHood") return LATaylorHoodEnum end if(name=="LambdaS") return LambdaSEnum end if(name=="LevelsetAnalysis") return LevelsetAnalysisEnum end if(name=="LevelsetfunctionPicard") return LevelsetfunctionPicardEnum end if(name=="LinearFloatingMeltRate") return LinearFloatingMeltRateEnum end if(name=="LliboutryDuval") return LliboutryDuvalEnum end if(name=="Loads") return LoadsEnum end if(name=="LoveAnalysis") return LoveAnalysisEnum end if(name=="LoveHf") return LoveHfEnum end if(name=="LoveHt") return LoveHtEnum end if(name=="LoveKernelsImag") return LoveKernelsImagEnum end if(name=="LoveKernelsReal") return LoveKernelsRealEnum end if(name=="LoveKf") return LoveKfEnum end if(name=="LoveKt") return LoveKtEnum end if(name=="LoveLf") return LoveLfEnum end if(name=="LoveLt") return LoveLtEnum end if(name=="LoveTidalHt") return LoveTidalHtEnum end if(name=="LoveTidalKt") return LoveTidalKtEnum end if(name=="LoveTidalLt") return LoveTidalLtEnum end if(name=="LovePMTF1t") return LovePMTF1tEnum end if(name=="LovePMTF2t") return LovePMTF2tEnum end if(name=="LoveYi") return LoveYiEnum end if(name=="LoveRhs") return LoveRhsEnum end if(name=="LoveSolution") return LoveSolutionEnum end if(name=="MINI") return MINIEnum end if(name=="MINIcondensed") return MINIcondensedEnum end if(name=="MantlePlumeGeothermalFlux") return MantlePlumeGeothermalFluxEnum end if(name=="MassFlux") return MassFluxEnum end if(name=="Masscon") return MassconEnum end if(name=="Massconaxpby") return MassconaxpbyEnum end if(name=="Massfluxatgate") return MassfluxatgateEnum end if(name=="MasstransportAnalysis") return MasstransportAnalysisEnum end if(name=="MasstransportSolution") return MasstransportSolutionEnum end if(name=="Matdamageice") return MatdamageiceEnum end if(name=="Matenhancedice") return MatenhancediceEnum end if(name=="Materials") return MaterialsEnum end if(name=="Matestar") return MatestarEnum end if(name=="Matice") return MaticeEnum end if(name=="Matlitho") return MatlithoEnum end if(name=="Mathydro") return MathydroEnum end if(name=="MatrixParam") return MatrixParamEnum end if(name=="MaxAbsVx") return MaxAbsVxEnum end if(name=="MaxAbsVy") return MaxAbsVyEnum end if(name=="MaxAbsVz") return MaxAbsVzEnum end if(name=="MaxDivergence") return MaxDivergenceEnum end if(name=="MaxVel") return MaxVelEnum end if(name=="MaxVx") return MaxVxEnum end if(name=="MaxVy") return MaxVyEnum end if(name=="MaxVz") return MaxVzEnum end if(name=="Melange") return MelangeEnum end if(name=="MeltingAnalysis") return MeltingAnalysisEnum end if(name=="MeshElements") return MeshElementsEnum end if(name=="MeshX") return MeshXEnum end if(name=="MeshY") return MeshYEnum end if(name=="MinVel") return MinVelEnum end if(name=="MinVx") return MinVxEnum end if(name=="MinVy") return MinVyEnum end if(name=="MinVz") return MinVzEnum end if(name=="MismipFloatingMeltRate") return MismipFloatingMeltRateEnum end if(name=="Moulin") return MoulinEnum end if(name=="MpiDense") return MpiDenseEnum end if(name=="Mpi") return MpiEnum end if(name=="MpiSparse") return MpiSparseEnum end if(name=="Mumps") return MumpsEnum end if(name=="NoFrictionOnPartiallyFloating") return NoFrictionOnPartiallyFloatingEnum end if(name=="NoMeltOnPartiallyFloating") return NoMeltOnPartiallyFloatingEnum end if(name=="Nodal") return NodalEnum end if(name=="Nodalvalue") return NodalvalueEnum end if(name=="NodeSId") return NodeSIdEnum end if(name=="NoneApproximation") return NoneApproximationEnum end if(name=="None") return NoneEnum end if(name=="Numberedcostfunction") return NumberedcostfunctionEnum end if(name=="NyeCO2") return NyeCO2Enum end if(name=="NyeH2O") return NyeH2OEnum end if(name=="Numericalflux") return NumericalfluxEnum end if(name=="OceantransportAnalysis") return OceantransportAnalysisEnum end if(name=="OceantransportSolution") return OceantransportSolutionEnum end if(name=="OldGradient") return OldGradientEnum end if(name=="OneLayerP4z") return OneLayerP4zEnum end if(name=="Open") return OpenEnum end if(name=="Option") return OptionEnum end if(name=="Param") return ParamEnum end if(name=="Parameters") return ParametersEnum end if(name=="P0Array") return P0ArrayEnum end if(name=="P0DG") return P0DGEnum end if(name=="P1DG") return P1DGEnum end if(name=="P1P1") return P1P1Enum end if(name=="P1P1GLS") return P1P1GLSEnum end if(name=="P1bubble") return P1bubbleEnum end if(name=="P1bubblecondensed") return P1bubblecondensedEnum end if(name=="P1xP2") return P1xP2Enum end if(name=="P1xP3") return P1xP3Enum end if(name=="P1xP4") return P1xP4Enum end if(name=="P2") return P2Enum end if(name=="P2bubble") return P2bubbleEnum end if(name=="P2bubblecondensed") return P2bubblecondensedEnum end if(name=="P2xP1") return P2xP1Enum end if(name=="P2xP4") return P2xP4Enum end if(name=="Paterson") return PatersonEnum end if(name=="Pengrid") return PengridEnum end if(name=="Penpair") return PenpairEnum end if(name=="Penta") return PentaEnum end if(name=="PentaInput") return PentaInputEnum end if(name=="Profiler") return ProfilerEnum end if(name=="ProfilingCurrentFlops") return ProfilingCurrentFlopsEnum end if(name=="ProfilingCurrentMem") return ProfilingCurrentMemEnum end if(name=="ProfilingSolutionTime") return ProfilingSolutionTimeEnum end if(name=="Regionaloutput") return RegionaloutputEnum end if(name=="Regular") return RegularEnum end if(name=="RecoveryAnalysis") return RecoveryAnalysisEnum end if(name=="Riftfront") return RiftfrontEnum end if(name=="SamplingAnalysis") return SamplingAnalysisEnum end if(name=="SamplingSolution") return SamplingSolutionEnum end if(name=="SIAApproximation") return SIAApproximationEnum end if(name=="SMBautoregression") return SMBautoregressionEnum end if(name=="SMBcomponents") return SMBcomponentsEnum end if(name=="SMBd18opdd") return SMBd18opddEnum end if(name=="SMBforcing") return SMBforcingEnum end if(name=="SMBgcm") return SMBgcmEnum end if(name=="SMBgemb") return SMBgembEnum end if(name=="SMBgradients") return SMBgradientsEnum end if(name=="SMBgradientscomponents") return SMBgradientscomponentsEnum end if(name=="SMBgradientsela") return SMBgradientselaEnum end if(name=="SMBhenning") return SMBhenningEnum end if(name=="SMBmeltcomponents") return SMBmeltcomponentsEnum end if(name=="SMBpdd") return SMBpddEnum end if(name=="SMBpddSicopolis") return SMBpddSicopolisEnum end if(name=="SMBsemic") return SMBsemicEnum end if(name=="SSAApproximation") return SSAApproximationEnum end if(name=="SSAFSApproximation") return SSAFSApproximationEnum end if(name=="SSAHOApproximation") return SSAHOApproximationEnum end if(name=="Scaled") return ScaledEnum end if(name=="SealevelAbsolute") return SealevelAbsoluteEnum end if(name=="SealevelEmotion") return SealevelEmotionEnum end if(name=="SealevelchangePolarMotionX") return SealevelchangePolarMotionXEnum end if(name=="SealevelchangePolarMotionY") return SealevelchangePolarMotionYEnum end if(name=="SealevelchangePolarMotionZ") return SealevelchangePolarMotionZEnum end if(name=="SealevelchangePolarMotion") return SealevelchangePolarMotionEnum end if(name=="SealevelNmotion") return SealevelNmotionEnum end if(name=="SealevelUmotion") return SealevelUmotionEnum end if(name=="SealevelchangeAnalysis") return SealevelchangeAnalysisEnum end if(name=="Seg") return SegEnum end if(name=="SegInput") return SegInputEnum end if(name=="Segment") return SegmentEnum end if(name=="SegmentRiftfront") return SegmentRiftfrontEnum end if(name=="Separate") return SeparateEnum end if(name=="Seq") return SeqEnum end if(name=="SmbAnalysis") return SmbAnalysisEnum end if(name=="SmbSolution") return SmbSolutionEnum end if(name=="SmoothAnalysis") return SmoothAnalysisEnum end if(name=="SoftMigration") return SoftMigrationEnum end if(name=="SpatialLinearFloatingMeltRate") return SpatialLinearFloatingMeltRateEnum end if(name=="SpcDynamic") return SpcDynamicEnum end if(name=="SpcStatic") return SpcStaticEnum end if(name=="SpcTransient") return SpcTransientEnum end if(name=="Sset") return SsetEnum end if(name=="StatisticsSolution") return StatisticsSolutionEnum end if(name=="SteadystateSolution") return SteadystateSolutionEnum end if(name=="StressIntensityFactor") return StressIntensityFactorEnum end if(name=="StressbalanceAnalysis") return StressbalanceAnalysisEnum end if(name=="StressbalanceConvergenceNumSteps") return StressbalanceConvergenceNumStepsEnum end if(name=="StressbalanceSIAAnalysis") return StressbalanceSIAAnalysisEnum end if(name=="StressbalanceSolution") return StressbalanceSolutionEnum end if(name=="StressbalanceVerticalAnalysis") return StressbalanceVerticalAnalysisEnum end if(name=="StringArrayParam") return StringArrayParamEnum end if(name=="StringExternalResult") return StringExternalResultEnum end if(name=="StringParam") return StringParamEnum end if(name=="SubelementFriction1") return SubelementFriction1Enum end if(name=="SubelementFriction2") return SubelementFriction2Enum end if(name=="SubelementMelt1") return SubelementMelt1Enum end if(name=="SubelementMelt2") return SubelementMelt2Enum end if(name=="SubelementMigration") return SubelementMigrationEnum end if(name=="SurfaceSlopeSolution") return SurfaceSlopeSolutionEnum end if(name=="TaylorHood") return TaylorHoodEnum end if(name=="Tetra") return TetraEnum end if(name=="TetraInput") return TetraInputEnum end if(name=="ThermalAnalysis") return ThermalAnalysisEnum end if(name=="ThermalSolution") return ThermalSolutionEnum end if(name=="ThicknessErrorEstimator") return ThicknessErrorEstimatorEnum end if(name=="TotalCalvingFluxLevelset") return TotalCalvingFluxLevelsetEnum end if(name=="TotalCalvingMeltingFluxLevelset") return TotalCalvingMeltingFluxLevelsetEnum end if(name=="TotalFloatingBmb") return TotalFloatingBmbEnum end if(name=="TotalFloatingBmbScaled") return TotalFloatingBmbScaledEnum end if(name=="TotalGroundedBmb") return TotalGroundedBmbEnum end if(name=="TotalGroundedBmbScaled") return TotalGroundedBmbScaledEnum end if(name=="TotalSmb") return TotalSmbEnum end if(name=="TotalSmbScaled") return TotalSmbScaledEnum end if(name=="TransientArrayParam") return TransientArrayParamEnum end if(name=="TransientInput") return TransientInputEnum end if(name=="TransientParam") return TransientParamEnum end if(name=="TransientSolution") return TransientSolutionEnum end if(name=="Tria") return TriaEnum end if(name=="TriaInput") return TriaInputEnum end if(name=="UzawaPressureAnalysis") return UzawaPressureAnalysisEnum end if(name=="VectorParam") return VectorParamEnum end if(name=="Vertex") return VertexEnum end if(name=="VertexLId") return VertexLIdEnum end if(name=="VertexPId") return VertexPIdEnum end if(name=="VertexSId") return VertexSIdEnum end if(name=="Vertices") return VerticesEnum end if(name=="ViscousHeating") return ViscousHeatingEnum end if(name=="Water") return WaterEnum end if(name=="XTaylorHood") return XTaylorHoodEnum end if(name=="XY") return XYEnum end if(name=="XYZ") return XYZEnum end if(name=="BalancethicknessD0") return BalancethicknessD0Enum end if(name=="BalancethicknessDiffusionCoefficient") return BalancethicknessDiffusionCoefficientEnum end if(name=="BilinearInterp") return BilinearInterpEnum end if(name=="CalvingdevCoeff") return CalvingdevCoeffEnum end if(name=="DeviatoricStress") return DeviatoricStressEnum end if(name=="EtaAbsGradient") return EtaAbsGradientEnum end if(name=="MeshZ") return MeshZEnum end if(name=="NearestInterp") return NearestInterpEnum end if(name=="OutputdefinitionList") return OutputdefinitionListEnum end if(name=="SealevelObs") return SealevelObsEnum end if(name=="SealevelWeights") return SealevelWeightsEnum end if(name=="StrainRate") return StrainRateEnum end if(name=="StressTensor") return StressTensorEnum end if(name=="StressbalanceViscosityOvershoot") return StressbalanceViscosityOvershootEnum end if(name=="SubelementMigration4") return SubelementMigration4Enum end if(name=="TimesteppingTimeAdapt") return TimesteppingTimeAdaptEnum end if(name=="TriangleInterp") return TriangleInterpEnum end if(name=="MaximumNumberOfDefinitions") return MaximumNumberOfDefinitionsEnum end error("Enum ", name, " not found"); end
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1104
#Matice class definition struct Matice#{{{ vx_input::Input vy_input::Input B_input::Input n_input::Input end# }}} function Matice(element::Tria) #{{{ vx_input = GetInput(element, VxEnum) vy_input = GetInput(element, VyEnum) B_input = GetInput(element, MaterialsRheologyBEnum) n_input = GetInput(element, MaterialsRheologyNEnum) return Matice(vx_input, vy_input, B_input, n_input) end#}}} #vertices functions function ViscositySSA(matice::Matice, xyz_list::Matrix{Float64}, gauss::GaussTria, i::Int64) #{{{ #Get strain rate dvx = GetInputDerivativeValue(matice.vx_input,xyz_list,gauss,i) dvy = GetInputDerivativeValue(matice.vy_input,xyz_list,gauss,i) eps_xx = dvx[1] eps_yy = dvy[2] eps_xy = 0.5*(dvx[2] + dvy[1]) #In SSA, eps_eff^2 = exx^2 + eyy^2 + exy^2 + exx*eyy eps_eff = sqrt(eps_xx*eps_xx + eps_yy*eps_yy + eps_xy*eps_xy + eps_xx*eps_yy) #Get B and n n = GetInputValue(matice.n_input, gauss, i) B = GetInputValue(matice.B_input, gauss, i) #Compute viscosity if eps_eff==0. mu = 1.e+14/2 else mu = B/(2*eps_eff^((n-1)/n)) end return mu::Float64 end #}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
12186
#Model Processor and Core I/O function FetchDataToInput(md::model,inputs::Inputs,elements::Vector{Tria},data::Vector{Float64},enum::IssmEnum) #{{{ for i in 1:length(elements) InputCreate(elements[i],inputs,data,enum) end return nothing end#}}} function ModelProcessor(md::model, solutionstring::Symbol) #{{{ #Initialize structures elements = Vector{Tria}(undef,0) vertices = Vector{Vertex}(undef,0) results = Vector{Result}(undef,0) parameters = Parameters() inputs = Inputs(md.mesh.numberofelements, md.mesh.numberofvertices, Dict{IssmEnum,Input}()) #Create elements, vertices and materials (independent of the analysis) CreateElements(elements, md) CreateVertices(vertices, md) CreateParameters(parameters, md) CreateInputs(inputs,elements, md) if solutionstring===:TransientSolution UpdateParameters(TransientAnalysis(), parameters, md) end #Now create analysis specific data structure if solutionstring===:StressbalanceSolution analyses = Analysis[StressbalanceAnalysis()] elseif solutionstring===:TransientSolution if md.transient.ismovingfront analyses = Analysis[StressbalanceAnalysis(), MasstransportAnalysis(), LevelsetAnalysis()] else analyses = Analysis[StressbalanceAnalysis(), MasstransportAnalysis()] end else error(solutionstring, " not supported by ModelProcessor") end #Initialize analysis specific datasets numanalyses = length(analyses) nodes = Vector{Vector{Node}}(undef,numanalyses) constraints = Vector{Vector{Constraint}}(undef,numanalyses) for i in 1:numanalyses analysis = analyses[i] println(" creating datasets for analysis ", typeof(analysis)) nodes[i] = Vector{Node}(undef,0) constraints[i] = Vector{Constraint}(undef,0) UpdateParameters(analysis, parameters, md) UpdateElements(analysis, elements, inputs, md) CreateNodes(analysis, nodes[i], md) CreateConstraints(analysis, constraints[i], md) #Configure objects ConfigureObjectx(elements, nodes[i], vertices, parameters, inputs, i) end #Inversion? if md.inversion.iscontrol FetchDataToInput(md, inputs, elements, md.inversion.vx_obs./md.constants.yts,VxObsEnum) FetchDataToInput(md, inputs, elements, md.inversion.vy_obs./md.constants.yts,VyObsEnum) AddParam(parameters, md.inversion.independent_string, InversionControlParametersEnum) end #Build FemModel femmodel = FemModel(analyses, elements, vertices, Vector{Node}(undef,0), nodes, parameters, inputs, Vector{Constraint}(undef,0), constraints, results) println(" detecting active vertices") GetMaskOfIceVerticesLSMx0(femmodel) return femmodel end# }}} function CreateElements(elements::Vector{Tria},md::model) #{{{ #Make sure elements is currently empty @assert length(elements)==0 count = 0 for i in 1:(md.mesh.numberofelements::Int64) #Assume Linear Elements for now vertexids = (md.mesh.elements[i,:]::Vector{Int64}) nodeids = (md.mesh.elements[i,:]::Vector{Int64}) #Call constructor and add to dataset elements push!(elements,Tria(i,count, vertexids)) end return nothing end# }}} function CreateVertices(vertices::Vector{Vertex},md::model) #{{{ #Make sure vertices is currently empty @assert length(vertices)==0 #Get data from md x = md.mesh.x y = md.mesh.y count = 0 for i in 1:md.mesh.numberofvertices push!(vertices,Vertex(i,x[i],y[i],0.)) end return nothing end# }}} function CreateParameters(parameters::Parameters,md::model) #{{{ #Get data from md AddParam(parameters,md.materials.rho_ice,MaterialsRhoIceEnum) AddParam(parameters,md.materials.rho_water,MaterialsRhoSeawaterEnum) AddParam(parameters,md.materials.rho_freshwater,MaterialsRhoFreshwaterEnum) AddParam(parameters,md.constants.g,ConstantsGEnum) #Set step and time, this will be overwritten if we run a transient AddParam(parameters,1,StepEnum) AddParam(parameters,0.0,TimeEnum) #Is moving front AddParam(parameters,md.transient.ismovingfront,TransientIsmovingfrontEnum) return nothing end# }}} function CreateInputs(inputs::Inputs,elements::Vector{Tria},md::model) #{{{ #Only assume we have Matice for now FetchDataToInput(md,inputs,elements,md.materials.rheology_B,MaterialsRheologyBEnum) FetchDataToInput(md,inputs,elements,md.materials.rheology_n,MaterialsRheologyNEnum) return nothing end# }}} function OutputResultsx(femmodel::FemModel, md::model, solutionkey::Symbol)# {{{ if solutionkey===:TransientSolution #Compute maximum number of steps maxstep = 0 for i in length(femmodel.results) if(femmodel.results[i].step>maxstep) maxstep = femmodel.results[i].step end end #Initialize vector now that we know the size output = Vector{Dict}(undef, maxstep) for i in 1:maxstep; output[i] = Dict() end #Insert results in vector for i in 1:length(femmodel.results) result = femmodel.results[i] step = femmodel.results[i].step scale = OutputEnumToScale(md, result.enum) (output[step])[EnumToString(result.enum)] = result.value .* scale end else output = Dict() for i in 1:length(femmodel.results) result = femmodel.results[i] scale = OutputEnumToScale(md, result.enum) output[EnumToString(result.enum)] = result.value .* scale end end md.results[string(solutionkey)] = output return nothing end# }}} #Other modules function ConfigureObjectx(elements::Vector{Tria}, nodes::Vector{Node}, vertices::Vector{Vertex}, parameters::Parameters, inputs::Inputs, analysis::Int64) #{{{ for i in 1:length(elements) Configure(elements[i], nodes, vertices, parameters, inputs, analysis) end return nothing end# }}} function SpcNodesx(nodes::Vector{Node},constraints::Vector{Constraint},parameters::Parameters) #{{{ for i in 1:length(constraints) ConstrainNode(constraints[i],nodes,parameters) end return nothing end# }}} function NodesDofx(nodes::Vector{Node}, parameters::Parameters) #{{{ #Do we have any nodes? if length(nodes)==0 return end #Do we really need to update dof indexing if(~RequiresDofReindexing(nodes)) return end print(" Renumbering degrees of freedom\n") DistributeDofs(nodes,GsetEnum) DistributeDofs(nodes,FsetEnum) DistributeDofs(nodes,SsetEnum) return nothing end# }}} function GetSolutionFromInputsx(analysis::Analysis,femmodel::FemModel) #{{{ #Get size of vector gsize = NumberOfDofs(femmodel.nodes,GsetEnum) #Initialize solution vector ug = IssmVector(gsize) #Go through elements and plug in solution for i=1:length(femmodel.elements) GetSolutionFromInputs(analysis,ug,femmodel.elements[i]) end return ug end#}}} function InputUpdateFromSolutionx(analysis::Analysis,ug::IssmVector,femmodel::FemModel) #{{{ #Go through elements and plug in solution for i=1:length(femmodel.elements) InputUpdateFromSolution(analysis,ug.vector,femmodel.elements[i]) end return ug end#}}} function InputUpdateFromVectorx(femmodel::FemModel, vector::Vector{Float64}, enum::IssmEnum, layout::IssmEnum)# {{{ #Go through elements and plug in solution for i=1:length(femmodel.elements) InputUpdateFromVector(femmodel.elements[i], vector, enum, layout) end return nothing end#}}} function InputDuplicatex(femmodel::FemModel, oldenum::IssmEnum, newenum::IssmEnum) #{{{ DuplicateInput(femmodel.inputs, oldenum, newenum) return nothing end#}}} function Reducevectorgtofx(ug::IssmVector,nodes::Vector{Node}) #{{{ #Get size of output vector fsize = NumberOfDofs(nodes,FsetEnum) #Initialize output vector uf = IssmVector(fsize) #Go through elements and plug in solution for i=1:length(nodes) VecReduce(nodes[i],ug.vector,uf) end return uf end#}}} function Mergesolutionfromftogx(ug::IssmVector, uf::IssmVector, ys::IssmVector, nodes::Vector{Node}) #{{{ #Go through elements and plug in solution for i=1:length(nodes) VecMerge(nodes[i],ug,uf.vector,ys.vector) end return ug end#}}} function Reduceloadx!(pf::IssmVector, Kfs::IssmMatrix, ys::IssmVector) #{{{ #Is there anything to do? m, n = GetSize(Kfs) if(m*n>0) #Allocate Kfs*ys Kfsy_s=IssmVector(m) #Perform multiplication MatMult!(Kfs,ys,Kfsy_s) #Subtract Kfs*ys from pf AXPY!(pf,-1.0,Kfsy_s) end return nothing end#}}} function SystemMatricesx(femmodel::FemModel,analysis::Analysis)# {{{ #Allocate matrices println(" Allocating matrices") fsize = NumberOfDofs(femmodel.nodes,FsetEnum) ssize = NumberOfDofs(femmodel.nodes,SsetEnum) Kff = IssmMatrix(fsize,fsize) Kfs = IssmMatrix(fsize,ssize) pf = IssmVector(fsize) #Construct Stiffness matrix and load vector from elements println(" Assembling matrices") for i in 1:length(femmodel.elements) if IsIceInElement(femmodel.elements[i]) Ke = CreateKMatrix(analysis,femmodel.elements[i]) AddToGlobal!(Ke,Kff,Kfs) pe = CreatePVector(analysis,femmodel.elements[i]) AddToGlobal!(pe,pf) end end Assemble!(Kff) Assemble!(Kfs) Assemble!(pf) return Kff, Kfs, pf end# }}} function CreateNodalConstraintsx(nodes::Vector{Node})# {{{ #Allocate vector ssize=NumberOfDofs(nodes,SsetEnum) ys=IssmVector(ssize) #constraints vector with the constraint values for i in 1:length(nodes) CreateNodalConstraints(nodes[i],ys) end return ys end# }}} function RequestedOutputsx(femmodel::FemModel,outputlist::Vector{IssmEnum})# {{{ #Get Step and Time from parameters step = FindParam(Int64, femmodel.parameters,StepEnum) time = FindParam(Float64, femmodel.parameters,TimeEnum) #Now fetch results for i in 1:length(outputlist) #See if outputlist[i] is an input if outputlist[i]>InputsSTARTEnum && outputlist[i]<InputsENDEnum #Create Result input = GetInput(femmodel.inputs, outputlist[i]) input_copy = Vector{Float64}(undef, length(input.values)) copyto!(input_copy, input.values) result = Result(outputlist[i], step, time, input_copy) #Add to femmodel.results dataset push!(femmodel.results, result) else println("Output ",outputlist[i]," not supported yet") end end return nothing end# }}} function MigrateGroundinglinex(femmodel::FemModel)# {{{ for i=1:length(femmodel.elements) MigrateGroundingLine(femmodel.elements[i]) end return nothing end# }}} function UpdateConstraintsx(femmodel::FemModel, analysis::Analysis)# {{{ #First, see if the analysis needs to change constraints UpdateConstraints(analysis, femmodel) #Second, constraints might be time dependent SpcNodesx(femmodel.nodes, femmodel.constraints, femmodel.parameters) #Now, update degrees of freedoms NodesDofx(femmodel.nodes, femmodel.parameters) return nothing end# }}} function SetActiveNodesLSMx(femmodel::FemModel) #{{{ #Check mask of each element to see if element is active numnodes = 3 mask = Vector{Float64}(undef, numnodes) for i in 1:length(femmodel.elements) GetInputListOnNodes!(femmodel.elements[i], mask, IceMaskNodeActivationEnum) for j in 1:numnodes node = femmodel.elements[i].nodes[j] if(mask[j]==1.) Activate!(node) else Deactivate!(node) end end end return nothing end#}}} function GetMaskOfIceVerticesLSMx0(femmodel::FemModel) #{{{ #Initialize vector with number of vertices numvertices=length(femmodel.vertices) if(numvertices==0) return end #Initialize vector nbv = 3 onesvec = ones(nbv) vec_mask_ice = IssmVector(numvertices) vertexids = Vector{Int64}(undef, nbv) #Assign values to vector for i in 1:length(femmodel.elements) if (IsIceInElement(femmodel.elements[i])) for j in 1:nbv vertexids[j] = femmodel.elements[i].vertices[j].sid end SetValues!(vec_mask_ice, nbv, vertexids, onesvec) end end Assemble!(vec_mask_ice) #Serialize vector vec_mask_ice_serial = ToSerial(vec_mask_ice) #Update IceMaskNodeActivationEnum in elements InputUpdateFromVectorx(femmodel, vec_mask_ice_serial, IceMaskNodeActivationEnum, VertexSIdEnum) return nothing end#}}} function OutputEnumToScale(md::model, result::IssmEnum) #{{{ if (result == VxEnum) scale = md.constants.yts elseif (result == VyEnum) scale = md.constants.yts elseif (result == VzEnum) scale = md.constants.yts elseif (result == VelEnum) scale = md.constants.yts elseif (result == CalvingCalvingrateEnum) scale = md.constants.yts else scale = 1.0 end return scale end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
5192
#Node class definition mutable struct Node #{{{ id::Int64 sid::Int64 indexingupdate::Bool active::Bool gsize::Int64 gdoflist::Vector{Int64} fdoflist::Vector{Int64} sdoflist::Vector{Int64} svalues::Vector{Float64} end# }}} #Node functions function Base.show(io::IO, this::Node)# {{{ println(io,"Node:") println(io," id: ",this.id) println(io," sid: ",this.sid) println(io," indexingupdate: ",this.indexingupdate) println(io," gsize: ",this.gsize) println(io," gdoflist: ",this.gdoflist) println(io," fdoflist: ",this.fdoflist) println(io," sdoflist: ",this.sdoflist) println(io," svalues: ",this.svalues) return nothing end# }}} function Activate!(node::Node) #{{{ if(!node.active) node.indexingupdate = true node.active = true for i in 1:node.gsize node.fdoflist[i] = +1 node.sdoflist[i] = -1 node.svalues[i] = 0.0 end end return nothing end# }}} function Deactivate!(node::Node) #{{{ if(node.active) node.indexingupdate = true node.active = false for i in 1:node.gsize node.fdoflist[i] = -1 node.sdoflist[i] = +1 node.svalues[i] = 0.0 end end return nothing end# }}} function ApplyConstraint(node::Node,dof::Int8,value::Float64) #{{{ node.indexingupdate = true node.fdoflist[dof] = -1 node.sdoflist[dof] = +1 node.svalues[dof] = value return nothing end# }}} function CreateNodalConstraints(node::Node,ys::IssmVector) #{{{ if(SSize(node)>0) SetValues!(ys,node.gsize,node.sdoflist,node.svalues) end return nothing end# }}} function DistributeDofs(node::Node,setenum::IssmEnum,dofcount::Int64) #{{{ if setenum==GsetEnum for i in 1:node.gsize node.gdoflist[i] = dofcount dofcount += 1 end elseif setenum==FsetEnum for i in 1:node.gsize if node.fdoflist[i]!=-1 @assert node.sdoflist[i]==-1 node.fdoflist[i] = dofcount dofcount += 1 end end elseif setenum==SsetEnum for i in 1:node.gsize if node.sdoflist[i]!=-1 @assert node.fdoflist[i]==-1 node.sdoflist[i] = dofcount dofcount += 1 end end else error("not supported") end return dofcount end# }}} function GetNumberOfDofs(node::Node,setenum::IssmEnum) #{{{ if setenum==GsetEnum dofcount = node.gsize elseif setenum==FsetEnum dofcount = 0 for i=1:node.gsize if node.fdoflist[i]!=-1 dofcount += 1 end end elseif setenum==SsetEnum dofcount = 0 for i=1:node.gsize if node.sdoflist[i]!=-1 dofcount += 1 end end else error("not supported") end return dofcount end# }}} function GetDofList(node::Node,doflist::Vector{Int64},count::Int64,setenum::IssmEnum) #{{{ if setenum==GsetEnum for i in 1:node.gsize count += 1 doflist[count] = node.gdoflist[i] end elseif setenum==FsetEnum for i=1:node.gsize #if node.fdoflist[i]!=-1 count += 1 doflist[count] = node.fdoflist[i] #end end elseif setenum==SsetEnum for i=1:node.gsize #if node.sdoflist[i]!=-1 count += 1 doflist[count] = node.sdoflist[i] #end end else error("not supported") end return count end# }}} function GetGlobalDofList(nodes::Vector{Node},ndofs::Int64,setenum::IssmEnum) #{{{ #Allocate list doflist = Vector{Int64}(undef,ndofs) #Assign values count = 0 for i in 1:length(nodes) count = GetDofList(nodes[i],doflist,count,setenum) end @assert count==ndofs return doflist end# }}} function VecReduce(node::Node,ug::Vector{Float64},uf::IssmVector) #{{{ for i=1:node.gsize if node.fdoflist[i]!=-1 uf.vector[node.fdoflist[i]] = ug[node.gdoflist[i]] end end return nothing end# }}} function VecMerge(node::Node,ug::IssmVector,uf::Vector{Float64},ys::Vector{Float64}) #{{{ fsize = FSize(node) ssize = SSize(node) if fsize>0 indices = Vector{Int64}(undef,fsize) values = Vector{Float64}(undef,fsize) count = 1 for i=1:node.gsize if node.fdoflist[i]!=-1 indices[count] = node.gdoflist[i] values[count] = uf[node.fdoflist[i]] count += 1 end end SetValues!(ug,fsize,indices,values) end if ssize>0 indices = Vector{Int64}(undef,ssize) values = Vector{Float64}(undef,ssize) count = 1 for i=1:node.gsize if node.sdoflist[i]!=-1 indices[count] = node.gdoflist[i] values[count] = ys[node.sdoflist[i]] count += 1 end end SetValues!(ug,ssize,indices,values) end return nothing end# }}} function SSize(node::Node) #{{{ ssize = 0 for i=1:node.gsize if node.sdoflist[i]!=-1 ssize+=1 end end return ssize end# }}} function FSize(node::Node) #{{{ fsize = 0 for i=1:node.gsize if node.fdoflist[i]!=-1 fsize+=1 end end return fsize end# }}} #Nodes functions function RequiresDofReindexing(nodes::Vector{Node}) #{{{ for i in 1:length(nodes) if nodes[i].indexingupdate return true end end return false end# }}} function DistributeDofs(nodes::Vector{Node},setenum::IssmEnum) #{{{ dofcount = 1 for i in 1:length(nodes) dofcount = DistributeDofs(nodes[i],setenum,dofcount) end return nothing end# }}} function NumberOfDofs(nodes::Vector{Node},setenum::IssmEnum) #{{{ numdofs = 0 for i in 1:length(nodes) numdofs += GetNumberOfDofs(nodes[i],setenum) end return numdofs end# }}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
2887
#Parameter class definition abstract type Parameter end struct DoubleParam <: Parameter #{{{ enum::IssmEnum value::Float64 end# }}} struct IntParam <: Parameter #{{{ enum::IssmEnum value::Int64 end# }}} struct BoolParam <: Parameter #{{{ enum::IssmEnum value::Bool end# }}} struct StringParam <: Parameter #{{{ enum::IssmEnum value::String end# }}} mutable struct FluxChainParam <: Parameter #{{{ enum::IssmEnum value::Vector{Flux.Chain{}} end# }}} mutable struct StatsBaseTransformParam <: Parameter #{{{ enum::IssmEnum value::Vector{StatsBase.ZScoreTransform{Float64, Vector{Float64}} } end# }}} #Parameters dataset class definition mutable struct Parameters #{{{ lookup::Dict{IssmEnum,Parameter} double_lookup::Dict{IssmEnum,DoubleParam} end# }}} function Parameters() #{{{ return Parameters(Dict{IssmEnum,Parameter}(), Dict{IssmEnum,DoubleParam}()) end # }}} #Parameter functions function GetParameterValue(param::DoubleParam) #{{{ return param.value::Float64 end#}}} function GetParameterValue(param::IntParam) #{{{ return param.value::Int64 end#}}} function GetParameterValue(param::BoolParam) #{{{ return param.value::Bool end#}}} function GetParameterValue(param::StringParam) #{{{ return param.value::String end#}}} function GetParameterValue(param::FluxChainParam) #{{{ return param.value::Vector{Flux.Chain{}} end#}}} function GetParameterValue(param::StatsBaseTransformParam) #{{{ return param.value::Vector{StatsBase.ZScoreTransform{Float64, Vector{Float64}}} end#}}} #Parameters functions function AddParam(parameters::Parameters,value::Float64,enum::IssmEnum) #{{{ parameters.double_lookup[enum] = DoubleParam(enum,value) return nothing end#}}} function AddParam(parameters::Parameters,value::Int64, enum::IssmEnum) #{{{ parameters.lookup[enum] = IntParam(enum,value) return nothing end#}}} function AddParam(parameters::Parameters,value::Bool, enum::IssmEnum) #{{{ parameters.lookup[enum] = BoolParam(enum,value) return nothing end#}}} function AddParam(parameters::Parameters,value::String, enum::IssmEnum) #{{{ parameters.lookup[enum] = StringParam(enum,value) return nothing end#}}} function AddParam(parameters::Parameters,value::Vector{Flux.Chain{}}, enum::IssmEnum) #{{{ parameters.lookup[enum] = FluxChainParam(enum,value) return nothing end#}}} function AddParam(parameters::Parameters,value::Vector{StatsBase.ZScoreTransform{Float64, Vector{Float64}} }, enum::IssmEnum) #{{{ parameters.lookup[enum] = StatsBaseTransformParam(enum,value) return nothing end#}}} @noinline function FindParam(::Type{Float64}, parameters::Parameters,enum::IssmEnum) #{{{ param = parameters.double_lookup[enum] return GetParameterValue(param)::Float64 end#}}} @noinline function FindParam(::Type{T}, parameters::Parameters,enum::IssmEnum) where T #{{{ param = parameters.lookup[enum] return GetParameterValue(param)::T end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
86
mutable struct Result #{{{ enum::IssmEnum step::Int64 time::Float64 value end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
3937
function solutionsequence_linear(femmodel::FemModel,analysis::Analysis) # {{{ #First, update constraints in case the levelset has changed UpdateConstraintsx(femmodel, analysis) #Get new matrices Kff, Kfs, pf = SystemMatricesx(femmodel,analysis) #Enforce constraints ys = CreateNodalConstraintsx(femmodel.nodes) Reduceloadx!(pf, Kfs, ys) #Solve! uf = Solverx(Kff, pf) #Merge uf with ys and update inputs gsize = NumberOfDofs(femmodel.nodes,GsetEnum) ug = IssmVector(gsize) Mergesolutionfromftogx(ug, uf, ys, femmodel.nodes) InputUpdateFromSolutionx(analysis, ug, femmodel) return nothing end# }}} function solutionsequence_nonlinear(femmodel::FemModel,analysis::Analysis,maxiter::Int64,restol::Float64,reltol::Float64,abstol::Float64) # {{{ #First, update constraints in case the levelset has changed UpdateConstraintsx(femmodel, analysis) #Initialize number of iterations count = 0 converged = false #Get existing solution ug = GetSolutionFromInputsx(analysis,femmodel) uf = Reducevectorgtofx(ug,femmodel.nodes) #Update once again the solution to make sure that vx and vxold are similar (for next step in transient or steadystate) InputUpdateFromSolutionx(analysis,ug,femmodel) #Loop until we reach convergence while(~converged) #Get new matrices Kff, Kfs, pf = SystemMatricesx(femmodel,analysis) #Enforce constraints ys = CreateNodalConstraintsx(femmodel.nodes) Reduceloadx!(pf, Kfs, ys) #Solve! old_uf = uf uf = Solverx(Kff, pf, old_uf) #Merge uf with ys Mergesolutionfromftogx(ug, uf, ys, femmodel.nodes) #Check for convergence converged = convergence(Kff,pf,uf,old_uf,restol,reltol,abstol) InputUpdateFromSolutionx(analysis,ug,femmodel) #Increase count count += 1 if(count>=maxiter) println(" maximum number of nonlinear iterations (",maxiter,") exceeded") converged = true end end print("\n total number of iterations: ", count, "\n") return nothing end# }}} function convergence(Kff::IssmMatrix, pf::IssmVector, uf::IssmVector, old_uf::IssmVector, restol::Float64, reltol::Float64, abstol::Float64)#{{{ print(" checking convergence\n"); #If solution vector is empty, return true if(IsEmpty(uf)) return true end #Convergence criterion #1: force equilibrium (Mandatory) #compute K[n]U[n-1] - F KUold = Duplicate(uf); MatMult!(Kff,old_uf,KUold) KUoldF = Duplicate(KUold); VecCopy!(KUold, KUoldF); AXPY!(KUoldF, -1.0, pf) nKUoldF = Norm(KUoldF,2) nF = Norm(pf,2) res = nKUoldF/nF if ~isfinite(res) println("norm nf = ", nF, " and norm kuold = ",nKUoldF) error("mechanical equilibrium convergence criterion is not finite!") end if(res<restol) print(" mechanical equilibrium convergence criterion ", res*100, " < ", restol*100, " %\n") converged=true else print(" mechanical equilibrium convergence criterion ", res*100, " > ", restol*100, " %\n") converged=false; end #Convergence criterion #2: norm(du)/norm(u) if ~isnan(reltol) duf = Duplicate(old_uf); VecCopy!(old_uf,duf); AXPY!(duf, -1.0, uf) ndu = Norm(duf, 2); nu = Norm(old_uf, 2) if ~isfinite(ndu) | ~isfinite(nu) error("convergence criterion is not finite!") end if((ndu/nu)<reltol) print(" Convergence criterion: norm(du)/norm(u) ", ndu/nu*100, " < ", reltol*100, " %\n") else print(" Convergence criterion: norm(du)/norm(u) ", ndu/nu*100, " > ", reltol*100, " %\n") converged=false; end end #Convergence criterion #3: max(du) if ~isnan(abstol) duf = Duplicate(old_uf); VecCopy!(old_uf,duf); AXPY!(duf, -1.0, uf) nduinf= Norm(duf, 3) if ~isfinite(nduinf) error("convergence criterion is not finite!") end if(nduinf<abstol) print(" Convergence criterion: max(du) ", nduinf, " < ", abstol, "\n") else print(" Convergence criterion: max(du) ", nduinf, " > ", abstol, "\n") converged=false; end end return converged end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1665
include("./issmenums.jl") include("./toolkits.jl") include("./gauss.jl") include("./parameters.jl") include("./inputs.jl") include("./vertices.jl") include("./nodes.jl") include("./elements.jl") include("./constraints.jl") include("./results.jl") include("./matice.jl") include("./friction.jl") include("./analyses/analysis.jl") include("./femmodel.jl") include("./costfunctions.jl") include("./control.jl") #All analyses include("./analyses/stressbalanceanalysis.jl") include("./analyses/masstransportanalysis.jl") include("./analyses/transientanalysis.jl") include("./analyses/levelsetanalysis.jl") include("./solutionsequences.jl") include("./modules.jl") include("./elementmatrix.jl") include("./utils.jl") function solve(md::model, solution::Symbol) #{{{ #Process incoming string if solution===:sb || solution===:Stressbalance || solution===:grad solutionkey = :StressbalanceSolution elseif solution===:tr || solution===:Transient solutionkey = :TransientSolution else error("solutionkey "*solution*" not supported!"); end #Construct FemModel from md femmodel=ModelProcessor(md, solutionkey) #Solve (FIXME: to be improved later...) if (md.inversion.iscontrol) # solve inverse problem if solution===:grad computeGradient(md, femmodel) else Control_Core(md, femmodel) end else # otherwise forward problem if(solutionkey===:StressbalanceSolution) analysis = StressbalanceAnalysis() elseif (solutionkey===:TransientSolution) analysis = TransientAnalysis() else error("not supported") end Core(analysis, femmodel) end #add results to md.results OutputResultsx(femmodel, md, solutionkey) return md end# }}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
3905
#Matrix #Toolkit #1: serial sparse arrays #= DEACTIVATED FOR NOW using SparseArrays mutable struct IssmMatrix #{{{ M::Int64 N::Int64 rows::Vector{Int64} cols::Vector{Int64} vals::Vector{Float64} matrix::SparseMatrixCSC{Float64,Int64} end #}}} function IssmMatrix(M::Int64,N::Int64)#{{{ return IssmMatrix(M, N, Vector{Int64}(undef,0), Vector{Int64}(undef,0), Vector{Float64}(undef,0), spzeros(0,0)) end#}}} function AddValues!(matrix::IssmMatrix,m::Int64,midx::Vector{Int64},n::Int64,nidx::Vector{Int64},values::Matrix{Float64})#{{{ #This is inefficient now, but it will work for i in 1:m if(midx[i]==-1) continue end for j in 1:n if(nidx[j]==-1) continue end push!(matrix.rows, midx[i]) push!(matrix.cols, nidx[j]) push!(matrix.vals, values[i,j]) end end return nothing end#}}} function GetSize(matrix::IssmMatrix)#{{{ return size(matrix.matrix) end#}}} function Assemble!(matrix::IssmMatrix)#{{{ matrix.matrix = sparse(matrix.rows, matrix.cols, matrix.vals, matrix.M, matrix.N) return nothing end#}}} =# #Toolkit #2: dense matrix (for enzyme) mutable struct IssmMatrix #{{{ M::Int64 N::Int64 matrix::Matrix{Float64} end #}}} function IssmMatrix(M::Int64,N::Int64)#{{{ return IssmMatrix(M, N, zeros(M,N)) end#}}} function AddValues!(matrix::IssmMatrix,m::Int64,midx::Vector{Int64},n::Int64,nidx::Vector{Int64},values::Matrix{Float64})#{{{ #This is inefficient now, but it will work for i in 1:m if(midx[i]==-1) continue end for j in 1:n if(nidx[j]==-1) continue end matrix.matrix[midx[i],nidx[j]] += values[i,j] end end return nothing end#}}} function GetSize(matrix::IssmMatrix)#{{{ return size(matrix.matrix) end#}}} function Assemble!(matrix::IssmMatrix)#{{{ #Nothing to do here :) return nothing end#}}} #Vector mutable struct IssmVector #{{{ vector::Vector{Float64} end #}}} function IssmVector(M::Int64)#{{{ return IssmVector(zeros(M)) end#}}} function GetSize(vector::IssmVector)#{{{ return length(vector.vector) end#}}} function AddValues!(vector::IssmVector,m::Int64,midx::Vector{Int64},values::Vector{Float64})#{{{ #This is inefficient now, but it will work for i in 1:m if(midx[i]==-1) continue end vector.vector[midx[i]] += values[i] end return nothing end#}}} function SetValues!(vector::IssmVector,m::Int64,midx::Vector{Int64},values::Vector{Float64})#{{{ #This is inefficient now, but it will work for i in 1:m if(midx[i]==-1) continue end vector.vector[midx[i]] = values[i] end return nothing end#}}} function IsEmpty(vector::IssmVector)#{{{ return GetSize(vector)==0 end#}}} function Duplicate(vector::IssmVector)#{{{ #Copy data structure M=GetSize(vector) return IssmVector(M) end#}}} function VecCopy!(x::IssmVector,y::IssmVector)#{{{ y.vector = x.vector return nothing end#}}} function Assemble!(vector::IssmVector)#{{{ #Nothing to do for this toolkit return nothing end#}}} function ToSerial(vector::IssmVector)#{{{ return vector.vector end#}}} function Norm(x::IssmVector,type::Int64)#{{{ norm = 0.0 if type==2 for i in 1:length(x.vector) norm += x.vector[i]^2 end norm = sqrt(norm) elseif type==3 #Infinite norm for i in 1:length(x.vector) if(abs(x.vector[i])>norm) norm = abs(x.vector[i]) end end else error("type ",type," not supported yet") end return norm end#}}} #Operations function MatMult!(A::IssmMatrix,x::IssmVector,y::IssmVector) #{{{ y.vector = A.matrix*x.vector return nothing end#}}} function AXPY!(y::IssmVector,alpha::Float64,x::IssmVector) #{{{ y.vector = alpha*x.vector + y.vector return nothing end#}}} function Solverx(A::IssmMatrix, b::IssmVector, xold::IssmVector) #{{{ return Solverx(A, b) end#}}} function Solverx(A::IssmMatrix, b::IssmVector) #{{{ println(" Solving matrix system") #Initialize output x = IssmVector(0) #Solve linear system x.vector = A.matrix \ b.vector return x end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
685
function Matrix2x2Determinant(A::Matrix{Float64}) #{{{ return A[1,1]*A[2,2]-A[2,1]*A[1,2] end#}}} function Matrix2x2Invert(A::Matrix{Float64}) #{{{ #Initialize output Ainv = Matrix{Float64}(undef,2,2) #Compute determinant det = Matrix2x2Determinant(A) if(abs(det)<eps(Float64)) error("Determinant smaller than machine epsilon") end #Multiplication is faster than divsion, so we multiply by the reciprocal det_reciprocal = 1/det #compute invert matrix Ainv[1,1]= A[2,2]*det_reciprocal # = d/det Ainv[1,2]= - A[1,2]*det_reciprocal # = -b/det Ainv[2,1]= - A[2,1]*det_reciprocal # = -c/det Ainv[2,2]= A[1,1]*det_reciprocal # = a/det return Ainv end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
453
#Vertex class definition mutable struct Vertex#{{{ sid::Int64 x::Float64 y::Float64 z::Float64 end# }}} #vertices functions function GetVerticesCoordinates(vertices::Vector{Vertex}) #{{{ #Intermediaries nbv = length(vertices) #Allocate xyz_list = Matrix{Float64}(undef,nbv,3) #Assign value to xyz_list for i in 1:nbv xyz_list[i,1]=vertices[i].x xyz_list[i,2]=vertices[i].y xyz_list[i,3]=vertices[i].z end return xyz_list end #}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
55
#Analysis class definitions abstract type Analysis end
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
7492
#LevelsetAnalysis class definition struct LevelsetAnalysis <: Analysis#{{{ end #}}} #Model Processing function CreateConstraints(analysis::LevelsetAnalysis,constraints::Vector{Constraint},md::model) #{{{ #load constraints from model spclevelset = md.levelset.spclevelset count = 1 for i in 1:md.mesh.numberofvertices if ~isnan(spclevelset[i]) push!(constraints,Constraint(count,i,1,spclevelset[i])) count+=1 end end return nothing end#}}} function CreateNodes(analysis::LevelsetAnalysis,nodes::Vector{Node},md::model) #{{{ numdof = 1 for i in 1:md.mesh.numberofvertices push!(nodes,Node(i,i,true,true,numdof,-ones(Int64,numdof), ones(Int64,numdof), -ones(Int64,numdof), zeros(numdof))) end return nothing end#}}} function UpdateElements(analysis::LevelsetAnalysis,elements::Vector{Tria}, inputs::Inputs, md::model) #{{{ #Provide node indices to element for i in 1:md.mesh.numberofelements Update(elements[i],inputs,i,md,P1Enum) end #Add necessary inputs to perform this analysis FetchDataToInput(md,inputs,elements,md.mask.ice_levelset,MaskIceLevelsetEnum) FetchDataToInput(md,inputs,elements,md.mask.ocean_levelset,MaskOceanLevelsetEnum) FetchDataToInput(md,inputs,elements,md.initialization.vx./md.constants.yts,VxEnum) FetchDataToInput(md,inputs,elements,md.initialization.vy./md.constants.yts,VyEnum) FetchDataToInput(md,inputs,elements,md.geometry.thickness,ThicknessEnum) FetchDataToInput(md,inputs,elements,md.geometry.surface,SurfaceEnum) FetchDataToInput(md,inputs,elements,md.geometry.base,BaseEnum) FetchDataToInput(md,inputs,elements,md.mask.ice_levelset, MaskIceLevelsetEnum) FetchDataToInput(md,inputs,elements,md.mask.ocean_levelset, MaskOceanLevelsetEnum) #Get moving front parameters if typeof(md.calving) == DefaultCalving FetchDataToInput(md,inputs,elements,md.calving.calvingrate,CalvingCalvingrateEnum) else error("Calving ", typeof(md.calving), " not supported yet") end #Get frontal melt parameters FetchDataToInput(md,inputs,elements,md.frontalforcings.meltingrate, CalvingMeltingrateEnum) FetchDataToInput(md,inputs,elements,md.frontalforcings.ablationrate, CalvingAblationrateEnum) return nothing end#}}} function UpdateParameters(analysis::LevelsetAnalysis,parameters::Parameters,md::model) #{{{ AddParam(parameters,md.levelset.stabilization,LevelsetStabilizationEnum) AddParam(parameters,md.levelset.reinit_frequency,LevelsetReinitFrequencyEnum) AddParam(parameters,md.levelset.kill_icebergs,LevelsetKillIcebergsEnum) AddParam(parameters,md.levelset.migration_max,MigrationMaxEnum) #Deal with Calving if typeof(md.calving)==DefaultCalving AddParam(parameters, 1, CalvingLawEnum) else error("Calving ", typeof(md.calving), " not supported yet") end return nothing end#}}} #Finite Element Analysis function Core(analysis::LevelsetAnalysis,femmodel::FemModel)# {{{ # moving front MovingFrontalVel(femmodel) #Activate formulation SetCurrentConfiguration!(femmodel, analysis) #Call solution sequence to compute new speeds println(" call computational core:"); solutionsequence_linear(femmodel,analysis) # TODO: add reinitialization # save RequestedOutputsx(femmodel, [MaskIceLevelsetEnum]) return nothing end #}}} function CreateKMatrix(analysis::LevelsetAnalysis,element::Tria)# {{{ #Internmediaries numnodes = 3 #Initialize Element matrix and basis function derivatives Ke = ElementMatrix(element.nodes) dbasis = Matrix{Float64}(undef,numnodes,2) basis = Vector{Float64}(undef,numnodes) #Retrieve all inputs and parameters xyz_list = GetVerticesCoordinates(element.vertices) mf_vx_input = GetInput(element, MovingFrontalVxEnum) mf_vy_input = GetInput(element, MovingFrontalVyEnum) dt = FindParam(Float64, element, TimesteppingTimeStepEnum) stabilization = FindParam(Int64, element, LevelsetStabilizationEnum) migration_max = FindParam(Float64, element, MigrationMaxEnum) h = CharacteristicLength(element) #Start integrating gauss = GaussTria(2) for ig in 1:gauss.numgauss Jdet = JacobianDeterminant(xyz_list, gauss) NodalFunctionsDerivatives(element, dbasis, xyz_list, gauss) NodalFunctions(element, basis, gauss, ig, P1Enum) #Transient term for i in 1:numnodes for j in 1:numnodes Ke.values[i ,j] += gauss.weights[ig]*Jdet*basis[i]*basis[j] end end # levelset speed wx = GetInputValue(mf_vx_input, gauss, ig) wy = GetInputValue(mf_vy_input, gauss, ig) vel = sqrt(wx^2+wy^2)+1.0e-14 #rescale by migration_max if (vel > migration_max) wx = wx/vel*migration_max wy = wy/vel*migration_max end for i in 1:numnodes for j in 1:numnodes #\phi_i v\cdot\nabla\phi_j Ke.values[i ,j] += dt*gauss.weights[ig]*Jdet*basis[i]*(wx*dbasis[j,1] + wy*dbasis[j,2]) end end #Stabilization if(stabilization==0) #do nothing elseif (stabilization==1) hx, hy, hz = GetElementSizes(element) h = sqrt((hx*wx/vel)^2 + (hy*wy/vel)^2) kappa = h*vel/2.0 D = dt*gauss.weights[ig]*Jdet*kappa for i in 1:numnodes for j in 1:numnodes for k in 1:2 Ke.values[i ,j] += D*dbasis[i,k]*dbasis[j,k] end end end else error("Stabilization ",stabilization, " not supported yet") end end return Ke end #}}} function CreatePVector(analysis::LevelsetAnalysis,element::Tria)# {{{ #Internmediaries numnodes = 3 #Initialize Element vectro and basis functions pe = ElementVector(element.nodes) basis = Vector{Float64}(undef,numnodes) #Retrieve all inputs and parameters xyz_list = GetVerticesCoordinates(element.vertices) levelset_input = GetInput(element, MaskIceLevelsetEnum) mf_vx_input = GetInput(element, MovingFrontalVxEnum) mf_vy_input = GetInput(element, MovingFrontalVyEnum) dt = FindParam(Float64, element, TimesteppingTimeStepEnum) stabilization = FindParam(Int64, element, LevelsetStabilizationEnum) migration_max = FindParam(Float64, element, MigrationMaxEnum) h = CharacteristicLength(element) #Start integrating gauss = GaussTria(2) for ig in 1:gauss.numgauss Jdet = JacobianDeterminant(xyz_list, gauss) #Get nodal basis NodalFunctions(element, basis, gauss, ig, P1Enum) #Old function value lsf = GetInputValue(levelset_input, gauss, ig) for i in 1:numnodes pe.values[i] += gauss.weights[ig]*Jdet*lsf*basis[i] end #TODO: add stab=5 end return pe end #}}} function GetSolutionFromInputs(analysis::LevelsetAnalysis,ug::IssmVector,element::Tria) #{{{ #Get dofs for this finite element doflist = GetDofList(element,GsetEnum) @assert length(doflist)==3 #Fetch inputs mask_input = GetInput(element, MaskIceLevelsetEnum) #Loop over each node and enter solution in ug count = 0 gauss=GaussTria(P1Enum) for i in 1:gauss.numgauss mask = GetInputValue(mask_input, gauss, i) count += 1 ug.vector[doflist[count]] = mask end #Make sure we reached all the values @assert count==length(doflist) return nothing end#}}} function InputUpdateFromSolution(analysis::LevelsetAnalysis,ug::Vector{Float64},element::Tria) #{{{ InputUpdateFromSolutionOneDof(element, ug, MaskIceLevelsetEnum) end#}}} function UpdateConstraints(analysis::LevelsetAnalysis, femmodel::FemModel) #{{{ #Default do nothing return nothing end#}}} # Moving front function MovingFrontalVel(femmodel::FemModel)# {{{ for i in 1:length(femmodel.elements) MovingFrontalVelocity(femmodel.elements[i]) end return nothing end #}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
9613
#MasstransportAnalysis class definition struct MasstransportAnalysis <: Analysis#{{{ end #}}} #Model Processing function CreateConstraints(analysis::MasstransportAnalysis,constraints::Vector{Constraint},md::model) #{{{ #load constraints from model spcthickness = md.masstransport.spcthickness count = 1 for i in 1:md.mesh.numberofvertices if ~isnan(spcthickness[i]) push!(constraints,Constraint(count,i,1,spcthickness[i])) count+=1 end end return nothing end#}}} function CreateNodes(analysis::MasstransportAnalysis,nodes::Vector{Node},md::model) #{{{ numdof = 1 for i in 1:md.mesh.numberofvertices push!(nodes,Node(i,i,true,true,numdof,-ones(Int64,numdof), ones(Int64,numdof), -ones(Int64,numdof), zeros(numdof))) end return nothing end#}}} function UpdateElements(analysis::MasstransportAnalysis,elements::Vector{Tria}, inputs::Inputs, md::model) #{{{ #Provide node indices to element for i in 1:md.mesh.numberofelements Update(elements[i],inputs,i,md,P1Enum) end #Add necessary inputs to perform this analysis FetchDataToInput(md,inputs,elements,md.geometry.thickness,ThicknessEnum) FetchDataToInput(md,inputs,elements,md.geometry.surface,SurfaceEnum) FetchDataToInput(md,inputs,elements,md.geometry.base,BaseEnum) FetchDataToInput(md,inputs,elements,md.geometry.bed,BedEnum) FetchDataToInput(md,inputs,elements,md.basalforcings.groundedice_melting_rate./md.constants.yts,BasalforcingsGroundediceMeltingRateEnum) FetchDataToInput(md,inputs,elements,md.basalforcings.floatingice_melting_rate./md.constants.yts,BasalforcingsFloatingiceMeltingRateEnum) FetchDataToInput(md,inputs,elements,md.smb.mass_balance./md.constants.yts,SmbMassBalanceEnum) FetchDataToInput(md,inputs,elements,md.mask.ice_levelset, MaskIceLevelsetEnum) FetchDataToInput(md,inputs,elements,md.mask.ocean_levelset, MaskOceanLevelsetEnum) FetchDataToInput(md,inputs,elements,md.initialization.vx./md.constants.yts,VxEnum) FetchDataToInput(md,inputs,elements,md.initialization.vy./md.constants.yts,VyEnum) return nothing end#}}} function UpdateParameters(analysis::MasstransportAnalysis,parameters::Parameters,md::model) #{{{ AddParam(parameters, md.masstransport.min_thickness, MasstransportMinThicknessEnum) AddParam(parameters, md.masstransport.stabilization, MasstransportStabilizationEnum) return nothing end#}}} #Finite Element Analysis function Core(analysis::MasstransportAnalysis,femmodel::FemModel)# {{{ println(" computing mass transport") SetCurrentConfiguration!(femmodel, analysis) InputDuplicatex(femmodel, ThicknessEnum, ThicknessOldEnum) InputDuplicatex(femmodel, BaseEnum, BaseOldEnum) InputDuplicatex(femmodel, SurfaceEnum, SurfaceOldEnum) solutionsequence_linear(femmodel,analysis) #Save output RequestedOutputsx(femmodel, [ThicknessEnum, SurfaceEnum, BaseEnum]) return nothing end #}}} function CreateKMatrix(analysis::MasstransportAnalysis,element::Tria)# {{{ #Return if there is no ice in this element if(!IsIceInElement(element)) return end #Internmediaries numnodes = 3 #Initialize Element matrix and basis function derivatives Ke = ElementMatrix(element.nodes) dbasis = Matrix{Float64}(undef,numnodes,2) basis = Vector{Float64}(undef,numnodes) #Retrieve all inputs and parameters xyz_list = GetVerticesCoordinates(element.vertices) vx_input = GetInput(element, VxEnum) vy_input = GetInput(element, VyEnum) dt = FindParam(Float64, element, TimesteppingTimeStepEnum) stabilization = FindParam(Int64, element, MasstransportStabilizationEnum) h = CharacteristicLength(element) #Start integrating gauss = GaussTria(2) for ig in 1:gauss.numgauss Jdet = JacobianDeterminant(xyz_list, gauss) NodalFunctionsDerivatives(element, dbasis, xyz_list, gauss) NodalFunctions(element, basis, gauss, ig, P1Enum) #Transient term for i in 1:numnodes for j in 1:numnodes Ke.values[i ,j] += gauss.weights[ig]*Jdet*basis[i]*basis[j] end end #Advection term vx = GetInputValue(vx_input, gauss, ig) vy = GetInputValue(vy_input, gauss, ig) dvx = GetInputDerivativeValue(vx_input, xyz_list, gauss, ig) dvy = GetInputDerivativeValue(vy_input, xyz_list, gauss, ig) for i in 1:numnodes for j in 1:numnodes #\phi_i \phi_j \nabla\cdot v Ke.values[i ,j] += dt*gauss.weights[ig]*Jdet*basis[i]*basis[j]*(dvx[1] + dvy[2]) #\phi_i v\cdot\nabla\phi_j Ke.values[i ,j] += dt*gauss.weights[ig]*Jdet*basis[i]*(vx*dbasis[j,1] + vy*dbasis[j,2]) end end #Stabilization if(stabilization==0) #do nothing elseif (stabilization==1) vx = GetInputAverageValue(vx_input) vy = GetInputAverageValue(vy_input) D = dt*gauss.weights[ig]*Jdet*[h/2*abs(vx) 0; 0 h/2*abs(vy)] for i in 1:numnodes; for j in 1:numnodes Ke.values[i ,j] += (dbasis[i,1]*(D[1,1]*dbasis[j,1] + D[1,2]*dbasis[j,2]) + dbasis[i,2]*(D[2,1]*dbasis[j,1] + D[2,2]*dbasis[j,2])) end end else error("Stabilization ",stabilization, " not supported yet") end end return Ke end #}}} function CreatePVector(analysis::MasstransportAnalysis,element::Tria)# {{{ #Return if there is no ice in this element if(!IsIceInElement(element)) return end #Internmediaries numnodes = 3 #Initialize Element vectro and basis functions pe = ElementVector(element.nodes) basis = Vector{Float64}(undef,numnodes) #Retrieve all inputs and parameters xyz_list = GetVerticesCoordinates(element.vertices) H_input = GetInput(element, ThicknessEnum) gmb_input = GetInput(element, BasalforcingsGroundediceMeltingRateEnum) fmb_input = GetInput(element, BasalforcingsFloatingiceMeltingRateEnum) smb_input = GetInput(element, SmbMassBalanceEnum) olevelset_input = GetInput(element, MaskOceanLevelsetEnum) dt = FindParam(Float64, element, TimesteppingTimeStepEnum) stabilization = FindParam(Int64, element, MasstransportStabilizationEnum) #How much is actually grounded? phi=GetGroundedPortion(element, xyz_list) #Start integrating gauss = GaussTria(3) for ig in 1:gauss.numgauss Jdet = JacobianDeterminant(xyz_list, gauss) NodalFunctions(element, basis, gauss, ig, P1Enum) smb = GetInputValue(smb_input, gauss, ig) H = GetInputValue(H_input, gauss, ig) #Only apply melt on fully floating cells if(phi<0.00000001) mb = GetInputValue(fmb_input, gauss, ig) else mb = GetInputValue(gmb_input, gauss, ig) end for i in 1:numnodes pe.values[i] += gauss.weights[ig]*Jdet*(H + dt*(smb - mb))*basis[i] end end return pe end #}}} function GetSolutionFromInputs(analysis::MasstransportAnalysis,ug::IssmVector,element::Tria) #{{{ #Get dofs for this finite element doflist = GetDofList(element,GsetEnum) @assert length(doflist)==3 #Fetch inputs thickness_input = GetInput(element, ThicknessEnum) #Loop over each node and enter solution in ug count = 0 gauss=GaussTria(P1Enum) for i in 1:gauss.numgauss thickness = GetInputValue(thickness_input, gauss, i) count += 1 ug.vector[doflist[count]] = thickness end #Make sure we reached all the values @assert count==length(doflist) return nothing end#}}} function InputUpdateFromSolution(analysis::MasstransportAnalysis,ug::Vector{Float64},element::Tria) #{{{ #Get dofs for this finite element doflist = GetDofList(element,GsetEnum) #Get solution vector for this element numdof = 3 values = Vector{Float64}(undef,numdof) for i in 1:numdof values[i]=ug[doflist[i]] end #Get some parameters rho_water = FindParam(Float64, element, MaterialsRhoSeawaterEnum) rho_ice = FindParam(Float64, element, MaterialsRhoIceEnum) H_min = FindParam(Float64, element, MasstransportMinThicknessEnum) #Now split solution vector into x and y components numnodes = 3 thickness = Vector{Float64}(undef,numnodes) for i in 1:numnodes thickness[i]=values[i] @assert isfinite(thickness[i]) #Enforce minimum thickness if(thickness[i]<H_min) thickness[i] = H_min end end AddInput(element, ThicknessEnum, thickness, P1Enum) #Update bed and surface accordingly newthickness = Vector{Float64}(undef,3) oldthickness = Vector{Float64}(undef,3) oldbase = Vector{Float64}(undef,3) oldsurface = Vector{Float64}(undef,3) phi = Vector{Float64}(undef,3) bed = Vector{Float64}(undef,3) GetInputListOnVertices!(element, newthickness, ThicknessEnum) GetInputListOnVertices!(element, oldthickness, ThicknessOldEnum) GetInputListOnVertices!(element, oldbase, BaseOldEnum) GetInputListOnVertices!(element, oldsurface, SurfaceOldEnum) GetInputListOnVertices!(element, phi, MaskOceanLevelsetEnum) GetInputListOnVertices!(element, bed, BedEnum) sealevel = zeros(3) newsurface = Vector{Float64}(undef,3) newbase = Vector{Float64}(undef,3) for i in 1:3 if(phi[i]>0.) #this is grounded ice: just add thickness to base. newsurface[i] = bed[i]+newthickness[i] #surface = bed + newthickness newbase[i] = bed[i] #new base at new bed else #this is an ice shelf: hydrostatic equilibrium newsurface[i] = newthickness[i]*(1-rho_ice/rho_water) + sealevel[i] newbase[i] = newthickness[i]*(-rho_ice/rho_water) + sealevel[i] end end AddInput(element, SurfaceEnum, newsurface, P1Enum) AddInput(element, BaseEnum, newbase, P1Enum) return nothing end#}}} function UpdateConstraints(analysis::MasstransportAnalysis, femmodel::FemModel) #{{{ SetActiveNodesLSMx(femmodel) return nothing end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
10566
#StressbalanceAnalysis class definition struct StressbalanceAnalysis <: Analysis#{{{ end #}}} #Model Processing function CreateConstraints(analysis::StressbalanceAnalysis,constraints::Vector{Constraint},md::model) #{{{ #load constraints from model spcvx = md.stressbalance.spcvx spcvy = md.stressbalance.spcvy count = 1 for i in 1:md.mesh.numberofvertices if ~isnan(spcvx[i]) push!(constraints,Constraint(count,i,1,spcvx[i]/md.constants.yts)) count+=1 end if ~isnan(spcvy[i]) push!(constraints,Constraint(count,i,2,spcvy[i]/md.constants.yts)) count+=1 end end return nothing end#}}} function CreateNodes(analysis::StressbalanceAnalysis,nodes::Vector{Node},md::model) #{{{ numdof = 2 for i in 1:md.mesh.numberofvertices push!(nodes,Node(i,i,true,true,numdof,-ones(Int64,numdof), ones(Int64,numdof), -ones(Int64,numdof), zeros(numdof))) end return nothing end#}}} function UpdateElements(analysis::StressbalanceAnalysis,elements::Vector{Tria}, inputs::Inputs, md::model) #{{{ #Provide node indices to element for i in 1:md.mesh.numberofelements Update(elements[i],inputs,i,md,P1Enum) end #Add necessary inputs to perform this analysis FetchDataToInput(md,inputs,elements,md.materials.rheology_B,MaterialsRheologyBEnum) FetchDataToInput(md,inputs,elements,md.geometry.thickness,ThicknessEnum) FetchDataToInput(md,inputs,elements,md.geometry.surface,SurfaceEnum) FetchDataToInput(md,inputs,elements,md.geometry.base,BaseEnum) FetchDataToInput(md,inputs,elements,md.initialization.vx./md.constants.yts,VxEnum) FetchDataToInput(md,inputs,elements,md.initialization.vy./md.constants.yts,VyEnum) FetchDataToInput(md,inputs,elements,md.mask.ice_levelset, MaskIceLevelsetEnum) FetchDataToInput(md,inputs,elements,md.mask.ocean_levelset, MaskOceanLevelsetEnum) #Deal with friction if typeof(md.friction) == BuddFriction FetchDataToInput(md,inputs,elements,md.friction.coefficient,FrictionCoefficientEnum) FetchDataToInput(md,inputs,elements,md.friction.p,FrictionPEnum) FetchDataToInput(md,inputs,elements,md.friction.q,FrictionQEnum) elseif typeof(md.friction) == WeertmanFriction FetchDataToInput(md,inputs,elements,md.friction.C,FrictionCEnum) FetchDataToInput(md,inputs,elements,md.friction.m,FrictionMEnum) elseif typeof(md.friction) == SchoofFriction FetchDataToInput(md,inputs,elements,md.friction.C,FrictionCEnum) FetchDataToInput(md,inputs,elements,md.friction.m,FrictionMEnum) FetchDataToInput(md,inputs,elements,md.friction.Cmax,FrictionCmaxEnum) elseif typeof(md.friction) == DNNFriction FetchDataToInput(md,inputs,elements,md.geometry.ssx,SurfaceSlopeXEnum) FetchDataToInput(md,inputs,elements,md.geometry.ssy,SurfaceSlopeYEnum) FetchDataToInput(md,inputs,elements,md.geometry.bsx,BedSlopeXEnum) FetchDataToInput(md,inputs,elements,md.geometry.bsy,BedSlopeYEnum) else error("Friction ", typeof(md.friction), " not supported yet") end return nothing end#}}} function UpdateParameters(analysis::StressbalanceAnalysis,parameters::Parameters,md::model) #{{{ AddParam(parameters,md.stressbalance.restol,StressbalanceRestolEnum) AddParam(parameters,md.stressbalance.reltol,StressbalanceReltolEnum) AddParam(parameters,md.stressbalance.abstol,StressbalanceAbstolEnum) AddParam(parameters,md.stressbalance.maxiter,StressbalanceMaxiterEnum) #Deal with friction if typeof(md.friction)==BuddFriction AddParam(parameters, 1, FrictionLawEnum) elseif typeof(md.friction)==WeertmanFriction AddParam(parameters, 2, FrictionLawEnum) elseif typeof(md.friction)==SchoofFriction AddParam(parameters, 11, FrictionLawEnum) elseif typeof(md.friction)==DNNFriction AddParam(parameters, 20, FrictionLawEnum) AddParam(parameters, md.friction.dnnChain, FrictionDNNChainEnum) AddParam(parameters, md.friction.dtx, FrictionDNNdtxEnum) AddParam(parameters, md.friction.dty, FrictionDNNdtyEnum) else error("Friction ", typeof(md.friction), " not supported yet") end return nothing end#}}} #Finite Element Analysis function Core(analysis::StressbalanceAnalysis,femmodel::FemModel)# {{{ #Set current analysis to Stressnalance SetCurrentConfiguration!(femmodel, analysis) #Fetch parameters relevant to solution sequence maxiter = FindParam(Int64, femmodel.parameters,StressbalanceMaxiterEnum) restol = FindParam(Float64, femmodel.parameters,StressbalanceRestolEnum) reltol = FindParam(Float64, femmodel.parameters,StressbalanceReltolEnum) abstol = FindParam(Float64, femmodel.parameters,StressbalanceAbstolEnum) #Call solution sequence to compute new speeds println(" computing stress balance"); solutionsequence_nonlinear(femmodel,analysis,maxiter,restol,reltol,abstol) #Save output RequestedOutputsx(femmodel, [VxEnum,VyEnum,VelEnum]) return nothing end #}}} function CreateKMatrix(analysis::StressbalanceAnalysis, element::Tria) #{{{ # a wrapper for Enzyme to know the type of friction law frictionlaw = FindParam(Int64, element, FrictionLawEnum) CreateKMatrix(analysis, element, Val(frictionlaw))::DJUICE.ElementMatrix end #}}} function CreateKMatrix(analysis::StressbalanceAnalysis, element::Tria, ::Val{frictionlaw}) where frictionlaw# {{{ #Internmediaries numnodes = 3 #Initialize Element matrix and basis function derivatives Ke = ElementMatrix(element.nodes)::DJUICE.ElementMatrix dbasis = Matrix{Float64}(undef,numnodes,2) #Retrieve all inputs and parameters xyz_list = GetVerticesCoordinates(element.vertices) H_input = GetInput(element, ThicknessEnum) #Prepare material object material = Matice(element) #Start integrating gauss = GaussTria(2) for ig in 1:gauss.numgauss Jdet = JacobianDeterminant(xyz_list, gauss) NodalFunctionsDerivatives(element,dbasis,xyz_list,gauss) H = GetInputValue(H_input, gauss, ig) mu = ViscositySSA(material, xyz_list, gauss, ig) for i in 1:numnodes for j in 1:numnodes Ke.values[2*i-1,2*j-1] += gauss.weights[ig]*Jdet*mu*H*(4*dbasis[j,1]*dbasis[i,1] + dbasis[j,2]*dbasis[i,2]) Ke.values[2*i-1,2*j ] += gauss.weights[ig]*Jdet*mu*H*(2*dbasis[j,2]*dbasis[i,1] + dbasis[j,1]*dbasis[i,2]) Ke.values[2*i ,2*j-1] += gauss.weights[ig]*Jdet*mu*H*(2*dbasis[j,1]*dbasis[i,2] + dbasis[j,2]*dbasis[i,1]) Ke.values[2*i ,2*j ] += gauss.weights[ig]*Jdet*mu*H*(4*dbasis[j,2]*dbasis[i,2] + dbasis[j,1]*dbasis[i,1]) end end end #Add basal friction phi=GetGroundedPortion(element, xyz_list) if(phi>0) basis = Vector{Float64}(undef,numnodes) friction = CoreFriction(element, Val(frictionlaw)) #Start integrating gauss = GaussTria(2) for ig in 1:gauss.numgauss Jdet = JacobianDeterminant(xyz_list, gauss) NodalFunctions(element, basis, gauss, ig, P1Enum) alpha2 = Alpha2(friction, gauss, ig) for i in 1:numnodes for j in 1:numnodes Ke.values[2*i-1,2*j-1] += gauss.weights[ig]*Jdet*phi*alpha2*basis[i]*basis[j] Ke.values[2*i ,2*j ] += gauss.weights[ig]*Jdet*phi*alpha2*basis[i]*basis[j] end end end end return Ke end #}}} function CreatePVector(analysis::StressbalanceAnalysis, element::Tria)# {{{ #Internmediaries numnodes = 3 #Initialize Element vectro and basis functions pe = ElementVector(element.nodes) basis = Vector{Float64}(undef,numnodes) #Retrieve all inputs and parameters xyz_list = GetVerticesCoordinates(element.vertices) H_input = GetInput(element, ThicknessEnum) s_input = GetInput(element, SurfaceEnum) rho_ice = FindParam(Float64, element, MaterialsRhoIceEnum) g = FindParam(Float64, element, ConstantsGEnum) #Start integrating gauss = GaussTria(2) for ig in 1:gauss.numgauss Jdet = JacobianDeterminant(xyz_list, gauss) NodalFunctions(element, basis, gauss, ig, P1Enum) H = GetInputValue(H_input, gauss, ig) ds = GetInputDerivativeValue(s_input, xyz_list, gauss, ig) for i in 1:numnodes pe.values[2*i-1] += -gauss.weights[ig]*Jdet*rho_ice*g*H*ds[1]*basis[i] pe.values[2*i ] += -gauss.weights[ig]*Jdet*rho_ice*g*H*ds[2]*basis[i] end end if(IsIcefront(element)) #Get additional parameters and inputs b_input = GetInput(element, BaseEnum) rho_water = FindParam(Float64, element, MaterialsRhoSeawaterEnum) #Get normal and ice front coordinates xyz_list_front = Matrix{Float64}(undef,2,3) GetIcefrontCoordinates!(element, xyz_list_front, xyz_list, MaskIceLevelsetEnum) nx, ny = NormalSection(element, xyz_list_front) gauss = GaussTria(element, xyz_list, xyz_list_front, 3) for ig in 1:gauss.numgauss Jdet = JacobianDeterminantSurface(xyz_list_front, gauss) NodalFunctions(element, basis, gauss, ig, P1Enum) H = GetInputValue(H_input, gauss, ig) b = GetInputValue(b_input, gauss, ig) sl = 0 term = 0.5*g*rho_ice*H^2 + 0.5*g*rho_water*(min(0, H+b-sl)^2 - min(0, b-sl)^2) for i in 1:numnodes pe.values[2*i-1] += gauss.weights[ig]*Jdet*term*nx*basis[i] pe.values[2*i ] += gauss.weights[ig]*Jdet*term*ny*basis[i] end end end return pe end #}}} function GetSolutionFromInputs(analysis::StressbalanceAnalysis,ug::IssmVector,element::Tria) #{{{ #Get dofs for this finite element doflist = GetDofList(element,GsetEnum) @assert length(doflist)==6 #Fetch inputs vx_input = GetInput(element, VxEnum) vy_input = GetInput(element, VyEnum) #Loop over each node and enter solution in ug count = 0 gauss=GaussTria(P1Enum) for i in 1:gauss.numgauss vx = GetInputValue(vx_input, gauss, i) vy = GetInputValue(vy_input, gauss, i) count += 1 ug.vector[doflist[count]] = vx count += 1 ug.vector[doflist[count]] = vy end #Make sure we reached all the values @assert count==length(doflist) return nothing end#}}} function InputUpdateFromSolution(analysis::StressbalanceAnalysis,ug::Vector{Float64},element::Tria) #{{{ #Get dofs for this finite element doflist = GetDofList(element,GsetEnum) #Get solution vector for this element numdof = 3*2 values = Vector{Float64}(undef,numdof) for i in 1:numdof values[i]=ug[doflist[i]] end #Now split solution vector into x and y components numnodes = 3 vx = Vector{Float64}(undef,numnodes) vy = Vector{Float64}(undef,numnodes) vel = Vector{Float64}(undef,numnodes) for i in 1:numnodes vx[i]=values[2*i-1] vy[i]=values[2*i] @assert isfinite(vx[i]) @assert isfinite(vy[i]) vel[i] =sqrt(vx[i]^2 + vy[i]^2) end AddInput(element, VxEnum, vx, P1Enum) AddInput(element, VyEnum, vy, P1Enum) AddInput(element, VelEnum, vel, P1Enum) return nothing end#}}} function UpdateConstraints(analysis::StressbalanceAnalysis, femmodel::FemModel) #{{{ SetActiveNodesLSMx(femmodel) return nothing end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
2135
#TransientAnalysis class definition struct TransientAnalysis <: Analysis#{{{ end #}}} function UpdateParameters(analysis::TransientAnalysis,parameters::Parameters,md::model) #{{{ AddParam(parameters, md.constants.yts, ConstantsYtsEnum) AddParam(parameters, md.timestepping.start_time*md.constants.yts, TimeEnum) AddParam(parameters, md.timestepping.final_time*md.constants.yts, TimesteppingFinalTimeEnum) AddParam(parameters, md.timestepping.time_step*md.constants.yts, TimesteppingTimeStepEnum) AddParam(parameters, md.transient.isstressbalance, TransientIsstressbalanceEnum) AddParam(parameters, md.transient.ismasstransport, TransientIsmasstransportEnum) return nothing end#}}} function Core(analysis::TransientAnalysis,femmodel::FemModel)# {{{ step = FindParam(Int64, femmodel.parameters, StepEnum) time = FindParam(Float64, femmodel.parameters, TimeEnum) finaltime = FindParam(Float64, femmodel.parameters, TimesteppingFinalTimeEnum) yts = FindParam(Float64, femmodel.parameters, ConstantsYtsEnum) dt = FindParam(Float64, femmodel.parameters, TimesteppingTimeStepEnum) ismovingfront = FindParam(Bool, femmodel.parameters, TransientIsmovingfrontEnum) isstressbalance = FindParam(Bool, femmodel.parameters, TransientIsstressbalanceEnum) ismasstransport = FindParam(Bool, femmodel.parameters, TransientIsmasstransportEnum) while(time < finaltime - (yts*eps(Float64))) #make sure we run up to finaltime. time+=dt AddParam(femmodel.parameters, time, TimeEnum) AddParam(femmodel.parameters, step, StepEnum) println("iteration ", step, "/", Int(ceil((finaltime-time)/dt))+step," time [yr]: ", time/yts, " (time step: ", dt/yts, " [yr])") if(isstressbalance) Core(StressbalanceAnalysis(), femmodel) end if(ismovingfront) Core(LevelsetAnalysis(), femmodel) end if(ismasstransport) Core(MasstransportAnalysis(), femmodel) end MigrateGroundinglinex(femmodel) step+=1 end println("=======================================") println(" Simulation completed successfully" ) println("=======================================") return nothing end #}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
13732
using Printf using Flux using StatsBase #Model fields #Mesh {{{ abstract type AbstractMesh end mutable struct Mesh2dTriangle <: AbstractMesh numberofvertices::Int64 numberofelements::Int64 x::Vector{Float64} y::Vector{Float64} elements::Matrix{Int64} segments::Matrix{Int64} vertexonboundary::Vector{Bool} end function Mesh2dTriangle() #{{{ return Mesh2dTriangle( 0, 0, Vector{Float64}(undef,0), Vector{Float64}(undef, 0), Matrix{Int64}(undef, 0, 0), Matrix{Int64}(undef, 0, 0), Vector{Bool}(undef,0)) end# }}} function Base.show(io::IO, this::Mesh2dTriangle)# {{{ IssmStructDisp(io, this) end# }}} mutable struct Mesh3dPrism{T} <: AbstractMesh numberofvertices::Int64 numberofelements::Int64 numberoflayers::Int64 x::Vector{Float64} y::Vector{Float64} z::Vector{Float64} elements::Matrix{Int64} segments::Matrix{Int64} vertexonboundary::Vector{Bool} end function Mesh3dPrism() #{{{ return Mesh3dPrism( 0, 0, 0, Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0), Matrix{Int64}(undef, 0, 0), Matrix{Int64}(undef, 0, 0), Vector{Bool}(undef,0)) end# }}} #}}} #Geometry{{{ mutable struct Geometry surface::Vector{Float64} base::Vector{Float64} thickness::Vector{Float64} bed::Vector{Float64} ssx::Vector{Float64} ssy::Vector{Float64} bsx::Vector{Float64} bsy::Vector{Float64} end function Geometry() #{{{ return Geometry( Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0)) end# }}} function Base.show(io::IO, this::Geometry)# {{{ IssmStructDisp(io, this) end# }}} #}}} #Mask {{{ mutable struct Mask ocean_levelset::Vector{Float64} ice_levelset::Vector{Float64} end function Mask() #{{{ return Mask( Vector{Float64}(undef,0), Vector{Float64}(undef,0)) end# }}} function Base.show(io::IO, this::Mask)# {{{ IssmStructDisp(io, this) end# }}} #}}} #Initialization{{{ mutable struct Initialization vx::Vector{Float64} vy::Vector{Float64} end function Initialization() #{{{ return Initialization( Vector{Float64}(undef,0), Vector{Float64}(undef,0)) end# }}} function Base.show(io::IO, this::Initialization)# {{{ IssmStructDisp(io, this) end# }}} #}}} #Stressbalance {{{ mutable struct Stressbalance spcvx::Vector{Float64} spcvy::Vector{Float64} restol::Float64 reltol::Float64 abstol::Float64 maxiter::Int64 end function Stressbalance() #{{{ return Stressbalance( Vector{Float64}(undef,0), Vector{Float64}(undef,0), 1.e-4, 0.01, 10., 100) end# }}} function Base.show(io::IO, this::Stressbalance)# {{{ IssmStructDisp(io, this) end# }}} #}}} #Constants{{{ mutable struct Constants g::Float64 yts::Float64 end function Constants() #{{{ return Constants( 9.81, 365*24*3600.) end# }}} function Base.show(io::IO, this::Constants)# {{{ IssmStructDisp(io, this) end# }}} # }}} #Materials {{{ mutable struct Materials rho_ice::Float64 rho_water::Float64 rho_freshwater::Float64 mu_water::Float64 heatcapacity::Float64 latentheat::Float64 thermalconductivity::Float64 temperateiceconductivity::Float64 effectiveconductivity_averaging::Int64 meltingpoint::Float64 beta::Float64 mixed_layer_capacity::Float64 thermal_exchange_velocity::Float64 rheology_B::Vector{Float64} rheology_n::Vector{Float64} rheology_law::String end function Materials() #{{{ return Materials(917., 1023., 1000., 0.001787, 2093., 3.34*10^5, 2.4, .24, 1, 273.15, 9.8*10^-8, 3974., 1.00*10^-4, Vector{Float64}(undef,0), Vector{Float64}(undef,0), "Cuffey") end# }}} function Base.show(io::IO, this::Materials)# {{{ IssmStructDisp(io, this) end# }}} # }}} #Friction {{{ abstract type AbstractFriction end mutable struct BuddFriction <: AbstractFriction coefficient::Vector{Float64} p::Vector{Float64} q::Vector{Float64} end function BuddFriction() #{{{ return BuddFriction(Vector{Float64}(undef,0),Vector{Float64}(undef,0),Vector{Float64}(undef,0)) end# }}} function Base.show(io::IO, this::BuddFriction)# {{{ IssmStructDisp(io, this) end# }}} mutable struct WeertmanFriction <: AbstractFriction C::Vector{Float64} m::Vector{Float64} end function WeertmanFriction() #{{{ return WeertmanFriction(Vector{Float64}(undef,0),Vector{Float64}(undef,0)) end# }}} function Base.show(io::IO, this::WeertmanFriction)# {{{ IssmStructDisp(io, this) end# }}} mutable struct SchoofFriction <: AbstractFriction C::Vector{Float64} m::Vector{Float64} Cmax::Vector{Float64} end function SchoofFriction() #{{{ return SchoofFriction(Vector{Float64}(undef,0),Vector{Float64}(undef,0),Vector{Float64}(undef,0)) end# }}} function Base.show(io::IO, this::SchoofFriction)# {{{ IssmStructDisp(io, this) end# }}} mutable struct DNNFriction <: AbstractFriction dnnChain::Vector{Flux.Chain{}} dtx::Vector{StatsBase.ZScoreTransform{Float64, Vector{Float64}} } dty::Vector{StatsBase.ZScoreTransform{Float64, Vector{Float64}} } end function DNNFriction() #{{{ return DNNFriction(Vector{Flux.Chain{}}(undef,0), Vector{StatsBase.ZScoreTransform{ Float64, Vector{Float64} }}(undef,0), Vector{StatsBase.ZScoreTransform{ Float64, Vector{Float64} }}(undef,0)) end# }}} function Base.show(io::IO, this::DNNFriction)# {{{ IssmStructDisp(io, this) end# }}} # }}} #Basalforcings {{{ mutable struct Basalforcings groundedice_melting_rate::Vector{Float64} floatingice_melting_rate::Vector{Float64} end function Basalforcings() #{{{ return Basalforcings( Vector{Float64}(undef,0), Vector{Float64}(undef,0)) end# }}} function Base.show(io::IO, this::Basalforcings)# {{{ IssmStructDisp(io, this) end# }}} # }}} #Surfaceforcings {{{ mutable struct SMBforcings mass_balance::Vector{Float64} end function SMBforcings() #{{{ return SMBforcings( Vector{Float64}(undef,0)) end# }}} function Base.show(io::IO, this::SMBforcings)# {{{ IssmStructDisp(io, this) end# }}} # }}} #Timestepping{{{ abstract type AbstractTimestepping end mutable struct Timestepping <: AbstractTimestepping start_time::Float64 final_time::Float64 time_step::Float64 end function Timestepping() #{{{ return Timestepping( 0., 0., 0.) end# }}} function Base.show(io::IO, this::Timestepping)# {{{ IssmStructDisp(io, this) end# }}} # }}} #Masstransport {{{ mutable struct Masstransport spcthickness::Vector{Float64} min_thickness::Float64 stabilization::Int64 end function Masstransport() #{{{ return Masstransport( Vector{Float64}(undef,0), 10.0, 1) end# }}} function Base.show(io::IO, this::Masstransport)# {{{ IssmStructDisp(io, this) end# }}} # }}} #Transient {{{ mutable struct Transient issmb::Bool ismasstransport::Bool isstressbalance::Bool isgroundingline::Bool ismovingfront::Bool end function Transient() #{{{ return Transient( true, true, true, false, false) end# }}} function Base.show(io::IO, this::Transient)# {{{ IssmStructDisp(io, this) end# }}} # }}} #Inversion{{{ mutable struct Inversion iscontrol::Bool vx_obs::Vector{Float64} vy_obs::Vector{Float64} min_parameters::Vector{Float64} max_parameters::Vector{Float64} independent::Vector{Float64} maxiter::Int64 independent_string::String end function Inversion() #{{{ return Inversion( false, Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0), Vector{Float64}(undef,0), 0, "Friction") end# }}} function Base.show(io::IO, this::Inversion)# {{{ IssmStructDisp(io, this) end# }}} # }}} #Calving {{{ abstract type AbstractCalving end mutable struct DefaultCalving <: AbstractCalving calvingrate::Vector{Float64} end function DefaultCalving() #{{{ return DefaultCalving(Vector{Float64}(undef,0)) end# }}} function Base.show(io::IO, this::DefaultCalving)# {{{ IssmStructDisp(io, this) end# }}} # }}} #Levelset{{{ mutable struct Levelset spclevelset::Vector{Float64} stabilization::Int64 reinit_frequency::Int64 kill_icebergs::Int64 migration_max::Float64 end function Levelset() #{{{ return Levelset(Vector{Float64}(undef,0), 1, 10, 1, 1.0e12) end# }}} function Base.show(io::IO, this::Levelset)# {{{ IssmStructDisp(io, this) end# }}} # }}} #Frontalforcings{{{ mutable struct Frontalforcings meltingrate::Vector{Float64} ablationrate::Vector{Float64} end function Frontalforcings() #{{{ return Frontalforcings(Vector{Float64}(undef,0), Vector{Float64}(undef,0)) end# }}} function Base.show(io::IO, this::Frontalforcings)# {{{ IssmStructDisp(io, this) end# }}} # }}} #Model structure mutable struct model{Mesh<:AbstractMesh, Friction<:AbstractFriction, Calving<:AbstractCalving} mesh::Mesh geometry::Geometry mask::Mask materials::Materials initialization::Initialization stressbalance::Stressbalance constants::Constants results::Dict friction::Friction basalforcings::Basalforcings smb::SMBforcings timestepping::Timestepping masstransport::Masstransport transient::Transient inversion::Inversion calving::Calving levelset::Levelset frontalforcings::Frontalforcings end function model() #{{{ return model( Mesh2dTriangle(), Geometry(), Mask(), Materials(), Initialization(),Stressbalance(), Constants(), Dict(), BuddFriction(), Basalforcings(), SMBforcings(), Timestepping(), Masstransport(), Transient(), Inversion(), DefaultCalving(), Levelset(), Frontalforcings()) end#}}} function model(md::model; mesh::AbstractMesh=md.mesh, friction::AbstractFriction=md.friction, calving::AbstractCalving=md.calving) #{{{ return model(mesh, md.geometry, md.mask, md.materials, md.initialization, md.stressbalance, md.constants, md.results, friction, md.basalforcings, md.smb, md.timestepping, md.masstransport, md.transient, md.inversion, md.calving, md.levelset, md.frontalforcings) end#}}} function model(matmd::Dict,verbose::Bool=true) #{{{ #initialize output md = model() #Loop over all possible fields for name1 in keys(matmd) if !(Symbol(name1) in fieldnames(model)) if verbose; println("could not recover md.",name1) end continue end mdfield = getfield(md,Symbol(name1)) matfield = matmd[name1] for name2 in keys(matfield) if !(Symbol(name2) in fieldnames(typeof(mdfield))) if verbose; println("could not recover md.",name1,".",name2) end continue end value_matlab = matfield[name2] value_julia = getfield(mdfield, Symbol(name2)) if typeof(value_matlab)==typeof(value_julia) setfield!(mdfield, Symbol(name2), value_matlab) elseif typeof(value_matlab)==Float64 && typeof(value_julia)==Int64 setfield!(mdfield, Symbol(name2), Int64(value_matlab)) elseif typeof(value_matlab)==Float64 && typeof(value_julia)==Bool setfield!(mdfield, Symbol(name2), Bool(value_matlab)) # TODO: temporarily fix the issue when loading one value from matlab to a vector in Julia elseif typeof(value_matlab)==Float64 && typeof(value_julia)==Vector{Float64} setfield!(mdfield, Symbol(name2), [value_matlab]) elseif typeof(value_matlab)==Matrix{Float64} && typeof(value_julia)==Vector{Float64} if(size(value_matlab,2)!=1) error("only one column expected") end setfield!(mdfield, Symbol(name2), value_matlab[:,1]) elseif typeof(value_matlab)==Matrix{Float64} && typeof(value_julia)==Matrix{Int64} matrix = Matrix{Int64}(undef,size(value_matlab)) for i in 1:length(value_matlab) matrix[i] = Int64(value_matlab[i]) end setfield!(mdfield, Symbol(name2), matrix) elseif typeof(value_matlab)==Matrix{Float64} && typeof(value_julia)==Vector{Bool} if(size(value_matlab,2)!=1) error("only one column expected") end vector = Vector{Bool}(undef,size(value_matlab,1)) for i in 1:length(vector) vector[i] = Bool(value_matlab[i]) end setfield!(mdfield, Symbol(name2), vector) else error("Don't know how to convert ", name2, " from ",typeof(value_matlab)," to ",typeof(value_julia)) end end end return md end#}}} function Base.show(io::IO, md::model)# {{{ compact = get(io, :compact, false) println(io,"Model:") @printf "%19s: %-26s -- %s\n" "mesh" typeof(md.mesh) "mesh properties" @printf "%19s: %-26s -- %s\n" "geometry" typeof(md.geometry) "surface elevation, bedrock topography, ice thickness,..." @printf "%19s: %-26s -- %s\n" "mask" typeof(md.mask) "defines grounded and floating regions" @printf "%19s: %-26s -- %s\n" "materials" typeof(md.materials) "material properties" @printf "%19s: %-26s -- %s\n" "initialization" typeof(md.initialization) "initial state" @printf "%19s: %-26s -- %s\n" "constants" typeof(md.constants) "physical constants" @printf "%19s: %-26s -- %s\n" "friction" typeof(md.friction) "basal friction" @printf "%19s: %-26s -- %s\n" "basalforcings" typeof(md.basalforcings) "basal forcings" @printf "%19s: %-26s -- %s\n" "smb" typeof(md.smb) "surface mass balance" @printf "%19s: %-26s -- %s\n" "timestepping" typeof(md.timestepping) "time stepping for transient simulations" @printf "%19s: %-26s -- %s\n" "stressbalance" typeof(md.stressbalance) "parameters stress balance simulations" @printf "%19s: %-26s -- %s\n" "masstransport" typeof(md.masstransport) "parameters mass transport simulations" @printf "%19s: %-26s -- %s\n" "transient" typeof(md.transient) "parameters for transient simulations" @printf "%19s: %-26s -- %s\n" "inversion" typeof(md.inversion) "parameters for inverse methods" @printf "%19s: %-26s -- %s\n" "calving" typeof(md.calving) "parameters for calving" @printf "%19s: %-26s -- %s\n" "levelset" typeof(md.levelset) "parameters for moving boundaries (level-set method)" @printf "%19s: %-26s -- %s\n" "frontalforcings" typeof(md.frontalforcings) "parameters for frontalforcings" @printf "%19s: %-26s -- %s\n" "results" typeof(md.results) "model results" end# }}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
2706
function cuffey(temperature) #CUFFEY - calculates ice rigidity as a function of temperature # # rigidity (in s^(1/3)Pa) is the flow law parameter in the flow law sigma=B*e(1/3) # (Cuffey and Paterson, p75). # temperature is in Kelvin degrees # Usage: # rigidity=cuffey(temperature) if temperature<0 error("input temperature should be in Kelvin (positive)") end T=temperature-273.15 #The routine below is equivalent to: # n=3; T=temperature-273; # %From cuffey # Temp=[0;-2;-5;-10;-15;-20;-25;-30;-35;-40;-45;-50]; # A=[2.4*10^-24;1.7*10^-24;9.3*10^-25;3.5*10^-25;2.1*10^-25;1.2*10^-25;6.8*10^-26;3.7*10^-26;2.0*10^-26;1.0*10^-26;5.2*10^-27;2.6*10^-27];%s-1(Pa-3) # %Convert into rigidity B # B=A.^(-1/n); %s^(1/3)Pa # %Now, do a cubic fit between Temp and B: # fittedmodel=fit(Temp,B,'cubicspline'); # rigidity=fittedmodel(temperature); rigidity=zeros(length(T)); if T<=-45 rigidity = 10^8*(-0.000396645116301*(T+50).^3+ 0.013345579471334*(T+50).^2 -0.356868703259105*(T+50)+7.272363035371383) elseif -45<=T && T<-40 rigidity=10^8*(-0.000396645116301*(T+45).^3+ 0.007395902726819*(T+45).^2 -0.253161292268336*(T+45)+5.772078366321591) elseif -45<=T && T<-40 rigidity=10^8*(-0.000396645116301*(T+45).^3+ 0.007395902726819*(T+45).^2 -0.253161292268336*(T+45)+5.772078366321591) elseif -40<=T && T<-35 rigidity=10^8*(0.000408322072669*(T+40).^3+ 0.001446225982305*(T+40).^2 -0.208950648722716*(T+40)+4.641588833612773) elseif -35<=T && T<-30 rigidity=10^8*(-0.000423888728124*(T+35).^3+ 0.007571057072334*(T+35).^2 -0.163864233449525*(T+35)+3.684031498640382) elseif -30<=T && T<-25 rigidity=10^8*(0.000147154327025*(T+30).^3+ 0.001212726150476*(T+30).^2 -0.119945317335478*(T+30)+3.001000667185614) elseif -25<=T && T<-20 rigidity=10^8*(-0.000193435838672*(T+25).^3+ 0.003420041055847*(T+25).^2 -0.096781481303861*(T+25)+2.449986525148220) elseif -20<=T && T<-15 rigidity=10^8*(0.000219771255067*(T+20).^3+ 0.000518503475772*(T+20).^2 -0.077088758645767*(T+20)+2.027400665191131) elseif -15<=T && T<-10 rigidity=10^8*(-0.000653438900191*(T+15).^3+ 0.003815072301777*(T+15).^2 -0.055420879758021*(T+15)+1.682390865739973) elseif -10<=T && T<-5 rigidity=10^8*(0.000692439419762*(T+10).^3 -0.005986511201093 *(T+10).^2 -0.066278074254598*(T+10)+1.418983411970382) elseif -5<=T && T<-2 rigidity=10^8*(-0.000132282004110*(T+5).^3 +0.004400080095332*(T+5).^2 -0.074210229783403*(T+5)+ 1.024485188140279) elseif -2<=T rigidity=10^8*(-0.000132282004110*(T+2).^3 +0.003209542058346*(T+2).^2 -0.051381363322371*(T+2)+ 0.837883605537096) end #Make sure that rigidity is positive if rigidity<0 rigidity=10^6 end return rigidity end
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
5116
#for exptool, look into this http://juliaplots.org/MakieReferenceImages/gallery//mouse_picking/index.html #exp object definition, constructor, and disp mutable struct ExpStruct #{{{ name::String nods::Int32 density::Float64 x::Vector{Float64} y::Vector{Float64} closed::Bool end #}}} function ExpStruct() #{{{ return ExpStruct("",0, 0., Vector{Float64}(undef,0), Vector{Float64}(undef,0), false) end# }}} function Base.show(io::IO, exp::ExpStruct)# {{{ compact = get(io, :compact, false) println(io,"ExpStruct:") for name in fieldnames(typeof(exp)) a=getfield(exp,name) print(io," $(name) = ") if !isempty(a) if compact && eltype(a)<:Number && length(a)>3 println(io, typeof(a), " of size ", size(a)) else println(io,a) end else println(io,"empty") end end end# }}} #methods #expread {{{ """ EXPREAD - read a file exp and build a Structure This function reads an *.exp* and builds a structure containing the fields x and y corresponding to the coordinates, one for the filename of the exp file, for the density, for the nodes, and a field 'closed' to indicate if the domain is closed. Usage: exp=expread(filename) # Examples: ```julia-repl julia> exp=expread('domainoutline.exp') ``` # Arguments: - filename: the ARGUS file to read """ function expread(filename::String) #initialize output contours = Vector{ExpStruct}(undef, 0) #open file f = open(filename, "r") do f #initialize some variables nprof = 0 line = 1 while !eof(f) #read first line A = readline(f); line += 1 #if isempty, go to the next line and try again if isempty(A) continue else #initialize new profile nprof += 1 exp = ExpStruct(); end #extract profile name if A[1:8]!="## Name:" println("line $(line): $(A)") error("Unexpected exp file formatting") end if length(A)>8 exp.name = A[9:end] end #read Icon A = readline(f); line += 1 if A[1:8]!="## Icon:" error("Unexpected exp file formatting") end #read Info A = readline(f); line += 1 if A[1:14]!="# Points Count" println("line $(line): $(A)") error("Unexpected exp file formatting") end #Reads number of nods and density A = readline(f); line += 1 A = parse.(Float64, split(A)) if length(A) != 2 error("Unexpected exp file formatting") end exp.nods = A[1]; exp.density = A[2] #Allocate arrays if exp.nods<=0 error("Unexpected exp file formatting") end exp.x = Vector{Float64}(undef,exp.nods) exp.y = Vector{Float64}(undef,exp.nods) #Read coordinates A = readline(f); line += 1 if A[1:13]!="# X pos Y pos" error("Unexpected exp file formatting") end for i in 1:exp.nods A = readline(f); line += 1 A = parse.(Float64, split(A)) if length(A) != 2 error("Unexpected exp file formatting") end if any(isnan.(A)) error("NaNs found in coordinate") end exp.x[i] = A[1]; exp.y[i] = A[2] end #check if closed if exp.nods>1 && exp.x[1]==exp.x[end] && exp.y[1]==exp.y[end] exp.closed = true else exp.closed = false end #add profile to list push!(contours, exp) end end return contours end# }}} #ContourToNodes{{{ """ ContourToNodes - Flag points that are in contour More doc to come later.... Usage: exp=expread(filename) # Examples: ```julia-repl julia> exp=expread('domainoutline.exp') ``` # Arguments: - filename: the ARGUS file to read """ function ContourToNodes(x::Vector{Float64},y::Vector{Float64},filename::String,edgevalue::Float64) #Read input file contours = expread(filename) #Initialize output nbpts = length(x) flags = zeros(Bool,nbpts) #Loop over contours for c in 1:length(contours) #Get current contours contour = contours[c] xp = contour.x yp = contour.y #Check that we are within box xmin = minimum(xp); xmax = maximum(xp) ymin = minimum(yp); ymax = maximum(yp) #Loop over all points provided for ii in 1:nbpts #If this node is already within one of the contours, do not change it if(flags[ii]) continue end #Are we within bounds? if(x[ii]<xmin || x[ii]>xmax || y[ii]<ymin || y[ii]>ymax) continue end #we are potentially inside... perform pnpoly test flags[ii] = pnpoly(xp, yp, x[ii], y[ii], edgevalue) end end return flags end# }}} function pnpoly(xp::Vector{Float64},yp::Vector{Float64},x::Float64,y::Float64,edgevalue::Float64) #{{{ npol = length(xp) #Do we need to test for colinearity? if(edgevalue!=2) i = 1 j = npol while(i<=npol) n1 = (yp[i]-yp[j])^2 + (xp[i]-xp[j])^2 n2 = (y-yp[j])^2 + (x-xp[j])^2 normp=sqrt(n1*n2) scalar=(yp[i]-yp[j])*(y-yp[j])+(xp[i]-xp[j])*(x-xp[j]) if (scalar == normp) if (n2<=n1) return edgevalue end end j = i i += 1 end end #second test : point is neither on a vertex, nor on a side, where is it ? i = 1 j = npol c = false while(i<=npol) if (((yp[i]<=y && y<yp[j]) || (yp[j]<=y && y<yp[i])) && (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i])) c = !c end j = i i += 1 end return c end# }}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1777
# setmask {{{ """ SETMASK - establish boundaries between grounded and floating ice. By default, ice is considered grounded. The contour floatingicename defines nodes for which ice is floating. The contour groundedicename defines nodes inside an floatingice, that are grounded (ie: ice rises, islands, etc ...) All input files are in the Argus format (extension .exp). Usage: md=setmask(md,floatingicename,groundedicename) Examples: md=setmask(md,'all',''); md=setmask(md,'Iceshelves.exp','Islands.exp'); """ function setmask(md::model,floatingicename::String,groundedicename::String) elementonfloatingice = FlagElements( md, floatingicename) elementongroundedice = FlagElements( md, groundedicename) elementonfloatingice = convert( Array{Float64}, (elementonfloatingice.>0) .& (elementongroundedice.==0.)) elementongroundedice = convert( Array{Float64}, elementonfloatingice.==0.) vertexonfloatingice=zeros(md.mesh.numberofvertices) vertexongroundedice=zeros(md.mesh.numberofvertices) vertexongroundedice[md.mesh.elements[findall(elementongroundedice.>0),:]] .= 1. vertexonfloatingice[findall(vertexongroundedice.==0.)] .= 1. #define levelsets md.mask.ocean_levelset = vertexongroundedice md.mask.ocean_levelset[findall(vertexongroundedice .==0.)] .= -1. md.mask.ice_levelset = -1*ones(md.mesh.numberofvertices) return md end #}}} # FlagElements {{{ function FlagElements(md::model,region::String) if isempty(region) flags = zeros(md.mesh.numberofelements) elseif region == "all" flags = ones(md.mesh.numberofelements) else xcenter = md.mesh.x[md.mesh.elements]*[1;1;1]/3 ycenter = md.mesh.y[md.mesh.elements]*[1;1;1]/3 flags = ContourToNodes(xcenter, ycenter, region, 2.) end return flags end #}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1976
import ColorSchemes.jet using GLMakie function plotmodel( md::model, data::Vector; showvertices::Bool=false, showfacets::Bool=false, caxis::Tuple{Float64, Float64}=(0.0, 0.0)) #{{{ vertexcolor = :black facetcolor = :blue if data isa AbstractVector # use default caxis if caxis[1] >= caxis[2] caxis = (minimum(data), maximum(data)) end if length(data)==md.mesh.numberofelements # vector of polygons x = md.mesh.x y = md.mesh.y index = md.mesh.elements ps = [Makie.GeometryBasics.Polygon([Point2(x[index[i,1]], y[index[i,1]]), Point2(x[index[i,2]], y[index[i,2]]), Point2(x[index[i,3]], y[index[i,3]])]) for i in 1:md.mesh.numberofelements] fig, ax, h = Makie.poly(ps, color = data, colormap = jet, colorrange = caxis) #Add colorbar Colorbar(fig[1, 2], limits = caxis, colormap = jet) elseif length(data)==md.mesh.numberofvertices fig, ax, h = Makie.mesh( [md.mesh.x md.mesh.y], md.mesh.elements, shading = NoShading, color = data, colormap = jet, colorrange = caxis) #Add colorbar Colorbar(fig[1, 2], h, width=25) else error("data of size "*string(length(data))*" not supported yet!") end else # default to single color @assert length(data)==1 fig, ax, h = Makie.mesh( [md.mesh.x md.mesh.y], md.mesh.elements, shading = NoShading, color = data, colormap = jet) end if showfacets Makie.wireframe!(ax, h[1][], color=facetcolor) end if showvertices Makie.scatter!( [md.mesh.x md.mesh.y], markersize = 4, color = vertexcolor) end return fig end #}}} function plotmodel(md::model,data::BitVector) #{{{ println("Converting BitVector to Vector") data2 = Vector{Float64}(undef,size(data)) for i in 1:length(data) data2[i] = Float64(data[i]) end plotmodel(md,data2) end#}}} function plotmodel(md::model,data::String) #{{{ if(data=="mesh") poly([md.mesh.x md.mesh.y], md.mesh.elements, strokewidth=1, shading=NoShading) else error(data, " plot not supported yet") end end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
3494
using Triangulate """ TRIANGLE - create model mesh using the triangle package This function creates a model mesh using Triangle and a domain outline, to within a certain resolution #Arguments - md is a model tuple - domainname is the name of an Argus domain outline file - resolution: is a characteristic length for the mesh (same unit as the domain outline unit) # Usage: - md=triangle(md,domainname,resolution) # Examples: - md=triangle(md,'DomainOutline.exp',1000); - md=triangle(md,'DomainOutline.exp','Rifts.exp',1500); """ function triangle(md::model,domainname::String,resolution::Float64) #{{{ #read input file contours = expread(domainname) return triangle(md, contours, resolution) end#}}} function triangle(md::model,contours::Vector{ExpStruct},resolution::Float64) #{{{ area = resolution^2 #Initialize input structure triin=Triangulate.TriangulateIO() #Construct input structure numberofpoints = 0 numberofsegments = 0 for i in 1:length(contours) numberofpoints += contours[i].nods-1 numberofsegments += contours[i].nods-1 end numberofpointattributes = 1 pointlist=Array{Cdouble,2}(undef,2,numberofpoints) count = 0 for i in 1:length(contours) nods = contours[i].nods pointlist[1,count+1:count+nods-1] = contours[i].x[1:end-1] pointlist[2,count+1:count+nods-1] = contours[i].y[1:end-1] count += (nods-1) end pointattributelist=Array{Cdouble,1}(undef,numberofpoints) pointmarkerlist=Array{Cint,1}(undef,numberofpoints) for i in 1:numberofpoints pointmarkerlist[i]=0 pointattributelist[i]=0. end counter=0; backcounter=0; segmentlist=Array{Cint,2}(undef,2,numberofsegments) segmentmarkerlist=Array{Cint,1}(undef,numberofsegments) segmentmarkerlist[:].=0 for i in 1:length(contours) nods = contours[i].nods segmentlist[1,counter+1:counter+nods-2] = collect(counter+0:counter+nods-3) segmentlist[2,counter+1:counter+nods-2] = collect(counter+1:counter+nods-2) counter+=nods-2 #close profile segmentlist[1,counter+1]=counter segmentlist[2,counter+1]=backcounter counter+=1 backcounter=counter end numberofregions = 0 numberofholes = length(contours)-1 holelist = Array{Cdouble,2}(undef,2,numberofholes) if numberofholes>0 for i in 2:length(contours) xA=contours[i].x[1]; xB=contours[i].x[end-1] yA=contours[i].y[1]; yB=contours[i].y[end-1] xC=(xA+xB)/2; yC=(yA+yB)/2; xD=xC+tan(10. /180. *pi)*(yC-yA); yD=yC+tan(10. /180. *pi)*(xA-xC); xE=xC-tan(10. /180. *pi)*(yC-yA); yE=yC-tan(10. /180. *pi)*(xA-xC); holelist[1,i-1] = xD holelist[2,i-1] = yD end end #based on this, prepare input structure triin.pointlist=pointlist triin.segmentlist=segmentlist triin.segmentmarkerlist = segmentmarkerlist triin.holelist=holelist #Triangulate triangle_switches = "pQzDq30ia"*@sprintf("%lf",area) #replace V by Q to quiet down the logging (triout, vorout)=triangulate(triangle_switches, triin) #assign output md.mesh = Mesh2dTriangle() md.mesh.numberofvertices = size(triout.pointlist, 2) md.mesh.numberofelements = size(triout.trianglelist, 2) md.mesh.x = triout.pointlist[1,:] md.mesh.y = triout.pointlist[2,:] md.mesh.elements = convert(Matrix{Int64}, triout.trianglelist' .+ 1) md.mesh.segments = collect(triout.segmentlist' .+ 1) #post processing md.mesh.vertexonboundary = zeros(Bool,md.mesh.numberofvertices) md.mesh.vertexonboundary[md.mesh.segments] .= true return md end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
6079
#Class Triangle's triangulateio mutable struct CTriangulateIO #{{{ pointlist :: Ptr{Cdouble} pointattributelist :: Ptr{Cdouble} pointmarkerlist :: Ptr{Cint} numberofpoints :: Cint numberofpointattributes :: Cint trianglelist :: Ptr{Cint} triangleattributelist :: Ptr{Cdouble} trianglearealist :: Ptr{Cdouble} neighborlist :: Ptr{Cint} numberoftriangles :: Cint numberofcorners :: Cint numberoftriangleattributes :: Cint segmentlist :: Ptr{Cint} segmentmarkerlist :: Ptr{Cint} numberofsegments :: Cint holelist :: Ptr{Cdouble} numberofholes :: Cint regionlist :: Ptr{Cdouble} numberofregions :: Cint edgelist :: Ptr{Cint} edgemarkerlist :: Ptr{Cint} normlist :: Ptr{Cdouble} numberofedges :: Cint end #}}} function CTriangulateIO() #{{{ return CTriangulateIO(C_NULL, C_NULL, C_NULL, 0, 0, C_NULL, C_NULL, C_NULL, C_NULL, 0, 0, 0, C_NULL, C_NULL, 0, C_NULL, 0, C_NULL, 0, C_NULL, C_NULL, C_NULL, 0) end# }}} function Base.show(io::IO, tio::CTriangulateIO)# {{{ println(io,"CTriangulateIO(") for name in fieldnames(typeof(tio)) a=getfield(tio,name) print(io,"$(name) = ") println(io,a) end println(io,")") end# }}} using Printf #needed for sprintf """ TRIANGLE - create model mesh using the triangle package This function creates a model mesh using Triangle and a domain outline, to within a certain resolution #Arguments - md is a model tuple - domainname is the name of an Argus domain outline file - resolution: is a characteristic length for the mesh (same unit as the domain outline unit) # Usage: - md=triangle(md,domainname,resolution) # Examples: - md=triangle(md,'DomainOutline.exp',1000); - md=triangle(md,'DomainOutline.exp','Rifts.exp',1500); """ function triangle_issm(md::model,domainname::String,resolution::Float64) #{{{ #read input file contours = expread(domainname) area = resolution^2 #Initialize i/o structures ctio_in = CTriangulateIO(); ctio_out = CTriangulateIO(); vor_out = CTriangulateIO(); #Construct input structure numberofpoints = 0 numberofsegments = 0 for i in 1:length(contours) numberofpoints += contours[i].nods-1 numberofsegments += contours[i].nods-1 end numberofpointattributes = 1 pointlist=Array{Cdouble,2}(undef,2,numberofpoints) count = 0 for i in 1:length(contours) nods = contours[i].nods pointlist[1,count+1:count+nods-1] = contours[i].x[1:end-1] pointlist[2,count+1:count+nods-1] = contours[i].y[1:end-1] count += (nods-1) end pointattributelist=Array{Cdouble,1}(undef,numberofpoints) pointmarkerlist=Array{Cint,1}(undef,numberofpoints) for i in 1:numberofpoints pointmarkerlist[i]=0 pointattributelist[i]=0. end counter=0; backcounter=0; segmentlist=Array{Cint,2}(undef,2,numberofsegments) segmentmarkerlist=Array{Cint,1}(undef,numberofsegments) segmentmarkerlist[:].=0 for i in 1:length(contours) nods = contours[i].nods segmentlist[1,counter+1:counter+nods-2] = collect(counter+0:counter+nods-3) segmentlist[2,counter+1:counter+nods-2] = collect(counter+1:counter+nods-2) counter+=nods-2 #close profile segmentlist[1,counter+1]=counter segmentlist[2,counter+1]=backcounter counter+=1 backcounter=counter end numberofregions = 0 numberofholes = length(contours)-1 holelist = Array{Cdouble,2}(undef,2,numberofholes) if numberofholes>0 for i in 2:length(contours) xA=contours[i].x[1]; xB=contours[i].x[end-1] yA=contours[i].y[1]; yB=contours[i].y[end-1] xC=(xA+xB)/2; yC=(yA+yB)/2; xD=xC+tan(10. /180. *pi)*(yC-yA); yD=yC+tan(10. /180. *pi)*(xA-xC); xE=xC-tan(10. /180. *pi)*(yC-yA); yE=yC-tan(10. /180. *pi)*(xA-xC); holelist[1,i-1] = xD holelist[2,i-1] = yD end end #based on this, prepare input structure ctio_in.numberofpoints = numberofpoints ctio_in.pointlist=pointer(pointlist) ctio_in.numberofpointattributes=numberofpointattributes ctio_in.pointattributelist=pointer(pointattributelist) ctio_in.pointmarkerlist=pointer(pointmarkerlist) ctio_in.numberofsegments=numberofsegments ctio_in.segmentlist=pointer(segmentlist) ctio_in.segmentmarkerlist = pointer(segmentmarkerlist) ctio_in.numberofholes=numberofholes ctio_in.holelist=pointer(holelist) ctio_in.numberofregions=0 #Call triangle using ISSM's default options triangle_switches = "pQzDq30ia"*@sprintf("%lf",area) #replace V by Q to quiet down the logging #rc=ccall( (:triangulate,"libtriangle"), try rc=ccall( (:triangulate,issmdir()*"/externalpackages/triangle/src/libtriangle."*(@static Sys.islinux() ? :"so" : (@static Sys.isapple() ? :"dylib" : :"so"))), Cint, ( Cstring, Ref{CTriangulateIO}, Ref{CTriangulateIO}, Ref{CTriangulateIO}), triangle_switches, Ref(ctio_in), Ref(ctio_out), Ref(vor_out)) catch LoadError rc=ccall( (:triangulate,issmdir()*"/externalpackages/triangle/install/lib/libtriangle."*(@static Sys.islinux() ? :"so" : (@static Sys.isapple() ? :"dylib" : :"so"))), Cint, ( Cstring, Ref{CTriangulateIO}, Ref{CTriangulateIO}, Ref{CTriangulateIO}), triangle_switches, Ref(ctio_in), Ref(ctio_out), Ref(vor_out)) end #post process output points = convert(Array{Cdouble,2}, Base.unsafe_wrap(Array, ctio_out.pointlist, (2,Int(ctio_out.numberofpoints)), own=true))' triangles = convert(Array{Cint,2}, Base.unsafe_wrap(Array, ctio_out.trianglelist, (3,Int(ctio_out.numberoftriangles)), own=true))' .+1 segments = convert(Array{Cint,2}, Base.unsafe_wrap(Array, ctio_out.segmentlist, (2,Int(ctio_out.numberofsegments)), own=true))' .+1 #assign output md.mesh = Mesh2dTriangle() md.mesh.numberofvertices = ctio_out.numberofpoints md.mesh.numberofelements = ctio_out.numberoftriangles md.mesh.x = points[:,1] md.mesh.y = points[:,2] md.mesh.elements = triangles md.mesh.segments = segments #post processing md.mesh.vertexonboundary = zeros(Bool,md.mesh.numberofvertices) md.mesh.vertexonboundary[md.mesh.segments] .= true return md end#}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
7458
#utils function issmdir() #{{{ if haskey(ENV, "ISSM_DIR") issmdir = ENV["ISSM_DIR"] else println("Could not determine the location of ISSM, use DJUICE path instead") return joinpath(dirname(pathof(DJUICE)), "..") end if isempty(issmdir) println("Could not determine the location of ISSM, use DJUICE path instead") return joinpath(dirname(pathof(DJUICE)), "..") else return issmdir end end#}}} function archread(filename::String,variablename::String) #{{{ #initialize variables found = false #open file output = open(filename, "r") do f while !eof(f) reclen = bswap(read(f, Int32)) rectype = bswap(read(f, Int32)) if rectype!=1 error("Expected variable of type string") else fieldname_length = bswap(read(f, Int32)) field_name = String(read(f, fieldname_length)) end rec_length = bswap(read(f, Int32)) field_type = bswap(read(f, Int32)) if field_type==2 data = bswap(read(f, Float64)) elseif field_type==3 rows = bswap(read(f, Int32)) cols = bswap(read(f, Int32)) data = reinterpret(Float64, read(f, sizeof(Float64)*rows*cols)) data .= ntoh.(data) data = reshape(data, (rows,cols)) data = collect(data) if cols == 1 data = vec(data) end else error("Error: Encountered invalid field type when reading data.") end if field_name == variablename found = true return data end end end return output end# }}} function InterpFromMeshToMesh2d(index_data::Array,x_data::Vector,y_data::Vector,data::Vector,xout::Vector,yout::Vector,default::Float64=NaN) #{{{ #Allocate output nods_out = length(xout) data_out = default*ones(nods_out) #Interpolation type data_length = size(data,1) nods_data = length(x_data) nels_data = size(index_data,1) if(data_length==nods_data) interpolation_type=1; elseif (data_length==nels_data) interpolation_type=2 else error("length of vector data not supported yet. It should be of length (number of nodes) or (number of elements)!") end xmin = minimum(xout); xmax = maximum(xout) ymin = minimum(yout); ymax = maximum(yout) for i in 1:nels_data #skip element if no overlap if (minimum(x_data[index_data[i,:]]) > xmax) continue end if (minimum(y_data[index_data[i,:]]) > ymax) continue end if (maximum(x_data[index_data[i,:]]) < xmin) continue end if (maximum(y_data[index_data[i,:]]) < ymin) continue end #get area of the current element (Jacobian = 2 * area)*/ #area =x2 * y3 - y2*x3 + x1 * y2 - y1 * x2 + x3 * y1 - y3 * x1; area = (x_data[index_data[i,2]]*y_data[index_data[i,3]]-y_data[index_data[i,2]]*x_data[index_data[i,3]] + x_data[index_data[i,1]]*y_data[index_data[i,2]]-y_data[index_data[i,1]]*x_data[index_data[i,2]] + x_data[index_data[i,3]]*y_data[index_data[i,1]]-y_data[index_data[i,3]]*x_data[index_data[i,1]]) for j in 1:nods_out #Get first area coordinate = det(x-x3 x2-x3 ; y-y3 y2-y3)/area area_1=((xout[j]-x_data[index_data[i,3]])*(y_data[index_data[i,2]]-y_data[index_data[i,3]]) - (yout[j]-y_data[index_data[i,3]])*(x_data[index_data[i,2]]-x_data[index_data[i,3]]))/area #Get second area coordinate =det(x1-x3 x-x3 ; y1-y3 y-y3)/area area_2=((x_data[index_data[i,1]]-x_data[index_data[i,3]])*(yout[j]-y_data[index_data[i,3]]) - (y_data[index_data[i,1]]-y_data[index_data[i,3]])*(xout[j]-x_data[index_data[i,3]]))/area #Get third area coordinate = 1-area1-area2 area_3=1-area_1-area_2 if (area_1>=0 && area_2>=0 && area_3>=0) if (interpolation_type==1) #nodal interpolation data_out[j]=area_1*data[index_data[i,1]]+area_2*data[index_data[i,2]]+area_3*data[index_data[i,3]]; else #element interpolation data_out[j]=data[i]; end end end end return data_out #OLD STUFF!!! not working... #prepare input arrays nods = Cint(length(x)) nels = Cint(size(index,1)) nods_interp = Cint(length(xout)) Cindex=Array{Cint,1}(undef,length(index)) for i in 1:size(index,1) for j in 1:3 Cindex[(i-1)*3+j] = Int32(index[i,j]) end end Cx = Array{Cdouble,1}(undef,nods) Cy = Array{Cdouble,1}(undef,nods) Cdata = Array{Cdouble,1}(undef,nods) for i in 1:nods Cx[i] = x[i] Cy[i] = y[i] Cdata[i] = data[i] end Cxout = Array{Cdouble,1}(undef,nods_interp) Cyout = Array{Cdouble,1}(undef,nods_interp) for i in 1:nods_interp Cxout[i] = xout[i] Cyout[i] = yout[i] end Cdataout = Vector{Float64}(undef,nods_interp) #This is not working.... rc=ccall( (:InterpFromMeshToMesh2dx,"libISSMCore"), Cint, (Ptr{Ptr{Cdouble}},Ptr{Cint}, Ptr{Cdouble}, Ptr{Cdouble}, Cint, Cint, Ptr{Cdouble}, Cint, Cint, Ptr{Cdouble}, Ptr{Cdouble}, Cint), Ref(Ref(Cdataout)), Ref(Cindex), Ref(Cx), Ref(Cy), nods, nels, Ref(Cdata), nods, 1, Ref(Cxout), Ref(Cyout), nods_interp) #Process output dataout = Vector{Float64}(undef,nods_interp) for i in 1:nods_interp dataout[i] = Cdataout[i] end return dataout end #}}} function InterpFromMeshToMesh2d2(index_data::Array,x_data::Vector,y_data::Vector,data::Vector,xout::Vector,yout::Vector) #{{{ #prepare input arrays nods = Cint(length(x_data)) nels = Cint(size(index_data,1)) nods_interp = Cint(length(xout)) Cindex=Array{Cint,1}(undef,length(index_data)) for i in 1:size(index_data,1) for j in 1:3 Cindex[(i-1)*3+j] = Int32(index_data[i,j]) end end Cx = Array{Cdouble,1}(undef,nods) Cy = Array{Cdouble,1}(undef,nods) Cdata = Array{Cdouble,1}(undef,nods) for i in 1:nods Cx[i] = x_data[i] Cy[i] = y_data[i] Cdata[i] = data[i] end Cxout = Array{Cdouble,1}(undef,nods_interp) Cyout = Array{Cdouble,1}(undef,nods_interp) Cdataout = Array{Cdouble,1}(undef,nods_interp) for i in 1:nods_interp Cxout[i] = xout[i] Cyout[i] = yout[i] end #This is not working.... #rc=ccall( (:InterpFromMeshToMesh2dx,"../bamg/libBamg.so"), # Cint, (Ptr{Cdouble},Ptr{Cint}, Ptr{Cdouble}, Ptr{Cdouble}, Cint, Cint, Ptr{Cdouble}, Cint, Cint, Ptr{Cdouble}, Ptr{Cdouble}, Cint), # Ref(Cdataout), Ref(Cindex), Ref(Cx), Ref(Cy), nods, nels, # Ref(Cdata), nods, 1, Ref(Cxout), Ref(Cyout), nods_interp) #rc=ccall( (:InterpFromMeshToMesh2dx,"../bamg/libBamg.so"), # Cint, (Ptr{Cint}, Ptr{Cdouble}, Ptr{Cdouble}, Cint, Cint), # Ref(Cindex), Ref(Cx), Ref(Cy), nods, nels) # # dataout = Vector{Float64}(undef,nods_interp) rc=ccall( (:InterpFromMeshToMesh2dx3,"/Users/mmorligh/Desktop/issmuci/trunk-jpl/src/jl/bamg/libBamg.dylib"), Cint, (Ptr{Cdouble}, Cint), dataout, nods_interp) #Process output for i in 1:nods_interp dataout[i] = Cdataout[i] end return dataout end #}}} function IssmStructDisp(io::IO, modelfield::Any) # {{{ @printf "%s:\n" typeof(modelfield) for name in fieldnames(typeof(modelfield)) a=getfield(modelfield,name) @printf "%19s: " name IssmPrintField(io, a) @printf "\n" end end #}}} function IssmPrintField(io::IO, field::Any) #{{{ @printf "%s" field end #}}} function IssmPrintField(io::IO, field::Flux.Chain) #{{{ @printf "Flux: %s" field end #}}} function IssmPrintField(io::IO, field::StatsBase.ZScoreTransform) #{{{ @printf "Normalization: %s" field end #}}} function IssmPrintField(io::IO, field::Union{Vector, Matrix}) #{{{ if !isempty(field) @printf "%s of size %s" typeof(field) size(field) else @printf "empty" end end #}}} function meshgrid(x::Vector, y::Vector) # {{{ X = [i for i in x, j in 1:length(y)] Y = [j for i in 1:length(x), j in y] return X, Y end #}}}
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1224
module ModelStruct using DJUICE using Test using MAT @testset "Model basic sturct" begin md = model() @test (typeof(md.mesh)) <: DJUICE.AbstractMesh @test (typeof(md.mesh)) == DJUICE.Mesh2dTriangle @test (typeof(md.friction)) <: DJUICE.AbstractFriction @test (typeof(md.friction)) <: DJUICE.BuddFriction md = model(md; friction=DNNFriction()) @test (typeof(md.friction)) == DJUICE.DNNFriction md = model(md; friction=SchoofFriction()) @test (typeof(md.friction)) == DJUICE.SchoofFriction end @testset "Enums <-> String" begin @test DJUICE.StringToEnum("FrictionCoefficient") == DJUICE.FrictionCoefficientEnum @test DJUICE.StringToEnum("MaterialsRheologyB") == DJUICE.MaterialsRheologyBEnum @test DJUICE.EnumToString(DJUICE.FrictionCoefficientEnum) == "FrictionCoefficient" @test DJUICE.EnumToString(DJUICE.MaterialsRheologyBEnum) == "MaterialsRheologyB" end @testset "Triangle" begin md = model() c = DJUICE.ExpStruct() c.name = "domainoutline" c.nods = 5 c.density = 1.0 c.x = [0.0, 1.0e6, 1.0e6, 0.0, 0.0] c.y = [0.0, 0.0, 1.0e6, 1.0e6, 0.0] c.closed = true contour = [c] md = triangle(md,contour,50000.) @test md.mesh.numberofvertices == 340 @test md.mesh.numberofelements == 614 end end
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
514
using DJUICE using Test function searchdir(path,key) filter(x->occursin(key,x), readdir(path)) end @time begin @time @testset "Model Struct Tests" begin include("modelstructtests.jl") end # test each individual cases, name with test[0-9]*.jl testsolutions = searchdir("./", r"test[0-9]*.jl") @time @testset "Model Solution Tests" begin for tf in testsolutions include(tf) end end # AD test @time include("testad.jl") #@time include("testad2.jl") # GPU test #@time include("testGPU.jl") end
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1787
using DJUICE md = model() md = triangle(md,issmdir()*"/test/Exp/Square.exp",50000.) md = setmask(md,"all","") #Geometry hmin=300. hmax=1000. ymin=minimum(md.mesh.y) ymax=maximum(md.mesh.y) xmin=minimum(md.mesh.x) xmax=maximum(md.mesh.x) md.geometry.thickness = hmax .+ (hmin-hmax)*(md.mesh.y .- ymin)./(ymax-ymin) .+ 0.1*(hmin-hmax)*(md.mesh.x .- xmin)./(xmax-xmin) md.geometry.base = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness md.geometry.surface = md.geometry.base+md.geometry.thickness md.geometry.bed = md.geometry.base .-10 #Initial velocity x = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","x") y = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","y") vx = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vx") vy = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vy") index = Int.(archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","index")) md.initialization.vx=0 .*InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y,0.0) md.initialization.vy=0 .*InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y,0.0) md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices) md.materials.rheology_n=3*ones(md.mesh.numberofelements) md.friction.coefficient=20*ones(md.mesh.numberofvertices) md.friction.p=ones(md.mesh.numberofvertices) md.friction.q=ones(md.mesh.numberofvertices) md.stressbalance.restol=0.05 md.stressbalance.reltol=0.05 md.stressbalance.abstol=NaN #Boundary conditions md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices) md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices) pos = findall(md.mesh.vertexonboundary) md.stressbalance.spcvx[pos] .= 0.0 md.stressbalance.spcvy[pos] .= 0.0 md=solve(md,:Stressbalance)
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
2208
using DJUICE md = model() md = triangle(md,issmdir()*"/test/Exp/Square.exp", 50000.) md = setmask(md, "all", "") #Geometry hmin=300. hmax=1000. ymin=minimum(md.mesh.y) ymax=maximum(md.mesh.y) xmin=minimum(md.mesh.x) xmax=maximum(md.mesh.x) md.geometry.thickness = hmax .+ (hmin-hmax)*(md.mesh.y .- ymin)./(ymax-ymin) .+ 0.1*(hmin-hmax)*(md.mesh.x .- xmin)./(xmax-xmin) md.geometry.base = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness md.geometry.surface = md.geometry.base+md.geometry.thickness md.geometry.bed = md.geometry.base .-10 #Initial velocity x = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","x") y = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","y") vx = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vx") vy = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vy") index = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","index") md.initialization.vx=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y) md.initialization.vy=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y) md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices) md.materials.rheology_n=3*ones(md.mesh.numberofelements) md.friction.coefficient=20*ones(md.mesh.numberofvertices) md.friction.p=ones(md.mesh.numberofvertices) md.friction.q=ones(md.mesh.numberofvertices) md.stressbalance.restol=0.1 md.stressbalance.reltol=0.02 md.stressbalance.abstol=NaN #Boundary conditions nodefront=ContourToNodes(md.mesh.x,md.mesh.y,issmdir()*"/test/Exp/SquareFront.exp",2.0) .& md.mesh.vertexonboundary md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices) md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices) pos = findall(md.mesh.vertexonboundary .& .~nodefront) md.mask.ice_levelset[findall(nodefront)] .= 0 segmentsfront=md.mask.ice_levelset[md.mesh.segments[:,1:2]]==0 segments = findall(vec(sum(Int64.(md.mask.ice_levelset[md.mesh.segments[:,1:2]].==0), dims=2)) .!=2) pos=md.mesh.segments[segments,1:2] md.stressbalance.spcvx[pos] .= 0.0 md.stressbalance.spcvy[pos] .= 0.0 md=solve(md,:Stressbalance)
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
2577
using DJUICE md = model() md = triangle(md,issmdir()*"/test/Exp/Square.exp", 150000.) md = setmask(md, "all", "") #Geometry hmin=300. hmax=1000. ymin=minimum(md.mesh.y) ymax=maximum(md.mesh.y) xmin=minimum(md.mesh.x) xmax=maximum(md.mesh.x) md.geometry.thickness = hmax .+ (hmin-hmax)*(md.mesh.y .- ymin)./(ymax-ymin) .+ 0.1*(hmin-hmax)*(md.mesh.x .- xmin)./(xmax-xmin) md.geometry.base = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness md.geometry.surface = md.geometry.base+md.geometry.thickness md.geometry.bed = md.geometry.base .-10 #Initial velocity x = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","x") y = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","y") vx = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vx") vy = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vy") index = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","index") md.initialization.vx=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y) md.initialization.vy=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y) md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices) md.materials.rheology_n=3*ones(md.mesh.numberofelements) md.friction.coefficient=20*ones(md.mesh.numberofvertices) md.friction.p=ones(md.mesh.numberofvertices) md.friction.q=ones(md.mesh.numberofvertices) md.stressbalance.restol=0.1 md.stressbalance.reltol=0.02 md.stressbalance.abstol=NaN md.timestepping.start_time = 0.0 md.timestepping.final_time = 3.0 md.timestepping.time_step = 1.0 #Boundary conditions nodefront=ContourToNodes(md.mesh.x,md.mesh.y,issmdir()*"/test/Exp/SquareFront.exp",2.0) .& md.mesh.vertexonboundary md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices) md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices) pos = findall(md.mesh.vertexonboundary .& .~nodefront) md.mask.ice_levelset[findall(nodefront)] .= 0 segmentsfront=md.mask.ice_levelset[md.mesh.segments[:,1:2]]==0 segments = findall(vec(sum(Int64.(md.mask.ice_levelset[md.mesh.segments[:,1:2]].==0), dims=2)) .!=2) pos=md.mesh.segments[segments,1:2] md.stressbalance.spcvx[pos] .= 0.0 md.stressbalance.spcvy[pos] .= 0.0 md.smb.mass_balance = zeros(md.mesh.numberofvertices) md.basalforcings.groundedice_melting_rate = zeros(md.mesh.numberofvertices) md.basalforcings.floatingice_melting_rate = ones(md.mesh.numberofvertices) md.masstransport.spcthickness = NaN*ones(md.mesh.numberofvertices) md=solve(md,:Transient)
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1832
using DJUICE md = model() md = triangle(md,issmdir()*"/test/Exp/Square.exp",150000.) md = setmask(md,"","") #Geometry hmin=300. hmax=1000. ymin=minimum(md.mesh.y) ymax=maximum(md.mesh.y) xmin=minimum(md.mesh.x) xmax=maximum(md.mesh.x) md.geometry.thickness = hmax .+ (hmin-hmax)*(md.mesh.y .- ymin)./(ymax-ymin) .+ 0.1*(hmin-hmax)*(md.mesh.x .- xmin)./(xmax-xmin) md.geometry.base = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness .+20 md.geometry.surface = md.geometry.base+md.geometry.thickness md.geometry.bed = md.geometry.base #Initial velocity #x = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","x") #y = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","y") #vx = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vx") #vy = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vy") #index = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","index") md.initialization.vx=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y) md.initialization.vy=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y) md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices) md.materials.rheology_n=3*ones(md.mesh.numberofelements) md.friction.coefficient=20*ones(md.mesh.numberofvertices) md.friction.p=ones(md.mesh.numberofvertices) md.friction.q=ones(md.mesh.numberofvertices) md.stressbalance.restol=0.05 md.stressbalance.reltol=0.05 md.stressbalance.abstol=NaN #Boundary conditions md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices) md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices) pos = findall(md.mesh.vertexonboundary) md.stressbalance.spcvx[pos] .= 0.0 md.stressbalance.spcvy[pos] .= 0.0 md=solve(md,:Stressbalance)
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
2431
using DJUICE md = model() md = triangle(md,issmdir()*"/test/Exp/Pig.exp",10000.) md = setmask( md,issmdir()*"/test/Exp/PigShelves.exp",issmdir()*"/test/Exp/PigIslands.exp") #Initial velocity and geometry x = archread(issmdir()*"/test/Data/Pig.arch","x") y = archread(issmdir()*"/test/Data/Pig.arch","y") vx_obs = archread(issmdir()*"/test/Data/Pig.arch","vx_obs") vy_obs = archread(issmdir()*"/test/Data/Pig.arch","vy_obs") index = Int.(archread(issmdir()*"/test/Data/Pig.arch","index")) surface = archread(issmdir()*"/test/Data/Pig.arch","surface") thickness = archread(issmdir()*"/test/Data/Pig.arch","thickness") bed = archread(issmdir()*"/test/Data/Pig.arch","bed") md.initialization.vx=InterpFromMeshToMesh2d(index, x, y, vx_obs, md.mesh.x, md.mesh.y, 0.0) md.initialization.vy=InterpFromMeshToMesh2d(index, x, y, vy_obs, md.mesh.x, md.mesh.y, 0.0) md.geometry.surface = InterpFromMeshToMesh2d(index, x, y, surface, md.mesh.x, md.mesh.y, 0.0) md.geometry.thickness = InterpFromMeshToMesh2d(index, x, y, thickness, md.mesh.x, md.mesh.y, 0.0) md.geometry.base=md.geometry.surface .- md.geometry.thickness md.geometry.bed =md.geometry.base pos = findall(md.mask.ocean_levelset.<0) md.geometry.bed[pos] = InterpFromMeshToMesh2d(index, x, y, bed, md.mesh.x[pos], md.mesh.y[pos]) md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices) md.materials.rheology_n=3*ones(md.mesh.numberofelements) md.friction.coefficient=50*ones(md.mesh.numberofvertices) md.friction.p=ones(md.mesh.numberofvertices) md.friction.q=ones(md.mesh.numberofvertices) md.stressbalance.restol=0.05 md.stressbalance.reltol=1.0 md.stressbalance.abstol=NaN #Boundary conditions pos = findall(vec(sum(Int64.(md.mask.ocean_levelset[md.mesh.elements].<0), dims=2)) .> 0.0) vertexonfloatingice=zeros(md.mesh.numberofvertices) vertexonfloatingice[md.mesh.elements[pos,:]] .= 1 nodefront=(md.mesh.vertexonboundary .& (vertexonfloatingice.>0)) md.mask.ice_levelset[findall(nodefront)] .= 0 md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices) md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices) segmentsfront=md.mask.ice_levelset[md.mesh.segments[:,1:2]]==0 segments = findall(vec(sum(Int64.(md.mask.ice_levelset[md.mesh.segments[:,1:2]].==0), dims=2)) .!=2) pos=md.mesh.segments[segments,1:2] md.stressbalance.spcvx[pos] .= 0.0 md.stressbalance.spcvy[pos] .= 0.0 md=solve(md, :Stressbalance)
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
2776
using DJUICE md = model() md = triangle(md,issmdir()*"/test/Exp/Square.exp",200000.) md = setmask(md,"all","") #Geometry hmin=300. hmax=1000. ymin=minimum(md.mesh.y) ymax=maximum(md.mesh.y) xmin=minimum(md.mesh.x) xmax=maximum(md.mesh.x) md.geometry.thickness = hmax .+ (hmin-hmax)*(md.mesh.y .- ymin)./(ymax-ymin) .+ 0.1*(hmin-hmax)*(md.mesh.x .- xmin)./(xmax-xmin) md.geometry.base = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness md.geometry.surface = md.geometry.base+md.geometry.thickness md.geometry.bed = md.geometry.base .-500 #Initial velocity x = archread(issmdir()*"/test/Data/SquareShelf.arch","x") y = archread(issmdir()*"/test/Data/SquareShelf.arch","y") vx = archread(issmdir()*"/test/Data/SquareShelf.arch","vx") vy = archread(issmdir()*"/test/Data/SquareShelf.arch","vy") index = Int.(archread(issmdir()*"/test/Data/SquareShelf.arch","index")) md.initialization.vx=InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y,0.0) md.initialization.vy=InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y,0.0) md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices) md.materials.rheology_n=3*ones(md.mesh.numberofelements) md.friction.coefficient=20*ones(md.mesh.numberofvertices) md.friction.p=ones(md.mesh.numberofvertices) md.friction.q=ones(md.mesh.numberofvertices) md.stressbalance.restol=0.05 md.stressbalance.reltol=0.05 md.stressbalance.abstol=NaN #Boundary conditions md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices) md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices) md.masstransport.spcthickness = NaN*ones(md.mesh.numberofvertices) pos = findall(md.mesh.vertexonboundary) md.stressbalance.spcvx[pos] .= 0.0 md.stressbalance.spcvy[pos] .= 0.0 md.masstransport.spcthickness[pos] .= md.geometry.thickness[pos] # surface mass balance and basal melting md.smb.mass_balance=10*ones(md.mesh.numberofvertices) md.basalforcings.floatingice_melting_rate=5*ones(md.mesh.numberofvertices) md.basalforcings.groundedice_melting_rate=5*ones(md.mesh.numberofvertices) # mask Lx = xmax - xmin alpha = 2.0/3.0 md.mask.ice_levelset = ((md.mesh.x .- alpha*Lx).>0) .- ((md.mesh.x .- alpha*Lx).<0) md.levelset.kill_icebergs = 0 # time stepping md.timestepping.time_step = 10; md.timestepping.final_time = 30; # Transient md.transient.isstressbalance=1; md.transient.ismasstransport=1; md.transient.issmb=1; md.transient.ismovingfront=1; md.calving.calvingrate=0*ones(md.mesh.numberofvertices) md.frontalforcings.meltingrate=10000*ones(md.mesh.numberofvertices) md.frontalforcings.ablationrate=10000*ones(md.mesh.numberofvertices) md.levelset.spclevelset=NaN*ones(md.mesh.numberofvertices) md.levelset.spclevelset[pos] = md.mask.ice_levelset[pos] md=solve(md,:Transient)
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1457
using DJUICE using Flux using BSON: @load md = model2() md = triangle(md,issmdir()*"/test/Exp/Square.exp",150000.) md = setmask(md,"","") #Geometry hmin=300. hmax=1000. ymin=minimum(md.mesh.y) ymax=maximum(md.mesh.y) xmin=minimum(md.mesh.x) xmax=maximum(md.mesh.x) md.geometry.thickness = hmax .+ (hmin-hmax)*(md.mesh.y .- ymin)./(ymax-ymin) .+ 0.1*(hmin-hmax)*(md.mesh.x .- xmin)./(xmax-xmin) md.geometry.base = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness .+20 md.geometry.surface = md.geometry.base+md.geometry.thickness md.geometry.bed = md.geometry.base #Initial velocity md.initialization.vx=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y) md.initialization.vy=zeros(md.mesh.numberofvertices)#InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y) md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices) md.materials.rheology_n=3*ones(md.mesh.numberofelements) md.friction.coefficient=20*ones(md.mesh.numberofvertices) @load "../data/Weertman.bson" nn md.friction.dnnChain = nn; md.stressbalance.restol=0.05 md.stressbalance.reltol=0.05 md.stressbalance.abstol=NaN #Boundary conditions md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices) md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices) pos = findall(md.mesh.vertexonboundary) md.stressbalance.spcvx[pos] .= 0.0 md.stressbalance.spcvy[pos] .= 0.0 md=solve(md,"Stressbalance")
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
13445
#!/Applications/Julia-1.8.app/Contents/Resources/julia/bin/julia --project using DJUICE import Statistics: mean using Printf function NodalCoeffs(index,x,y,nbe)# {{{ nods=length(x) #compute nodal functions coefficients N(x,y)=alpha x + beta y +gamma x1=x[index[:,1]]; x2=x[index[:,2]]; x3=x[index[:,3]]; y1=y[index[:,1]]; y2=y[index[:,2]]; y3=y[index[:,3]]; invdet=1. ./ (x1.*(y2-y3)-x2.*(y1-y3)+x3.*(y1-y2)) #get alpha and beta alpha=[invdet.*(y2-y3) invdet.*(y3-y1) invdet.*(y1-y2)] beta =[invdet.*(x3-x2) invdet.*(x1-x3) invdet.*(x2-x1)] #Compute Areas areas=(0.5*((x2-x1).*(y3-y1)-(y2-y1).*(x3-x1))) #return return areas, alpha, beta end # }}} function Weights(index,areas,nbe,nbv)# {{{ weights = zeros(nbv, 1) for i in 1:nbe for j in 1:3 weights[index[i,j]] += areas[i] end end return weights end # }}} function derive_xy_elem(f,index,alpha,beta,nbe)# {{{ dfdx_e = sum(f[index].*alpha, dims=2) dfdy_e = sum(f[index].*beta, dims=2) return dfdx_e, dfdy_e end # }}} function elem2node(f_e,index,areas,weights,nbe,nbv)# {{{ f_v = zeros(nbv, 1) for i in 1:nbe for j in 1:3 f_v[index[i,j]] += areas[i]*f_e[i] end end f_v = f_v ./ weights return f_v end # }}} function MeshSize(index,x,y,areas,weights,nbe,nbv)# {{{ #Get element size dx_elem = maximum(x[index], dims=2)-minimum(x[index], dims=2) dy_elem = maximum(y[index], dims=2)-minimum(y[index], dims=2) #Average over each node resolx = elem2node(dx_elem,index,areas,weights,nbe,nbv); resoly = elem2node(dy_elem,index,areas,weights,nbe,nbv); return resolx, resoly end # }}} function testGPU() relaxation = 1; damp = 0.2; md = model() md = triangle(md,issmdir()*"/test/Exp/Square.exp",50000.) md = setmask(md,"all","") #Geometry hmin=300. hmax=1000. ymin=minimum(md.mesh.y) ymax=maximum(md.mesh.y) xmin=minimum(md.mesh.x) xmax=maximum(md.mesh.x) md.geometry.thickness = hmax .+ (hmin-hmax)*(md.mesh.y .- ymin)./(ymax-ymin) .+ 0.1*(hmin-hmax)*(md.mesh.x .- xmin)./(xmax-xmin) md.geometry.base = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness md.geometry.surface = md.geometry.base+md.geometry.thickness md.geometry.bed = md.geometry.base .-10 #Initial velocity x = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","x") y = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","y") vx = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vx") vy = archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","vy") index = Int.(archread(issmdir()*"/test/Data/SquareShelfConstrained.arch","index")) md.initialization.vx=0 .*InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y,0.0) md.initialization.vy=0 .*InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y,0.0) md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices) md.materials.rheology_n=3*ones(md.mesh.numberofelements) md.friction.coefficient=20*ones(md.mesh.numberofvertices) md.friction.p=ones(md.mesh.numberofvertices) md.friction.q=ones(md.mesh.numberofvertices) md.stressbalance.restol=0.05 md.stressbalance.reltol=0.05 md.stressbalance.abstol=NaN #Boundary conditions md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices) md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices) pos = findall(md.mesh.vertexonboundary) md.stressbalance.spcvx[pos] .= 0.0 md.stressbalance.spcvy[pos] .= 0.0 # Start GPU code here # ======================== LOAD DATA FROM MD =============================== nbe = md.mesh.numberofelements; nbv = md.mesh.numberofvertices; g = md.constants.g; rho = md.materials.rho_ice; rho_w = md.materials.rho_water; yts = md.constants.yts; index = md.mesh.elements; spcvx = md.stressbalance.spcvx/yts; spcvy = md.stressbalance.spcvy/yts; x = md.mesh.x; y = md.mesh.y; H = md.geometry.thickness; surface = md.geometry.surface; base = md.geometry.base; ice_levelset = md.mask.ice_levelset; ocean_levelset = md.mask.ocean_levelset; rheology_B_temp = md.materials.rheology_B; vx = md.initialization.vx/yts; vy = md.initialization.vy/yts; friction = md.friction.coefficient; # =================== SIMILAR TO C++ FILE LINE 384 DOWN =================== #Constants n_glen = 3 rele = 1.e-1 eta_b = 0.5 eta_0 = 1.e+14/2. niter = 5e6 nout_iter = 1000 epsi = 1.e-8 #Initial guesses (except vx and vy that we already loaded) etan = 1.e+14*ones(nbe) dVxdt = zeros(nbv) dVydt = zeros(nbv) #Manage derivatives once for all areas, alpha, beta = NodalCoeffs(index,x,y,nbe) weights=Weights(index,areas,nbe,nbv) #Mesh size resolx, resoly = MeshSize(index,x,y,areas,weights,nbe,nbv) #Physical properties once for all dsdx, dsdy = derive_xy_elem(surface,index,alpha,beta,nbe) Helem = mean(H[md.mesh.elements],dims=2) rheology_B = mean(rheology_B_temp[md.mesh.elements],dims=2) #Linear integration points order 3 wgt3=[0.555555555555556, 0.888888888888889, 0.555555555555556] xg3 =[-0.774596669241483, 0.000000000000000, 0.774596669241483] #Compute RHS amd ML once for all ML = zeros(Float64, nbv) Fvx = zeros(Float64, nbv) Fvy = zeros(Float64, nbv) groundedratio = zeros(Float64, nbe) isice = zeros(Bool, nbe) for n in 1:nbe #Lumped mass matrix for i in 1:3 for j in 1:3 # \int_E phi_i * phi_i dE = A/6 and % \int_E phi_i * phi_j dE = A/12 if(i==j) ML[index[n,j]] += areas[n]/6. else ML[index[n,j]] += areas[n]/12. end end end #Is there ice at all in the current element? level = ice_levelset[index[n,:]] if level[1]<0 || level[2]<0 || level[3]<0 isice[n]= true else #We can skip this element altogether isices[n] = false for i in 1:3 vx[index[n,i]] = 0. vy[index[n,i]] = 0. end continue end #RHS (Driving stress term) for i in 1:3 for j in 1:3 if i==j Fvx[index[n,i]] += -rho*g*H[index[n,j]]*dsdx[n]*areas[n]/6. Fvy[index[n,i]] += -rho*g*H[index[n,j]]*dsdy[n]*areas[n]/6. else Fvx[index[n,i]] += -rho*g*H[index[n,j]]*dsdx[n]*areas[n]/12. Fvy[index[n,i]] += -rho*g*H[index[n,j]]*dsdy[n]*areas[n]/12. end end end #RHS (Water pressure at the ice front) level = ice_levelset[index[n,:]] count = 0 for i in 1:3 if(level[i]<0.) count = count+1; end end if(count==1) #This element has an ice front, get indices of the 2 vertices seg1 = [index[n,1] index[n,2]] seg2 = [index[n,2] index[n,3]] seg3 = [index[n,3] index[n,1]] if ice_levelset[seg1[1]]>=0 && ice_levelset[seg1[2]]>=0 pairids = seg1 elseif ice_levelset[seg2[1]]>=0 && ice_levelset[seg2[2]]>=0 pairids = seg2 elseif ice_levelset[seg3[1]]>=0 && ice_levelset[seg3[2]]>=0 pairids = seg3 else error("not supported") end #Get normal len = sqrt((x[pairids[2]]-x[pairids[1]])^2 + (y[pairids[2]]-y[pairids[1]])^2); nx = +(y[pairids[2]]-y[pairids[1]])/len; ny = -(x[pairids[2]]-x[pairids[1]])/len; #add RHS for gg in 1:3 phi1 = (1. - xg3[gg])/2. phi2 = (1. + xg3[gg])/2. bg = base[pairids[1]]*phi1 + base[pairids[2]]*phi2 Hg = H[pairids[1]]*phi1 + H[pairids[2]]*phi2 bg = min(bg, 0) Fvx[pairids[1]] += wgt3[gg]/2*1/2*(-rho_w*g*bg^2+rho*g*Hg^2)*nx*len*phi1 Fvx[pairids[2]] += wgt3[gg]/2*1/2*(-rho_w*g*bg^2+rho*g*Hg^2)*nx*len*phi2 Fvy[pairids[1]] += wgt3[gg]/2*1/2*(-rho_w*g*bg^2+rho*g*Hg^2)*ny*len*phi1 Fvy[pairids[2]] += wgt3[gg]/2*1/2*(-rho_w*g*bg^2+rho*g*Hg^2)*ny*len*phi2 end end #One more thing in this element loop: prepare groundedarea needed later for the calculation of basal friction level = ocean_levelset[index[n,:]] if level[1]>0 && level[2]>0 && level[3]>0 #Completely grounded groundedratio[n]=1. elseif level[1]<0 && level[2]<0 && level[3]<0 #Completely floating groundedratio[n]=0. else #Partially floating, if(level[1]*level[2]>0) #Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2 s1=level[3]/(level[3]-level[2]) s2=level[3]/(level[3]-level[1]) elseif(level[2]*level[3]>0) #Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2 s1=level[1]/(level[1]-level[2]) s2=level[1]/(level[1]-level[3]) elseif(level[1]*level[3]>0) #Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2 s1=level[2]/(level[2]-level[1]) s2=level[2]/(level[2]-level[3]) else error("not supposed to be here...") end if(level[1]*level[2]*level[3]>0) groundedratio[n]= s1*s2; else groundedratio[n]= (1-s1*s2) end end end #Finally add calculation of friction coefficient: alpha2 = zeros(nbv) for i in 1:nbv #Compute effective pressure p_ice = g*rho*H[i] p_water = -rho_w*g*base[i] Neff = p_ice - p_water if(Neff<0.) Neff=0.; end #Compute alpha2 alpha2[i] = friction[i]^2*Neff end #Update viscosity dvxdx, dvxdy=derive_xy_elem(vx,index,alpha,beta,nbe) dvydx, dvydy=derive_xy_elem(vy,index,alpha,beta,nbe) for i=1:nbe if(isice[i]==0.) continue; end eps_xx = dvxdx[i] eps_yy = dvydy[i] eps_xy = .5*(dvxdy[i]+dvydx[i]) EII2 = eps_xx^2 + eps_yy^2 + eps_xy^2 + eps_xx*eps_yy eta_it = 1.e+14/2. if(EII2>0.) eta_it = rheology_B[i]/(2*EII2^((n_glen-1.)/(2*n_glen))); end etan[i] = min(eta_it,eta_0*1e5) if(isnan(etan[i])) error("Found NaN in etan[i]"); end end #Main loop, allocate a few vectors needed for the computation KVx = zeros(nbv) KVy = zeros(nbv) for iter in 1:niter # Pseudo-Transient cycles #Strain rates dvxdx, dvxdy = derive_xy_elem(vx,index,alpha,beta,nbe) dvydx, dvydy = derive_xy_elem(vy,index,alpha,beta,nbe) #KV term in equation 22 (initialize as 0) KVx .= 0. KVy .= 0. for n in 1:nbe #Skip if no ice if(isice[n]==0.) continue; end #Viscous Deformation eta_e = etan[n] eps_xx = dvxdx[n] eps_yy = dvydy[n] eps_xy = .5*(dvxdy[n]+dvydx[n]) for i in 1:3 KVx[index[n,i]] += 2*Helem[n]*eta_e*(2*eps_xx+eps_yy)*alpha[n,i]*areas[n] + 2*Helem[n]*eta_e*eps_xy*beta[n,i]*areas[n] KVy[index[n,i]] += 2*Helem[n]*eta_e*eps_xy*alpha[n,i]*areas[n] + 2*Helem[n]*eta_e*(2*eps_yy+eps_xx)*beta[n,i]*areas[n] end #Add basal friction if(groundedratio[n]>0.) for k in 1:3 for i in 1:3 for j in 1:3 if(i==j && j==k) KVx[index[n,k]] += groundedratio[n]*alpha2[index[n,i]]*vx[index[n,j]]*areas[n]/10. KVy[index[n,k]] += groundedratio[n]*alpha2[index[n,i]]*vy[index[n,j]]*areas[n]/10. elseif((i!=j) && (j!=k) && (k!=i)) KVx[index[n,k]] += groundedratio[n]*alpha2[index[n,i]]*vx[index[n,j]]*areas[n]/60. KVy[index[n,k]] += groundedratio[n]*alpha2[index[n,i]]*vy[index[n,j]]*areas[n]/60. else KVx[index[n,k]] += groundedratio[n]*alpha2[index[n,i]]*vx[index[n,j]]*areas[n]/30. KVy[index[n,k]] += groundedratio[n]*alpha2[index[n,i]]*vy[index[n,j]]*areas[n]/30. end end end end end if(any(isnan.(KVx))) error("Found NaN in dVxdt[i]"); end end if(any(isnan.(KVx))) error("Found NaN in dVxdt[i]"); end #Get current viscosity on nodes (Needed for time stepping) eta_nbv = elem2node(etan,index,areas,weights,nbe,nbv) #Velocity rate update in the x and y, refer to equation 19 in Rass paper normX = 0 normY = 0 #1. Get time derivative based on residual (dV/dt) ResVx = 1. ./(rho*ML).*(-KVx + Fvx) #rate of velocity in the x, equation 23 ResVy = 1. ./(rho*ML).*(-KVy + Fvy) #rate of velocity in the y, equation 24 dVxdt = dVxdt*(1. -damp/20.) + ResVx dVydt = dVydt*(1. -damp/20.) + ResVy if(any(isnan.(dVxdt))) error("Found NaN in dVxdt[i]"); end if(any(isnan.(dVydt))) error("Found NaN in dVydt[i]"); end #2. Explicit CFL time step for viscous flow, x and y directions dtVx = rho*resolx.^2 ./(4*max.(80.,H).*eta_nbv*(1. + eta_b)*4.1) dtVy = rho*resoly.^2 ./(4*max.(80.,H).*eta_nbv*(1. + eta_b)*4.1) #3. velocity update, vx(new) = vx(old) + change in vx, Similarly for vy vx += relaxation*dVxdt.*dtVx vy += relaxation*dVydt.*dtVy #Apply Dirichlet boundary condition, Residual should also be 0 (for convergence) pos = findall(.~isnan.(spcvx)) vx[pos] = spcvx[pos] if any(isnan.(vx)) error("VX NaN") end dVxdt[pos] .= 0. pos = findall(.~isnan.(spcvy)) vy[pos] = spcvy[pos] dVydt[pos] .= 0. #4. Update error normX += sum(dVxdt.^2) normY += sum(dVydt.^2) #Get final error estimate normX = sqrt(normX)/nbv normY = sqrt(normY)/nbv #Check convergence iterror = max(normX,normY) if((iterror < epsi) && (iter > 2)) @printf("iter=%d, err=%1.3e --> converged\n",iter,iterror) break end if (mod(iter,nout_iter)==1) @printf("iter=%d, err=%1.3e \n",iter,iterror) end #LAST: Update viscosity for i in 1:nbe if ~isice[i] continue; end eps_xx = dvxdx[i] eps_yy = dvydy[i] eps_xy = .5*(dvxdy[i]+dvydx[i]); EII2 = eps_xx^2 + eps_yy^2 + eps_xy^2 + eps_xx*eps_yy; eta_it = 1.e+14/2.; if(EII2>0.) eta_it = rheology_B[i]/(2*EII2^((n_glen-1.)/(2*n_glen))); end etan[i] = min(exp(rele*log(eta_it) + (1-rele)*log(etan[i])),eta_0*1e5); if(isnan(etan[i])) error("Found NaN in etan[i]"); end end end return md end
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1572
module enzymeDiff_grad_frictionC using Enzyme Enzyme.API.typeWarning!(false) Enzyme.Compiler.RunAttributor[] = false using DJUICE using MAT using Test #Load model from MATLAB file #file = matopen(joinpath(@__DIR__, "..", "data","temp12k.mat")) #BIG model file = matopen(joinpath(@__DIR__, "..", "data","temp.mat")) #SMALL model (35 elements) mat = read(file, "md") close(file) md = model(mat) #make model run faster md.stressbalance.maxiter = 20 #Now call AD! md.inversion.iscontrol = 1 md.inversion.independent = md.friction.coefficient md.inversion.independent_string = "FrictionCoefficient" md = solve(md, :grad) # compute gradient by finite differences at each node addJ = md.results["StressbalanceSolution"]["Gradient"] @testset "Quick AD test with Cost function" begin #Now call AD! md.inversion.iscontrol = 1 md.inversion.independent = md.friction.coefficient md.inversion.independent_string = "FrictionCoefficient" α = md.inversion.independent femmodel=DJUICE.ModelProcessor(md, :StressbalanceSolution) J1 = DJUICE.costfunction(α, femmodel) @test ~isnothing(J1) end @testset "AD gradient calculation for FrictionC" begin α = md.inversion.independent delta = 1e-7 femmodel=DJUICE.ModelProcessor(md, :StressbalanceSolution) J1 = DJUICE.costfunction(α, femmodel) for i in 1:md.mesh.numberofvertices dα = zero(md.friction.coefficient) dα[i] = delta femmodel=DJUICE.ModelProcessor(md, :StressbalanceSolution) J2 = DJUICE.costfunction(α+dα, femmodel) dJ = (J2-J1)/delta @test abs(dJ - addJ[i])< 1e-5 end end end
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1547
module enzymeDiff_grad_rheologyB using DJUICE using MAT using Test using Enzyme Enzyme.API.typeWarning!(false) Enzyme.Compiler.RunAttributor[] = false #Load model from MATLAB file #file = matopen(joinpath(@__DIR__, "..", "data","temp12k.mat")) #BIG model file = matopen(joinpath(@__DIR__, "..", "data","temp.mat")) #SMALL model (35 elements) mat = read(file, "md") close(file) md = model(mat) #make model run faster md.stressbalance.maxiter = 20 #Now call AD! md.inversion.iscontrol = 1 md.inversion.independent = md.materials.rheology_B md.inversion.independent_string = "MaterialsRheologyB" md = solve(md, :grad) # compute gradient by finite differences at each node addJ = md.results["StressbalanceSolution"]["Gradient"] @testset "Quick AD test with Cost function" begin #Now call AD! md.inversion.iscontrol = 1 md.inversion.independent = md.materials.rheology_B md.inversion.independent_string = "MaterialsRheologyB" α = md.inversion.independent femmodel=DJUICE.ModelProcessor(md, :StressbalanceSolution) J1 = DJUICE.costfunction(α, femmodel) @test ~isnothing(J1) end @testset "AD results RheologyB" begin α = md.inversion.independent delta = 1e-8 femmodel=DJUICE.ModelProcessor(md, :StressbalanceSolution) J1 = DJUICE.costfunction(α, femmodel) for i in 1:md.mesh.numberofvertices dα = zero(md.friction.coefficient) dα[i] = delta femmodel=DJUICE.ModelProcessor(md, :StressbalanceSolution) J2 = DJUICE.costfunction(α+dα, femmodel) dJ = (J2-J1)/delta @test abs(dJ - addJ[i])< 1e-6 end end end
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
code
1446
module enzymeDiff using DJUICE using MAT using Test using Enzyme Enzyme.Compiler.RunAttributor[] = false using Optimization, OptimizationOptimJL #Load model from MATLAB file #file = matopen(joinpath(@__DIR__, "..", "data","temp12k.mat")) #BIG model file = matopen(joinpath(@__DIR__, "..", "data","temp.mat")) #SMALL model (35 elements) mat = read(file, "md") close(file) md = model(mat) #make model run faster md.stressbalance.maxiter = 20 #Now call AD! md.inversion.iscontrol = 1 md.inversion.independent = md.friction.coefficient md.inversion.min_parameters = ones(md.mesh.numberofvertices)*(0.0) md.inversion.max_parameters = ones(md.mesh.numberofvertices)*(1.0e3) md.inversion.independent_string = "FrictionCoefficient" α = md.inversion.independent ∂J_∂α = zero(α) femmodel=DJUICE.ModelProcessor(md, :StressbalanceSolution) n = length(α) # use user defined grad, errors! optprob = OptimizationFunction(DJUICE.costfunction, Optimization.AutoEnzyme(), grad=DJUICE.computeGradient) #optprob = OptimizationFunction(DJUICE.costfunction, Optimization.AutoEnzyme()) #prob = Optimization.OptimizationProblem(optprob, α, femmodel, lb=md.inversion.min_parameters, ub=md.inversion.max_parameters) prob = Optimization.OptimizationProblem(optprob, α, femmodel) sol = Optimization.solve(prob, Optim.LBFGS()) #md = solve(md, :sb) # compute gradient by finite differences at each node #addJ = md.results["StressbalanceSolution"]["Gradient"] end
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.1
6611f28064f4c8fb5dacb8e765ddb7f08977bfdb
docs
3828
# DJUICE.jl [![][build-stable-img]][build-url] **Differentiable JUlia ICE model** ## Overview DJUICE.jl is a Julia package designed for differentiable ice sheet modeling, leveraging the power of [Enzyme.jl](https://github.com/EnzymeAD/Enzyme.jl) for automatic differentiation. This package employs the Finite Element method (FEM) and follows the structure of the [ice-sheet and Sea-level System Model (ISSM)](https://issm.jpl.nasa.gov/), which is the C++ counterpart for ice sheet modeling. ## Features - Differentiable ice sheet modeling using Enzyme.jl. - Finite Element method implementation for ice numerical sheet modeling. - Based on the well-established ISSM framework. ## Installation To install DJUICE.jl, you can use the Julia package manager. In your Julia REPL, run: ```julia using Pkg Pkg.add("DJUICE") ``` ## Usage Here is a simple example of how to use DJUICE.jl: ```julia using DJUICE # Initialize model md = model() # Create mesh md = triangle(md,issmdir()*"/test/Exp/Square.exp",50000.) md = setmask(md,"all","") #Geometry hmin=300. hmax=1000. ymin=minimum(md.mesh.y) ymax=maximum(md.mesh.y) xmin=minimum(md.mesh.x) xmax=maximum(md.mesh.x) md.geometry.thickness = hmax .+ (hmin-hmax)*(md.mesh.y .- ymin)./(ymax-ymin) .+ 0.1*(hmin-hmax)*(md.mesh.x .- xmin)./(xmax-xmin) md.geometry.base = -md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness md.geometry.surface = md.geometry.base+md.geometry.thickness md.geometry.bed = md.geometry.base .-10 #Initial velocity md.initialization.vx=zeros(md.mesh.numberofvertices) md.initialization.vy=zeros(md.mesh.numberofvertices) # Physical parameters md.materials.rheology_B=1.815730284801701e+08*ones(md.mesh.numberofvertices) md.materials.rheology_n=3*ones(md.mesh.numberofelements) md.friction.coefficient=20*ones(md.mesh.numberofvertices) md.friction.p=ones(md.mesh.numberofvertices) md.friction.q=ones(md.mesh.numberofvertices) # Numerical tolerances md.stressbalance.restol=0.05 md.stressbalance.reltol=0.05 md.stressbalance.abstol=NaN #Boundary conditions md.stressbalance.spcvx = NaN*ones(md.mesh.numberofvertices) md.stressbalance.spcvy = NaN*ones(md.mesh.numberofvertices) pos = findall(md.mesh.vertexonboundary) md.stressbalance.spcvx[pos] .= 0.0 md.stressbalance.spcvy[pos] .= 0.0 # Solve md=solve(md,:Stressbalance) ``` For detailed tutorials and examples, please refer to the [documentation](https://github.com/DJ4Earth/DJUICE.jl). ## Documentation Comprehensive documentation is available to help you get started and make the most out of DJUICE.jl. It includes tutorials, API references, and examples. Access the documentation [here](https://github.com/DJ4Earth/DJUICE.jl). ## Contributing Contributions are welcome! If you find a bug or have a feature request, please open an issue on our [GitHub repository](https://github.com/DJ4Earth/DJUICE.jl). If you want to contribute code, please fork the repository and submit a pull request. ## License DJUICE.jl is released under the MIT License. See the [LICENSE](https://github.com/DJ4Earth/DJUICE.jl/blob/main/LICENSE) file for more details. ## Acknowledgements This project is inspired by the [ice-sheet and Sea-level System Model (ISSM)](https://issm.jpl.nasa.gov/). Special thanks to the developers of Enzyme.jl for providing an excellent tool for automatic differentiation in Julia. ## Authors: - [Mathieu Morlighem](https://github.com/mmorligh), Dartmouth College, USA - [Cheng Gong](https://github.com/enigne), Dartmouth College, USA [build-stable-img]: https://github.com/DJ4Earth/DJUICE.jl/workflows/CI/badge.svg [build-url]: https://github.com/yourusername/DJUICE.jl/actions [build-stable-img]: https://github.com/DJ4Earth/DJUICE.jl/workflows/CI/badge.svg [build-url]: https://github.com/DJ4Earth/DJUICE/actions?query=workflow
DJUICE
https://github.com/DJ4Earth/DJUICE.jl.git
[ "MIT" ]
0.1.3
4d44ffb3d3eb54b6be5a30dd178853a336818e1c
code
821
#* NOTE: This will be slow to load on first start-up, since it needs to install all the #* Julia packages! ENV["EDITOR"] = "nvim" ENV["PYTHON"] = "/opt/conda/bin/python" ENV["JUPYTER"] = "/opt/conda/bin/jupyter" orig_project = Base.active_project() import Pkg Pkg.activate() let pkgs = [ "Revise", "OhMyREPL", "DrWatson", "AbbreviatedStackTraces", "JuliaFormatter", ] for pkg in pkgs if Base.find_package(pkg) === nothing Pkg.add(pkg) end end end using OhMyREPL using AbbreviatedStackTraces # https://timholy.github.io/Revise.jl/stable/config/#Using-Revise-automatically-within-Jupyter/IJulia-1 try @eval using Revise catch e @warn "Error initializing Revise" exception=(e, catch_backtrace()) end Pkg.activate(orig_project)
BoxesWorld
https://github.com/jmuchovej/BoxesWorld.jl.git
[ "MIT" ]
0.1.3
4d44ffb3d3eb54b6be5a30dd178853a336818e1c
code
675
using BoxesWorld using Documenter DocMeta.setdocmeta!(BoxesWorld, :DocTestSetup, :(using BoxesWorld); recursive=true) makedocs(; modules=[BoxesWorld], authors="John Muchovej <[email protected]> and contributors", repo="https://github.com/jmuchovej/BoxesWorld.jl/blob/{commit}{path}#{line}", sitename="BoxesWorld.jl", format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true", canonical="https://jmuchovej.github.io/BoxesWorld.jl", edit_link="main", assets=String[], ), pages=["Home" => "index.md"], ) deploydocs(; repo="github.com/jmuchovej/BoxesWorld.jl", devbranch="main")
BoxesWorld
https://github.com/jmuchovej/BoxesWorld.jl.git
[ "MIT" ]
0.1.3
4d44ffb3d3eb54b6be5a30dd178853a336818e1c
code
1937
module BoxesWorld using POMDPs using POMDPs: POMDP, isterminal, discount using POMDPTools: SparseCat, Deterministic using StaticArrays: SVector, @SVector using Distances: euclidean using DataStructures: OrderedDict export Point, State, Action, Move, MoveAction, Take, TakeAction, Box, BoxWorld const Point = SVector{2, R} where {R <: Real} struct State{K} pos::Point items::SVector{K, Symbol} end function State(pos::Point, items::Vector) items = SVector{length(items)}(items) return State{length(items)}(pos, items) end Base.:(==)(state::State, p::Point) = state.pos == p Base.length(::State{K}) where {K} = K function Base.iterate(state::State, index::Int=1) if index > length(state.items) return nothing end return (state.items[index], index + 1) end struct Action{t} target::Number end struct Box pos::Point end Box(x::Number, y::Number) = Box(Point(x, y)) Base.:(==)(state::State, box::Box) = state.pos == box.pos struct BoxWorld{K} <: POMDP{State{K}, Action, Symbol} spawn::Point items::Vector{Symbol} boxes::SVector{K, Box} terminal::State{K} rewards::OrderedDict{Symbol, <:Number} discount::Real end function BoxWorld(; items::Vector{Symbol}, boxes::Vector, spawn::Point, rewards::OrderedDict{Symbol, Real}, discount=0.95, ) terminal = State{length(boxes)}(Point(-1, -1), fill(:null, length(boxes))) @assert issubset(items, keys(rewards)) boxes = SVector{length(boxes)}(boxes) return BoxWorld{length(boxes)}(spawn, items, boxes, terminal, rewards, discount) end locations(p::BoxWorld) = [p.spawn, [box.pos for box ∈ p.boxes]...] function POMDPs.isterminal(p::BoxWorld, s::State) return s == p.terminal end function POMDPs.discount(p::BoxWorld) return p.discount end include("./states.jl") include("./actions.jl") include("./transitions.jl") include("./observations.jl") include("./rewards.jl") end
BoxesWorld
https://github.com/jmuchovej/BoxesWorld.jl.git
[ "MIT" ]
0.1.3
4d44ffb3d3eb54b6be5a30dd178853a336818e1c
code
385
using POMDPs: actions, actionindex const MoveAction = Action{:move} Move(target::Number) = Action{:move}(target) const TakeAction = Action{:take} Take() = Action{:take}(0) function POMDPs.actions(p::BoxWorld) moves = Move.(1:length(p.boxes)) return [moves..., Take()] end function POMDPs.actionindex(p::BoxWorld, a::Action) return findfirst(isequal(a), actions(p)) end
BoxesWorld
https://github.com/jmuchovej/BoxesWorld.jl.git
[ "MIT" ]
0.1.3
4d44ffb3d3eb54b6be5a30dd178853a336818e1c
code
663
using POMDPs: observations, obsindex, observation function POMDPs.observations(p::BoxWorld) return [p.items..., :null] end function POMDPs.obsindex(p::BoxWorld, o::Symbol) return findfirst(isequal(o), observations(p)) end function POMDPs.observation(p::BoxWorld, a::MoveAction, sp::State) idx = obsindex(p, sp.items[a.target]) dist = zeros(length(observations(p))) dist[idx] = 1.0 return SparseCat(observations(p), dist) end function POMDPs.observation(p::BoxWorld, a::TakeAction, sp::State) idx = obsindex(p, :null) dist = zeros(length(observations(p))) dist[idx] = 1.0 return SparseCat(observations(p), dist) end
BoxesWorld
https://github.com/jmuchovej/BoxesWorld.jl.git
[ "MIT" ]
0.1.3
4d44ffb3d3eb54b6be5a30dd178853a336818e1c
code
628
using POMDPs: reward using Distances: euclidean function POMDPs.reward(p::BoxWorld, s::State, a::MoveAction) box = s.pos boxp = p.boxes[a.target].pos mv_cost = -1 * euclidean(box, boxp) #* Is the agent loitering at the current box? Penalize them. loitering_penalty = box == boxp ? -1 : 0 return mv_cost + loitering_penalty end function POMDPs.reward(p::BoxWorld, s::State, a::TakeAction) box_idx = findfirst(isequal(s.pos), [box.pos for box ∈ p.boxes]) reward = -1 if isnothing(box_idx) return reward end item = s.items[box_idx] return reward + p.rewards[item] end
BoxesWorld
https://github.com/jmuchovej/BoxesWorld.jl.git
[ "MIT" ]
0.1.3
4d44ffb3d3eb54b6be5a30dd178853a336818e1c
code
1922
using POMDPs: stateindex, states, initialstate using LinearAlgebra: normalize function Base.CartesianIndices(p::BoxWorld) nlocations = length(locations(p)) box_item_combos = fill(length(p.items), length(p.boxes)) return CartesianIndices((box_item_combos..., nlocations)) end function Base.LinearIndices(p::BoxWorld) return LinearIndices(CartesianIndices(p)) end function Base.length(p::BoxWorld) return length(CartesianIndices(p)) + 1 end function POMDPs.stateindex(p::BoxWorld, s::State) if isterminal(p, s) return length(p) end pos_idx = findfirst(isequal(s.pos), locations(p)) int_boxes = [findfirst(isequal(item), p.items) for item ∈ s.items] as_index = CartesianIndex((int_boxes..., pos_idx)) stateindex = LinearIndices(p)[as_index] return stateindex end function Base.getindex(p::BoxWorld, stateindex::Int) if stateindex == length(p) return p.terminal end index = CartesianIndices(p)[stateindex] return getindex(p, index) end function Base.getindex(p::BoxWorld, stateindex::CartesianIndex) (item_idxs..., location_idx) = stateindex.I location = locations(p)[location_idx] items = [p.items[idx] for idx ∈ item_idxs] state = BoxesWorld.State(location, items) return state end function Base.iterate(p::BoxWorld, stateindex::Int=1) if stateindex > length(p) return nothing end state = p[stateindex] return (state, stateindex + 1) end function POMDPs.states(p::BoxWorld) return collect(p) end function POMDPs.initialstate(p::BoxWorld) spawn_index = findfirst(isequal(p.spawn), locations(p)) num_boxes = ntuple(_ -> Colon(), length(p.boxes)) indices = CartesianIndices(p)[num_boxes..., spawn_index] spawnstates = [p[index] for index ∈ indices][:] probs = normalize(ones(length(spawnstates)), 1) dist = SparseCat(spawnstates, probs) return dist end
BoxesWorld
https://github.com/jmuchovej/BoxesWorld.jl.git
[ "MIT" ]
0.1.3
4d44ffb3d3eb54b6be5a30dd178853a336818e1c
code
364
using POMDPs: transition function POMDPs.transition(p::BoxWorld, s::State, a::MoveAction) if isterminal(p, s) return Deterministic(s) end box_pos = p.boxes[a.target].pos sp = State(box_pos, s.items) return Deterministic(sp) end function POMDPs.transition(p::BoxWorld, ::State, ::TakeAction) return Deterministic(p.terminal) end
BoxesWorld
https://github.com/jmuchovej/BoxesWorld.jl.git
[ "MIT" ]
0.1.3
4d44ffb3d3eb54b6be5a30dd178853a336818e1c
code
2248
using Test using Random using BoxesWorld using POMDPs using POMDPTools using NativeSARSOP const FRUITS = [:🍋, :🍒, :🥝] function pomdp() return BoxWorld(; items=FRUITS, boxes=[Box(1, 3), Box(3, 3), Box(3, 1)], spawn=Point(1, 1), rewards=Dict(f => r for (f, r) ∈ zip(FRUITS, [20.0, 10.0, 5.0])), ) end @testset "BoxWorld: S" begin p = pomdp() state_iter = states(p) S = ordered_states(p) @test length(state_iter) == length(S) @test all([state == S[idx] for (idx, state) ∈ enumerate(state_iter)]) @test all([state.pos == p.spawn for state ∈ initialstate(p).vals]) @test has_consistent_initial_distribution(p) end @testset "BoxWorld: A" begin p = pomdp() action_iter = actions(p) A = ordered_actions(p) @test length(action_iter) == length(A) @test length(filter(a -> a isa MoveAction, A)) == length(p.boxes) @test all([action == A[idx] for (idx, action) ∈ enumerate(action_iter)]) end @testset "BoxWorld: O|Z" begin rng = MersenneTwister(42) p = pomdp() obs_iter = observations(p) O = ordered_observations(p) @test length(obs_iter) == length(O) @test all([obs == O[idx] for (idx, obs) ∈ enumerate(obs_iter)]) s0 = rand(rng, initialstate(p)) obs = rand(rng, observation(p, Move(1), s0)) @test obs == s0.items[1] # @inferred observation(p, Move(2), s0) # @inferred observation(p, Take() , s0) obs = rand(rng, observation(p, Take(), s0)) @test obs == :null @test has_consistent_observation_distributions(p) end @testset "BoxWorld: T" begin rng = MersenneTwister(42) p = pomdp() s = rand(rng, initialstate(p)) sp = rand(rng, transition(p, s, Move(1))) @test sp.pos == p.boxes[1].pos @test s.items == sp.items @test transition(p, s, Move(1)) isa Deterministic s = rand(rng, initialstate(p)) sp = rand(rng, transition(p, s, Take())) @test isterminal(p, sp) @test sp.items == p.terminal.items @test transition(p, s, Take()) isa Deterministic @test has_consistent_transition_distributions(p) end @testset "BoxWorld: Solvers" begin p = pomdp() sarsop = SARSOPSolver() policy = solve(sarsop, p) @test policy isa AlphaVectorPolicy end
BoxesWorld
https://github.com/jmuchovej/BoxesWorld.jl.git
[ "MIT" ]
0.1.3
4d44ffb3d3eb54b6be5a30dd178853a336818e1c
docs
703
# BoxesWorld [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://jmuchovej.github.io/BoxesWorld.jl/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://jmuchovej.github.io/BoxesWorld.jl/dev/) [![Build Status](https://github.com/jmuchovej/BoxesWorld.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/jmuchovej/BoxesWorld.jl/actions/workflows/CI.yml?query=branch%3Amain) [![Coverage](https://codecov.io/gh/jmuchovej/BoxesWorld.jl/branch/main/graph/badge.svg?token=tnd1L7sWgI)](https://codecov.io/gh/jmuchovej/BoxesWorld.jl) [![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
BoxesWorld
https://github.com/jmuchovej/BoxesWorld.jl.git
[ "MIT" ]
0.1.3
4d44ffb3d3eb54b6be5a30dd178853a336818e1c
docs
187
```@meta CurrentModule = BoxesWorld ``` # BoxesWorld Documentation for [BoxesWorld](https://github.com/jmuchovej/BoxesWorld.jl). ```@index ``` ```@autodocs Modules = [BoxesWorld] ```
BoxesWorld
https://github.com/jmuchovej/BoxesWorld.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
684
using Orbits using Documenter setup = quote using Orbits end DocMeta.setdocmeta!(Orbits, :DocTestSetup, setup; recursive = true) include("pages.jl") makedocs(; modules = [Orbits], authors = "Miles Lucas <[email protected]> and contributors", repo = "https://github.com/juliaastro/Orbits.jl/blob/{commit}{path}#L{line}", sitename = "Orbits.jl", format = Documenter.HTML(; prettyurls = get(ENV, "CI", "false") == "true", canonical = "https://juliaastro.github.io/Orbits.jl", assets = String[], ), pages = pages, ) deploydocs(; repo = "github.com/JuliaAstro/Orbits.jl", push_preview = true, devbranch = "main", )
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
118
pages = [ "Home" => "index.md", "Getting Started" => "gettingstarted.md", "API/Reference" => "api.md", ]
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
1271
module Orbits using ConcreteStructs using StaticArrays using Printf export SimpleOrbit, KeplerianOrbit, relative_position abstract type AbstractOrbit end Base.broadcastable(o::AbstractOrbit) = Ref(o) """ relative_position(::AbstractOrbit, t) The relative position, `[x, y, z]`, of the companion compared to the host at time `t`. In other words, this is the vector pointing from the host to the companion along the line of sight. Nominally, the units of this distance are relative to the host's radius. For example, a distance of 2 is 2 *stellar* radii. """ relative_position(::AbstractOrbit, t) """ position_angle(::AbstractOrbit, t) Calculates the position angle (in degrees) of the companion at time `t` """ function position_angle(orbit::AbstractOrbit, t) x, y, _ = relative_position(orbit, t) return atand(x, y) end """ separation(::AbstractOrbit, t) Calculates the separation of the companion at time `t` """ function separation(orbit::AbstractOrbit, t) x, y, _ = relative_position(orbit, t) return sqrt(x^2 + y^2) end """ flip(::AbstractOrbit) Return a new orbit with the primary and secondary swapped. """ function flip end include("simple.jl") include("keplerian/keplerian.jl") include("plots.jl") end # module
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
874
using RecipesBase @recipe function f(orbit::KeplerianOrbit; N = 90, distance = nothing) # We almost always want to see spatial coordinates with equal step sizes aspect_ratio --> 1 # And we almost always want to reverse the RA coordinate to match how we # see it in the sky. xflip --> true if isnothing(distance) xguide --> "Δx" yguide --> "Δy" end # We trace out in equal steps of true anomaly instead of time for a smooth # curve, regardless of eccentricity. νs = range(-π, π; length = N) pos = @. _position(orbit, -orbit.aR_star, sin(νs), cos(νs)) xs = map(p -> p[1], pos) ys = map(p -> p[2], pos) if !isnothing(distance) xs = @. xs / distance |> u"arcsecond" ys = @. ys / distance |> u"arcsecond" xguide --> "Δra" yguide --> "Δdec" end return xs, ys end
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
2405
@concrete struct SimpleOrbit <: AbstractOrbit period t0 b duration speed half_period ref_time end """ SimpleOrbit(; period, duration, t0=0, b=0.0) Circular orbit parameterized by the basic observables of a transiting system. # Parameters * `period` - The orbital period of the planets, nominally in days * `duration` - The duration of the transit, similar units as `period`. * `t0` - The midpoint time of the reference transit, similar units as `period` * `b` - The impact parameter of the orbit, unitless """ function SimpleOrbit(; period, duration, t0 = zero(period), b = 0) half_period = 0.5 * period duration > half_period && error("duration cannot be longer than half the period") speed = 2.0 * sqrt(1.0 - b^2) / duration ref_time = t0 - half_period SimpleOrbit(period, t0, b, duration, speed, half_period, ref_time) end period(orbit::SimpleOrbit) = orbit.period duration(orbit::SimpleOrbit) = orbit.duration relative_time(orbit::SimpleOrbit, t) = mod(t - orbit.ref_time, period(orbit)) - orbit.half_period function relative_position(orbit::SimpleOrbit, t) Δt = relative_time(orbit, t) x = orbit.speed * Δt y = orbit.b z = abs(Δt) < 0.5 * duration(orbit) ? one(x) : -one(x) return SA[x, y, z] end # TODO: if texp, ϵ += 0.5 * texp #function in_transit(orbit::SimpleOrbit, t) # Δt = relative_time.(orbit, t) # ϵ = 0.5 * duration(orbit) # return findall(x -> abs(x) < ϵ, Δt) #end #function in_transit(orbit::SimpleOrbit, t, r) # Δt = relative_time.(orbit, t) # ϵ = √((1.0 + r)^2.0 - orbit.b^2.0) / orbit.speed # return findall(x -> abs(x) < ϵ, Δt) #end function flip(orbit::SimpleOrbit, ror) t0 = orbit.t0 + orbit.half_period b = orbit.b / ror speed = orbit.speed / ror ref_time = orbit.t0 return SimpleOrbit( period(orbit), t0, b, duration(orbit), speed, orbit.half_period, ref_time, ) end function Base.show(io::IO, orbit::SimpleOrbit) T = duration(orbit) P = period(orbit) b = orbit.b t0 = orbit.t0 print(io, "SimpleOrbit(P=$P, T=$T, t0=$t0, b=$b)") end function Base.show(io::IO, ::MIME"text/plain", orbit::SimpleOrbit) T = duration(orbit) P = period(orbit) b = orbit.b t0 = orbit.t0 print(io, "SimpleOrbit\n period: ", P, "\n duration: ", T, "\n t0: ", t0, "\n b: ", b) end
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
11639
""" KeplerianOrbit(; kwargs...) Keplerian orbit parameterized by the basic observables of a transiting 2-body system. # Parameters * `period`/`P` -- The orbital period of the planet [d]. * `t0`/`t_0` -- The midpoint time of the reference transit [d]. * `tp`/`t_p` -- The time of periastron [d]. * `duration`/`τ`/`T` -- The transit duration [d]. * `a` -- The semi-major axis [R⊙]. * `aR_star`/`aRs` -- The ratio of the semi-major axis to star radius. * `R_planet`/`Rp` -- The radius of the planet [R⊙]. * `R_star`/`Rs` -- The radius of the star [R⊙]. * `rho_star`/`ρ_star` -- The spherical star density [M⊙/R⊙³]. * `r`/`RpRs` -- The ratio of the planet radius to star radius. * `b` -- The impact parameter, bounded between 0 ≤ b ≤ 1. * `ecc`/`e` -- The eccentricity of the closed orbit, bounded between 0 ≤ ecc < 1. * `incl` -- The inclination of the orbital plane relative to the axis perpendicular to the reference plane [rad] * `omega`/`ω` -- The argument of periapsis [rad]. * `cos_omega`/`cos_ω` -- The cosine of the argument of periapsis. * `sin_omega`/`sin_ω` -- The sine of the argument of periapsis. * `Omega`/`Ω` -- The longitude of the ascending node [rad]. * `M_planet`/`Mp` -- The mass of the planet [M⊙]. * `M_star`/`Ms` -- The mass of the star [M⊙]. # Valid combinations The following flowchart can be used to determine which parameters can define a `KeplerianOrbit`: 1. The `period` or `a` must be given. If both given, then neither `M_star` or `rho_star` can be defined because the stellar density is now implied. 2. Only `incl` or `b` can be given. 3. If `ecc` is given, then `omega` must also be given. 4. If no stellar parameters are given, the central body is assumed to be the Sun. If only `rho_star` is given, then `R_star` is defined to be 1 solar radius. Otherwise, at most two of `M_star`, `R_star`, and `rho_star` can be given. 5. Either `t0` or `tp` must be given, but not both. """ @concrete struct KeplerianOrbit <: AbstractOrbit period t0 tp t_ref duration a a_planet a_star R_planet R_star rho_planet rho_star r aR_star b ecc M0 cos_incl sin_incl cos_omega sin_omega cos_Omega sin_Omega incl omega Omega n M_planet M_star end function KeplerianOrbit( nt::NamedTuple{( :period, :t0, :tp, :duration, :a, :R_planet, :R_star, :rho_star, :r, :aR_star, :b, :ecc, :cos_omega, :sin_omega, :incl, :omega, :Omega, :M_planet, :M_star, )}, ) if nt.period isa Real || nt.a isa Real G = G_nom else G = G_unit end if (isnothing(nt.ecc) || iszero(nt.ecc)) && !isnothing(nt.duration) isnothing(nt.b) && throw( ArgumentError( "`b` must also be provided for a circular orbit if `duration given`", ), ) isnothing(nt.r) && throw(ArgumentError("`r` must also be provided if `duration` given")) end a, aR_star, period, rho_star, R_star, M_star, M_planet, duration = compute_consistent_inputs( nt.a, nt.aR_star, nt.period, nt.rho_star, nt.R_star, nt.M_star, nt.M_planet, G, nt.ecc, nt.duration, nt.b, nt.r, ) r = isnothing(nt.r) ? zero(aR_star) : nt.r M_tot = compute_M_tot(M_star, M_planet) R_planet = compute_R_planet(R_star, r, nt.R_planet) rho_planet = compute_rho(M_planet, R_planet) n = 2.0 * π / period a_star = compute_a_X(a, M_planet, M_tot) a_planet = -compute_a_X(a, M_star, M_tot) # Omega Omega = nt.Omega sin_Omega, cos_Omega = sincos(Omega) # Eccentricity ecc = nt.ecc if iszero(ecc) M0 = 0.5 * π incl_factor_inv = 1.0 omega = zero(Omega) cos_omega, sin_omega = 1.0, 0.0 else if !isnothing(nt.omega) all(!isnothing, (nt.cos_omega, nt.sin_omega)) && throw(ArgumentError("Only `ω`, or `cos_ω` and `sin_ω` can be provided")) omega = nt.omega sin_omega, cos_omega = sincos(nt.omega) else cos_omega, sin_omega = nt.cos_omega, nt.sin_omega omega = atan(sin_omega, cos_omega) end E0 = compute_E0(ecc, cos_omega, sin_omega) M0 = compute_M0(ecc, E0) incl_factor_inv = compute_incl_factor_inv(ecc, sin_omega) end # Jacobian for cos(i) -> b dcosi_db = compute_dcosi_db(a, R_star, incl_factor_inv) if !isnothing(nt.b) if any(!isnothing, (nt.incl, duration)) throw(ArgumentError("Only `incl`, `b`, or `duration` can be given")) end b = nt.b cos_incl = dcosi_db * b incl = acos(cos_incl) sin_incl = sin(incl) duration = nt.duration elseif !isnothing(nt.incl) !isnothing(nt.duration) && throw(ArgumentError("Only `incl`, `b`, or `duration` can be given")) incl = nt.incl sin_incl, cos_incl = sincos(incl) b = compute_b(cos_incl, dcosi_db) duration = nt.duration elseif !isnothing(nt.duration) duration = nt.duration b = compute_b(a_planet, R_star, duration, period, incl_factor_inv, ecc, sin_omega) cos_incl = dcosi_db * b incl = acos(cos_incl) sin_incl = sin(incl) else incl = 0.5 * π cos_incl = 0.0 sin_incl = 1.0 b = 0.0 duration = nt.duration end # Compute remaining system parameters t0, tp = compute_t0_tp(nt.t0, nt.tp; M0 = M0, n = n) t_ref = tp - t0 # Sanitize dimensionless units if period isa AbstractQuantity r, aR_star, b = NoUnits.((r, aR_star, b)) end return KeplerianOrbit( period, t0, tp, t_ref, duration, a, a_planet, a_star, R_planet, R_star, rho_planet, rho_star, r, aR_star, b, ecc, M0, cos_incl, sin_incl, cos_omega, sin_omega, cos_Omega, sin_Omega, incl, omega, Omega, n, M_planet, M_star, ) end @kwcall KeplerianOrbit( period = nothing, t0 = nothing, tp = nothing, duration = nothing, a = nothing, R_planet = nothing, R_star = nothing, rho_star = nothing, r = nothing, aR_star = nothing, b = nothing, ecc = 0.0, cos_omega = nothing, sin_omega = nothing, incl = nothing, omega = 0.0, Omega = 0.0, M_planet = nothing, M_star = nothing, ) @kwalias KeplerianOrbit [ P => period, t_0 => t0, t_p => tp, τ => duration, T => duration, aRs => aR_star, Rp => R_planet, Rs => R_star, ρ_star => rho_star, RpRs => r, e => ecc, cos_ω => cos_omega, sin_ω => sin_omega, ω => omega, Ω => Omega, Mp => M_planet, Ms => M_star, ] function compute_consistent_inputs( a, aR_star, period, rho_star, R_star, M_star, M_planet, G, ecc, duration, b, r, ) if isnothing(a) && isnothing(period) throw(ArgumentError("At least `a` or `P` must be specified")) end if (isnothing(ecc) || iszero(ecc)) && !isnothing(duration) isnothing(R_star) && (R_star = compute_R_star_nom(G)) aR_star = compute_aor(duration, period, b, r = r) a = compute_a(aR_star, R_star) duration = nothing end if isnothing(M_planet) && (!isnothing(a) || !isnothing(period)) M_planet = compute_M_planet_nom(G) end # Compute implied stellar density implied_rho_star = false if all(!isnothing, (a, period)) if any(!isnothing, (rho_star, M_star)) throw( ArgumentError( "If both `a` and `P` are given, `rho_star` or `M_star` cannot be defined", ), ) end # Default to R_star = 1 R⊙ if not provided isnothing(R_star) && (R_star = oneunit(a)) # Compute implied mass M_tot = compute_M_tot(a, G, period) # Compute implied density M_star = M_tot - M_planet rho_star = compute_rho_star(M_star, R_star) implied_rho_star = true end # Check combination of stellar params are valid if all(isnothing, (R_star, M_star)) R_star = compute_R_star_nom(G) isnothing(rho_star) && (M_star = oneunit(M_planet)) end if !implied_rho_star && sum(isnothing, (rho_star, R_star, M_star)) ≠ 1 throw( ArgumentError( "Must provide exactly two of: `rho_star`, `R_star`, or `M_star` if rho_star not implied", ), ) end # Compute stellar params if isnothing(rho_star) rho_star = compute_rho_star(M_star, R_star) elseif isnothing(R_star) R_star = compute_R_star(rho_star, M_star) else M_star = compute_M_star(rho_star, R_star) end # Compute planet params M_tot = compute_M_tot(M_star, M_planet) if isnothing(a) if isnothing(aR_star) a = compute_a(M_tot, period, G) aR_star = a / R_star else a = compute_a(aR_star, R_star) end else period = compute_period(M_tot, a, G) aR_star = a / R_star end return a, aR_star, period, rho_star, R_star, M_star, M_planet, duration end stringify_units(value, unit_str) = @sprintf "%.4f %s" value unit_str function stringify_units(value::Unitful.AbstractQuantity, unit_str) u = upreferred(value) return stringify_units(ustrip(u), string(unit(u))) end stringify_units(value::Nothing, unit) = "$(value)" stringify_units(value) = @sprintf "%.4f" value function Base.show(io::IO, ::MIME"text/plain", orbit::KeplerianOrbit) print( IOContext(io, :fancy_exponent => false), """ Keplerian Orbit P: $(stringify_units(orbit.period, "d")) t₀: $(stringify_units(orbit.t0, "d")) tₚ: $(stringify_units(orbit.tp, "d")) t_ref: $(stringify_units(orbit.t_ref, "d")) τ: $(stringify_units(orbit.duration, "d")) a: $(stringify_units(orbit.a, "R⊙")) aₚ: $(stringify_units(orbit.a_planet, "R⊙")) aₛ: $(stringify_units(orbit.a_star, "R⊙")) Rₚ: $(stringify_units(orbit.R_planet, "R⊙")) Rₛ: $(stringify_units(orbit.R_star, "R⊙")) ρₚ: $(stringify_units(orbit.rho_planet, "M⊙/R⊙³")) ρₛ: $(stringify_units(orbit.rho_star, "M⊙/R⊙³")) r: $(stringify_units(orbit.r)) aRₛ: $(stringify_units(orbit.aR_star)) b: $(stringify_units(orbit.b)) ecc: $(stringify_units(orbit.ecc)) cos(i): $(stringify_units(orbit.cos_incl)) sin(i): $(stringify_units(orbit.sin_incl)) cos(ω): $(stringify_units(orbit.cos_omega)) sin(ω): $(stringify_units(orbit.sin_omega)) cos(Ω): $(stringify_units(orbit.cos_Omega)) sin(Ω): $(stringify_units(orbit.sin_Omega)) i: $(stringify_units(orbit.incl, "rad")) ω: $(stringify_units(orbit.omega, "rad")) Ω: $(stringify_units(orbit.Omega, "rad")) Mₚ: $(stringify_units(orbit.M_planet, "M⊙")) Mₛ: $(stringify_units(orbit.M_star, "M⊙"))""", ) end
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
2496
compute_R_star(rho_star, M_star) = cbrt(3.0 * M_star / (4.0 * π * rho_star)) compute_R_star_nom(G::Real) = 1.0 compute_R_star_nom(G) = 1.0u"Rsun" compute_M_star(rho_star, R_star) = 4.0 * π * R_star^3 * rho_star / 3.0 compute_M_planet_nom(G::Real) = 0.0 compute_M_planet_nom(G) = 0.0u"Msun" compute_M_tot(m1, m2) = m1 + m2 compute_M_tot(a, G, period) = 4.0 * π^2 * a^3 / (G * period^2) compute_a(aR_star, R_star) = R_star * aR_star compute_a(M_tot, period, G) = cbrt(G * M_tot * period^2 / (4.0 * π^2)) compute_a_X(a, m, M) = a * m / M compute_period(M_tot, a, G) = 2.0 * π * sqrt(a^3 / (G * M_tot)) compute_rho_star(M_star, R_star) = 3.0 * M_star / (4.0 * π * R_star^3) function compute_E0(ecc, cos_omega, sin_omega) y = sqrt(1.0 - ecc) * cos_omega x = sqrt(1.0 + ecc) * (1.0 + sin_omega) return 2.0 * atan(y, x) end compute_M0(ecc, E0) = E0 - ecc * sin(E0) compute_M(t, t0, t_ref, n) = (t - t0 - t_ref) * n # Spherical density compute_rho(M, R) = 0.75 * M / (π * R^3) compute_rho(M, R::Nothing) = nothing # Semi-major axis / star radius ratio, assuming circular orbit function compute_aor(duration, period, b; r = nothing) r = isnothing(r) ? 0.0 : r sin_ϕ, cos_ϕ = sincos(π * duration / period) return sqrt((1 + r)^2 - (b * cos_ϕ)^2) / sin_ϕ end # Impact radius function compute_b(a_planet, R_star, duration, period, incl_factor_inv, ecc, sin_omega) c = sin(π * duration / (period * incl_factor_inv)) c_sq = c^2 ecc_sin_omega = ecc * sin_omega aor = a_planet / R_star num = aor^2 * c_sq - 1.0 den = c_sq * ecc_sin_omega^2 + 2.0 * c_sq * ecc_sin_omega + c_sq - ecc^4 + 2.0 * ecc^2 - 1.0 return sqrt(num / den) * (1.0 - ecc) * (1.0 + ecc) end compute_b(cos_incl, dcosi_db) = cos_incl / dcosi_db # Inclination factor compute_incl_factor_inv(ecc, sin_omega) = (1.0 - ecc) * (1.0 + ecc) / (1.0 + ecc * sin_omega) # Jacobian for cos(i) -> b compute_dcosi_db(a, R_star, incl_factor_inv) = R_star / (a * incl_factor_inv) # Planet radius compute_R_planet(R_star, r, R_planet) = R_planet compute_R_planet(R_star, r, R_planet::Nothing) = iszero(r) ? zero(R_star) : R_star * r # Transit times compute_t0_tp(t0::Nothing, tp; M0, n) = (tp + M0 / n, tp) compute_t0_tp(t0, tp::Nothing; M0, n) = (t0, t0 - M0 / n) compute_t0_tp(t0::Nothing, tp::Nothing; kwargs...) = throw(ArgumentError("Please specify either `t0` or `tp`")) compute_t0_tp(t0, tp; kwargs...) = throw(ArgumentError("Please only specify one of `t0` or `tp`"))
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
2838
using AstroLib: trueanom, kepler_solver using KeywordCalls using Rotations using Unitful using Unitful: AbstractQuantity using UnitfulAstro # Domain specific unit conversions / constants/ fallbacks Unitful.preferunits(u"Msun,Rsun,d"...) const G_unit = Unitful.G const G_nom = ustrip(u"Rsun^3/Msun/d^2", G_unit) # Helpers include("kepler_helpers.jl") include("constructor.jl") # Finds the position `r` of the planet along its orbit after rotating # through the true anomaly `ν`, then transforms this from the # orbital plan to the equatorial plane # separation: aR_star, a/R_star, a_star / R_star, or a_planet / R_star # TODO: consider moving this to a separate orbital calculations package in the future function _position(orbit, separation, t) sin_ν, cos_ν = compute_true_anomaly(orbit, t) return _position(orbit, separation, sin_ν, cos_ν) end # get a _position that takes true anomaly directly, useful for plotting function _position(orbit, separation, true_anom_sin, true_anom_cos) if isnothing(orbit.ecc) || iszero(orbit.ecc) r = separation else r = separation * (1 + orbit.ecc) * (1 - orbit.ecc) / (1 + orbit.ecc * true_anom_cos) end # Transform from orbital plane to equatorial plane X = SA[r*true_anom_cos, r*true_anom_sin, zero(r)] * oneunit(orbit.R_star) R = RotZXZ(orbit.Omega, -orbit.incl, orbit.omega) return R * X end _star_position(orb, R_star, t) = _position(orb, orb.a_star / R_star, t) _planet_position(orb, R_star, t) = _position(orb, orb.a_planet / R_star, t) relative_position(orbit::KeplerianOrbit, t) = _position(orbit, -orbit.aR_star, t) # Returns sin(ν), cos(ν) function compute_true_anomaly(orbit::KeplerianOrbit, t) M = compute_M(t, orbit.t0, orbit.t_ref, orbit.n) if isnothing(orbit.ecc) || iszero(orbit.ecc) return sincos(M) else E = kepler_solver(uconvert(NoUnits, M), orbit.ecc) return sincos(trueanom(E, orbit.ecc)) end end function flip(orbit::KeplerianOrbit, R_planet) if isnothing(orbit.ecc) || iszero(orbit.ecc) return KeplerianOrbit( period = orbit.period, tp = orbit.tp + 0.5 * orbit.period, incl = orbit.incl, Omega = orbit.Omega, omega = orbit.omega, M_star = orbit.M_planet, M_planet = orbit.M_star, R_star = R_planet, R_planet = orbit.R_star, ecc = orbit.ecc, ) else return KeplerianOrbit( period = orbit.period, tp = orbit.tp, incl = orbit.incl, Omega = orbit.Omega, omega = orbit.omega - π, M_star = orbit.M_planet, M_planet = orbit.M_star, R_star = R_planet, R_planet = orbit.R_star, ecc = orbit.ecc, ) end end
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
16953
using BenchmarkTools using LinearAlgebra using Measurements using Orbits: flip, compute_aor, compute_rho, compute_b, _star_position, _planet_position, stringify_units, position_angle, separation using Statistics # Constants const G_nom = 2942.2062175044193 # Rsun^3/Msun/d^2 const MsunRsun_to_gcc = ustrip(u"g/cm^3", 1.0u"Msun/Rsun^3") # Setup python env import Pkg ENV["PYTHON"] = "" Pkg.build("PyCall") using PyCall, Conda Conda.add(["batman-package"]; channel = "conda-forge") py""" import numpy as np from batman import _rsky def sky_coords(): t = np.linspace(-100, 100, 1_000) t0, period, a, e, omega, incl = ( x.flatten() for x in np.meshgrid( np.linspace(-5.0, 5.0, 2), np.exp(np.linspace(np.log(5.0), np.log(50.0), 3)), np.linspace(50.0, 100.0, 2), np.linspace(0.0, 0.9, 5), np.linspace(-np.pi, np.pi, 3), np.arccos(np.linspace(0, 1, 5)[:-1]), ) ) r_batman = np.empty((len(t), len(t0))) for i in range(len(t0)): r_batman[:, i] = _rsky._rsky( t, t0[i], period[i], a[i], incl[i], e[i], omega[i], 1, 1 ) m = r_batman < 100.0 return { "m_sum" : m.sum().item(), # Save native Int format "r_batman" : r_batman, "m" : m, "t" : t, "t0" : t0, "period" : period, "a" : a, "e" : e, "omega" : omega, "incl" : incl, } def small_star(period, t0, aR_star, incl, ecc, omega): t = np.linspace(0, period, 500) r_batman = _rsky._rsky( t, t0, period, aR_star, incl, ecc, omega, 1, 1 ) m = r_batman < 100.0 return { "t": t, "r_batman": r_batman, "m": m, } """ function compute_r(orbit, t) pos = relative_position(orbit, t) return hypot(pos[1], pos[2]) end # Convert vector of vectors -> matrix as_matrix(pos) = reinterpret(reshape, Float64, pos) |> permutedims # Tests from: # https://github.com/exoplanet-dev/exoplanet/blob/main/tests/orbits/keplerian_test.py @testset "KeplerianOrbit: sky coords" begin # Comparison coords from `batman` sky_coords = py"sky_coords"() # Create comparison orbits from Orbits.jl orbits = map(1:length(sky_coords["t0"])) do i return KeplerianOrbit(; aR_star = sky_coords["a"][i], P = sky_coords["period"][i], incl = sky_coords["incl"][i], t0 = sky_coords["t0"][i], ecc = sky_coords["e"][i], Omega = 0.0, omega = sky_coords["omega"][i], ) end # Compute coords t = sky_coords["t"] x = Matrix{Float64}(undef, length(sky_coords["t"]), length(sky_coords["t0"])) y = similar(x) z = similar(x) for (col, orbit) in enumerate(orbits) for (row, _t) in enumerate(t) pos = relative_position(orbit, _t) x[row, col] = pos[1] y[row, col] = pos[2] z[row, col] = pos[3] end end # Compare m = sky_coords["m"] r = hypot.(x, y) r_Orbits = r[m] r_batman = sky_coords["r_batman"][m] @test count(m) > 0 @test allclose(r_Orbits, r_batman, atol = 2e-5) @test all(>(0), z[m]) no_transit = @. (z[!(m)] < 0) | (r[!(m)] > 2) @test all(no_transit) end @testset "KeplerianOrbit: construction performance" begin b_rho_star = @benchmark KeplerianOrbit( rho_star = 2.0, R_star = 0.5, period = 2.0, ecc = 0.0, t0 = 0.0, incl = π / 2.0, Omega = 0.0, omega = 0.0, ) b_rho_star_units = @benchmark KeplerianOrbit( rho_star = 2.0u"g/cm^3", R_star = 0.5u"Rsun", period = 2.0u"d", ecc = 0.0, t0 = 0.0u"d", incl = 90.0u"°", Omega = 0.0u"°", omega = 0.0u"°", ) b_aR_star = @benchmark KeplerianOrbit( aR_star = 7.5, P = 2.0, incl = π / 2.0, t0 = 0.0, ecc = 0.0, Omega = 0.0, omega = 0.0, ) b_aR_star_units = @benchmark KeplerianOrbit( aR_star = 7.5, P = 2.0u"d", incl = 90.0u"°", t0 = 0.0u"d", ecc = 0.0, Omega = 0.0u"°", omega = 0.0u"°", ) # Units @test median(b_rho_star_units.times) ≤ 100_000 # ns @test b_rho_star_units.allocs ≤ 500 @test median(b_aR_star_units.times) ≤ 100_000 # ns @test b_aR_star_units.allocs ≤ 500 # TODO: Look into this if Base.VERSION < v"1.7" @test b_rho_star.allocs == b_rho_star.memory == 0 @test b_aR_star.allocs == b_aR_star.memory == 0 @test median(b_rho_star.times) ≤ 500 # ns @test median(b_aR_star.times) ≤ 500 # ns else # TODO: investigate performance regression @test median(b_rho_star.times) ≤ 20_000 # ns @test median(b_aR_star.times) ≤ 20_000 # ns end end @testset "KeplerianOrbit: orbital elements" begin orbit = KeplerianOrbit( cos_omega = √(2) / 2, sin_omega = √(2) / 2, period = 2.0, t0 = 0.0, b = 0.01, M_star = 1.0, R_star = 1.0, ecc = 0.0, ) @test orbit.omega == atan(orbit.sin_omega, orbit.cos_omega) orbit = KeplerianOrbit(aR_star = 1.0, period = 2.0, t0 = 0.0) @test iszero(orbit.b) orbit = KeplerianOrbit( period = 2.0, t0 = 0.0, M_star = 1.0, R_star = 1.0, ecc = 0.01, omega = 0.1, r = 0.01, ) @test isnothing(orbit.duration) end @testset "KeplerianOrbit: valid inputs" begin @test_throws ArgumentError( "`b` must also be provided for a circular orbit if `duration given`", ) KeplerianOrbit(duration = 0.01, period = 2.0, t0 = 0.0, R_star = 1.0) @test_throws ArgumentError("`r` must also be provided if `duration` given") KeplerianOrbit( duration = 0.01, b = 0.0, period = 2.0, t0 = 0.0, R_star = 1.0, ) #@test_throws ArgumentError("Only `ω`, or `cos_ω` and `sin_ω` can be provided") KeplerianOrbit( # omega=0.0, cos_omega=1.0, sin_omega=0.0, # period=2.0, t0=0.0, b=0.0, M_star=1.0, R_star=1.0, ecc=0.0, #) #@test_throws ArgumentError("`ω` must also be provided if `ecc` specified") KeplerianOrbit( # rho_star=2.0, R_star=0.5, period=2.0, t0=0.0, incl=π/2.0, Omega=0.0, ecc=0.0, #) @test_throws ArgumentError("Only `incl`, `b`, or `duration` can be given") KeplerianOrbit( incl = π / 2.0, b = 0.0, duration = 1.0, period = 2.0, t0 = 0.0, R_star = 1.0, r = 0.01, ) @test_throws ArgumentError("Please specify either `t0` or `tp`") KeplerianOrbit( b = 0.0, period = 2.0, R_star = 1.0, M_star = 1.0, ) @test_throws ArgumentError("Please only specify one of `t0` or `tp`") KeplerianOrbit( b = 0.0, period = 2.0, R_star = 1.0, M_star = 1.0, t0 = 0.0, tp = 1.0, ) @test_throws ArgumentError("At least `a` or `P` must be specified") KeplerianOrbit( b = 0.0, R_star = 1.0, M_star = 1.0, ) @test_throws ArgumentError( "If both `a` and `P` are given, `rho_star` or `M_star` cannot be defined", ) KeplerianOrbit( rho_star = 2.0, R_star = 0.5, a = 7.5, period = 2.0, t0 = 0.0, incl = π / 2.0, Omega = 0.0, omega = 0.0, ecc = 0.0, ) @test_throws ArgumentError( "If both `a` and `P` are given, `rho_star` or `M_star` cannot be defined", ) KeplerianOrbit( M_star = 1.0, R_star = 0.5, a = 7.5, period = 2.0, t0 = 0.0, incl = π / 2.0, Omega = 0.0, omega = 0.0, ecc = 0.0, ) @test_throws ArgumentError( "Must provide exactly two of: `rho_star`, `R_star`, or `M_star` if rho_star not implied", ) KeplerianOrbit( R_star = 0.5, period = 2.0, t0 = 0.0, incl = π / 2.0, Omega = 0.0, omega = 0.0, ecc = 0.0, ) @test_throws ArgumentError( "Must provide exactly two of: `rho_star`, `R_star`, or `M_star` if rho_star not implied", ) KeplerianOrbit( M_star = 0.5, period = 2.0, t0 = 0.0, incl = π / 2.0, Omega = 0.0, omega = 0.0, ecc = 0.0, ) @test_throws ArgumentError( "Must provide exactly two of: `rho_star`, `R_star`, or `M_star` if rho_star not implied", ) KeplerianOrbit( M_star = 0.5, R_star = 0.5, rho_star = 0.5, period = 2.0, t0 = 0.0, incl = π / 2.0, Omega = 0.0, omega = 0.0, ecc = 0.0, ) end @testset "KeplerianOrbit: implied inputs" begin # R_star ≡ 1.0 R⊙ if not specified orbit_no_R_star = KeplerianOrbit( rho_star = 2.0, period = 2.0, t0 = 0.0, incl = π / 2.0, Omega = 0.0, omega = 0.0, ecc = 0.0, ) @test orbit_no_R_star.R_star == one(orbit_no_R_star.a) # Compute M_tot if `a` and `period` given orbit_a_period = KeplerianOrbit( a = 1.0, period = 1.0, t0 = 0.0, incl = π / 2.0, Omega = 0.0, omega = 0.0, ecc = 0.0, ) @test orbit_a_period.M_planet + orbit_a_period.M_star == 4.0 * π^2 / G_nom # Compute `R_star` from `M_star` orbit_M_star = KeplerianOrbit( M_star = 4.0 * π, rho_star = 1.0, period = 2.0, t0 = 0.0, incl = π / 2.0, Omega = 0.0, omega = 0.0, ecc = 0.0, ) @test orbit_M_star.R_star == 3.0^(1 / 3) end @testset "KeplerianOrbit: small star" begin # Sample model from `Orbits.jl` orbit = KeplerianOrbit( R_star = 0.189, M_star = 0.151, period = 0.4626413, t0 = 0.2, b = 0.5, ecc = 0.1, omega = 0.1, ) # Comparison coords from `batman` small_star = py"small_star"( orbit.period, orbit.t0, orbit.aR_star, orbit.incl, orbit.ecc, orbit.omega, ) # Compare t = small_star["t"] r_batman = small_star["r_batman"] m = small_star["m"] r = compute_r.(orbit, t) @test count(m) > 0 @test allclose(r_batman[m], r[m], atol = 2e-5) end @testset "KeplerianOrbit: impact" begin # Sample model from `Orbits.jl` orbit = KeplerianOrbit( R_star = 0.189, M_star = 0.151, P = 0.4626413, t0 = 0.2, b = 0.5, ecc = 0.8, omega = 0.1, ) pos = relative_position.(orbit, orbit.t0) @test hypot(pos[1], pos[2]) ≈ orbit.b end @testset "KeplerianOrbit: flip" begin orbit = KeplerianOrbit( M_star = 1.3, R_star = 1.1, t0 = 0.5, period = 100.0, ecc = 0.3, incl = 0.25 * π, omega = 0.5, Omega = 1.0, M_planet = 0.1, ) orbit_flipped = flip(orbit, 0.7) t = range(0, 100; length = 1_000) u_star = as_matrix(_star_position.(orbit, orbit.R_star, t)) u_planet_flipped = as_matrix(_planet_position.(orbit_flipped, orbit.R_star, t)) for i = 1:3 @test allclose(u_star[:, i], u_planet_flipped[:, i], atol = 1e-5) end u_planet = as_matrix(_planet_position.(orbit, orbit.R_star, t)) u_star_flipped = as_matrix(_star_position.(orbit_flipped, orbit.R_star, t)) for i = 1:3 @test allclose(u_planet[:, i], u_star_flipped[:, i], atol = 1e-5) end end @testset "KeplerianOrbit: flip circular" begin t = range(0, 100; length = 1_000) orbit = KeplerianOrbit( M_star = 1.3, M_planet = 0.1, R_star = 1.0, P = 100.0, t0 = 0.5, incl = 45.0, ecc = 0.0, omega = 0.5, Omega = 1.0, ) orbit_flipped = flip(orbit, 0.7) u_star = as_matrix(_star_position.(orbit, orbit.R_star, t)) u_planet_flipped = as_matrix(_planet_position.(orbit_flipped, orbit.R_star, t)) for i = 1:3 @test allclose(u_star[:, i], u_planet_flipped[:, i], atol = 1e-5) end u_planet = as_matrix(_planet_position.(orbit, orbit.R_star, t)) u_star_flipped = as_matrix(_star_position.(orbit_flipped, orbit.R_star, t)) for i = 1:3 @test allclose(u_planet[:, i], u_star_flipped[:, i], atol = 1e-5) end end @testset "KeplerianOrbit: compute_aor" begin duration = 0.12 period = 10.1235 b = 0.34 r = 0.06 R_star = 0.7 aor = compute_aor(duration, period, b, r = r) for orbit in [ KeplerianOrbit(period = period, t0 = 0.0, b = b, a = R_star * aor, R_star = R_star), KeplerianOrbit( period = period, t0 = 0.0, b = b, duration = duration, R_star = R_star, r = r, ), ] x, y, z = _planet_position(orbit, R_star, 0.5 * duration) @test allclose(hypot(x, y), 1.0 + r) x, y, z = _planet_position(orbit, R_star, -0.5 * duration) @test allclose(hypot(x, y), 1.0 + r) x, y, z = _planet_position(orbit, R_star, period + 0.5 * duration) @test allclose(hypot(x, y), 1.0 + r) end end @testset "KeplerianOrbit: compute_rho" begin @test isnothing(compute_rho(0.0, nothing)) end @testset "KeplerianOrbit: compute_b" begin @test iszero(compute_b(-1.0, 1.0, 10.0, 2.0, 10.0, 1.0, 0.0)) end @testset "KeplerianOrbit: stringify_units" begin #@test stringify_units(1u"Rsun", "Rsun") == "1 R⊙" @test stringify_units(1, "R⊙") == "1.0000 R⊙" end @testset "KeplerianOrbit: unit conversions" begin orbit = KeplerianOrbit( a = 12.0, t0 = 0.0, b = 0.0, R_star = 1.0, M_star = 1.0, M_planet = 0.01, r = 0.01, ) rho_planet_1 = orbit.rho_planet * u"Msun/Rsun^3" |> u"g/cm^3" rho_planet_2 = orbit.rho_planet * MsunRsun_to_gcc @test rho_planet_1.val == rho_planet_2 orbit = KeplerianOrbit( a = 12.0u"Rsun", t0 = 0.0u"d", b = 0.0, R_star = 1.0u"Rsun", M_star = 1.0u"Msun", ) @test isnan(orbit.rho_planet) orbit = KeplerianOrbit( a = 12.0u"Rsun", t0 = 0.0u"d", b = 0.0, R_star = 1.0u"Rsun", M_planet = 0.01u"Msun", M_star = 1.0u"Msun", r = 0.01, ) rho_planet = orbit.rho_planet |> u"g/cm^3" rho_star = orbit.rho_star |> u"g/cm^3" @test rho_planet.val == orbit.rho_planet.val * MsunRsun_to_gcc @test rho_star.val == orbit.rho_star.val * MsunRsun_to_gcc end @testset "KeplerianOrbit: aliased kwargs" begin orbit_standard_1 = KeplerianOrbit( a = 12.0, t0 = 0.0, b = 0.0, R_star = 1.0, M_star = 1.0, M_planet = 0.01, r = 0.01, ) orbit_kwarg_alias_1 = KeplerianOrbit( a = 12.0, t0 = 0.0, b = 0.0, Rs = 1.0, Ms = 1.0, Mp = 0.01, RpRs = 0.01, ) @test orbit_standard_1 === orbit_kwarg_alias_1 orbit_standard_2 = KeplerianOrbit( rho_star = 2.0, R_star = 0.5, period = 2.0, ecc = 0.0, t0 = 0.0, incl = π / 2.0, Omega = 0.0, omega = 0.0, ) orbit_kwarg_alias_2 = KeplerianOrbit( ρ_star = 2.0, Rs = 0.5, P = 2.0, e = 0.0, t0 = 0.0, incl = π / 2.0, Ω = 0.0, ω = 0.0, ) @test orbit_standard_2 === orbit_kwarg_alias_2 end @testset "KeplerianOrbit: mean anomaly is unitful" begin orbit = KeplerianOrbit(; period = (40.57 ± 0.19)u"yr", ecc = 0.42 ± 0.009, Omega = (318.6 ± 0.6)u"°", tp = (1972.12 ± 0.16)u"yr", incl = (54.7 ± 0.6)u"°", a = (0.154 ± 0.001) * 144.51u"AU", omega = (72.6 ± 0.8)u"°", ) pos = relative_position(orbit, orbit.tp) @test norm(pos) < orbit.a end @testset "KeplerianOrbit: position angle and separation" begin unit_circle = KeplerianOrbit(; period = 1, tp = 0, a = 1, incl = 0) # reminder, PA is from positive y-axis towards positive x-axis # therefore, angle should be atand(x, y) @test position_angle(unit_circle, 0) ≈ -90 @test position_angle(unit_circle, 0.25) ≈ -180 @test position_angle(unit_circle, 0.5) ≈ 90 @test position_angle(unit_circle, 0.75) ≈ 0 atol = 1e-8 @test all(t -> separation(unit_circle, t) ≈ 1, 0:0.25:0.75) ell = KeplerianOrbit(; period = 1, ecc = 0.5, tp = 0, a = 1, incl = 0) @test separation(ell, 0) ≈ (1 - ell.ecc) * ell.a @test separation(ell, 0.5) ≈ (1 + ell.ecc) * ell.a @test position_angle(ell, 0) ≈ -90 @test position_angle(ell, 0.5) ≈ 90 end
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
1839
using RecipesBase: apply_recipe @testset "KeplerianOrbit plotting" begin b_aR_star = KeplerianOrbit( aR_star = 7.5, P = 2.0, incl = π / 2.0, t0 = 0.0, ecc = 0.0, Omega = 0.0, omega = 0.0, ) recipes = apply_recipe(Dict{Symbol,Any}(), b_aR_star) for rec in recipes @test getfield(rec, 1) == Dict{Symbol,Any}(:seriestype => :line, :xguide => "Δx", :yguide => "Δy") x = rec.args[1] y = rec.args[2] @test length(x) == length(y) end end @testset "KeplerianOrbit plotting with units" begin b_rho_star_units = KeplerianOrbit( rho_star = 2.0u"g/cm^3", R_star = 0.5u"Rsun", period = 2.0u"d", ecc = 0.0, t0 = 0.0u"d", incl = 90.0u"°", Omega = 0.0u"°", omega = 0.0u"°", ) recipes = apply_recipe(Dict{Symbol,Any}(), b_rho_star_units) for rec in recipes @test getfield(rec, 1) == Dict{Symbol,Any}(:seriestype => :line, :xguide => "Δx", :yguide => "Δy", :xflip => true) x = rec.args[1] y = rec.args[2] @test length(x) == length(y) end end @testset "KeplerianOrbit plotting with distance" begin distance = inve(6.92e-3)u"pc" orbit = KeplerianOrbit(; period = 40.57u"yr", ecc = 0.42, Omega = 318.6u"°", tp = 1972.12u"yr", incl = 54.7u"°", a = 0.154u"arcsecond" * distance |> u"AU", omega = 72.6u"°", ) recipes = apply_recipe(Dict{Symbol,Any}(), orbit; distance) for rec in recipes @test getfield(rec, 1) == Dict{Symbol,Any}(:seriestype => :line, :xguide => "Δra", :yguide => "Δdec", :xflip => true) x = rec.args[1] y = rec.args[2] @test length(x) == length(y) end end
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
571
using Orbits using StableRNGs using Test using Unitful using UnitfulAstro Unitful.preferunits(u"Rsun,Msun,d"...) ENV["UNITFUL_FANCY_EXPONENTS"] = false # Numpy version of `isapprox` # https://stackoverflow.com/questions/27098844/allclose-how-to-check-if-two-arrays-are-close-in-julia/27100515#27100515 allclose(a, b; rtol = 1e-5, atol = 1e-8) = mapreduce((a, b) -> abs(a - b) ≤ (atol + rtol * abs(b)), &, a, b) rng = StableRNG(2752) @testset "Orbits" begin include("keplerian.jl") include("simple.jl") include("solvers.jl") include("show.jl") end
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
2109
@testset "SimpleOrbit" begin orbit = SimpleOrbit(duration = 1, period = 3) @test sprint(show, orbit) == "SimpleOrbit(P=3, T=1, t0=0, b=0)" @test sprint(show, "text/plain", orbit) == """ SimpleOrbit period: 3 duration: 1 t0: 0 b: 0""" end @testset "KeplerianOrbit" begin orbit = KeplerianOrbit( ρ_star = 1.0, R_star = cbrt(3.0 / (4.0 * π)), period = 2.0, ecc = 0.0, t_0 = 0.0, incl = π / 2.0, Ω = 0.0, ω = 0.0, ) orbit_unit = KeplerianOrbit( ρ_star = 1.0u"g/cm^3", R_star = cbrt(3.0 / (4.0 * π))u"Rsun", period = 2.0u"d", ecc = 0.0, t_0 = 0.0u"d", incl = π / 2.0, Ω = 0.0, ω = 0.0, ) @test repr("text/plain", orbit) === """ Keplerian Orbit P: 2.0000 d t₀: 0.0000 d tₚ: -0.5000 d t_ref: -0.5000 d τ: nothing a: 6.6802 R⊙ aₚ: -6.6802 R⊙ aₛ: 0.0000 R⊙ Rₚ: 0.0000 R⊙ Rₛ: 0.6204 R⊙ ρₚ: NaN M⊙/R⊙³ ρₛ: 1.0000 M⊙/R⊙³ r: 0.0000 aRₛ: 10.7685 b: 0.0000 ecc: 0.0000 cos(i): 0.0000 sin(i): 1.0000 cos(ω): 1.0000 sin(ω): 0.0000 cos(Ω): 1.0000 sin(Ω): 0.0000 i: 1.5708 rad ω: 0.0000 rad Ω: 0.0000 rad Mₚ: 0.0000 M⊙ Mₛ: 1.0000 M⊙""" @test repr("text/plain", orbit_unit) === """ Keplerian Orbit P: 2.0000 d t₀: 0.0000 d tₚ: -0.5000 d t_ref: -0.5000 d τ: nothing a: 3.6958 R⊙ aₚ: -3.6958 R⊙ aₛ: 0.0000 R⊙ Rₚ: 0.0000 R⊙ Rₛ: 0.6204 R⊙ ρₚ: NaN M⊙ R⊙^-3 ρₛ: 0.1693 M⊙ R⊙^-3 r: 0.0000 aRₛ: 5.9576 b: 0.0000 ecc: 0.0000 cos(i): 0.0000 sin(i): 1.0000 cos(ω): 1.0000 sin(ω): 0.0000 cos(Ω): 1.0000 sin(Ω): 0.0000 i: 1.5708 rad ω: 0.0000 rad Ω: 0.0000 rad Mₚ: 0.0000 M⊙ Mₛ: 0.1693 M⊙""" end
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
766
using Orbits: relative_position @testset "simple orbit" begin period = 3.456 t0 = 1.45 b = 0.5 duration = 0.12 t = t0 .+ range(-2.0 * period, 2.0 * period, length = 5000) m0 = @. abs(mod(t - t0 + 0.5 * period, period) - 0.5 * period) < 0.5 * duration orbit = SimpleOrbit(; period, t0, b, duration) pos = @. relative_position(orbit, t) bs = map(v -> sqrt(v[1]^2.0 + v[2]^2.0), pos) zs = map(v -> v[3], pos) m = @. (bs ≤ 1.0) & (zs > 0.0) @test orbit.ref_time == -0.278 @test m ≈ m0 #idxs = in_transit(orbit, t) #@test all(bs[idxs] .≤ 1.0) #@test all(zs[idxs] .> 0.0) # TODO: Do we want this? #pos = @. star_position(orbit, t) #for vec in pos # @test all(vec .≈ 0.0) #end end
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
code
2589
using Orbits: trueanom, kepler_solver # Compute sin_ν, cos_ν without using arctan function directly function compute_sincos_ν_no_atan(E, ecc; tol = 1e-10) sin_E, cos_E = sincos(E) denom = 1.0 + cos_E # Adjust denominator if necessary to avoid dividing by zero m = denom > tol m_inv = !m denom += 1.0 * m_inv # Compute sin ν, cos ν x = √((1 + ecc) / (1 - ecc)) * sin_E / denom # where ν = 2 arctan(x) x² = x * x # Apply trig identites: # sincos(arctan x) = (x, 1) ./ √(1 + x²) # sincos(ν) = 2 sin(arctan x)cos(arctan x), 1 - 2 sin²(arctan x) denom = 1.0 / (1.0 + x²) sin_ν = 2.0 * x * denom cos_ν = (1.0 - x²) * denom return sin_ν * m, cos_ν * m - 1.0 * m_inv end function compute_E_solver(E, ecc) M = E - ecc * sin(E) return kepler_solver(M, ecc) # <- E end function _compute_vals(E, ecc) # Restrict E to the range [-π, π] E = rem2pi(Float64(E), RoundNearest) # Computed from solver E_solver = compute_E_solver(E, ecc) sin_ν_solver, cos_ν_solver = compute_sincos_ν_no_atan(E_solver, ecc) # Computed directly sin_ν, cos_ν = sincos(trueanom(E, ecc)) return [E_solver, E, sin_ν_solver, sin_ν, cos_ν_solver, cos_ν] end # Returns a generator that can be unpacked into: # (E_solver, E_user, # sin_ν_solver, sin_ν_user, # cos_ν_solver, cos_ν_user) compute_summary(Es, eccs) = eachrow(mapreduce(_compute_vals, hcat, Es, eccs)) function test_vals(summary) (E_solver, E_user, sin_ν_solver, sin_ν_user, cos_ν_solver, cos_ν_user) = summary @test all(isfinite.(sin_ν_solver)) @test all(isfinite.(cos_ν_solver)) @test allclose(E_solver, E_user) @test allclose(sin_ν_solver, sin_ν_user) @test allclose(cos_ν_solver, cos_ν_user) end # Tests from: # https://github.com/dfm/kepler.py/blob/main/tests/test_kepler.py @testset "kepler_solver: M, E edge case" begin Es = [0.0, 2 * π, -226.2, -170.4] eccs = fill(1.0 - 1e-6, length(Es)) eccs[end] = 0.9939879759519037 test_vals(compute_summary(Es, eccs)) end @testset "kepler_solver: Let them eat π" begin eccs = range(0.0, 1.0; length = 100)[begin:end-1] Es = fill(π, length(eccs)) test_vals(compute_summary(Es, eccs)) end @testset "kepler_solver: solver" begin ecc_range = range(0, 1; length = 500)[begin:end-1] E_range = range(-300, 300; length = 1_001) E_ecc_pairs = Iterators.product(E_range, ecc_range) Es = reshape(map(x -> x[1], E_ecc_pairs), :, 1) eccs = reshape(map(x -> x[2], E_ecc_pairs), :, 1) test_vals(compute_summary(Es, eccs)) end
Orbits
https://github.com/JuliaAstro/Orbits.jl.git
[ "MIT" ]
0.1.0
716c364edd604db0fbc497f9a8b93f8d700050af
docs
3035
# Orbits.jl [![Build Status](https://github.com/juliaastro/Orbits.jl/workflows/CI/badge.svg?branch=main)](https://github.com/juliaastro/Orbits.jl/actions) [![PkgEval](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/O/Orbits.svg)](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/report.html) [![Coverage](https://codecov.io/gh/juliaastro/Orbits.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/juliaastro/Orbits.jl) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliaastro.github.io/Orbits.jl/stable) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliaastro.github.io/Orbits.jl/dev) Flexible and fast astronomical orbits (originally a submodule of [Transits.jl](https://github.com/JuliaAstro/Transits.jl)). The goals of this package are, in this order: * have a simple interface with high *composability* * be flexible with respect to numeric types and application * be fully compatible with [ChainRules.jl](https://github.com/juliadiff/ChainRules.jl) automatic differentiation (AD) system to leverage the derived analytical gradients * provide a codebase that is well-organized, instructive, and easy to extend * maintain high performance: at least as fast as similar tools ## Installation To install use [Pkg](https://julialang.github.io/Pkg.jl/v1/managing-packages/). From the REPL, press `]` to enter Pkg-mode ```julia pkg> add Orbits ``` If you want to use the most up-to-date version of the code, check it out from `main` ```julia pkg> add Orbits#main ``` ## Usage ```julia using Orbits using Plots using Unitful, UnitfulAstro using UnitfulRecipes # orbital params for SAO 136799 distance = inv(6.92e-3)u"pc" orbit = KeplerianOrbit(; period = 40.57u"yr", ecc = 0.42, Omega = 318.6u"°", tp = 1972.12u"yr", incl = 54.7u"°", a = 0.154u"arcsecond" * distance |> u"AU", omega = 72.6u"°", ) # get position at specific time t = 2022.134u"yr" pos = relative_position(orbit, t) ra_off, dec_off = @. pos[1:2] / distance |> u"arcsecond" ``` ```julia 2-element Vector{Quantity{Float64, NoDims, Unitful.FreeUnits{(″,), NoDims, nothing}}}: 0.14482641030730156 ″ -0.07816487001285195 ″ ``` --- ```julia # plot using Unitful recipes plot(orbit; distance, lab="", leg=:topleft) scatter!([0u"arcsecond" ra_off], [0u"arcsecond" dec_off], c=[:black 1], m=[:+ :o], lab=["SAO 136799A" "B ($t)"]) ``` ![](docs/src/assets/sao136799.png) --- ```julia pa = round(Orbits.position_angle(orbit, t), sigdigits=5) sep = round(u"AU", Orbits.separation(orbit, t), sigdigits=5) pa, sep ``` ``` (118.36, 23.782 AU) ``` ## Contributing and Support If you would like to contribute, feel free to open a [pull request](https://github.com/JuliaAstro/Orbits.jl/pulls). If you want to discuss something before contributing, head over to [discussions](https://github.com/JuliaAstro/Orbits.jl/discussions) and join or open a new topic.
Orbits
https://github.com/JuliaAstro/Orbits.jl.git