Changeset 26682
- Timestamp:
- 11/30/21 18:48:37 (3 years ago)
- Location:
- issm/trunk-jpl/src/jl/solve
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/jl/solve/analyses/stressbalanceanalysis.jl
r26681 r26682 136 136 end 137 137 138 print(pe) 139 error("STOP") 140 141 return Pe 138 return pe 142 139 end #}}} 143 140 function GetSolutionFromInputs(analysis::StressbalanceAnalysis,ug::Vector{Float64},element::Tria) #{{{ -
issm/trunk-jpl/src/jl/solve/elementmatrix.jl
r26681 r26682 31 31 display(this.values) 32 32 end# }}} 33 function AddToGlobal!(Ke::ElementMatrix,Kff::IssmMatrix,Kfs::IssmMatrix)#{{{ 34 35 #First check that the element matrix looks alright 36 CheckConsistency(Ke) 37 38 #See if we need to do anything 39 is_fset = false 40 is_sset = false 41 for i in 1:Ke.nrows 42 if(Ke.fglobaldoflist[i]>0) is_fset = true end 43 if(Ke.sglobaldoflist[i]>0) is_sset = true end 44 end 45 46 if is_fset 47 AddValues!(Kff,Ke.nrows,Ke.fglobaldoflist,Ke.nrows,Ke.fglobaldoflist,Ke.values) 48 end 49 if is_sset 50 AddValues!(Kfs,Ke.nrows,Ke.fglobaldoflist,Ke.nrows,Ke.sglobaldoflist,Ke.values) 51 end 52 53 end#}}} 54 function CheckConsistency(Ke::ElementMatrix)#{{{ 55 56 for i in 1:Ke.nrows 57 for j in 1:Ke.nrows 58 if(isnan(Ke.values[i,j])) error("NaN found in Element Matrix") end 59 if(isinf(Ke.values[i,j])) error("Inf found in Element Matrix") end 60 if(abs(Ke.values[i,j])>1.e+50) error("Element Matrix values exceeds 1.e+50") end 61 end 62 end 63 end#}}} 33 64 34 65 mutable struct ElementVector#{{{ … … 58 89 display(this.values) 59 90 end# }}} 91 function AddToGlobal!(pe::ElementVector,pf::IssmVector)#{{{ 92 93 #First check that the element matrix looks alright 94 CheckConsistency(pe) 95 96 #See if we need to do anything 97 is_fset = false 98 for i in 1:pe.nrows 99 if(pe.fglobaldoflist[i]>0) 100 is_fset = true 101 break 102 end 103 end 104 105 if is_fset 106 AddValues!(pf,pe.nrows,pe.fglobaldoflist,pe.values) 107 end 108 109 end#}}} 110 function CheckConsistency(pe::ElementVector)#{{{ 111 112 for i in 1:pe.nrows 113 if(isnan(pe.values[i])) error("NaN found in Element Vector") end 114 if(isinf(pe.values[i])) error("Inf found in Element Vector") end 115 if(abs(pe.values[i])>1.e+50) error("Element Vector values exceeds 1.e+50") end 116 end 117 end#}}} -
issm/trunk-jpl/src/jl/solve/modules.jl
r26681 r26682 171 171 172 172 #Construct Stiffness matrix and load vector from elements 173 for i =1:length(femmodel.elements)173 for i in 1:length(femmodel.elements) 174 174 Ke = CreateKMatrix(analysis,femmodel.elements[i]) 175 175 pe = CreatePVector(analysis,femmodel.elements[i]) 176 print(Ke) 177 error("don't know what to do") 176 177 AddToGlobal!(Ke,Kff,Kfs) 178 AddToGlobal!(pe,pf) 178 179 end 179 180 180 181 182 error("STOP") 181 return Kff, Kfs, pf 183 182 end# }}} 183 function CreateNodalConstraintsx(nodes::Vector{Node})# {{{ 184 185 #Allocate vector 186 ssize=NumberOfDofs(nodes,SsetEnum) 187 ys=IssmVector(ssize) 188 189 #constraints vector with the constraint values 190 for i in 1:length(nodes) 191 CreateNodalConstraints(nodes[i],ys) 192 end 193 194 return ys 195 end# }}} -
issm/trunk-jpl/src/jl/solve/nodes.jl
r26659 r26682 30 30 node.sdoflist[dof] = +1 31 31 node.svalues[dof] = value 32 33 end# }}} 34 function CreateNodalConstraints(node::Node,ys::IssmVector) #{{{ 35 36 if(SSize(node)>0) 37 SetValues!(ys,node.gsize,node.sdoflist,node.svalues) 38 end 32 39 33 40 end# }}} … … 138 145 139 146 end# }}} 147 function SSize(node::Node) #{{{ 148 149 ssize = 0 150 151 for i=1:node.gsize 152 if node.fdoflist[i]!=-1 153 ssize+=1 154 end 155 end 156 157 return ssize 158 159 end# }}} 140 160 141 161 #Nodes functions -
issm/trunk-jpl/src/jl/solve/solutionsequences.jl
r26655 r26682 17 17 #Get new matrices 18 18 Kff, Kfs, pf = SystemMatricesx(femmodel,analysis) 19 20 #Enforce constraints 21 ys = CreateNodalConstraintsx(femmodel.nodes) 22 19 23 error("not implemented yet") 20 24 -
issm/trunk-jpl/src/jl/solve/solve.jl
r26675 r26682 1 1 include("../md/classes.jl") 2 2 include("./issmenums.jl") 3 include("./toolkits.jl") 3 4 include("./gauss.jl") 4 5 include("./parameters.jl") … … 14 15 include("./solutionsequences.jl") 15 16 include("./modules.jl") 16 include("./ toolkits.jl")17 include("./elementmatrix.jl") 17 18 include("./utils.jl") 18 include("./elementmatrix.jl")19 19 20 20 function IssmCore(md::model) #{{{ -
issm/trunk-jpl/src/jl/solve/toolkits.jl
r26655 r26682 8 8 return IssmMatrix(spzeros(M,N)) 9 9 end#}}} 10 function AddValues!(matrix::IssmMatrix,m::Int64,midx::Vector{Int64},n::Int64,nidx::Vector{Int64},values::Matrix{Float64})#{{{ 11 12 #This is inefficient now, but it will work 13 for i in 1:m 14 if(midx[i]==-1) continue end 15 for j in 1:n 16 if(nidx[j]==-1) continue end 17 matrix.matrix[midx[i],nidx[j]] += values[i,j] 18 end 19 end 20 21 end#}}} 22 10 23 mutable struct IssmVector #{{{ 11 24 vector::Vector{Float64} … … 14 27 return IssmVector(zeros(M)) 15 28 end#}}} 29 function AddValues!(vector::IssmVector,m::Int64,midx::Vector{Int64},values::Vector{Float64})#{{{ 30 31 #This is inefficient now, but it will work 32 for i in 1:m 33 if(midx[i]==-1) continue end 34 vector.vector[midx[i]] += values[i] 35 end 36 37 end#}}} 38 function SetValues!(vector::IssmVector,m::Int64,midx::Vector{Int64},values::Vector{Float64})#{{{ 39 40 #This is inefficient now, but it will work 41 for i in 1:m 42 if(midx[i]==-1) continue end 43 vector.vector[midx[i]] = values[i] 44 end 45 46 end#}}}
Note:
See TracChangeset
for help on using the changeset viewer.