Skip to content

Minor changes in transient_heat_equation.jl and change in notation of test functions#1305

Draft
Avina-cK wants to merge 8 commits intoFerrite-FEM:masterfrom
Avina-cK:docs_patch2603
Draft

Minor changes in transient_heat_equation.jl and change in notation of test functions#1305
Avina-cK wants to merge 8 commits intoFerrite-FEM:masterfrom
Avina-cK:docs_patch2603

Conversation

@Avina-cK
Copy link
Copy Markdown
Contributor

In all changed files: Change in notation of test functions: δu, v -> ϕ
In transient_heat_equation.jl:

  • Assembly function of K,M,f merged to one.
  • Added reference to fe_into and heat_equation.jl

In transient_heat_equation.jl:
- Assembly function of K,M,f merged to one.
- Added reference to fe_into
@Avina-cK Avina-cK changed the title Change in notation of test functions Minor changes in transient_heat_equation.jl and change in notation of test functions Mar 13, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.40%. Comparing base (4eec1a3) to head (83e3602).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1305   +/-   ##
=======================================
  Coverage   94.40%   94.40%           
=======================================
  Files          40       40           
  Lines        6846     6846           
=======================================
  Hits         6463     6463           
  Misses        383      383           

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


The solution to the equation above is usually calculated from the corresponding weak
form. By multiplying the equation with an arbitrary *test function* $\delta u$, integrating
form. By multiplying the equation with an arbitrary *test function* $\varphi$, integrating
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 definitely see the point made by the contributor here @KnutAM . Since we explain it here from the Bubnov-Galerkin perspective I see that the notation $\delta u$ can indeed be a bit confusing. It is definitely not wrong to use $\delta u$ in this context. Would you agree with changing the notation here?

I am just not sure about the choice of $\varphi$, because we mix different alphabets for closely related symbols. Despite $v$ being visually close to $u$, should we rather opt for $v$ to still highlight the closeness of these objects?

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.

δu can indeed be a bit confusing

Yes, but I also think that for most users it will make things easier if we are always consistent that test function for x is δx, even if mathematically the variation and test functions are different. Alternatively, we should have another consistent scheme (but that would require something like φᵤ or uₜ to have a good scheme for coupled problems). Using the subscripts quickly becomes confusing though, since we typically want to reserve these for indices (e.g. old value in time-dependent problems)

Specifically using φ is not good, since we used that for the shape functions in the intro to FEM (we use N in other places).

In the code, we are currently mixing using the notation for the test function and function itself with the test shape function and shape function. (I'm no fan of that but others are :D)

My preferred notation

For a field x,

  • Function x (obviously) ($x \approx N_i a_i$)
  • Test function δx (but highlight in the intro to FEM that we use this even though we argue from the "Bubnov-Galerkin perspective") ($\delta x \approx \delta N_i c_i$)
  • Use N in code for shape_value for the function interpolation
  • Use δN in code for shape_value for the test function interpolation
  • In code, add letter Nx / δNx in coupled problems (and $N^x$ / $\delta N^x$ in math notation)
  • For assembly, we can subscript these, e.g. ∇δNᵢ⋅D⋅∇Nⱼ or ∇δNuᵢ⋅D⋅∇Npⱼ

Of course, we can exchange N -> φ, but easier to type N and consistent with the internal implementation in FunctionValues.
\varphi and \phi also renders a bit differently depending, sometimes \varphi looks like \phi, so we shouldn't use both for different things.

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.

And noting @fredrikekre's comment here: #1304 (comment) - I guess that would be ok if we note that we (ab)use the notation δx for the test function even though it is not necessarily a variation.

And regarding the transient heat problem specifically, I think this can be derived from a potential so it can actually be considered a variation, but this would fail for other cases such as partially saturated porous media.

I guess we could introduce a different notation instead of δ, e.g. 𝒯 (\scrT), but I'm guessing this would be more confusing for most users even if we are consistent?

# The semidiscrete weak form is given by
# ```math
# \int_{\Omega}v \frac{\partial u}{\partial t} \ \mathrm{d}\Omega + \int_{\Omega} k \nabla v \cdot \nabla u \ \mathrm{d}\Omega = \int_{\Omega} f v \ \mathrm{d}\Omega,
# \int_{\Omega}\delta u \frac{\partial u}{\partial t} \ \mathrm{d}\Omega + \int_{\Omega} k \nabla \delta u \cdot \nabla u \ \mathrm{d}\Omega = \int_{\Omega} f \delta u \ \mathrm{d}\Omega,
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.

Maybe I misunderstood you, but didn't you wanted to change these to be consistent with the heat example? Before changing these, let us wait for a quick feedback on https://github.com/Ferrite-FEM/Ferrite.jl/pull/1305/changes#r2934003577 .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

😅right. I must have missed that part. Once we get feedback on which symbol would be better, I'll update the lot and fix the two broken reference links.

Avina-cK added 2 commits April 1, 2026 19:57
Fixed broken links and changed test functions (in heat-equation.jl and transient-heat-equation.jl) to  δu.
@Avina-cK Avina-cK marked this pull request as ready for review April 17, 2026 17:20
@Avina-cK
Copy link
Copy Markdown
Contributor Author

All (except for one) examples' code sections are now using the following notation:

  • N in code for shape_value for the function interpolation
  • δN in code for shape_value for the test function interpolation
  • For assembly, subscripted these, e.g. ∇δNᵢ⋅D⋅∇Nⱼ or ∇δNuᵢ⋅D⋅∇Npⱼ

Copy link
Copy Markdown
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.

Some drive-by comments on stuff I saw found when going over the proposed changes. No need to take action yet.

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.

This tutorial is not fully translated to the new syntax (see the pressure blocks).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

😅 My mistake, I switched it to review way too soon. I'm a bit new to Git and contributing; thanks for your patience.

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.

Absolutely not problem! :) Take your time. And no worries, we all understand that the first steps to open source contributions have a bit of a barrier due all to the nitty-gritty details like familiarizing one-self with git, documentation conventions, ... .

Comment thread docs/src/literate-tutorials/reactive_surface.jl
Comment thread docs/src/literate-tutorials/transient_heat_equation.jl Outdated
Comment thread docs/src/literate-tutorials/dg_heat_equation.jl Outdated
Comment thread docs/src/literate-tutorials/heat_equation.jl Outdated
@Avina-cK Avina-cK marked this pull request as draft April 20, 2026 15:52
In the code of ns_vs_diffeq.jl:
* v - Nvᵢ / Nvⱼ
* ϕ - δNvᵢ/ δNvⱼ
* ψ - δNpᵢ/ δNpⱼ
* p - Npᵢ / Npⱼ

Added a section describing notation in fe_intro.md.
@Avina-cK
Copy link
Copy Markdown
Contributor Author

Avina-cK commented Apr 24, 2026

All (except linearshell) tutorials have now been updated. I'm not sure I know how to update the linearshell one, so I left it as is. It is partially already using the 'N' notation and I think it is okay as is.

A small section has been added in fe_intro describing the new notation.

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.

3 participants