Skip to content

Commit

Permalink
Merge pull request #40 from gridap/update_to_Gridap_v0.15.0
Browse files Browse the repository at this point in the history
Update to Gridap v0.15.0 and Release GridapEmbedded 0.6.0
  • Loading branch information
fverdugo authored Jan 12, 2021
2 parents 148a8cc + 492a1d9 commit 1d75d4d
Show file tree
Hide file tree
Showing 37 changed files with 992 additions and 1,177 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: CompatHelper

on:
schedule:
- cron: '00 00 * * *'

workflow_dispatch:
jobs:
CompatHelper:
runs-on: ubuntu-latest
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
issue_comment:
types:
- created
workflow_dispatch:
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## [0.6.0] - 2021-01-12

### Changed

- Switch to Gridap 0.15.
- Switch from TravisCI to GitHubCI

## [0.5.0] - 2020-10-21
Expand Down
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name = "GridapEmbedded"
uuid = "8838a6a3-0006-4405-b874-385995508d5d"
authors = ["Francesc Verdugo <[email protected]>"]
version = "0.5.0"
version = "0.6.0"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e"
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand All @@ -16,7 +17,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[compat]
AbstractTrees = "0.3.3"
Combinatorics = "1"
Gridap = "0.14"
Gridap = "0.15"
LightGraphs = "1.3.3"
MiniQhull = "0.1.0, 0.2"
julia = "1.3"
Expand Down
117 changes: 48 additions & 69 deletions examples/BimaterialLinElastCutFEM/BimaterialLinElastCutFEM.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module BimaterialLinElastCutFEM

using Gridap
using Gridap.Arrays: reindex
using Gridap.Geometry: cell_measure
using GridapEmbedded
using LinearAlgebra: tr

Expand Down Expand Up @@ -41,13 +39,13 @@ function main(;n,outputfile=nothing)
E1 = 4.0
ν1 = 0.2
λ1, μ1 = lame_parameters(E1,ν1)
@law σ1(ε) = λ1*tr(ε)*one(ε) + 2*μ1*ε
σ1(ε) = λ1*tr(ε)*one(ε) + 2*μ1*ε

# Material parameters 2
E2 = 1.0
ν2 = 0.2
λ2, μ2 = lame_parameters(E2,ν2)
@law σ2(ε) = λ2*tr(ε)*one(ε) + 2*μ2*ε
σ2(ε) = λ2*tr(ε)*one(ε) + 2*μ2*ε

# Dirichlet values
u0 = VectorValue(0,0,0)
Expand All @@ -61,91 +59,72 @@ function main(;n,outputfile=nothing)
model2 = DiscreteModel(cutgeo,"concrete")

# Setup integration meshes
trian_Ω1 = Triangulation(cutgeo,"steel")
trian_Ω2 = Triangulation(cutgeo,"concrete")
trian_Γ = EmbeddedBoundary(cutgeo,"steel","concrete")
Ω1 = Triangulation(cutgeo,"steel")
Ω2 = Triangulation(cutgeo,"concrete")
Γ = EmbeddedBoundary(cutgeo,"steel","concrete")

# Setup normal vectors
n_Γ = get_normal_vector(trian_Γ)
n_Γ = get_normal_vector(Γ)

# Setup cuadratures
# Setup Lebesgue measures
order = 1
quad_Ω1 = CellQuadrature(trian_Ω1,2*order)
quad_Ω2 = CellQuadrature(trian_Ω2,2*order)
quad_Γ = CellQuadrature(trian_Γ,2*order)
degree = 2*order
dΩ1 = Measure(Ω1,degree)
dΩ2 = Measure(Ω2,degree)
= Measure(Γ,degree)

# Setup stabilization parameters
meas_K1 = cell_measure(trian_Ω1,num_cells(bgmodel))
meas_K2 = cell_measure(trian_Ω2,num_cells(bgmodel))
meas_KΓ = cell_measure(trian_Γ,num_cells(bgmodel))

meas_K1_Γ = reindex(meas_K1,trian_Γ)
meas_K2_Γ = reindex(meas_K2,trian_Γ)
meas_KΓ_Γ = reindex(meas_KΓ,trian_Γ)
# Setup FESpace

