Changeset 26649
- Timestamp:
- 11/19/21 11:13:48 (3 years ago)
- Location:
- issm/trunk-jpl/src/jl/solve
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/jl/solve/analyses.jl
r26648 r26649 57 57 #Get dofs for this finite element 58 58 doflist = GetDofList(element,GsetEnum) 59 error("S") 59 @assert length(doflist)==6 60 61 #Fetch inputs 62 vx_input = GetInput(element, VxEnum) 63 vy_input = GetInput(element, VyEnum) 64 65 #Loop over each node and enter solution in ug 66 count = 0 67 gauss=GaussTria(P1Enum) 68 for i in 1:gauss.numgauss 69 vx = GetInputValue(vx_input, gauss, i) 70 vy = GetInputValue(vy_input, gauss, i) 71 72 count += 1 73 ug[doflist[count]] = vx 74 count += 1 75 ug[doflist[count]] = vy 76 end 77 78 #Make sure we reached all the values 79 @assert count==length(doflist) 60 80 61 81 end#}}} … … 84 104 ug = GetSolutionFromInputsx(analysis,femmodel) 85 105 106 print(ug) 107 86 108 #Loop until we reach convergence 87 109 while(~converged) -
issm/trunk-jpl/src/jl/solve/elements.jl
r26648 r26649 72 72 end 73 73 74 println(doflist) 75 error("S") 74 return doflist 75 end # }}} 76 function GetInput(element::Tria,enum::IssmEnum) # {{{ 77 78 input = GetInput(element.inputs,enum) 79 InputServe!(element,input) 80 return input 76 81 77 82 end # }}} 83 function InputServe!(element::Tria,input::ElementInput) # {{{ 84 85 if input.interp==P0Enum 86 input.element_values[1] = input.values[element.sid] 87 elseif input.interp==P1Enum 88 for i in 1:3 89 input.element_values[i] = input.values[element.vertices[i].sid] 90 end 91 else 92 error("interpolation ",input.interp," not supported yet") 93 end 94 95 end # }}} -
issm/trunk-jpl/src/jl/solve/gauss.jl
r26629 r26649 23 23 coords3 = [0.333333333333333] 24 24 elseif(order==2) 25 weights = [0.577350269189625 , 0.577350269189625,0.577350269189625]26 coords1 = [0.666666666666667 , 0.166666666666667,0.166666666666667]27 coords2 = [0.166666666666667 , 0.666666666666667,0.166666666666667]28 coords3 = [0.166666666666667 , 0.166666666666667,0.666666666666667]25 weights = [0.577350269189625; 0.577350269189625; 0.577350269189625] 26 coords1 = [0.666666666666667; 0.166666666666667; 0.166666666666667] 27 coords2 = [0.166666666666667; 0.666666666666667; 0.166666666666667] 28 coords3 = [0.166666666666667; 0.166666666666667; 0.666666666666667] 29 29 elseif(order==3) 30 30 npoints=4 31 weights = [-0.974278579257493 , 0.902109795608790, 0.902109795608790,0.902109795608790]32 coords1 = [ 0.333333333333333, 0.600000000000000, 0.200000000000000,0.200000000000000]33 coords2 = [ 0.333333333333333, 0.200000000000000, 0.600000000000000,0.200000000000000]34 coords3 = [ 0.333333333333333, 0.200000000000000, 0.200000000000000,0.600000000000000]31 weights = [-0.974278579257493; 0.902109795608790; 0.902109795608790; 0.902109795608790] 32 coords1 = [ 0.333333333333333; 0.600000000000000; 0.200000000000000; 0.200000000000000] 33 coords2 = [ 0.333333333333333; 0.200000000000000; 0.600000000000000; 0.200000000000000] 34 coords3 = [ 0.333333333333333; 0.200000000000000; 0.200000000000000; 0.600000000000000] 35 35 else 36 36 error("order ",order," not supported yet"); … … 39 39 return GaussTria(npoints,weights,coords1,coords2,coords3) 40 40 end# }}} 41 function GaussTria(finiteelement::IssmEnum) #{{{ 41 42 43 if(finiteelement==P0Enum) 44 npoints = 1 45 weights = [1.] 46 coords1 = [0.333333333333333] 47 coords2 = [0.333333333333333] 48 coords3 = [0.333333333333333] 49 elseif(finiteelement==P1Enum) 50 npoints = 3 51 weights = 0.333333333333333*ones(3) 52 coords1 = [1.; 0.; 0.] 53 coords2 = [0.; 1.; 0.] 54 coords3 = [0.; 0.; 1.] 55 else 56 error("finite element ", finiteelement," not supported yet"); 57 end 58 59 return GaussTria(npoints,weights,coords1,coords2,coords3) 60 end# }}} -
issm/trunk-jpl/src/jl/solve/inputs.jl
r26629 r26649 13 13 interp::IssmEnum 14 14 values::Vector{Float64} 15 element_values::Vector{Float64} 15 16 end# }}} 16 17 … … 23 24 24 25 #Inputs functions 26 function GetInput(inputs::Inputs,enum::IssmEnum) #{{{ 27 28 #Does this input exist 29 if !haskey(inputs.lookup,enum) 30 error("Input ",enum," not found") 31 end 32 33 #return input 34 return inputs.lookup[enum] 35 36 end#}}} 25 37 function SetInput(inputs::Inputs,enum::IssmEnum,index::Int64,value::Bool) #{{{ 26 38 … … 48 60 @assert inputs.numberofelements > 0 49 61 if interp==P0Enum 50 inputs.lookup[enum] = ElementInput(enum,interp,zeros(inputs.numberofelements) )62 inputs.lookup[enum] = ElementInput(enum,interp,zeros(inputs.numberofelements),Vector{Float64}(undef,1)) 51 63 elseif interp==P1Enum 52 inputs.lookup[enum] = ElementInput(enum,interp,zeros(inputs.numberofvertices) )64 inputs.lookup[enum] = ElementInput(enum,interp,zeros(inputs.numberofvertices),Vector{Float64}(undef,3)) 53 65 else 54 66 error("not supported yet") … … 71 83 @assert inputs.numberofvertices>0 72 84 if interp==P1Enum 73 inputs.lookup[enum] = ElementInput(enum,interp,zeros(inputs.numberofvertices) )85 inputs.lookup[enum] = ElementInput(enum,interp,zeros(inputs.numberofvertices),Vector{Float64}(undef,3)) 74 86 else 75 87 error("not supported yet") … … 85 97 input.values[indices] = values 86 98 end#}}} 99 function GetInputValue(input::ElementInput,gauss::GaussTria,i::Int64) 100 101 if input.interp==P0Enum 102 return input.element_value 103 elseif input.interp==P1Enum 104 value = input.element_values[1]*gauss.coords1[i] + input.element_values[2]*gauss.coords2[i] + input.element_values[3]*gauss.coords3[i] 105 else 106 error("not implemented yet") 107 end 108 109 return value 110 111 end#}}} -
issm/trunk-jpl/src/jl/solve/solve.jl
r26629 r26649 1 1 include("../md/classes.jl") 2 2 include("./issmenums.jl") 3 include("./gauss.jl") 3 4 include("./parameters.jl") 4 5 include("./inputs.jl") … … 9 10 include("./femmodel.jl") 10 11 include("./analyses.jl") 11 include("./gauss.jl")12 12 include("./modules.jl") 13 13
Note:
See TracChangeset
for help on using the changeset viewer.