Allow access to physical groups in distributed fashion
Maybe this is possible, but I haven't found a way to do this in a parallel way, but I'm trying to adapt some parts of Tutorial 3 to a distributed fashion.
In there, the parts I want to copy is:
model = GmshDiscreteModel(parts, "./geometry.msh")
labels = get_face_labeling(model)
tags = get_face_tag(labels,dimension)
function σ_bimat(ε,tag)
if tag == alu_tag
return λ_alu*tr(ε)*one(ε) + 2*μ_alu*ε
else
return λ_steel*tr(ε)*one(ε) + 2*μ_steel*ε
end
end
a(u,v) = ∫( ε(v) ⊙ (σ_bimat∘(ε(u),tags)) )*dΩ
So I want to use different parameters depending on the 3d physical group of the element. I was wondering if and how this is possible in a distributed fashion, since with this direct code I get:
ERROR: LoadError: MethodError: no method matching get_face_tag(::GridapDistributed.DistributedFaceLabeling{MPIData{FaceLabeling, 1}}, ::Int64)
@jellejurre It is possible, but you should use the map_parts functionality to extract the FaceLabeling in each processor.
Something along the lines of
tags = map_parts(local_views(labels)) do labels
get_face_tag(labels,dimension)
end
This will return an AbstractPData with the tags in each part. You can then create a parallel version of your σ_bimat function, which takes ε as a DistributedCellField and tag as AbstractPData. Something like
function σ_bimat(ε::DsitributedCellField,tag::AbstractPData)
fields = map_parts(local_views(ε),tag) do ε,tag
σ_bimat(ε,tag)
end
return DistributedCellField(fields)
end
This calls the serial version of σ_bimat(ε,tag) in each processor, which returns a CellField in each part. Then you return a DistributedCellField with those serial cellfields as parts.