Skip to content

Dirichlet values#74

Merged
amartinhuertas merged 16 commits intogridap:masterfrom
oriolcg:dirichlet_values
Feb 14, 2022
Merged

Dirichlet values#74
amartinhuertas merged 16 commits intogridap:masterfrom
oriolcg:dirichlet_values

Conversation

@oriolcg
Copy link
Copy Markdown
Member

@oriolcg oriolcg commented Feb 1, 2022

Added support for interpolate_everywhere

@oriolcg
Copy link
Copy Markdown
Member Author

oriolcg commented Feb 11, 2022

Hi @amartinhuertas , @fverdugo . Is there any missing point that prevents the merge of this PR?

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 11, 2022

Codecov Report

❌ Patch coverage is 0% with 85 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (b09230f) to head (b1fbd6b).
⚠️ Report is 636 commits behind head on master.

Files with missing lines Patch % Lines
src/FESpaces.jl 0.00% 45 Missing ⚠️
src/MultiField.jl 0.00% 40 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master     #74   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files           7       7           
  Lines        1240    1322   +82     
======================================
- Misses       1240    1322   +82     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/FESpaces.jl Outdated
@abstractmethod
end

function get_dirichlet_dof_ids(f::DistributedFESpace)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Missing FESpaces., agreed?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

BTW, did you implement this abstract method for the subtypes of DistributedFESpaces? I am not able to see the implementations. If they are not implemented, why arent they required?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 7030e01.

Regarding the implementation for subtypes, that would only involve DistributedMultiFieldFESpace, right? In that case the specialization is not necessary because this function is called for each of the single FE spaces. That's also the case in Gridap, where this function is not specialized for MultiFieldFESpaces.

Copy link
Copy Markdown
Member

@amartinhuertas amartinhuertas Feb 13, 2022

Choose a reason for hiding this comment

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

I have been taken a more close look at the rationale behind the get_dirichlet_dof_ids in Gridap.jl.

The abstract method at hand is defined at the SingleFieldFESpace level in the type hierarchy.

All the subtypes of SingleFieldFESpace implement it, as expected

julia> subtypes(Gridap.FESpaces.SingleFieldFESpace)
6-element Vector{Any}:
 Gridap.FESpaces.DirichletFESpace
 Gridap.FESpaces.FESpaceWithConstantFixed
 Gridap.FESpaces.FESpaceWithLinearConstraints
 Gridap.FESpaces.UnconstrainedFESpace
 Gridap.FESpaces.ZeroMeanFESpace
 TrialFESpace

The method is called SOLELY within the whole Gridap.jl code at the following two points:

num_dirichlet_dofs(f::SingleFieldFESpace) = length(get_dirichlet_dof_ids(f))

function get_free_dof_ids(f::DirichletFESpace)
  get_dirichlet_dof_ids(f.space)
end

Going back to GridapDistributed.jl, and given the above, wouldn't it make more sense to define (and implement) the method for DistributedSingleFieldFESpace? Should we also implement num_dirichlet_dofs?

In any case, I think that before implementing anything we should understand why do we need this method in GridapDistributed. Why do you need it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do you need it?

Ok, I now see that you need it in the following line (sorry, I had missed it):

https://github.com/gridap/GridapDistributed.jl/pull/74/files#diff-8f937e22a7913b08b6cc1767736c1fd408cb88da2cd2ae15a5335f8ca5833fe4R42

Should we also implement num_dirichlet_dofs?

Ok, I see you have implemented it here:

https://github.com/gridap/GridapDistributed.jl/pull/74/files#diff-8f937e22a7913b08b6cc1767736c1fd408cb88da2cd2ae15a5335f8ca5833fe4R48

Anyway, i still do not get why it is working. Are you actually calling zero_dirichlet_values(f::DistributedFESpace) ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I used zero_dirichlet_values in a driver prior to having the current interpolate_everywhere implementation. It is not used for the devs proposed in this PR and, to be consistent, I removed from this PR. If needed in the future, we can re-implement it.

Comment thread src/FESpaces.jl Outdated
Comment thread test/FESpacesTests.jl
@amartinhuertas
Copy link
Copy Markdown
Member

Hi @amartinhuertas , @fverdugo . Is there any missing point that prevents the merge of this PR?

Hi @oriolcg ! Thanks for your work. I have added some comments to the code you have added. Besides, I also miss a description of the work you did in the NEWS.md file.

@fverdugo fverdugo self-requested a review February 14, 2022 06:49
Comment thread src/FESpaces.jl Outdated
fill!(vec,zero(eltype(vec)))
end

function FESpaces.zero_dirichlet_values(f::DistributedFESpace)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not sure if it is correct. What is the type of vec ?

I think that the "tricky" part regarding Dirichlet dofs is that we never generate a global numeration for them. Thus, the queries related with dirichlet dofs, should to return an AbstractPData object that wraps the corresponding serial Gridap call. They cannot return global objects that would require to generate a global numeration for them.

Another option would be to create a global numeration for Dirichlet dofs. It would be more elegant because the rationale for free and Dirichlet would be equivalent, but this is an extra cost not needed in general.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed in fa9873e (to be re-implemented in another PR if needed)

Comment thread src/FESpaces.jl Outdated

FESpaces.num_free_dofs(f::DistributedFESpace) = length(get_free_dof_ids(f))

FESpaces.num_dirichlet_dofs(f::DistributedFESpace) = length(get_dirichlet_dof_ids(f))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would say that even this one needs to return an AbstractPData object.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Removed in fa9873e

@amartinhuertas amartinhuertas merged commit 54d1766 into gridap:master Feb 14, 2022
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

Successfully merging this pull request may close these issues.

4 participants