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

DG heat equation tutorial #787

Merged
merged 37 commits into from
Jan 4, 2024

Conversation

AbdAlazezAhmed
Copy link
Collaborator

Tested convergence using an edited version of #640 and it seems to converge * currently doing some edits to optimize it and see where the results stagnate. Will leave the script in a resolved comment once finished so it doesn't take much space *
image
image

These plots are in log-log, and N is the number of elements in one of the dimensions (so for quad the number of elements is N^2)

@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cfe3863) 93.28% compared to head (42daa59) 93.27%.
Report is 2 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #787      +/-   ##
==========================================
- Coverage   93.28%   93.27%   -0.01%     
==========================================
  Files          36       36              
  Lines        5224     5235      +11     
==========================================
+ Hits         4873     4883      +10     
- Misses        351      352       +1     

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

@termi-official
Copy link
Member

Is the continuous below order 2 or the discontinuous above order 2?

@AbdAlazezAhmed
Copy link
Collaborator Author

Is the continuous below order 2 or the discontinuous above order 2?

I think you mean what the two lines at the bottom are, right?
The two lines are the bottom are order 2, the lower one is discontinuous and the above one is continuous

@termi-official
Copy link
Member

But they differ in slope, right? What are their exact orders?

Copy link
Member

@termi-official termi-official left a comment

Choose a reason for hiding this comment

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

I think we must clarify some details here.

docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
@AbdAlazezAhmed
Copy link
Collaborator Author

Some convergence script results as graphs can be harder to read (all for quadrilateral):

  • First order continuous
 Row │ N      Linf         L2           L2_expected_next  H1         H1_expected_next
     │ Int64  Float64      Float64      Float64           Float64    Float64
─────┼────────────────────────────────────────────────────────────────────────────────
   12  0.130196     0.202511          0.0506276    1.00388           0.50194
   24  0.0460564    0.0510494         0.0127623    0.502255          0.251128
   38  0.012506     0.0128262         0.00320656   0.251625          0.125813
   416  0.00319102   0.00321117        0.000802793  0.125888          0.0629439
   532  0.000801829  0.00080309        0.000200773  0.0629537         0.0314769
   664  0.000200712  0.000200791       5.01978e-5   0.0314781         0.015739
  • First order discontinuous
 Row │ N      Linf         L2           L2_expected_next  H1         H1_expected_next
     │ Int64  Float64      Float64      Float64           Float64    Float64
─────┼────────────────────────────────────────────────────────────────────────────────
   12  0.130196     0.202511          0.0506276    1.00388           0.50194
   24  0.0453722    0.0501761         0.012544     0.502248          0.251124
   38  0.0124713    0.0127358         0.00318395   0.251674          0.125837
   416  0.00318923   0.00320436        0.000801089  0.125898          0.0629488
   532  0.000801729  0.000802629       0.000200657  0.0629551         0.0314776
   664  0.000200707  0.000200761       5.01903e-5   0.0314783         0.0157391
  • Second order continuous
 Row │ N      Linf         L2           L2_expected_next  H1           H1_expected_next
     │ Int64  Float64      Float64      Float64           Float64      Float64
─────┼──────────────────────────────────────────────────────────────────────────────────
   12  0.0247816    0.028836          0.0036045    0.204098          0.0510244
   24  0.00307976   0.00386503        0.000483128  0.0511228         0.0127807
   38  0.000388316  0.000490246       6.12807e-5   0.0127715         0.00319286
   416  4.81335e-5   6.14925e-5        7.68657e-6   0.00319204        0.00079801
   532  5.97622e-6   7.6931e-6         9.61637e-7   0.000797955       0.000199489
   664  7.44099e-7   9.61841e-7        1.2023e-7    0.000199485       4.98713e-5
  • Second order discontinuous
 Row │ N      Linf         L2           L2_expected_next  H1           H1_expected_next
     │ Int64  Float64      Float64      Float64           Float64      Float64
─────┼──────────────────────────────────────────────────────────────────────────────────
   12  0.0247816    0.028836          0.0036045    0.204098          0.0510244
   24  0.00283828   0.00320227        0.000400284  0.0531917         0.0132979
   38  0.000371974  0.000358141       4.47676e-5   0.0133091         0.00332728
   416  4.69751e-5   4.18634e-5        5.23293e-6   0.00332116        0.00083029
   532  5.88702e-6   5.04621e-6        6.30776e-7   0.000829385       0.000207346
   664  7.36358e-7   6.18999e-7        7.73749e-8   0.000207235       5.18088e-5
  • Third order continuous
Row │ N      Linf         L2           L2_expected_next  H1           H1_expected_next
   │ Int64  Float64      Float64      Float64           Float64      Float64
─────┼──────────────────────────────────────────────────────────────────────────────────
 12  0.00287087   0.00271881        0.000169926  0.0268203         0.00335254
 24  0.000242052  0.000176249       1.10156e-5   0.00338103        0.000422628
 38  1.61882e-5   1.11276e-5        6.95476e-7   0.000423456       5.2932e-5
 416  1.03618e-6   6.97278e-7        4.35799e-8   5.29573e-5        6.61966e-6
 532  6.51477e-8   4.36082e-8        2.72552e-9   6.62044e-6        8.27556e-7
 664  4.07782e-9   2.72595e-9        1.70372e-10  8.2758e-7         1.03448e-7
  • Third order discontinuous
 Row │ N      Linf         L2           L2_expected_next  H1           H1_expected_next
     │ Int64  Float64      Float64      Float64           Float64      Float64
