diff --git a/README.md b/README.md index dab77f9..2cf3b49 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ # dJUICE differentiable JUlia ICE model -(Mathieu Morlighem, 2022/01) + +Authors: + - Mathieu Morlighem, Dartmouth College + +License: MIT diff --git a/core/analyses/analysis.jl b/core/analyses/analysis.jl new file mode 100644 index 0000000..ea81241 --- /dev/null +++ b/core/analyses/analysis.jl @@ -0,0 +1,2 @@ +#Analysis class definitions +abstract type Analysis end diff --git a/core/analyses/masstransportanalysis.jl b/core/analyses/masstransportanalysis.jl new file mode 100644 index 0000000..ce0ce14 --- /dev/null +++ b/core/analyses/masstransportanalysis.jl @@ -0,0 +1,275 @@ +#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 + +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 +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) + +end#}}} +function UpdateParameters(analysis::MasstransportAnalysis,parameters::Parameters,md::model) #{{{ + + AddParam(parameters, md.masstransport.min_thickness, MasstransportMinThicknessEnum) + AddParam(parameters, md.masstransport.stabilization, MasstransportStabilizationEnum) + +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]) + +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) + +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]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) +end#}}} +function UpdateConstraints(analysis::MasstransportAnalysis, femmodel::FemModel) #{{{ + SetActiveNodesLSMx(femmodel) +end#}}} diff --git a/core/analyses/stressbalanceanalysis.jl b/core/analyses/stressbalanceanalysis.jl new file mode 100644 index 0000000..ef81dc4 --- /dev/null +++ b/core/analyses/stressbalanceanalysis.jl @@ -0,0 +1,284 @@ +#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 + +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 +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) + elseif typeof(md.friction)==WeertmanFriction + FetchDataToInput(md,inputs,elements,md.friction.C,FrictionCEnum) + FetchDataToInput(md,inputs,elements,md.friction.m,FrictionMEnum) + else + error("Friction ", typeof(md.friction), " not supported yet") + end + +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) + else + error("Friction ", typeof(md.friction), " not supported yet") + end +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]) + +end #}}} +function CreateKMatrix(analysis::StressbalanceAnalysis,element::Tria)# {{{ + + 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) + + #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) + + #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)# {{{ + + 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) + 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) + +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) +end#}}} +function UpdateConstraints(analysis::StressbalanceAnalysis, femmodel::FemModel) #{{{ + SetActiveNodesLSMx(femmodel) +end#}}} diff --git a/core/analyses/transientanalysis.jl b/core/analyses/transientanalysis.jl new file mode 100644 index 0000000..ab3248a --- /dev/null +++ b/core/analyses/transientanalysis.jl @@ -0,0 +1,44 @@ +#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) + +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) + + 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(ismasstransport) Core(MasstransportAnalysis(), femmodel) end + MigrateGroundinglinex(femmodel) + + step+=1 + end + + println("=======================================") + println(" Simulation completed successfully" ) + println("=======================================") + +end #}}} diff --git a/core/constraints.jl b/core/constraints.jl new file mode 100644 index 0000000..3379246 --- /dev/null +++ b/core/constraints.jl @@ -0,0 +1,18 @@ +#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) + +end# }}} diff --git a/core/elementmatrix.jl b/core/elementmatrix.jl new file mode 100644 index 0000000..b29d7ae --- /dev/null +++ b/core/elementmatrix.jl @@ -0,0 +1,117 @@ +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) +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 + +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 +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) +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 + +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 +end#}}} diff --git a/core/elements.jl b/core/elements.jl new file mode 100644 index 0000000..9caa133 --- /dev/null +++ b/core/elements.jl @@ -0,0 +1,489 @@ +#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(Dict{IssmEnum,Parameter}()) + 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 yet"); + end +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 +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 +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 +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 + +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 + +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 + +end # }}} +function FindParam(::Type{T}, element::Tria, enum::IssmEnum) where T # {{{ + + return FindParam(T, element.parameters, enum) + +end # }}} +function InputServe!(element::Tria,input::ElementInput) # {{{ + + 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 + +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 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],:] + +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 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) + +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 + + +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 + +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 +end#}}} +function NumberofNodesTria(finiteelement) #{{{ + + if (finiteelement==P0Enum) return 0 + elseif(finiteelement==P1Enum) return 3 + else + error("Element type ",finiteelement," not supported yet") + end +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 +end #}}} diff --git a/core/femmodel.jl b/core/femmodel.jl new file mode 100644 index 0000000..3ff58c0 --- /dev/null +++ b/core/femmodel.jl @@ -0,0 +1,40 @@ +#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] + +end#}}} diff --git a/core/friction.jl b/core/friction.jl new file mode 100644 index 0000000..527f98b --- /dev/null +++ b/core/friction.jl @@ -0,0 +1,69 @@ +#Friction class definition + +abstract type CoreFriction end +struct CoreBuddFriction#{{{ + H_input::ElementInput + b_input::ElementInput + c_input::ElementInput + rho_ice::Float64 + rho_water::Float64 + g::Float64 +end# }}} +struct CoreWeertmanFriction#{{{ + c_input::ElementInput + m_input::ElementInput + vx_input::ElementInput + vy_input::ElementInput +end# }}} + +function CoreFriction(element::Tria) #{{{ + + frictionlaw = FindParam(Int64, element, FrictionLawEnum) + + if frictionlaw==1 + H_input = GetInput(element, ThicknessEnum) + b_input = GetInput(element, BaseEnum) + c_input = GetInput(element, FrictionCoefficientEnum) + + rho_ice = FindParam(Float64, element, MaterialsRhoIceEnum) + rho_water = FindParam(Float64, element, MaterialsRhoSeawaterEnum) + g = FindParam(Float64, element, ConstantsGEnum) + + return CoreBuddFriction(H_input, b_input, c_input, rho_ice, rho_water, g) + elseif frictionlaw==2 + c_input = GetInput(element, FrictionCEnum) + m_input = GetInput(element, FrictionMEnum) + vx_input = GetInput(element, VxEnum) + vy_input = GetInput(element, VyEnum) + return CoreWeertmanFriction(c_input,m_input,vx_input,vy_input) + else + error("Friction ",typeof(md.friction)," not supported yet") + end +end#}}} + +#vertices functions +function Alpha2(friction::CoreBuddFriction, gauss::GaussTria, i::Int64) #{{{ + + #Get effective pressure + H = GetInputValue(friction.H_input, gauss, i) + b = GetInputValue(friction.b_input, gauss, i) + c = GetInputValue(friction.c_input, gauss, i) + N = friction.rho_ice*friction.g*H + friction.rho_water*friction.g*b + + if(N<0) N=0 end + + return c^2*N +end #}}} + +function Alpha2(friction::CoreWeertmanFriction, gauss::GaussTria, i::Int64)#{{{ + c = GetInputValue(friction.c_input, gauss, i) + m = GetInputValue(friction.m_input, gauss, i) + vx = GetInputValue(friction.vx_input, gauss, i) + vy = GetInputValue(friction.vy_input, gauss, i) + + if sqrt(vx^2+vy^2)==0 && m<1 + return 0 + else + return c^2*sqrt(vx^2+vy^2)^(m-1) + end +end#}}} diff --git a/core/gauss.jl b/core/gauss.jl new file mode 100644 index 0000000..fe5769d --- /dev/null +++ b/core/gauss.jl @@ -0,0 +1,113 @@ +#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) +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# }}} diff --git a/core/inputs.jl b/core/inputs.jl new file mode 100644 index 0000000..69c9490 --- /dev/null +++ b/core/inputs.jl @@ -0,0 +1,167 @@ +#Input class definition +abstract type Input end +struct BoolInput <: Input#{{{ + enum::IssmEnum + values::Matrix{Bool} +end# }}} +struct IntInput <: Input#{{{ + enum::IssmEnum + values::Matrix{Int64} +end# }}} +struct ElementInput <: 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 SetInput(inputs::Inputs,enum::IssmEnum,index::Int64,value::Bool) #{{{ + + #Does this input exist + if !haskey(inputs.lookup,enum) + #it does not exist yet, we need to create it... + @assert inputs.numberofelements > 0 + input = BoolInput(enum,zeros(Bool,inputs.numberofelements)) + inputs.lookup[enum] = BoolInput(enum,zeros(Bool,inputs.numberofelements)) + end + + #Get this input and check type + input = inputs.lookup[enum] + if typeof(input)!=BoolInput error("not consistent") end + + #set value + @assert index>0 && index<=inputs.numberofelements + input.values[index] = value +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] = ElementInput(enum,interp,zeros(inputs.numberofelements),Vector{Float64}(undef,1)) + elseif interp==P1Enum + inputs.lookup[enum] = ElementInput(enum,interp,zeros(inputs.numberofvertices),Vector{Float64}(undef,3)) + else + error("not supported yet") + end + end + + #Get this input and check type + input = inputs.lookup[enum] + if typeof(input)!=ElementInput error("input type not consistent") end + if interp!=input.interp error("input interpolations not consistent") end + + #set value + input.values[index] = value +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] = ElementInput(enum,interp,zeros(inputs.numberofvertices),Vector{Float64}(undef,3)) + else + error("not supported yet") + end + end + + #Get this input and check type + input = inputs.lookup[enum] + if typeof(input)!=ElementInput error("input type not consistent") end + if interp!=input.interp error("input interpolations not consistent") end + + #set value + input.values[indices] = values +end#}}} +function GetInputAverageValue(input::ElementInput) #{{{ + + 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::ElementInput) #{{{ + + return minimum(input.element_values) + +end#}}} +function GetInputValue(input::ElementInput,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::ElementInput,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)==ElementInput + inputs.lookup[new] = ElementInput(new, oldinput.interp, copy(oldinput.values), copy(oldinput.element_values)) + end + +end#}}} diff --git a/core/issmenums.jl b/core/issmenums.jl new file mode 100644 index 0000000..532e11a --- /dev/null +++ b/core/issmenums.jl @@ -0,0 +1,3111 @@ +# 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 + 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 + BasalforcingsBottomplumedepthEnum + BasalforcingsCrustthicknessEnum + BasalforcingsDeepwaterElevationEnum + BasalforcingsDeepwaterMeltingRateEnum + BasalforcingsDtbgEnum + BasalforcingsEnum + BasalforcingsIsmip6AverageTfEnum + BasalforcingsIsmip6BasinAreaEnum + BasalforcingsIsmip6DeltaTEnum + BasalforcingsIsmip6Gamma0Enum + BasalforcingsIsmip6IsLocalEnum + BasalforcingsIsmip6NumBasinsEnum + BasalforcingsIsmip6TfDepthsEnum + BasalforcingsLowercrustheatEnum + BasalforcingsMantleconductivityEnum + BasalforcingsNusseltEnum + 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 + 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 + FlowequationIsMLHOEnum + 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 + 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 + 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 + LoveCoreMantleBoundaryEnum + LoveEarthMassEnum + LoveForcingTypeEnum + LoveFrequenciesEnum + LoveIsTemporalEnum + LoveG0Enum + LoveGravitationalConstantEnum + LoveInnerCoreBoundaryEnum + LoveComplexComputationEnum + LoveIntStepsPerLayerEnum + LoveKernelsEnum + LoveMu0Enum + LoveNfreqEnum + LoveNTemporalIterationsEnum + LoveNYiEquationsEnum + LoveR0Enum + LoveShNmaxEnum + LoveShNminEnum + LoveStartingLayerEnum + LoveUnderflowTolEnum + 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 + SamplingPhiEnum + SamplingNumRequestedOutputsEnum + SamplingRequestedOutputsEnum + SamplingRobinEnum + SamplingSeedEnum + SamplingTauEnum + SaveResultsEnum + SolidearthPartitionIceEnum + SolidearthPartitionHydroEnum + SolidearthPartitionOceanEnum + SolidearthNpartIceEnum + SolidearthNpartOceanEnum + SolidearthNpartHydroEnum + SolidearthPlanetRadiusEnum + SolidearthPlanetAreaEnum + SolidearthSettingsAbstolEnum + SolidearthSettingsCrossSectionShapeEnum + RotationalAngularVelocityEnum + SolidearthSettingsElasticEnum + SolidearthSettingsViscousEnum + SealevelchangeGeometryDoneEnum + SealevelchangeViscousNumStepsEnum + SealevelchangeViscousTimesEnum + SealevelchangeViscousIndexEnum + RotationalEquatorialMoiEnum + TidalLoveHEnum + TidalLoveKEnum + TidalLoveLEnum + TidalLoveK2SecularEnum + LoadLoveHEnum + LoadLoveKEnum + LoadLoveLEnum + LoveTimeFreqEnum + LoveIsTimeEnum + SealevelchangeGSelfAttractionEnum + SealevelchangeGViscoElasticEnum + SolidearthSettingsSealevelLoadingEnum + SolidearthSettingsGRDEnum + SolidearthSettingsRunFrequencyEnum + SolidearthSettingsTimeAccEnum + SealevelchangeHViscoElasticEnum + SolidearthSettingsHorizEnum + SolidearthSettingsMaxiterEnum + SolidearthSettingsGrdOceanEnum + SolidearthSettingsOceanAreaScalingEnum + StochasticForcingCovarianceEnum + StochasticForcingDefaultDimensionEnum + StochasticForcingDimensionsEnum + StochasticForcingFieldsEnum + StochasticForcingIsEffectivePressureEnum + StochasticForcingIsStochasticForcingEnum + StochasticForcingIsWaterPressureEnum + StochasticForcingNumFieldsEnum + StochasticForcingRandomflagEnum + RotationalPolarMoiEnum + SolidearthSettingsReltolEnum + SealevelchangeRequestedOutputsEnum + SolidearthSettingsSelfAttractionEnum + SolidearthSettingsRotationEnum + SolidearthSettingsMaxSHCoeffEnum + SealevelchangeRunCountEnum + SealevelchangeTransitionsEnum + SealevelchangeUViscoElasticEnum + SettingsIoGatherEnum + SettingsNumResultsOnNodesEnum + SettingsOutputFrequencyEnum + SettingsCheckpointFrequencyEnum + SettingsResultsOnNodesEnum + SettingsSbCouplingFrequencyEnum + SettingsSolverResidueThresholdEnum + SettingsWaitonlockEnum + SmbAIceEnum + SmbAIdxEnum + SmbASnowEnum + SmbAccualtiEnum + SmbAccugradEnum + SmbAccurefEnum + SmbAdThreshEnum + SmbAutoregressionInitialTimeEnum + SmbAutoregressionTimestepEnum + SmbAutoregressiveOrderEnum + SmbAveragingEnum + SmbBeta0Enum + SmbBeta1Enum + SmbDesfacEnum + SmbDpermilEnum + SmbDsnowIdxEnum + 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 + SmbNumBasinsEnum + SmbNumRequestedOutputsEnum + SmbPfacEnum + SmbPhiEnum + SmbRdlEnum + SmbRequestedOutputsEnum + SmbRlapsEnum + SmbRlapslgmEnum + SmbRunoffaltiEnum + SmbRunoffgradEnum + SmbRunoffrefEnum + SmbSealevEnum + SmbStepsPerStepEnum + SmbSwIdxEnum + SmbT0dryEnum + SmbT0wetEnum + 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 + TimesteppingCflCoefficientEnum + TimesteppingCouplingTimeEnum + TimesteppingFinalTimeEnum + TimesteppingInterpForcingEnum + TimesteppingCycleForcingEnum + TimesteppingStartTimeEnum + TimesteppingTimeStepEnum + TimesteppingTimeStepMaxEnum + TimesteppingTimeStepMinEnum + TimesteppingTypeEnum + ToMITgcmCommEnum + ToolkitsFileNameEnum + ToolkitsOptionsAnalysesEnum + ToolkitsOptionsStringsEnum + ToolkitsTypesEnum + TransientAmrFrequencyEnum + 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 + AirEnum + ApproximationEnum + BalancethicknessMisfitEnum + BalancethicknessOmega0Enum + BalancethicknessOmegaEnum + BalancethicknessSpcthicknessEnum + BalancethicknessThickeningRateEnum + BasalCrevasseEnum + BasalforcingsFloatingiceMeltingRateEnum + BasalforcingsGeothermalfluxEnum + BasalforcingsGroundediceMeltingRateEnum + BasalforcingsPerturbationMeltingRateEnum + BasalforcingsIsmip6BasinIdEnum + BasalforcingsIsmip6TfEnum + BasalforcingsIsmip6TfShelfEnum + BasalforcingsIsmip6MeltAnomalyEnum + BasalforcingsMeltrateFactorEnum + BasalforcingsOceanSalinityEnum + BasalforcingsOceanTempEnum + BasalforcingsPicoBasinIdEnum + BasalforcingsPicoBoxIdEnum + BasalforcingsPicoOverturningCoeffEnum + BasalforcingsPicoSubShelfOceanOverturningEnum + BasalforcingsPicoSubShelfOceanSalinityEnum + BasalforcingsPicoSubShelfOceanTempEnum + BasalStressxEnum + BasalStressyEnum + BasalStressEnum + BaseEnum + BaseOldEnum + BaseSlopeXEnum + BaseSlopeYEnum + BaselineBasalforcingsFloatingiceMeltingRateEnum + BaselineCalvingCalvingrateEnum + BaselineFrictionEffectivePressureEnum + BedEnum + BedGRDEnum + BedEastEnum + BedEastGRDEnum + BedNorthEnum + BedNorthGRDEnum + BedSlopeXEnum + BedSlopeYEnum + BottomPressureEnum + BottomPressureOldEnum + CalvingCalvingrateEnum + CalvingHabFractionEnum + CalvingMeltingrateEnum + CalvingStressThresholdFloatingiceEnum + CalvingStressThresholdGroundediceEnum + CalvinglevermannCoeffEnum + CalvingratexAverageEnum + CalvingratexEnum + CalvingrateyAverageEnum + 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 + FrictionEffectivePressureEnum + FrictionMEnum + FrictionPEnum + FrictionPressureAdjustedTemperatureEnum + FrictionQEnum + FrictionSedimentCompressibilityCoefficientEnum + FrictionTillFrictionAngleEnum + FrictionWaterLayerEnum + 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 + SamplingBetaEnum + SamplingKappaEnum + SealevelEnum + SealevelGRDEnum + 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 + SealevelGrotm1Enum + SealevelGrotm2Enum + SealevelGrotm3Enum + SealevelGUrotm1Enum + SealevelGUrotm2Enum + SealevelGUrotm3Enum + SealevelGNrotm1Enum + SealevelGNrotm2Enum + SealevelGNrotm3Enum + SealevelGErotm1Enum + SealevelGErotm2Enum + SealevelGErotm3Enum + SealevelRSLBarystaticEnum + SealevelRSLRateEnum + SealevelUGrdEnum + SealevelNGrdEnum + SealevelUEastEsaEnum + SealevelUNorthEsaEnum + SealevelchangeIndicesEnum + SealevelchangeGEnum + SealevelchangeGUEnum + SealevelchangeGEEnum + SealevelchangeGNEnum + SealevelchangeGsubelOceanEnum + SealevelchangeGUsubelOceanEnum + SealevelchangeGEsubelOceanEnum + SealevelchangeGNsubelOceanEnum + SealevelchangeGsubelIceEnum + SealevelchangeGUsubelIceEnum + SealevelchangeGEsubelIceEnum + SealevelchangeGNsubelIceEnum + SealevelchangeGsubelHydroEnum + SealevelchangeGUsubelHydroEnum + SealevelchangeGEsubelHydroEnum + SealevelchangeGNsubelHydroEnum + SealevelchangeViscousRSLEnum + 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 + FrictionWaterPressureEnum + FrictionWaterPressureNoiseEnum + 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 + AggressiveMigrationEnum + AmrBamgEnum + AmrNeopzEnum + AndroidFrictionCoefficientEnum + ArrheniusEnum + AutodiffJacobianEnum + Balancethickness2AnalysisEnum + Balancethickness2SolutionEnum + BalancethicknessAnalysisEnum + BalancethicknessApparentMassbalanceEnum + BalancethicknessSoftAnalysisEnum + BalancethicknessSoftSolutionEnum + BalancethicknessSolutionEnum + BalancevelocityAnalysisEnum + BalancevelocitySolutionEnum + BasalforcingsIsmip6Enum + BasalforcingsPicoEnum + BeckmannGoosseFloatingMeltRateEnum + BedSlopeSolutionEnum + BoolExternalResultEnum + BoolInputEnum + IntInputEnum + DoubleInputEnum + BoolParamEnum + BoundaryEnum + BuddJackaEnum + CalvingDev2Enum + CalvingHabEnum + CalvingLevermannEnum + 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 + 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 + 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 + MLHOApproximationEnum + L2ProjectionBaseAnalysisEnum + L2ProjectionEPLAnalysisEnum + LACrouzeixRaviartEnum + LATaylorHoodEnum + LambdaSEnum + LevelsetAnalysisEnum + LevelsetfunctionPicardEnum + LinearFloatingMeltRateEnum + LliboutryDuvalEnum + LoadsEnum + LoveAnalysisEnum + LoveHiEnum + LoveHrEnum + LoveKernelsImagEnum + LoveKernelsRealEnum + LoveKiEnum + LoveKrEnum + LoveLiEnum + LoveLrEnum + 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 + SealevelInertiaTensorXZEnum + SealevelInertiaTensorYZEnum + SealevelInertiaTensorZZEnum + 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==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==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==BasalforcingsLowercrustheatEnum) return "BasalforcingsLowercrustheat" end + if(enum==BasalforcingsMantleconductivityEnum) return "BasalforcingsMantleconductivity" end + if(enum==BasalforcingsNusseltEnum) return "BasalforcingsNusselt" 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==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==FlowequationIsMLHOEnum) return "FlowequationIsMLHO" 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==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==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==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==LoveIntStepsPerLayerEnum) return "LoveIntStepsPerLayer" 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==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==SamplingPhiEnum) return "SamplingPhi" 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==SamplingTauEnum) return "SamplingTau" 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==RotationalAngularVelocityEnum) return "RotationalAngularVelocity" end + if(enum==SolidearthSettingsElasticEnum) return "SolidearthSettingsElastic" end + if(enum==SolidearthSettingsViscousEnum) return "SolidearthSettingsViscous" 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==RotationalEquatorialMoiEnum) return "RotationalEquatorialMoi" 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==SealevelchangeGSelfAttractionEnum) return "SealevelchangeGSelfAttraction" end + if(enum==SealevelchangeGViscoElasticEnum) return "SealevelchangeGViscoElastic" 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==SealevelchangeHViscoElasticEnum) return "SealevelchangeHViscoElastic" 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==StochasticForcingNumFieldsEnum) return "StochasticForcingNumFields" end + if(enum==StochasticForcingRandomflagEnum) return "StochasticForcingRandomflag" end + if(enum==RotationalPolarMoiEnum) return "RotationalPolarMoi" end + if(enum==SolidearthSettingsReltolEnum) return "SolidearthSettingsReltol" end + if(enum==SealevelchangeRequestedOutputsEnum) return "SealevelchangeRequestedOutputs" end + if(enum==SolidearthSettingsSelfAttractionEnum) return "SolidearthSettingsSelfAttraction" end + if(enum==SolidearthSettingsRotationEnum) return "SolidearthSettingsRotation" end + if(enum==SolidearthSettingsMaxSHCoeffEnum) return "SolidearthSettingsMaxSHCoeff" end + if(enum==SealevelchangeRunCountEnum) return "SealevelchangeRunCount" end + if(enum==SealevelchangeTransitionsEnum) return "SealevelchangeTransitions" end + if(enum==SealevelchangeUViscoElasticEnum) return "SealevelchangeUViscoElastic" 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==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==SmbNumBasinsEnum) return "SmbNumBasins" 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==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==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==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==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==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==BasalforcingsFloatingiceMeltingRateEnum) return "BasalforcingsFloatingiceMeltingRate" end + if(enum==BasalforcingsGeothermalfluxEnum) return "BasalforcingsGeothermalflux" end + if(enum==BasalforcingsGroundediceMeltingRateEnum) return "BasalforcingsGroundediceMeltingRate" end + if(enum==BasalforcingsPerturbationMeltingRateEnum) return "BasalforcingsPerturbationMeltingRate" 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==BaselineCalvingCalvingrateEnum) return "BaselineCalvingCalvingrate" end + if(enum==BaselineFrictionEffectivePressureEnum) return "BaselineFrictionEffectivePressure" 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==CalvingMeltingrateEnum) return "CalvingMeltingrate" end + if(enum==CalvingStressThresholdFloatingiceEnum) return "CalvingStressThresholdFloatingice" end + if(enum==CalvingStressThresholdGroundediceEnum) return "CalvingStressThresholdGroundedice" end + if(enum==CalvinglevermannCoeffEnum) return "CalvinglevermannCoeff" end + if(enum==CalvingratexAverageEnum) return "CalvingratexAverage" end + if(enum==CalvingratexEnum) return "Calvingratex" end + if(enum==CalvingrateyAverageEnum) return "CalvingrateyAverage" 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==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==FrictionWaterLayerEnum) return "FrictionWaterLayer" 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==SamplingBetaEnum) return "SamplingBeta" end + if(enum==SamplingKappaEnum) return "SamplingKappa" end + if(enum==SealevelEnum) return "Sealevel" end + if(enum==SealevelGRDEnum) return "SealevelGRD" 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==SealevelGrotm1Enum) return "SealevelGrotm1" end + if(enum==SealevelGrotm2Enum) return "SealevelGrotm2" end + if(enum==SealevelGrotm3Enum) return "SealevelGrotm3" end + if(enum==SealevelGUrotm1Enum) return "SealevelGUrotm1" end + if(enum==SealevelGUrotm2Enum) return "SealevelGUrotm2" end + if(enum==SealevelGUrotm3Enum) return "SealevelGUrotm3" end + if(enum==SealevelGNrotm1Enum) return "SealevelGNrotm1" end + if(enum==SealevelGNrotm2Enum) return "SealevelGNrotm2" end + if(enum==SealevelGNrotm3Enum) return "SealevelGNrotm3" end + if(enum==SealevelGErotm1Enum) return "SealevelGErotm1" end + if(enum==SealevelGErotm2Enum) return "SealevelGErotm2" end + if(enum==SealevelGErotm3Enum) return "SealevelGErotm3" 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==SealevelchangeGEnum) return "SealevelchangeG" end + if(enum==SealevelchangeGUEnum) return "SealevelchangeGU" end + if(enum==SealevelchangeGEEnum) return "SealevelchangeGE" end + if(enum==SealevelchangeGNEnum) return "SealevelchangeGN" end + if(enum==SealevelchangeGsubelOceanEnum) return "SealevelchangeGsubelOcean" end + if(enum==SealevelchangeGUsubelOceanEnum) return "SealevelchangeGUsubelOcean" end + if(enum==SealevelchangeGEsubelOceanEnum) return "SealevelchangeGEsubelOcean" end + if(enum==SealevelchangeGNsubelOceanEnum) return "SealevelchangeGNsubelOcean" end + if(enum==SealevelchangeGsubelIceEnum) return "SealevelchangeGsubelIce" end + if(enum==SealevelchangeGUsubelIceEnum) return "SealevelchangeGUsubelIce" end + if(enum==SealevelchangeGEsubelIceEnum) return "SealevelchangeGEsubelIce" end + if(enum==SealevelchangeGNsubelIceEnum) return "SealevelchangeGNsubelIce" end + if(enum==SealevelchangeGsubelHydroEnum) return "SealevelchangeGsubelHydro" end + if(enum==SealevelchangeGUsubelHydroEnum) return "SealevelchangeGUsubelHydro" end + if(enum==SealevelchangeGEsubelHydroEnum) return "SealevelchangeGEsubelHydro" end + if(enum==SealevelchangeGNsubelHydroEnum) return "SealevelchangeGNsubelHydro" end + if(enum==SealevelchangeViscousRSLEnum) return "SealevelchangeViscousRSL" 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==FrictionWaterPressureEnum) return "FrictionWaterPressure" end + if(enum==FrictionWaterPressureNoiseEnum) return "FrictionWaterPressureNoise" 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==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==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==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==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==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==MLHOApproximationEnum) return "MLHOApproximation" 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==LoveHiEnum) return "LoveHi" end + if(enum==LoveHrEnum) return "LoveHr" end + if(enum==LoveKernelsImagEnum) return "LoveKernelsImag" end + if(enum==LoveKernelsRealEnum) return "LoveKernelsReal" end + if(enum==LoveKiEnum) return "LoveKi" end + if(enum==LoveKrEnum) return "LoveKr" end + if(enum==LoveLiEnum) return "LoveLi" end + if(enum==LoveLrEnum) return "LoveLr" 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==SealevelInertiaTensorXZEnum) return "SealevelInertiaTensorXZ" end + if(enum==SealevelInertiaTensorYZEnum) return "SealevelInertiaTensorYZ" end + if(enum==SealevelInertiaTensorZZEnum) return "SealevelInertiaTensorZZ" 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 diff --git a/core/matice.jl b/core/matice.jl new file mode 100644 index 0000000..b229816 --- /dev/null +++ b/core/matice.jl @@ -0,0 +1,44 @@ +#Matice class definition +struct Matice#{{{ + vx_input::ElementInput + vy_input::ElementInput + B_input::ElementInput + n_input::ElementInput +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 +end #}}} diff --git a/core/modules.jl b/core/modules.jl new file mode 100644 index 0000000..919a7b7 --- /dev/null +++ b/core/modules.jl @@ -0,0 +1,388 @@ +#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 +end#}}} +function ModelProcessor(md::model, solutionstring::String) #{{{ + + #Initialize structures + elements = Vector{Tria}(undef,0) + vertices = Vector{Vertex}(undef,0) + results = Vector{Result}(undef,0) + parameters = Parameters(Dict{IssmEnum,Parameter}()) + 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 = [StressbalanceAnalysis()] + elseif solutionstring=="TransientSolution" + analyses = [StressbalanceAnalysis(), MasstransportAnalysis()] + 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 + + #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 + + #Assume Linear Elements for now + vertexids = md.mesh.elements[i,:] + nodeids = md.mesh.elements[i,:] + + #Call constructor and add to dataset elements + push!(elements,Tria(i,count, vertexids)) + end + +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 + +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) + +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) +end# }}} +function OutputResultsx(femmodel::FemModel, md::model, solution::String)# {{{ + + + if solution=="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 + (output[step])[EnumToString(result.enum)] = result.value + end + else + output = Dict() + for i in length(femmodel.results) + result = femmodel.results[i] + output[EnumToString(result.enum)] = result.value + end + end + + md.results[solution] = output + +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 + +end# }}} +function SpcNodesx(nodes::Vector{Node},constraints::Vector{Constraint},parameters::Parameters) #{{{ + + for i in 1:length(constraints) + ConstrainNode(constraints[i],nodes,parameters) + end + +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) + +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 + +end#}}} +function InputDuplicatex(femmodel::FemModel, oldenum::IssmEnum, newenum::IssmEnum) #{{{ + DuplicateInput(femmodel.inputs, oldenum, newenum) +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 +end#}}} +function SystemMatricesx(femmodel::FemModel,analysis::Analysis)# {{{ + + #Allocate 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 + for i in 1:length(femmodel.elements) + Ke = CreateKMatrix(analysis,femmodel.elements[i]) + pe = CreatePVector(analysis,femmodel.elements[i]) + + if(!isnothing(Ke)) AddToGlobal!(Ke,Kff,Kfs) end + if(!isnothing(pe)) 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]0) + SetValues!(ys,node.gsize,node.sdoflist,node.svalues) + end + +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 + +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 + +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 + + +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# }}} diff --git a/core/parameters.jl b/core/parameters.jl new file mode 100644 index 0000000..05822d6 --- /dev/null +++ b/core/parameters.jl @@ -0,0 +1,53 @@ +#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# }}} + +#Parameters dataset class definition +mutable struct Parameters #{{{ + lookup::Dict{IssmEnum,Parameter} +end# }}} + +#Parameter functions +function GetParameterValue(param::DoubleParam) #{{{ + return param.value +end#}}} +function GetParameterValue(param::IntParam) #{{{ + return param.value +end#}}} +function GetParameterValue(param::BoolParam) #{{{ + return param.value +end#}}} + +#Parameters functions +function AddParam(parameters::Parameters,value::Float64,enum::IssmEnum) #{{{ + + parameters.lookup[enum] = DoubleParam(enum,value) + +end#}}} +function AddParam(parameters::Parameters,value::Int64, enum::IssmEnum) #{{{ + + parameters.lookup[enum] = IntParam(enum,value) + +end#}}} +function AddParam(parameters::Parameters,value::Bool, enum::IssmEnum) #{{{ + + parameters.lookup[enum] = BoolParam(enum,value) + +end#}}} +function FindParam(::Type{T}, parameters::Parameters,enum::IssmEnum) where T #{{{ + + param = parameters.lookup[enum] + return GetParameterValue(param)::T + +end#}}} diff --git a/core/results.jl b/core/results.jl new file mode 100644 index 0000000..87ccae9 --- /dev/null +++ b/core/results.jl @@ -0,0 +1,6 @@ +mutable struct Result #{{{ + enum::IssmEnum + step::Int64 + time::Float64 + value +end#}}} diff --git a/core/solutionsequences.jl b/core/solutionsequences.jl new file mode 100644 index 0000000..6286fc8 --- /dev/null +++ b/core/solutionsequences.jl @@ -0,0 +1,132 @@ +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) + +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") + +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*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*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, "\n") + converged=false; + end + end + + return converged + +end#}}} diff --git a/core/solve.jl b/core/solve.jl new file mode 100644 index 0000000..e957d18 --- /dev/null +++ b/core/solve.jl @@ -0,0 +1,45 @@ +include("../usr/classes.jl") +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") + +#All analyses +include("./analyses/stressbalanceanalysis.jl") +include("./analyses/masstransportanalysis.jl") +include("./analyses/transientanalysis.jl") + +include("./solutionsequences.jl") +include("./modules.jl") +include("./elementmatrix.jl") +include("./utils.jl") + +function IssmCore(md::model, solutionstring::String) #{{{ + + #Construct FemModel + femmodel=ModelProcessor(md, solutionstring) + + #Solve FIXME: to be improved later... + if(solutionstring=="StressbalanceSolution") + analysis = StressbalanceAnalysis() + elseif (solutionstring=="TransientSolution") + analysis = TransientAnalysis() + else + error("not supported") + end + Core(analysis, femmodel) + + #move results to md + OutputResultsx(femmodel, md, solutionstring) + +end# }}} diff --git a/core/toolkits.jl b/core/toolkits.jl new file mode 100644 index 0000000..3a8947b --- /dev/null +++ b/core/toolkits.jl @@ -0,0 +1,150 @@ + +#Toolkit #1: serial sparse arrays +using SparseArrays + +#Matrix +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 + +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) + +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 + +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 + +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 + +end#}}} +function Assemble!(vector::IssmVector)#{{{ + + #Nothing to do for this toolkit + +end#}}} +function ToSerial(vector::IssmVector)#{{{ + + return vector.vector + +end#}}} +function Norm(x::IssmVector,type::Int64)#{{{ + + norm = 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 + +end#}}} +function AXPY!(y::IssmVector,alpha::Float64,x::IssmVector) #{{{ + + y.vector = alpha*x.vector + y.vector + +end#}}} +function Solverx(A::IssmMatrix, b::IssmVector, xold::IssmVector) #{{{ + + #Initialize output + #x = IssmVector(GetSize(xold)) + + return Solverx(A, b) + +end#}}} +function Solverx(A::IssmMatrix, b::IssmVector) #{{{ + + #Initialize output + x = IssmVector(0) + + #Solve linear system + x.vector = A.matrix\b.vector + + return x + +end#}}} diff --git a/core/utils.jl b/core/utils.jl new file mode 100644 index 0000000..6733371 --- /dev/null +++ b/core/utils.jl @@ -0,0 +1,26 @@ +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) 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") diff --git a/usr/classes.jl b/usr/classes.jl new file mode 100644 index 0000000..417ed78 --- /dev/null +++ b/usr/classes.jl @@ -0,0 +1,311 @@ +using Printf + +#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} +end +function Geometry() #{{{ + return Geometry( 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} +end +function BuddFriction() #{{{ + return BuddFriction(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# }}} +# }}} +#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, true, true) +end# }}} +function Base.show(io::IO, this::Transient)# {{{ + IssmStructDisp(io, this) +end# }}} +# }}} + +#Model structure +mutable struct model + mesh::AbstractMesh + geometry::Geometry + mask::Mask + materials::Materials + initialization::Initialization + stressbalance::Stressbalance + constants::Constants + results::Dict + friction::AbstractFriction + basalforcings::Basalforcings + smb::SMBforcings + timestepping::Timestepping + masstransport::Masstransport + transient::Transient +end +function model() #{{{ + return model( Mesh2dTriangle(), Geometry(), Mask(), Materials(), + Initialization(),Stressbalance(), Constants(), Dict(), + BuddFriction(), Basalforcings(), SMBforcings(), Timestepping(), + Masstransport(), Transient()) +end#}}} +function model(matmd::Dict) #{{{ + + #initialize output + md = model() + + #Loop over all possible fields + for name1 in keys(matmd) + if !(Symbol(name1) in fieldnames(model)) + println("could not recover md.",name1) + continue + end + mdfield = getfield(md,Symbol(name1)) + matfield = matmd[name1] + for name2 in keys(matfield) + if !(Symbol(name2) in fieldnames(typeof(mdfield))) + println("could not recover md.",name1,".",name2) + 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)) + + 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 ",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" + +end# }}} diff --git a/usr/exp.jl b/usr/exp.jl new file mode 100644 index 0000000..63c2b70 --- /dev/null +++ b/usr/exp.jl @@ -0,0 +1,234 @@ +#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]xmax || 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 && y0) .& (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 +#}}} diff --git a/usr/plotmodel.jl b/usr/plotmodel.jl new file mode 100644 index 0000000..d931fe6 --- /dev/null +++ b/usr/plotmodel.jl @@ -0,0 +1,68 @@ +import ColorSchemes.jet +using GLMakie +using .ISSM + +function plotmodel( md::model, data::Vector, showvertices::Bool=false, showfacets::Bool=true) + + vertexcolor = :black + facetcolor = :blue + + if data isa AbstractVector + + 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) + + #Add colorbar + Colorbar(fig[1, 2], limits = (minimum(data), maximum(data)), colormap = jet) + elseif length(data)==md.mesh.numberofvertices + fig, ax, h = Makie.mesh( [md.mesh.x md.mesh.y], md.mesh.elements, shading = false, color = data, colormap = jet) + + #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 = false, 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=false) + else + error(data, " plot not supported yet") + end + +end#}}} diff --git a/usr/triangle.jl b/usr/triangle.jl new file mode 100644 index 0000000..caaa018 --- /dev/null +++ b/usr/triangle.jl @@ -0,0 +1,178 @@ + +#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(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"), + rc=ccall( (:triangulate,issmdir()*"/externalpackages/triangle/src/libtriangle.dylib"), + Cint, ( Cstring, Ref{CTriangulateIO}, Ref{CTriangulateIO}, Ref{CTriangulateIO}), + triangle_switches, Ref(ctio_in), Ref(ctio_out), Ref(vor_out)) + + #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#}}} diff --git a/usr/utils.jl b/usr/utils.jl new file mode 100644 index 0000000..d5cc684 --- /dev/null +++ b/usr/utils.jl @@ -0,0 +1,242 @@ +#utils +function issmdir() #{{{ + issmdir = ENV["ISSM_DIR"] + + if isempty(issmdir) + error("Could not determine the location of ISSM") + 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 solve(md::model,solution::String) #{{{ + + if solution=="sb" || solution=="Stressbalance" + solutionstring = "StressbalanceSolution" + elseif solution=="tr" || solution=="Transient" + solutionstring = "TransientSolution" + else + error("solutionstring "*solution*" not supported!"); + end + + IssmCore(md, solutionstring) + + return md +end #}}} +function IssmStructDisp(io::IO, modelfield::Any) # {{{ + println(io,typeof(modelfield),":") + for name in fieldnames(typeof(modelfield)) + a=getfield(modelfield,name) + #print(io," $(name) = ") + @printf "%19s: " name + if isa(a,String) + println(io, a) + elseif length(a)>1 + if !isempty(a) + println(io, typeof(a), " of size ", size(a)) + else + println(io,"empty") + end + else + println(io, a) + end + 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