Skip to content

WIP: Implemented sin w->t grids#162

Merged
moritzleucke merged 9 commits into
nomad-coe:mainfrom
marm314:main
Nov 11, 2025
Merged

WIP: Implemented sin w->t grids#162
moritzleucke merged 9 commits into
nomad-coe:mainfrom
marm314:main

Conversation

@marm314
Copy link
Copy Markdown
Contributor

@marm314 marm314 commented Oct 29, 2025

Dear all,

I have implemented the construction of the sine w->t grids that were missing. As suggested in Issue 17 (#161), the sin_w_to_t grids have been implemented as optional in minimax_grids.F90 to avoid problems with other codes already using greenX. I have also updated the test_gx_minimax_grid.f90, which now shows how to request these grids. Please, let me know what/how test(s) should be incorporated (or, feel free to directly add them).

Looking forward to hearing from you,

Mauricio

@marm314
Copy link
Copy Markdown
Contributor Author

marm314 commented Oct 29, 2025

@JWilhelm @fdelesma

Comment thread GX-TimeFrequency/src/minimax_grids.F90 Outdated
Comment thread GX-TimeFrequency/test/test_gx_minimax_grid.f90 Outdated
Copy link
Copy Markdown
Contributor

@fdelesma fdelesma left a comment

Choose a reason for hiding this comment

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

Left a few comments to address. I’ll be on a business trip for a bit, but I’ll check back once I return.

@marm314
Copy link
Copy Markdown
Contributor Author

marm314 commented Nov 2, 2025

Hello,

Thank @fdelesma for the revision and your comments. I have updated the files as suggested.
Looking forward to hearing from you if there are more comments or suggestions to address.

Bests,

@fdelesma
Copy link
Copy Markdown
Contributor

@marm314 Thanks for your changes. I worked on the regression test for the sine transformation duality error, both with and without regularization. It should now meet the requirements for this MR. @moritzleucke, could review it.

Copy link
Copy Markdown
Contributor

@fdelesma fdelesma left a comment

Choose a reason for hiding this comment

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

Looks good to me - let’s try to merge!

@fdelesma
Copy link
Copy Markdown
Contributor

Looks like the Python version in the Actions might be causing the problem.
@moritzleucke @marm314, it works fine locally for me with Python 3.10.12.
Could you run the ctest to check if you see the same issue?

@marm314
Copy link
Copy Markdown
Contributor Author

marm314 commented Nov 11, 2025

@fdelesma I have an externally managed python evironment and cannot install pygreenx. I am/was just using the Fortran parts.

@fdelesma
Copy link
Copy Markdown
Contributor

fdelesma commented Nov 11, 2025

I compile greenX in a difference machine. Here are my findings
The reference sine duality error without regularization is:

    ref_errors = np.array([[6, 2.50000000E+02, 5.56242714E-02, 2.36021543E-01, 8.74792753E-01],
                           [8, 2.50000000E+02, 1.49383520E-02, 1.11607214E-01, 8.80901314E-01],
                           [10, 2.50000000E+02, 3.87442807E-03, 2.61545954E-02, 9.62458551E-01],
                           [12, 2.50000000E+02, 9.86318209E-04, 1.36267244E-02, 9.39611514E-01],
                           [14, 2.50000000E+02, 2.46521564E-04, 4.19391179E-03, 9.55740373E-01],
                           [16, 2.50000000E+02, 7.70304736E-05, 5.97815737E-04, 9.42329775E-01],
                           [18, 2.50000000E+02, 1.94942501E-05, 1.39775660E-04, 9.45743358E-01],
                           [20, 2.50000000E+02, 4.88850816E-06, 3.73426583E-05, 9.40568100E-01],
                           [22, 2.50000000E+02, 2.68402244E-07, 2.38208860E-05, 1.01253368E+00],
                           [24, 2.50000000E+02, 1.31534818E-07, 2.01595323E-06, 2.04590429E+00],
                           [26, 2.50000000E+02, 3.78405247E-08, 6.37343151E-07, 8.82902975E+00],
                           [28, 2.50000000E+02, 4.30436009E-08, 8.53519608E-07, 1.59367298E+05],
                           [30, 2.50000000E+02, 5.14232643E-08, 1.07148550E-06, 1.05986563E+06],
                           [32, 2.50000000E+02, 4.94132300E-08, 1.02545263E-06, 1.12950579E+06],
                           [34, 2.50000000E+02, 6.66088497E-08, 1.45835462E-06, 5.71640192E+06]])

I got

#n   e_range           freq_to_tau_error tau_to_freq_error duality_error
6    2.50000000E+02    5.56242714E-02    2.36021543E-01    8.74792753E-01
8    2.50000000E+02    1.49383520E-02    1.11607214E-01    8.80901314E-01
10    2.50000000E+02    3.87442807E-03    2.61545954E-02    9.62458551E-01
12    2.50000000E+02    9.86318209E-04    1.36267244E-02    9.39611514E-01
14    2.50000000E+02    2.46521564E-04    4.19391179E-03    9.55740373E-01
16    2.50000000E+02    7.70304736E-05    5.97815737E-04    9.42329775E-01
18    2.50000000E+02    1.94942501E-05    1.39775660E-04    9.45743358E-01
20    2.50000000E+02    4.88850816E-06    3.73426583E-05    9.40568100E-01
22    2.50000000E+02    2.68402246E-07    2.38208860E-05    1.01253368E+00
24    2.50000000E+02    1.31534823E-07    2.01595323E-06    2.04590429E+00
26    2.50000000E+02    3.78405286E-08    6.37343525E-07    8.82903928E+00
28    2.50000000E+02    4.30436019E-08    8.54592843E-07    1.58948056E+05
30    2.50000000E+02    5.14232635E-08    1.07518952E-06    5.40678062E+05
32    2.50000000E+02    4.94132291E-08    1.02033059E-06    7.64394471E+05
34    2.50000000E+02    6.66088490E-08    1.43209368E-06    5.15145142E+06

It seems that the duality errors for the larger grids (28–34) are too large and unstable. When regularization is applied, everything looks fine. I’ll work on a fix for that.

@marm314
Copy link
Copy Markdown
Contributor Author

marm314 commented Nov 11, 2025

I also noticed the same for the duality errors; in practice, I am using at least 1e-5 for the regularization in my calculations using these grids.

Copy link
Copy Markdown
Collaborator

@moritzleucke moritzleucke left a comment

Choose a reason for hiding this comment

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

looks good to me 👍

@moritzleucke moritzleucke merged commit c90d131 into nomad-coe:main Nov 11, 2025
1 check passed
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