Skip to content

diff comparison from last pull request#8

Draft
HopeBestWorld wants to merge 724 commits into
branch-after-pr6from
main
Draft

diff comparison from last pull request#8
HopeBestWorld wants to merge 724 commits into
branch-after-pr6from
main

Conversation

@HopeBestWorld
Copy link
Copy Markdown
Collaborator

No description provided.

@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Comment thread README.md Outdated
## Installation
1. **Install the package:**
```bash
pip install git+[https://github.com/symbiotic-engineering/semi-analytical-hydro.git](https://github.com/symbiotic-engineering/semi-analytical-hydro.git)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be open flash now that it's on pypi?

Comment thread README.md Outdated
## References

### Install from the `CS_group` Branch
The following publications are relevant to this package:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add citations for the JOSS paper and the JFM paper (without writing JOSS or JFM since they haven't accepted it yet), you can add our names and the title and say "in prep", see the MDOcean readme as example

Comment thread docs/constants.rst Outdated
.. autodata:: m0
:annotation: = 1

Radial wave number.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just called "wavenumber", more often denoted with k

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

to be consistent with your description of omega, it's "wavenumber of the incident wave in 1/m"

Comment thread docs/constants.rst Outdated
Radial wave number.

.. autodata:: n
:annotation: = 3
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why =3?

Comment thread docs/constants.rst Outdated
Related to a mode or term index.

.. autodata:: z
:annotation: = 6
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why =6?

Comment thread package/src/meem_engine.py Outdated
# Convert the complex number to a dictionary
hydro_p_terms[i,j] = 0

# Now return per-mode values
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we have previously used mode to refer to the harmonics of the m_k's, but here mode means the mode of motion / degree of freedom. Clarify the difference in comments, or perhaps rename mode to dof here.

Comment thread package/src/meem_engine.py Outdated
imag_coeffs = np.zeros(num_modes)

for mode_index in range(num_modes):
if mode_index < hydro_h_terms.shape[0] and mode_index < hydro_p_terms.shape[0]:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is this conditional necessary? add comment, I don't remember why this would be the case. Would hydro_h_terms.shape[0] and hydro_p_terms.shape[0] ever be different?

Comment thread package/src/meem_engine.py Outdated
plt.show() # final display command

def run_and_store_results(self, problem_index: int, m0) -> Results:
def run_and_store_results(self, problem_index: int, m0_values: np.ndarray) -> 'Results':
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use from __future__ import annotations so you can type with Results (no string) even before it's defined

Comment thread package/src/meem_engine.py Outdated
def run_and_store_results(self, problem_index: int, m0_values: np.ndarray) -> 'Results':
"""
Perform the full MEEM computation and store results in the Results class.
Perform the full MEEM computation for a *list of frequencies* and store results
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

array, not list

Comment thread package/src/meem_engine.py Outdated
freq_idx_in_problem = freq_to_idx.get(m0)
if freq_idx_in_problem is None:
# This should ideally not happen if m0_values are a subset of problem.frequencies
print(f" Warning: m0={m0:.4f} not found in problem.frequencies. Skipping calculation.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

seems like the code structure should be tweaked so this is not a possibility: either problem.frequencies or m0_values is used but not both. My preference would be problem.frequencies

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we need to extract m0_values for some reason ie plottng, extract it from problem.frequencies so it's consistent

Comment thread package/src/multi_equations.py Outdated

constant = - heaving[i] * a[i]/(2 * (h - d[i]))
if k == 0:
if m0 * h < 14:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use M0_H_THRESH=14 or similar constant definition so it can be changed

Comment thread package/src/multi_equations.py Outdated
# ensure r_array doesn't contain 0 if R_2n is called for r=0
return 0.5 * np.log(r_array / a[i])
else:
return besselk(0, lambda_ni(n, i, h, d) * r_array) / besselk(0, lambda_ni(n, i, h, d) * local_scale[i])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

don't you need a value error if n<0 here like you have above?

Comment thread package/src/multi_equations.py Outdated
def Z_k_e_vectorized(k, z_array, m0, h, NMK, m_k_arr): # Changed 'z' to 'z_array'
local_m_k = m_k(NMK, m0, h)
if k == 0:
if m0 * h < 14:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use same const as suggested above

Comment thread package/src/coupling.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This has wrong eqns in it, but not a worry because it will be deleted and the multi equations is correct

Comment thread package/src/equations.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

delete this too since two-cylinder only

Comment thread docs/constants.rst Outdated
Below are the constants defined in this module:

mass = 5.0 # Example mass in kg
.. autodata:: g
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use the constant g and rho so the user doesn't have to specify them, and can override them if they wish. Other constants like m0, geometry, etc should not go in constants, it's when they create the problem, so delete them from here.

Comment thread docs/equations.rst Outdated
.. autofunction:: lambda_n2
:noindex:

Calculates the eigenvalue :math:`\lambda_n` for the middle fluid domain (Region 2).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not relevant since deleting.

Comment thread package/src/meem_engine.py Outdated
if bd == 0: # One cylinder case (Inner-Exterior directly)
for n in range(N_left): # Inner harmonics (N)
A[row_offset + n][col_offset + n] = (h - d[bd]) * R_1n(n, a[bd], bd, h, d, a)
for m in range(M_right): # Exterior harmonics (K)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is fixed in multi_MEEM notebook. Transfer this fix over to equations instead of engine.

Comment thread package/src/geometry.py Outdated
@@ -57,7 +57,7 @@ def make_domain_list(self) -> Dict[int, 'Domain']:
'h': h,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

don't allow h, di, and a to be independently passed domain params, but the geometry should auto create the domain objects with these properties so it's consistent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We want Bimali's functions to discretize the slant in different ways (left, right center, etc) as methods of geometry that it uses when turning r,z coordinates (of the body, representing a curve or other non MEEM supported thing) into a list of domains

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we want geometry (not problem as in the UML diagram) to have a property that is a logical array, of size num_domains x num_domains, saying whether a domain is next to each other domain.

Comment thread package/test/meem_engine_example.py Outdated
all_potentials_batch_data = [] # <--- NEW: List to store potential data for all frequencies/modes

print("\n--- Starting Batch Processing for Multiple Frequencies ---")
for i, current_m0_val in enumerate(meem_problem.frequencies):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

have the for loop here not be necessary for the user to do, you can just call engine.solve and it solves all the problems in the list

Comment thread package/test/meem_engine_example.py Outdated

# --- 3. Create a MEEMProblem Instance and set multiple frequencies ---
meem_problem = MEEMProblem(geometry=geometry)
meem_problem.set_frequencies_modes(analysis_frequencies, analysis_modes)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

analysis modes is redudant

Comment thread package/src/meem_engine.py Outdated
#AttributeError: 'Domain' object has no attribute 'r_coordinates'
#'r': domain.r_coordinates,
#'z': domain.z_coordinates
'r': geometry_instance.r_coordinates,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Users should be able to pass a desired r/z vector for visualization (or maybe just a resolution and we create it based on the geometry)

Comment thread package/test/meem_engine_example.py Outdated
damping_matrix = np.array(collected_damping).reshape(num_frequencies, num_modes)

# --- 7. Instantiate Results and Store Data ---
results_obj = Results(geometry, frequencies_for_results, modes_for_results)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use the method that creates results for you, instead of creating it yourself

Comment thread package/test/main_test.py Outdated
problem_cache = engine.cache_list[problem] # Access the existing cache

if problem_cache is None:
print("ERROR: problem_cache is None!")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this be an actual error?

Comment thread package/test/meem_engine_example.py Outdated
'data': formatted_potentials_for_batch
})

except np.linalg.LinAlgError as e:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

error handling should happen in the meem engine, not the test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this test, in addition to doing mocks, also test that the actual results for the non-first (cached) problem are the same as that problem evaluated without any caching (using the original _full method)

Comment thread pyproject.toml Outdated
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

instead of super specific versions and all packages from an env export, this should be a minimal list of dependencies with inequalities

Comment thread requirements.txt Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see comment on pyproject.toml

Comment thread docs/tutorial_walk.ipynb
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

great high level walkthrough, can we also include a plot of the hydro coeffs vs omega here?

HopeBestWorld and others added 20 commits May 28, 2026 00:15
Removed pull_request branch specification from CI workflow
Fix forcing-term callback signature mismatch after I_mk caching refactor
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 98.69565% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.55623%. Comparing base (230a8d5) to head (c29750d).

Files with missing lines Patch % Lines
package/src/openflash/results.py 66.66667% 3 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                     @@
##           branch-after-pr6          #8         +/-   ##
==========================================================
+ Coverage          98.38833%   98.55623%   +0.16791%     
==========================================================
  Files                    11          11                 
  Lines                  1303        1316         +13     
==========================================================
+ Hits                   1282        1297         +15     
+ Misses                   21          19          -2     
Flag Coverage Δ
unit 98.55623% <98.69565%> (+0.16791%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

5 participants