Skip to content

Commit

Permalink
Oriented Gridap-generated meshes + high order tets working
Browse files Browse the repository at this point in the history
  • Loading branch information
santiagobadia committed Sep 6, 2019
1 parent e00075f commit cbefe9b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
13 changes: 11 additions & 2 deletions src/Geometry/Simplexify.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,23 @@ end
function _generate_ltcell_to_lpoints(ct::ConstantCellValue)
extrusion = ct.value
if extrusion == (HEX_AXIS, HEX_AXIS)
ltcell_to_lpoints = [[1,2,3],[4,3,2]]
ltcell_to_lpoints = [[1,2,3],[2,3,4]]
return ltcell_to_lpoints
elseif extrusion == (HEX_AXIS, HEX_AXIS, HEX_AXIS)
ltcell_to_lpoints = [
[7,3,2,1], [7,5,2,1], [7,4,3,2], [7,4,8,2], [7,6,5,2], [7,6,8,2]]
[1,2,3,7], [1,2,5,7], [2,3,4,7], [2,4,7,8], [2,5,6,7], [2,6,7,8]]
else
@notimplemented
end
end

function _orient_simplex_connectivities(cell_to_nodes_data, cell_to_nodes_ptrs)
cell_nodes = Gridap.CellValuesGallery.CellVectorFromDataAndPtrs(cell_to_nodes_data,cell_to_nodes_ptrs)
oriented = Int64[]
for i in cell_nodes
push!(oriented,sort(i)...)
end
return oriented
end

end # module
24 changes: 21 additions & 3 deletions test/temp_devs/HighOrderTets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,27 @@ module HighOrderTets
using Gridap, Test
using Gridap.CellValuesGallery

import Gridap:

using Gridap.Helpers
using UnstructuredGrids.Kernels: refine_grid_connectivity
using UnstructuredGrids.Kernels: generate_tface_to_face
using Gridap.DiscreteModels: DiscreteModelFromData
##

##
ufun(x) = x[1] + x[2]
ufun_grad(x) = VectorValue(1.0,1.0)
ufun_grad(x) = VectorValue(1.0,1.0,0.0)
(::typeof(ufun)) = ufun_grad
bfun(x) = 0.0

# Construct the discrete model
model = CartesianDiscreteModel(domain=(0.0,1.0,0.0,1.0), partition=(2,2))
model = CartesianDiscreteModel(domain=(0.0,1.0,0.0,1.0,0.0,1.0), partition=(4,4,4))
model = simplexify(model)

order = 2

order = 4
# diritag = [1,2,3,4]
diritag = "boundary"
fespace = ConformingFESpace(Float64,model,order,diritag)

Expand All @@ -29,6 +40,9 @@ quad = CellQuadrature(trian,order=6)
a(v,u) = inner((v), (u))
b(v) = inner(v,bfun)

uh = interpolate(U,ufun)
sum(integrate(a(uh,uh),trian,quad))

# Define Assembler
assem = SparseMatrixAssembler(V,U)

Expand Down Expand Up @@ -56,6 +70,10 @@ eh1 = sqrt(sum( integrate(h1(e),trian,quad) ))

@test el2 < 1.e-8
@test eh1 < 1.e-8
##
uhno = uh
uho = uh
writevtk(trian,"trian",cellfields=["uh"=>uh])

# 1) Clean constructors without D or T

Expand Down

0 comments on commit cbefe9b

Please sign in to comment.