Changeset 26652
- Timestamp:
- 11/22/21 07:03:07 (3 years ago)
- Location:
- issm/trunk-jpl/src/jl/solve
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/jl/solve/analyses.jl
r26649 r26652 80 80 81 81 end#}}} 82 function InputUpdateFromSolution(analysis::StressbalanceAnalysis,ug::Vector{Float64},element::Tria) #{{{ 82 83 84 #Get dofs for this finite element 85 doflist = GetDofList(element,GsetEnum) 86 87 #Get solution vector for this element 88 numdof = 3*2 89 values = Vector{Float64}(undef,numdof) 90 for i in 1:numdof values[i]=ug[doflist[i]] end 91 92 #Now split solution vector into x and y components 93 numnodes = 3 94 vx= Vector{Float64}(undef,numnodes) 95 vy= Vector{Float64}(undef,numnodes) 96 for i in 1:numnodes 97 vx[i]=values[2*i-1] 98 vy[i]=values[2*i] 99 @assert isfinite(vx[i]) 100 @assert isfinite(vy[i]) 101 end 102 103 AddInput(element,VxEnum,vx,P1Enum) 104 AddInput(element,VyEnum,vy,P1Enum) 105 end#}}} 83 106 function Core(analysis::StressbalanceAnalysis,femmodel::FemModel)# {{{ 84 107 … … 95 118 96 119 97 function solutionsequence_nonlinear(femmodel::FemModel,analysis::Analysis,maxiter::Int64,restol::Float64,reltol::Float64,abstol::Float64) # {{{98 99 #Initialize number of iterations100 count = 0101 converged = false102 103 #Get existing solution104 ug = GetSolutionFromInputsx(analysis,femmodel)105 106 print(ug)107 108 #Loop until we reach convergence109 while(~converged)110 111 error("not implemented yet")112 113 #Increase count114 count += 1115 if(count>maxiter)116 println(" maximum number of nonlinear iterations (",maxiter,") exceeded")117 converged = true118 end119 end120 121 error("STOP")122 123 end# }}} -
issm/trunk-jpl/src/jl/solve/elements.jl
r26649 r26652 21 21 else 22 22 error("size ",size(data,1)," not supported yet"); 23 end 24 end #}}} 25 function AddInput(element::Tria,inputenum::IssmEnum,data::Vector{Float64},interpolation::IssmEnum) #{{{ 26 if interpolation==P1Enum 27 @assert length(data)==3 28 SetTriaInput(element.inputs,inputenum,P1Enum,element.vertexids,data) 29 else 30 error("interpolation ", interpolation, " not supported yet"); 23 31 end 24 32 end #}}} -
issm/trunk-jpl/src/jl/solve/modules.jl
r26648 r26652 134 134 135 135 end#}}} 136 function InputUpdateFromSolutionx(analysis::Analysis,ug::Vector{Float64},femmodel::FemModel) #{{{ 137 138 #Go through elements and plug in solution 139 for i=1:length(femmodel.elements) 140 InputUpdateFromSolution(analysis,ug,femmodel.elements[i]) 141 end 142 143 return ug 144 145 end#}}} 146 function Reducevectorgtofx(ug::Vector{Float64},nodes::Vector{Node}) #{{{ 147 148 #Get size of output vector 149 fsize = NumberOfDofs(nodes,FsetEnum) 150 151 #Initialize output vector 152 uf = Vector{Float64}(undef,fsize) 153 154 #Go through elements and plug in solution 155 for i=1:length(nodes) 156 VecReduce(nodes[i],ug,uf) 157 end 158 159 return ug 160 161 end#}}} -
issm/trunk-jpl/src/jl/solve/nodes.jl
r26648 r26652 114 114 115 115 end# }}} 116 function VecReduce(node::Node,ug::Vector{Float64},uf::Vector{Float64}) #{{{ 117 118 for i=1:node.gsize 119 if node.fdoflist[i]!=-1 120 uf[node.fdoflist[i]] = ug[node.gdoflist[i]] 121 end 122 end 123 124 end# }}} 116 125 117 126 #Nodes functions -
issm/trunk-jpl/src/jl/solve/solve.jl
r26649 r26652 10 10 include("./femmodel.jl") 11 11 include("./analyses.jl") 12 include("./solutionsequences.jl") 12 13 include("./modules.jl") 13 14
Note:
See TracChangeset
for help on using the changeset viewer.