Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feature): Approximate vorticity fields using velocity data. Include … #71

Merged
merged 6 commits into from
Oct 20, 2024

Conversation

greinerth
Copy link
Contributor

…github ci/cd stuff and code quality ensuring stuff

Features:

  • included modules for computing vorticity given velocity fields (vorticity.py, velocity2vorticity.py). Vorticity fields are currently missing in the 3dcfd datasets.
  • included noxfile.py for automatic testing, building of API doc, and code-linting.

Changes:

  • updated pyproject.toml (hatchling build) and added additional optional dependencies (dev, test)
  • bash file cleanup
  • cleanup of python code that can be done without domain-specific knowledge

CICD:

  • included .pre-commit-config.yaml to ensure code quality in the pipeline and locally
  • included github workflows (precommit.yml, python-package.yml, python-publish.yml)
  • included "tests" folder with test_vorticity.py for future unit testing with pytest.

Help required:

  • The employed linters (ruff, pylint) complain a great deal: Unused variables, missing typedefs for input/output parameters etc. The types are mostly unknown and are hard to infer. Thus the pipeline definitely fails.
  • Packages: Some of the packages got updates (e.g. jax). This needs to be tested before everything can be updated.
  • Extend python support (Python3.11 Python3.12)

@kmario23
Copy link
Member

kmario23 commented Oct 2, 2024

Hey @greinerth, appreciate the PR! Can you please have a look at the recent commits and resolve conflicts?

@greinerth
Copy link
Contributor Author

Hey @greinerth, appreciate the PR! Can you please have a look at the recent commits and resolve conflicts?

I'll have a look and resolve the conflicts within the next days.

Cheers,
Gerhard

@greinerth
Copy link
Contributor Author

Done ;)

@kmario23
Copy link
Member

@greinerth I've had time to look into it. There are issues with relative imports of vorticity.compute_spectral_vorticity_jnp in data_gen/velocity2vorticity.py. vorticity.py should be in the same tree level, which is now in src.

As it exists now, it's postprocessing. So, perhaps we can move these modules to a directory, say postprocess in data_gen. And, also add some info about how to run this script. E.g.,

export PYTHONPATH="/path/to/PDEBench"
CUDA_VISIBLE_DEVICES="0" python -m data_gen.velocity2vorticity --data /pdebench_data/3D/Train/3D_CFD_Turb_M1.0_Eta1e-08_Zeta1e-08_periodic_Train.hdf5

Later, we could try integrating this as part of the JAX solver itself and serialize both fields.

@greinerth
Copy link
Contributor Author

greinerth commented Oct 12, 2024

Hi @kmario23, good catch! The relative import issue is now fixed.
The conversion is now added as an executable script (c.f. pyproject.toml)
After installing pdebench via pip it can now be executed as follows:

velocity2vorticity --data /pdebench_data/3D/Train/3D_CFD_Turb_M1.0_Eta1e-08_Zeta1e-08_periodic_Train.hdf5

Let me know if additional adaptions are required.

Cheers,
Gerhard

@kmario23 kmario23 self-assigned this Oct 12, 2024
@kmario23
Copy link
Member

@greinerth LGTM.

@kmario23 kmario23 merged commit 9174a50 into pdebench:main Oct 20, 2024
@kmario23
Copy link
Member

Hey @greinerth, I had a few hours today, and I tried merging the PR and fixing some Ruff linter errors, but there's still a lot to fix. We especially need to add type annotations. I'll ask the authors about this.

It seems the noxfile.py is missing. Can you add that in the meantime, please?

@greinerth
Copy link
Contributor Author

I am currently out of office. I'll add it asap (next thursday).

Cheers,
Gerhard

@kmario23
Copy link
Member

Perhaps we should consider using a logger (e.g., python's logging) since Ruff complains about the print() statements.

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.

2 participants