Skip to content

Development of a new solver for 1D differential equations #3

Description

@nikoscham

Overview

This thread will monitor the development of a new FEAScript solver for 1D linear differential equations with the following general form:

DE_1,

where u is the unknown quantity we want to find (e.g., temperature, concentration, displacement). x is the position along a 1D line. A, B, C, D are coefficients that the user will provide. By choosing different values for them, the user can model different physical situations.

Tasks

  • Review and update the mesh generation and nodal numbering process for 1D meshes
  • Create a new generalFormPDEScript solver for 1D differential equations, where the differential equation will be converted into the "weak", integral, form.
  • Create a new tutorial and compare the results with the analytical solution
  • Integrate the solver with FEAScript's existing utilities

Activity

  1. nikoscham commented on May 19, 2025

    @nikoscham
    MemberAuthor

    This issue has been added to the FEAScript roadmap for the upcoming 0.2.0 release (https://github.com/orgs/FEAScript/discussions/17).

  2. nikoscham commented on Sep 5, 2025

    @nikoscham
    MemberAuthor

    Support for time-dependent PDEs is also considered:

    Image,

    where we suggest using the Backward Euler time-integration method.

  3. removed their assignment
    on Sep 16, 2025
  4. Stu-ops commented on Sep 17, 2025

    @Stu-ops
    Contributor

    Hey @nikoscham 👋 , could you assign it to me? I’d like to work on fixing it.

  5. nikoscham commented on Sep 17, 2025

    @nikoscham
    MemberAuthor

    Hey @nikoscham 👋 , could you assign it to me? I’d like to work on fixing it.

    Hi Priyank (@Stu-ops)! Thanks for your interest in contributing to the FEAScript project. Well, actually this one sits on the edge between a “good first issue” and an intermediate task 😃. The methodology is as follows:

    1. First you have to derive the weak form of the equation presented here:

    Overview

    This thread will monitor the development of a new FEAScript solver for 1D linear differential equations with the following general form:

    DE_1,

    where u is the unknown quantity we want to find (e.g., temperature, concentration, displacement). x is the position along a 1D line. A, B, C, D are coefficients that the user will provide. By choosing different values for them, the user can model different physical situations.

    I can help with the derivation and will add it as a follow-up comment in the next days. In the meanwhile you can also read some notes I wrote regarding the finite element method: https://blog.feascript.com/tutorial/2023/12/01/finite-element-method-notes.html

    1. Next you have to create a new solver generalFormPDEScript in the spirit of the existing solvers https://github.com/FEAScript/FEAScript-core/tree/main/src/solvers. Don't worry though, we can implement it together step by step if you agree.

    Best regards and please also consider ⭐️ the library!
    Nikos

  6. Stu-ops commented on Sep 18, 2025

    @Stu-ops
    Contributor

    Thanks @nikoscham for giving me this opportunity. Before I move ahead, I have a small but important request. I’ll be raising the PR after October 1st so that it counts for Hacktoberfest, which is important to me. In the meantime, I’ll continue working on the contribution to be ready by then. I hope that’s not a problem for you.

  7. 2 remaining items

  8. Stu-ops commented on Sep 23, 2025

    @Stu-ops
    Contributor

    Hi @nikoscham, thanks a lot for your message. I’ve been a bit occupied with academic commitments, so I wasn’t able to work on the weak form creation for 1D-PDE. However, after seeing your message, I’ve started working on writing code for it and I expect it might be completed in a few days.
    In the meantime, please suggest some test cases that I can use to verify my code before moving forward. That would really help ensure correctness during development. And thanks for your valuable assistance.

  9. nikoscham commented on Sep 24, 2025

    @nikoscham
    MemberAuthor

    Thanks for your update @Stu-ops! No worries at all — I completely understand.

    I’ve prepared a simple 1-D test case you can use to verify your weak-form code. It’s based on the equation:
    Image, Image
    This is a 1-D steady state convection–diffusion equation with source with: Image (diffusion term), Image (advection term), Image (reaction term - no reaction here) and the source term
    Image
    We also apply a Dirichlet boundary condition Image at Image and a Neumann (zero-flux) condition at Image.

    I’ve solved the problem in Fortran. Here are the results for different numbers of linear elements, which you can use for comparison.
    Image

    Specifically, the results for the finer mesh (20 elements) are:

    x u
    0.00E+00 1.00E+00
    5.00E-02 9.99E-01
    1.00E-01 9.98E-01
    1.50E-01 9.97E-01
    2.00E-01 9.94E-01
    2.50E-01 9.89E-01
    3.00E-01 9.82E-01
    3.50E-01 9.69E-01
    4.00E-01 9.49E-01
    4.50E-01 9.21E-01
    5.00E-01 8.94E-01
    5.50E-01 8.80E-01
    6.00E-01 8.76E-01
    6.50E-01 8.76E-01
    7.00E-01 8.76E-01
    7.50E-01 8.76E-01
    8.00E-01 8.76E-01
    8.50E-01 8.76E-01
    9.00E-01 8.76E-01
    9.50E-01 8.76E-01
    1.00E+00 8.76E-01

    Best regards,
    Nikos

  10. Stu-ops commented on Sep 24, 2025

    @Stu-ops
    Contributor

    @nikoscham thanks for this testcase, I have to run my code on this and see uncommon results, i don't know why it may be caused by addictive term ,reduction term or code discretization logic but before I need to show you the output for this testcase:

    Image and my example file code for it .

    Image thanks you

  11. nikoscham commented on Sep 24, 2025

    @nikoscham
    MemberAuthor

    Well @Stu-ops, it’s possible that I had the wrong signs in the Fortran code. I actually solved it a while ago. Could you try it with this version as well?

    Image

    I’m also uploading the legacy Fortran code I used so you can check the logic and signs if you can. I'm am sorry, I don't have the time to review this myself.

    1d_ode.zip

  12. Stu-ops commented on Sep 24, 2025

    @Stu-ops
    Contributor
    Image I think this Equation is well-suited for this test case, with some minor errors.
  13. nikoscham commented on Sep 24, 2025

    @nikoscham
    MemberAuthor

    Image I think this Equation is well-suited for this test case, with some minor errors.

    Nice work @Stu-ops

  14. Stu-ops commented on Oct 1, 2025

    @Stu-ops
    Contributor

    Hey @nikoscham i made pr for this issue, you can review and see the changes for it.
    And also, please can you tag my pr with the “hacktoberfest-accepted” after accepting it and also share any type of suggestions regarding the pr, because it was my first pr, so I don't know so much about it.
    for any type information related to the hactoberfest is given here:Hactoberfest

  15. nikoscham commented on Oct 1, 2025

    @nikoscham
    MemberAuthor

    @Stu-ops I really appreciate your effort in tackling this issue! I’ll review your PR as soon as possible and provide feedback. And of course, once it’s accepted, I’ll make sure to tag it with “hacktoberfest-accepted” as requested.
    Best, Nikos

  16. nikoscham commented on Oct 7, 2025

    @nikoscham
    MemberAuthor

    The integration has been completed. A new tutorial has been added (https://feascript.com/tutorials/advection-diffusion-1d.html) for the: d²u/dx² - 10 du/dx = 10 * exp(-200 * (x - 0.5)²) equation. Thanks again @Stu-ops for the contribution.

  17. linked a pull request that will close this issueFeature/general form pde script #48on Oct 7, 2025
  18. linked a pull request that will close this issuefeature 1D-PDE-Solver for FEAScript-core #42on Oct 7, 2025
  19. added this to the 0.2.0 milestone on Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions