Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow access to physical groups in distributed fashion #103

Open
jellejurre opened this issue Dec 22, 2022 · 1 comment
Open

Allow access to physical groups in distributed fashion #103

jellejurre opened this issue Dec 22, 2022 · 1 comment

Comments

@jellejurre
Copy link

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)

@JordiManyer
Copy link
Member

JordiManyer commented Mar 2, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants