Skip to content

Commit 3a8b4ef

Browse files
committed
Merge branch 'master' of github.com:gridap/Tutorials
2 parents 8d66c9f + a0da99a commit 3a8b4ef

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/elasticity.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ end
177177

178178
a(u,v) = ( ε(v) (σ_bimat(ε(u),tags)) )*
179179

180-
# In previous line, pay attention in the usage of the new constitutive law `σ_bimat`. Note that we have passed the vector `tags` containing the material identifiers in the last argument of the function`.
180+
# In previous line, pay attention in the usage of the new constitutive law `σ_bimat`. Note that we have passed the vector `tags` containing the material identifiers in the last argument of the function.
181181
#
182-
# At this point, we can build the FE problem again and solve it
182+
# At this point, we can build the FE problem again and solve it:
183183

184184
op = AffineFEOperator(a,l,U,V0)
185185
uh = solve(op)
@@ -189,5 +189,17 @@ uh = solve(op)
189189
writevtk(Ω,"results_bimat",cellfields=
190190
["uh"=>uh,"epsi"=>ε(uh),"sigma"=>σ_bimat(ε(uh),tags)])
191191

192+
# #### Constant multi-material law
193+
#
194+
# A material law depending on the model tags but not on the fields can be defined as follow:
195+
196+
tags_field = CellField(tags, Ω)
197+
σ_from_tag(tag) = tag==alu_tag ? 1. : 0.
198+
σ_bimat_cst = σ_from_tag tags_field
199+
200+
# `tags_field` is a field which value at $x$ is the tag of the cell containing $x$. `σ_bimat_cst` is used like a constant in (bi)linear form definition and solution export:
201+
202+
a(u,v) = ( σ_bimat_cst * (u)(v))*
203+
writevtk(Ω,"const_law",cellfields= ["sigma"=>σ_bimat_cst])
192204

193205
# Tutorial done!

0 commit comments

Comments
 (0)