γ_hat = 2
κ1 = (E2*meas_K1_Γ) ./ (E2*meas_K1_Γ .+ E1*meas_K2_Γ)
κ2 = (E1*meas_K2_Γ) ./ (E2*meas_K1_Γ .+ E1*meas_K2_Γ)
β = (γ_hat*meas_KΓ_Γ) ./ ( meas_K1_Γ/E1 .+ meas_K2_Γ/E2 )
V1 = TestFESpace(model1,
ReferenceFE(lagrangian,VectorValue{3,Float64},order),
conformity=:H1,
dirichlet_tags=["support0","support1"])
V2 = TestFESpace(model2,
ReferenceFE(lagrangian,VectorValue{3,Float64},order),
conformity=:H1,
dirichlet_tags=["support0","support1"])

# Jump and mean operators for this formulation
function jump_u(u)
u1,u2 = u
u1 - u2
end

function mean_t(u)
u1,u2 = u
κ1*σ1(ε(u1))n_Γ + κ2*σ2(ε(u2))n_Γ
end

# Setup FESpace
V1 = TestFESpace(
model=model1, valuetype=VectorValue{3,Float64},
reffe=:Lagrangian, order=order, conformity=:H1,
dirichlet_tags=["support0","support1"])

V2 = TestFESpace(
model=model2, valuetype=VectorValue{3,Float64},
reffe=:Lagrangian, order=order, conformity=:H1,
dirichlet_tags=["support0","support1"])

U1= TrialFESpace(V1,[u0,u1])
U1 = TrialFESpace(V1,[u0,u1])
U2 = TrialFESpace(V2,[u0,u1])

V = MultiFieldFESpace([V1,V2])
U = MultiFieldFESpace([U1,U2])

# Setup stabilization parameters

meas_K1 = get_cell_measure(Ω1)
meas_K2 = get_cell_measure(Ω2)
meas_KΓ = get_cell_measure(Γ)

γ_hat = 2
κ1 = (E2*meas_K1) ./ (E2*meas_K1 .+ E1*meas_K2)
κ2 = (E1*meas_K2) ./ (E2*meas_K1 .+ E1*meas_K2)
β = (γ_hat*meas_KΓ) ./ ( meas_K1/E1 .+ meas_K2/E2 )

# Jump and mean operators for this formulation

jump_u(u1,u2) = u1 - u2
mean_t(u1,u2) = κ1*(σ1ε(u1)) + κ2*(σ2ε(u2))

# Weak form
function a_Ω1(u,v)
u1,u2 = u
v1,v2 = v
ε(v1) σ1(ε(u1))
end

function a_Ω2(u,v)
u1,u2 = u
v1,v2 = v
ε(v2) σ2(ε(u2))
end

function a_Γ(u,v)
β*jump_u(v)jump_u(u) - jump_u(v)mean_t(u) - mean_t(v)jump_u(u)
end
a((u1,u2),(v1,v2)) =
( ε(v1) (σ1ε(u1)) ) * dΩ1 + ( ε(v2) (σ2ε(u2)) ) * dΩ2 +
( β*jump_u(v1,v2)jump_u(u1,u2)
- n_Γmean_t(u1,u2)jump_u(v1,v2)
- n_Γmean_t(v1,v2)jump_u(u1,u2) ) *

l((v1,v2)) = 0

# FE problem
t_Ω1 = LinearFETerm(a_Ω1,trian_Ω1,quad_Ω1)
t_Ω2 = LinearFETerm(a_Ω2,trian_Ω2,quad_Ω2)
t_Γ = LinearFETerm(a_Γ,trian_Γ,quad_Γ)
op = AffineFEOperator(U,V,t_Ω1,t_Ω2,t_Γ)
op = AffineFEOperator(a,l,U,V)
uh1, uh2 = solve(op)
uh = (uh1,uh2)

# Postprocess
uh_Ω1 = restrict(uh1,trian_Ω1)
uh_Ω2 = restrict(uh2,trian_Ω2)
if outputfile !== nothing
writevtk(trian_Ω1,"$(outputfile)_steel",cellfields=["uh"=>uh_Ω1,"sigma"=>σ1(ε(uh_Ω1))])
writevtk(trian_Ω2,"$(outputfile)_concrete",cellfields=["uh"=>uh_Ω2,"sigma"=>σ2(ε(uh_Ω2))])
writevtk(Ω1,"$(outputfile)_steel",cellfields=["uh"=>uh1,"sigma"=>σ1ε(uh1)])
writevtk(Ω2,"$(outputfile)_concrete",cellfields=["uh"=>uh2,"sigma"=>σ2ε(uh2)])
end

