You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Development of a new solver for 1D differential equations #3
This thread will monitor the development of a new FEAScript solver for 1D linear differential equations with the following general form:
,
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
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!
@Stu-ops, here's the derivation of the weak form for the given PDE:
We initially multiply the equation by a test function () and integrate over the domain:
We then apply integration by parts to the second-order term:
We substitute back, keeping the other terms as-is:
Rearranging, the weak form is:
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.
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.
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: ,
This is a 1-D steady state convection–diffusion equation with source with: (diffusion term), (advection term), (reaction term - no reaction here) and the source term
We also apply a Dirichlet boundary condition at and a Neumann (zero-flux) condition at .
I’ve solved the problem in Fortran. Here are the results for different numbers of linear elements, which you can use for comparison.
Specifically, the results for the finer mesh (20 elements) are:
@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:
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?
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.
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
@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
Activity
nikoscham commentedon Sep 18, 2025
No problem from my side @Stu-ops. That will give me also some time to prepare more detailed instructions!
nikoscham commentedon Sep 23, 2025
@Stu-ops, here's the derivation of the weak form for the given PDE:
We initially multiply the equation by a test function (
) and integrate over the domain:
We then apply integration by parts to the second-order term:
We substitute back, keeping the other terms as-is:
Rearranging, the weak form is:
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!
Stu-ops commentedon Sep 23, 2025
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.
nikoscham commentedon Sep 24, 2025
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:
, 
(diffusion term),
(advection term),
(reaction term - no reaction here) and the source term

at
and a Neumann (zero-flux) condition at
.
This is a 1-D steady state convection–diffusion equation with source with:
We also apply a Dirichlet boundary condition
I’ve solved the problem in Fortran. Here are the results for different numbers of linear elements, which you can use for comparison.

Specifically, the results for the finer mesh (20 elements) are:
Best regards,
Nikos
Stu-ops commentedon Sep 24, 2025
@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:
nikoscham commentedon Sep 24, 2025
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?
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
Stu-ops commentedon Sep 24, 2025
nikoscham commentedon Sep 24, 2025
Nice work @Stu-ops
Stu-ops commentedon Oct 1, 2025
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
nikoscham commentedon Oct 1, 2025
@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
nikoscham commentedon Oct 7, 2025
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.