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

Adding support to DiracDelta for generic points in the domain #837

Merged
merged 17 commits into from
Oct 17, 2022

Conversation

kishore-nori
Copy link
Collaborator

@kishore-nori kishore-nori commented Oct 12, 2022

Hi @santiagobadia and @amartinhuertas, I added methods to DiracDelta to support generic points in the domain, which are not grid entities with tags, would be glad to know your suggestions for improvement and changes. This PR is aimed at resolving the issue [#357]. Given that CellFields can now be evaluated at a generic point in the domain, the method make use of this to calculate the integral of the composition of DiracDelta with a CellField, and also works for generic functions compatible to evaluate at a Gridap Point.

So as to conform with DiracDelta struct, a DiscreteModel is constructed with given set of Points to generate Triangulation and Measure. If we are not required to conform with the existing framework, we could just store the Points as a struct and evaluate the CellField point-wise directly, but the above doesn't create much overhead. And probably the later is not generic enough to be extendable to line and surface forcing terms.

The usage is same as earlier but the constructor is as follows:

model = CartesianDiscreteModel((0,1,0,1),(3,3))
p = Point(0.1,0.2)
pvec = [p, 1.5*p]
δ = DiracDelta(model,p)
δ_comb = DiracDelta(model,pvec)

[WIP] TO DO: support for line and surface loads! (like presented here #408 (comment)). I think the line load case is extendable in a straight forward manner using CartesianDiscreteModel (but may be needs to be done separately for each line - defined by a pair of points..)

@kishore-nori kishore-nori self-assigned this Oct 12, 2022
@kishore-nori kishore-nori changed the title Adding support DiracDelta for generic points in the domain Adding support to DiracDelta for generic points in the domain Oct 12, 2022
@amartinhuertas
Copy link
Member

HI @kishore-nori ! Thanks for your work. Can you please add an entry to the NEWS.md file pointing to this work ?

Copy link
Member

@amartinhuertas amartinhuertas left a comment

Choose a reason for hiding this comment

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

Hi @kishore-nori ! I have finished a first round of review. Please address or rebut my comments/remarks/etc..

@kishore-nori
Copy link
Collaborator Author

Thank you very much for the comments Alberto, I ll make changes accordingly following our discussion in comments here.

@amartinhuertas amartinhuertas marked this pull request as draft October 14, 2022 06:53
@kishore-nori
Copy link
Collaborator Author

Hi @amartinhuertas and @santiagobadia, I have rewritten the implementation (realised I could do it in a good way, after our discussion to approach it as quadrature). This now works for evaluations and also solving the PDE with DiracDelta at a single or even a set of Points. I added tests to compare with both the exact solution and the earlier tag based implementation of DiracDelta. I also incorporated the earlier review comments from our discussions. Would be happy to know further comments for improvement.

Copy link
Member

@amartinhuertas amartinhuertas left a comment

Choose a reason for hiding this comment

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

Hi @kishore-nori ! nice work! I finished with my review. Please answer/rebut my comments.

@codecov-commenter
Copy link

codecov-commenter commented Oct 17, 2022

Codecov Report

Merging #837 (c5d38b1) into master (173e625) will increase coverage by 0.04%.
The diff coverage is 97.82%.

@@            Coverage Diff             @@
##           master     #837      +/-   ##
==========================================
+ Coverage   88.29%   88.33%   +0.04%     
==========================================
  Files         164      164              
  Lines       19079    19120      +41     
==========================================
+ Hits        16845    16889      +44     
+ Misses       2234     2231       -3     
Impacted Files Coverage Δ
src/CellData/DiracDeltas.jl 93.42% <97.82%> (+7.70%) ⬆️
src/Geometry/Triangulations.jl 89.29% <0.00%> (+0.73%) ⬆️
src/CellData/CellQuadratures.jl 79.78% <0.00%> (+1.06%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@amartinhuertas amartinhuertas marked this pull request as ready for review October 17, 2022 02:46
@kishore-nori kishore-nori linked an issue Oct 17, 2022 that may be closed by this pull request
Need to analyze why this is much faster than the usual way and
if we can generalize it to Gridap to make it faster, for such
situations involving Functions
@amartinhuertas amartinhuertas merged commit ce3a756 into master Oct 17, 2022
@kishore-nori kishore-nori deleted the dirac-delta branch October 17, 2022 07:54
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.

Add DiractDistribution for point "things"
3 participants