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 Sep 18, 2025

    @nikoscham
    MemberAuthor

    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.

    No problem from my side @Stu-ops. That will give me also some time to prepare more detailed instructions!

  2. nikoscham commented on Sep 23, 2025

    @nikoscham
    MemberAuthor

    @Stu-ops, here's the derivation of the weak form for the given PDE:

    Image

    We initially multiply the equation by a test function (Image) and integrate over the domain:

    Image

    We then apply integration by parts to the second-order term:

    Image

    We substitute back, keeping the other terms as-is:

    Image

    Rearranging, the weak form is:

    Image

    The boundary term incorporates the natural boundary conditions. Let me know if you need further details or help with discretization!

    Please do what you can—if you cannot complete everything 100%, that’s totally fine! Just push as far as you can, and we can continue or review together.

    Thanks a lot for your work on this!

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

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

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

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

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

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

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

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

  12. linked a pull request that will close this issueFeature/general form pde script #48on Oct 7, 2025
  13. linked a pull request that will close this issuefeature 1D-PDE-Solver for FEAScript-core #42on Oct 7, 2025
  14. 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