─────┼──────────────────────────────────────────────────────────────────────────────────
 12  0.00287087   0.00271881        0.000169926  0.0268203         0.00335254
 24  0.000228848  0.000172388       1.07742e-5   0.00351791        0.000439739
 38  1.60126e-5   1.10347e-5        6.89667e-7   0.000436887       5.46109e-5
 416  1.03317e-6   6.95645e-7        4.34778e-8   5.36008e-5        6.7001e-6
 532  6.50996e-8   4.35815e-8        2.72385e-9   6.64427e-6        8.30534e-7
 664  4.07685e-9   2.72552e-9        1.70345e-10  8.28381e-7        1.03548e-7

The expected norm is the current norm * 1/2^(order) for H1 and norm * 1/2^(order + 1) for L2
Looks like I misread the data at first, this one looks like it tends to follow the expected behavior?
Since we're halving the element size each time then $\Delta Log_2(L2) \approx P+1$ and $\Delta Log_2(H1) \approx P $

[ Info: order = 1
[ Info: slopes of L2 vs N = [-2.0129235398778857, -1.9781123405090923, -1.9907819594249005, -1.9972307802964462, -1.9992507830984803]
[ Info: slopes of H1 vs N = [-0.9991152976325772, -0.9968411962760191, -0.999308479759299, -0.9998539901566406, -0.9999670340139399]

[ Info: order = 2
[ Info: slopes of L2 vs N = [-3.1707031297879107, -3.1604949308839316, -3.096765601242465, -3.052417650566909, -3.027191020911541]
[ Info: slopes of H1 vs N = [-1.939987107438954, -1.99878412103502, -2.0026566568598767, -2.001573208098428, -2.000772421073222]

[ Info: order = 3
[ Info: slopes of L2 vs N = [-3.979248450192239, -3.9655415209701683, -3.9875483912823775, -3.9965627848873275, -3.999110899899076]
[ Info: slopes of H1 vs N = [-2.9305366294295183, -3.0093852067151214, -3.0269354855259873, -3.012071199303561, -3.0037441172379964]

docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
@AbdAlazezAhmed AbdAlazezAhmed marked this pull request as ready for review December 15, 2023 00:12
Copy link
Member

@termi-official termi-official left a comment

Choose a reason for hiding this comment

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

LGTM

@termi-official termi-official added the awaiting review PR is finished from the authors POV, waiting for feedback label Dec 22, 2023
Copy link
Member

@KnutAM KnutAM left a comment

Choose a reason for hiding this comment

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

Very nice work!
I just had some time to read and give some thoughts and comments (this is how far I got now)

Overall, I think it would be nice to avoid repeating too many things from the basic heat equation tutorial and focus on what is new here. IMO this is an advanced tutorial and readers should be familiar with the basic Ferrite syntax.

docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
@AbdAlazezAhmed AbdAlazezAhmed removed the awaiting review PR is finished from the authors POV, waiting for feedback label Dec 26, 2023
@AbdAlazezAhmed AbdAlazezAhmed marked this pull request as ready for review January 1, 2024 03:31
@AbdAlazezAhmed AbdAlazezAhmed added the awaiting review PR is finished from the authors POV, waiting for feedback label Jan 1, 2024
Copy link
Member

@KnutAM KnutAM left a comment

Choose a reason for hiding this comment

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

This is looking very good!
Mostly formatting (boldface) comments.

docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
@AbdAlazezAhmed AbdAlazezAhmed marked this pull request as draft January 1, 2024 19:23
@AbdAlazezAhmed AbdAlazezAhmed removed the awaiting review PR is finished from the authors POV, waiting for feedback label Jan 1, 2024
@AbdAlazezAhmed AbdAlazezAhmed marked this pull request as ready for review January 1, 2024 21:56
@AbdAlazezAhmed AbdAlazezAhmed added the awaiting review PR is finished from the authors POV, waiting for feedback label Jan 1, 2024
Copy link
Member

@KnutAM KnutAM left a comment

Choose a reason for hiding this comment

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

After the suggested fine-tuning, it is good to go from my perspective regarding formatting and clarity. (But I haven't checked the correctness wrt. the literature. I leave this to @termi-official :))

Nice work @AbdAlazezAhmed!

docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
docs/src/literate-tutorials/dg_heat_equation.jl Outdated Show resolved Hide resolved
@AbdAlazezAhmed AbdAlazezAhmed marked this pull request as draft January 2, 2024 22:24
Co-authored-by: Knut Andreas Meyer <[email protected]>
Co-authored-by: Dennis Ogiermann <[email protected]>
@AbdAlazezAhmed AbdAlazezAhmed removed the awaiting review PR is finished from the authors POV, waiting for feedback label Jan 2, 2024
@AbdAlazezAhmed AbdAlazezAhmed added the awaiting review PR is finished from the authors POV, waiting for feedback label Jan 4, 2024
@AbdAlazezAhmed AbdAlazezAhmed marked this pull request as ready for review January 4, 2024 06:18
@fredrikekre fredrikekre merged commit 0f74ebf into Ferrite-FEM:master Jan 4, 2024
6 checks passed
@KristofferC
Copy link
Collaborator

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review PR is finished from the authors POV, waiting for feedback
Projects
Development

Successfully merging this pull request may close these issues.

6 participants