end
Expand Down
51 changes: 26 additions & 25 deletions examples/PoissonCSGCutFEM/PoissonCSGCutFEM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function main(;n,outputfile=nothing)
pmin = 0.8*Point(-1,-1,-1)
pmax = 0.8*Point(1,1,1)
bgmodel = CartesianDiscreteModel(pmin,pmax,partition)

# Select geometry
R = 0.5
geo1 = cylinder(R,v=VectorValue(1,0,0))
Expand All @@ -30,51 +30,52 @@ function main(;n,outputfile=nothing)
cutgeo = cut(bgmodel,geo8)

# Setup integration meshes
trian_Ω = Triangulation(cutgeo,"csg")
trian_Γd = EmbeddedBoundary(cutgeo,"csg","source")
trian_Γg = GhostSkeleton(cutgeo,"csg")
Ω = Triangulation(cutgeo,"csg")
Γd = EmbeddedBoundary(cutgeo,"csg","source")
Γg = GhostSkeleton(cutgeo,"csg")

# Setup normal vectors
n_Γd = get_normal_vector(trian_Γd)
n_Γg = get_normal_vector(trian_Γg)
n_Γd = get_normal_vector(Γd)
n_Γg = get_normal_vector(Γg)

#writevtk(trian_Ω,"trian_O")
#writevtk(trian_Γd,"trian_Gd",cellfields=["normal"=>n_Γd])
#writevtk(trian_Γg,"trian_Gg",cellfields=["normal"=>n_Γg])
#writevtk(Ω,"trian_O")
#writevtk(Γd,"trian_Gd",cellfields=["normal"=>n_Γd])
#writevtk(Γg,"trian_Gg",cellfields=["normal"=>n_Γg])
#writevtk(Triangulation(bgmodel),"bgtrian")

# Setup cuadratures
# Setup Lebesgue measures
order = 1
quad_Ω = CellQuadrature(trian_Ω,2*order)
quad_Γd = CellQuadrature(trian_Γd,2*order)
quad_Γg = CellQuadrature(trian_Γg,2*order)
degree = 2*order
= Measure(Ω,degree)
dΓd = Measure(Γd,degree)
dΓg = Measure(Γg,degree)

# Setup FESpace
model = DiscreteModel(cutgeo,"csg")
V = TestFESpace(model=model,valuetype=Float64,reffe=:Lagrangian,order=order,conformity=:H1)
V = TestFESpace(model,ReferenceFE(lagrangian,Float64,order),conformity=:H1)
U = TrialFESpace(V)

# Weak form
γd = 10.0
γg = 0.1
h = (pmax - pmin)[1] / partition[1]
a_Ω(u,v) = (v)(u)
l_Ω(v) = v*f
a_Γd(u,v) = (γd/h)*v*u - v*(n_Γd(u)) - (n_Γd(v))*u
l_Γd(v) = (γd/h)*v*ud - (n_Γd(v))*ud
a_Γg(v,u) = (γg*h)*jump(n_Γg(v))*jump(n_Γg(u))

a(u,v) =
( (v)(u) ) *+
( (γd/h)*v*u - v*(n_Γd(u)) - (n_Γd(v))*u ) * dΓd +
( (γg*h)*jump(n_Γg(v))*jump(n_Γg(u)) ) * dΓg

l(v) =
( v*f ) *+
( (γd/h)*v*ud - (n_Γd(v))*ud ) * dΓd

# FE problem
t_Ω = AffineFETerm(a_Ω,l_Ω,trian_Ω,quad_Ω)
t_Γd = AffineFETerm(a_Γd,l_Γd,trian_Γd,quad_Γd)
t_Γg = LinearFETerm(a_Γg,trian_Γg,quad_Γg)
op = AffineFEOperator(U,V,t_Ω,t_Γd,t_Γg)
op = AffineFEOperator(a,l,U,V)
uh = solve(op)

# Postprocess
uh_Ω = restrict(uh,trian_Ω)
if outputfile !== nothing
writevtk(trian_Ω,outputfile,cellfields=["uh"=>uh_Ω])
writevtk(Ω,outputfile,cellfields=["uh"=>uh])
end

end
Expand Down
Loading

2 comments on commit 1d75d4d

@fverdugo
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/27811

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.0 -m "<description of version>" 1d75d4d44d67a7d31d788c37c3ac8ea7f7135b2a
git push origin v0.6.0

Please sign in to comment.