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

Parallelization of a concentrated load using GridapDistributed #132

Open
ZiwenH opened this issue Oct 4, 2023 · 3 comments
Open

Parallelization of a concentrated load using GridapDistributed #132

ZiwenH opened this issue Oct 4, 2023 · 3 comments

Comments

@ZiwenH
Copy link

ZiwenH commented Oct 4, 2023

I'm trying to parallelize a linear elastic problem solver with a concentrated load applied on the middle point of ine boundary. In series code the load is described using DiracDelta function as following:

function DiracDelta(model::DiscreteModel{D}, pvec::Vector{Point{D,T}}) where {D,T}
trian = Triangulation(model)
cell_to_pindices = _cell_to_pindices(pvec,trian)
cell_ids = collect(keys(cell_to_pindices))
cell_points = collect(values(cell_to_pindices))
points = map(i->pvec[cell_points[i]], 1:length(cell_ids))
weights_x_cell = Fill.(one(T),length.(cell_points))
pquad = map(i -> GenericQuadrature(points[i],weights_x_cell[i]), 1:length(cell_ids))
trianv = view(trian,cell_ids)
pmeas = Measure(CellQuadrature(pquad,points,weights_x_cell,trianv,PhysicalDomain(),PhysicalDomain()))
GenericDiracDelta{0,D,NotGridEntity}(trianv,pmeas)
end

Since in parallel mode, the model is a GenericDistributedDiscreteModel() which is not supported in original definition, I tried to write a parallel version of it:

tmp = map(local_views(model)) do model
p = Point(1.0,0.5)
trian = Triangulation(model)
cache = _point_to_cell_cache(KDTreeSearch(),trian)
cell = _point_to_cell!(cache, p)
...
end

Yet the _point_to_cell!(cache,p) throughs an error: ERROR: AssertionError: Point (1.0, 0.5) is not inside any active cell
I'm quite sure that point p is in the grid and the serial code runs well. Any idea how this problem results from? Or is there any other parallel application of a concentrated load on a point or a line?

@JordiManyer
Copy link
Member

JordiManyer commented Oct 4, 2023

@ZiwenH I would say the point is only in one of the processors local meshes. In parallel, processors only store a portion of the mesh, not all of it. Otherwise memory consumption would not scale. Therefore all other processors look for the point and cannot find it. Therefore the error. Searching for arbitrary points in parallel is a bad idea. Even if you find a way, this will be never be scalable.

Have a look at this other issue.

@ZiwenH
Copy link
Author

ZiwenH commented Oct 4, 2023

Thanks for the quick response @JordiManyer. I checked the issue you listed before and the problem is quite similar.
So in this case, do you think is there any other ways to handle a concentrated load in parallel?

@JordiManyer
Copy link
Member

It's not really my area, but in general I would advise creating a DistributedCellField that can represent that load.

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