Changeset 26659


Ignore:
Timestamp:
11/23/21 12:28:22 (3 years ago)
Author:
Mathieu Morlighem
Message:

CHG: getting to Jacobian Determinant

Location:
issm/trunk-jpl/src/jl
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/jl/solve/analyses/stressbalanceanalysis.jl

    r26658 r26659  
    6868function CreateKMatrix(analysis::StressbalanceAnalysis,element::Tria)# {{{
    6969
    70         #Initialize Element matrix
     70        #Internmediaries
     71        numnodes = 3
     72       
     73        #Initialize Element matrix and basis function derivatives
    7174        Ke = ElementMatrix(element.nodes)
     75        dbasis = Matrix{Float64}(undef,numnodes,2)
     76
     77        #Retrieve all inputs and parameters
     78        xyz_list = GetVerticesCoordinates(element.vertices)
     79        vx_input = GetInput(element, VxEnum)
     80        vy_input = GetInput(element, VyEnum)
     81        H_input  = GetInput(element, ThicknessEnum)
     82
     83        #Start integrating
     84        gauss = GaussTria(2)
     85        for i in 1:gauss.numgauss
     86
     87                Jdet = JacobianDeterminant(xyz_list, gauss)
     88
     89                println(Jdet)
     90
     91                error("STOP")
     92                vx = GetInputValue(vx_input, gauss, i)
     93                vy = GetInputValue(vy_input, gauss, i)
     94        end
     95
     96
     97        error("STOP")
    7298
    7399        return Ke
  • issm/trunk-jpl/src/jl/solve/elements.jl

    r26652 r26659  
    102102
    103103end # }}}
     104
     105#Finite Element stuff
     106function JacobianDeterminant(xyz_list::Matrix{Float64}, gauss::GaussTria) #{{{
     107
     108        #Get Jacobian Matrix
     109        J = Jacobian(xyz_list)
     110
     111        #Get its determinant
     112        Jdet = Matrix2x2Determinant(J)
     113
     114        #check and return
     115        if(Jdet<0) error("negative Jacobian Determinant") end
     116        return Jdet
     117
     118end#}}}
     119function Jacobian(xyz_list::Matrix{Float64}) #{{{
     120
     121        J = Matrix{Float64}(undef,2,2)
     122
     123        x1 = xyz_list[1,1]
     124        y1 = xyz_list[1,2]
     125        x2 = xyz_list[2,1]
     126        y2 = xyz_list[2,2]
     127        x3 = xyz_list[3,1]
     128        y3 = xyz_list[3,2]
     129
     130        J[1,1] = .5*(x2-x1)
     131        J[1,2] = sqrt(3)/6*(2*x3 -x1 -x2)
     132        J[2,1] = .5*(y2-y1)
     133        J[2,2] = sqrt(3)/6*(2*y3 -y1 -y2)
     134
     135        return J
     136end#}}}
  • issm/trunk-jpl/src/jl/solve/gauss.jl

    r26649 r26659  
    2323                coords3 = [0.333333333333333]
    2424        elseif(order==2)
     25                npoints = 3
    2526                weights = [0.577350269189625; 0.577350269189625; 0.577350269189625]
    2627                coords1 = [0.666666666666667; 0.166666666666667; 0.166666666666667]
     
    2829                coords3 = [0.166666666666667; 0.166666666666667; 0.666666666666667]
    2930        elseif(order==3)
    30                 npoints=4
     31                npoints = 4
    3132                weights = [-0.974278579257493; 0.902109795608790; 0.902109795608790; 0.902109795608790]
    3233                coords1 = [ 0.333333333333333; 0.600000000000000; 0.200000000000000; 0.200000000000000]
  • issm/trunk-jpl/src/jl/solve/modules.jl

    r26655 r26659  
    6969        count = 0
    7070        for i in 1:md.mesh.numberofvertices
    71                 push!(vertices,Vertex(i,x[i],y[i]))
     71                push!(vertices,Vertex(i,x[i],y[i],0.))
    7272        end
    7373
  • issm/trunk-jpl/src/jl/solve/nodes.jl

    r26658 r26659  
    124124                count = GetDofList(nodes[i],doflist,count,setenum)
    125125        end
    126         println(count," ",ndofs)
    127126        @assert count==ndofs
    128127
  • issm/trunk-jpl/src/jl/solve/solve.jl

    r26655 r26659  
    1414include("./modules.jl")
    1515include("./toolkits.jl")
     16include("./utils.jl")
    1617include("./elementmatrix.jl")
    1718
  • issm/trunk-jpl/src/jl/solve/vertices.jl

    r26629 r26659  
    44        x::Float64
    55        y::Float64
     6        z::Float64
    67end# }}}
     8
     9#vertices functions
     10function GetVerticesCoordinates(vertices::Vector{Vertex}) #{{{
     11
     12        #Intermediaries
     13        nbv = length(vertices)
     14
     15        #Allocate
     16        xyz_list = Matrix{Float64}(undef,nbv,3)
     17
     18        #Assign value to xyz_list
     19        for i in 1:nbv
     20                xyz_list[i,1]=vertices[i].x
     21                xyz_list[i,2]=vertices[i].y
     22                xyz_list[i,3]=vertices[i].z
     23        end
     24
     25        return xyz_list
     26end #}}}
  • issm/trunk-jpl/src/jl/test101.jl

    r26634 r26659  
    66#md = ISSM.triangle(md,"../../test/Exp/Square.exp",180000.)
    77md = ISSM.triangle(md,"../../test/Exp/Square.exp",250000.)
     8#md = ISSM.triangle(md,"../../test/Exp/Square.exp",1000.)
    89md = ISSM.setmask(md,"all","")
    910
Note: See TracChangeset for help on using the changeset viewer.