Changeset 26705
- Timestamp:
- 12/03/21 11:18:50 (3 years ago)
- Location:
- issm/trunk-jpl/src/jl/solve
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/jl/solve/analyses/stressbalanceanalysis.jl ¶
r26704 r26705 44 44 FetchDataToInput(md,inputs,elements,md.initialization.vx./md.constants.yts,VxEnum) 45 45 FetchDataToInput(md,inputs,elements,md.initialization.vy./md.constants.yts,VyEnum) 46 47 FetchDataToInput(md,inputs,elements,md.friction.coefficient,FrictionCoefficientEnum) 46 FetchDataToInput(md,inputs,elements,md.mask.ice_levelset, MaskIceLevelsetEnum) 47 FetchDataToInput(md,inputs,elements,md.mask.ocean_levelset, MaskOceanLevelsetEnum) 48 49 #Deal with friction 50 if typeof(md.friction)==BuddFriction 51 FetchDataToInput(md,inputs,elements,md.friction.coefficient,FrictionCoefficientEnum) 52 else 53 error("Friction ", typeof(md.friction), " not supported yet") 54 end 48 55 49 56 end#}}} … … 53 60 AddParam(parameters,md.stressbalance.abstol,StressbalanceAbstolEnum) 54 61 AddParam(parameters,md.stressbalance.maxiter,StressbalanceMaxiterEnum) 62 63 #Deal with friction 64 if typeof(md.friction)==BuddFriction 65 AddParam(parameters, 1, FrictionLawEnum) 66 else 67 error("Friction ", typeof(md.friction), " not supported yet") 68 end 55 69 end#}}} 56 70 … … 104 118 105 119 #Add basal friction 106 basis = Vector{Float64}(undef,numnodes) 107 friction = Friction(element) 108 109 #Start integrating 110 gauss = GaussTria(2) 111 for ig in 1:gauss.numgauss 112 113 Jdet = JacobianDeterminant(xyz_list, gauss) 114 NodalFunctions(element, basis, gauss, ig, P1Enum) 115 116 alpha2 = Alpha2(friction, gauss, ig) 117 118 for i in 1:numnodes 119 for j in 1:numnodes 120 Ke.values[2*i-1,2*j-1] += gauss.weights[ig]*Jdet*alpha2*basis[i]*basis[j] 121 Ke.values[2*i ,2*j ] += gauss.weights[ig]*Jdet*alpha2*basis[i]*basis[j] 120 phi=GetGroundedPortion(element, xyz_list) 121 122 if(phi>0) 123 basis = Vector{Float64}(undef,numnodes) 124 friction = CoreFriction(element) 125 126 #Start integrating 127 gauss = GaussTria(2) 128 for ig in 1:gauss.numgauss 129 130 Jdet = JacobianDeterminant(xyz_list, gauss) 131 NodalFunctions(element, basis, gauss, ig, P1Enum) 132 133 alpha2 = Alpha2(friction, gauss, ig) 134 135 for i in 1:numnodes 136 for j in 1:numnodes 137 Ke.values[2*i-1,2*j-1] += gauss.weights[ig]*Jdet*phi*alpha2*basis[i]*basis[j] 138 Ke.values[2*i ,2*j ] += gauss.weights[ig]*Jdet*phi*alpha2*basis[i]*basis[j] 139 end 122 140 end 123 141 end 124 142 end 125 126 143 127 144 return Ke -
TabularUnified issm/trunk-jpl/src/jl/solve/elements.jl ¶
r26681 r26705 89 89 90 90 end # }}} 91 function GetInputListOnVertices!(element::Tria, vector::Vector{Float64}, enum::IssmEnum) # {{{ 92 93 #Get Input first 94 input = GetInput(element, enum) 95 96 #Get value at each vertex (i.e. P1 Nodes) 97 gauss=GaussTria(P1Enum) 98 for i in 1:gauss.numgauss 99 vector[i] = GetInputValue(input, gauss, i) 100 end 101 102 end # }}} 91 103 function FindParam(element::Tria,enum::IssmEnum) # {{{ 92 104 … … 107 119 108 120 end # }}} 121 function GetGroundedPortion(element::Tria, xyz_list::Matrix{Float64}) #{{{ 122 123 level = Vector{Float64}(undef,3) 124 GetInputListOnVertices!(element, level, MaskOceanLevelsetEnum) 125 126 #Be sure that values are not zero 127 epsilon = 1.e-15 128 for i in 1:3 129 if(level[i]==0.) level[i]=level[i]+epsilon end 130 end 131 132 if level[1]>0 && level[2]>0 && level[3]>0 133 #Completely grounded 134 phi = 1.0 135 elseif level[1]<0 && level[2]<0 && level[3]<0 136 #Completely floating 137 phi = 0.0 138 else 139 #Partially floating, 140 if(level[1]*level[2]>0) #Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2 141 s1=level[3]/(level[3]-level[2]); 142 s2=level[3]/(level[3]-level[1]); 143 elseif(level[2]*level[3]>0) #Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2 144 s1=level[1]/(level[1]-level[2]); 145 s2=level[1]/(level[1]-level[3]); 146 elseif(level[1]*level[3]>0) #Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2 147 s1=level[2]/(level[2]-level[1]); 148 s2=level[2]/(level[2]-level[3]); 149 else 150 error("not supposed to be here...") 151 end 152 153 if(level[1]*level[2]*level[3]>0) 154 phi = s1*s2 155 else 156 phi = (1-s1*s2) 157 end 158 end 159 160 return phi 161 end#}}} 109 162 110 163 #Finite Element stuff -
TabularUnified issm/trunk-jpl/src/jl/solve/friction.jl ¶
r26704 r26705 1 1 #Friction class definition 2 struct Friction#{{{ 2 3 abstract type CoreFriction end 4 struct CoreBuddFriction#{{{ 3 5 H_input::ElementInput 4 6 b_input::ElementInput … … 8 10 g::Float64 9 11 end# }}} 10 function Friction(element::Tria) #{{{12 function CoreFriction(element::Tria) #{{{ 11 13 12 H_input = GetInput(element, ThicknessEnum) 13 b_input = GetInput(element, BaseEnum) 14 c_input = GetInput(element, FrictionCoefficientEnum) 14 frictionlaw = FindParam(element, FrictionLawEnum) 15 15 16 rho_ice = FindParam(element, MaterialsRhoIceEnum) 17 rho_water = FindParam(element, MaterialsRhoSeawaterEnum) 18 g = FindParam(element, ConstantsGEnum) 16 if frictionlaw==1 17 H_input = GetInput(element, ThicknessEnum) 18 b_input = GetInput(element, BaseEnum) 19 c_input = GetInput(element, FrictionCoefficientEnum) 19 20 20 return Friction(H_input, b_input, c_input, rho_ice, rho_water, g) 21 rho_ice = FindParam(element, MaterialsRhoIceEnum) 22 rho_water = FindParam(element, MaterialsRhoSeawaterEnum) 23 g = FindParam(element, ConstantsGEnum) 24 25 return CoreBuddFriction(H_input, b_input, c_input, rho_ice, rho_water, g) 26 else 27 error("Friction ",typeof(md.friction)," not supported yet") 28 end 21 29 end#}}} 22 30 23 31 #vertices functions 24 function Alpha2(friction:: Friction, gauss::GaussTria, i::Int64) #{{{32 function Alpha2(friction::CoreBuddFriction, gauss::GaussTria, i::Int64) #{{{ 25 33 26 34 #Get effective pressure
Note:
See TracChangeset
for help on using the changeset viewer.