Conversation
…aster. including: obstacle_cylinder.py, example-Simulation-script, HWBB and IBB boundary conditions, MEA for Bounce back boundaries, drag and lift observables...
…aster. including: obstacle_cylinder.py, example-Simulation-script, HWBB and IBB boundary conditions, MEA for Bounce back boundaries, drag and lift observables...
… 270-efficient_hwbb_and_ibb
…ed from MP2 and MA). obstacle_cylinder.py implements the flow, the boundary classes are implemented in the respective files under /_boundary WorkInProgress, see ToDOs
…ack boundaries to folder examples/advanced_projects/efficient_bounce_back_obstacle. Includes boundary conditions, obstacle_cylinder.py and placeholders for simulation-scripts for Re40-300 and Re3900, and a jupyter-notebook to run the scripts interactively _simulation.py: added comments for clarification
…pare to MP2 and cylinder2025 results!
|
@PhiSpel @McBs README:
|
There was a problem hiding this comment.
@MaxBille, could you revert these changes for cleaner history?
There was a problem hiding this comment.
of course. Will try to overwrite file back to original from master branch!
| self.f_index_fwbb[:, 1], | ||
| self.f_index_fwbb[:, 2], | ||
| self.f_index_fwbb[:, 3]] | ||
| print("FWBB call, DONE") |
There was a problem hiding this comment.
remove redundant print? @MaxBille, check for more of those
There was a problem hiding this comment.
will do; and will do in final version, together with obsolete comments and "old" code snippets
PhiSpel
left a comment
There was a problem hiding this comment.
@MaxBille nice job so far!
Could you
- Mirror the folder structure of /lettuce/.. for any files which are non-executables? (
Flow/obstacle_cylinder.py,Boundary/solid_boundary_data.py,boundary/linear_interpolated_bounce_back_boundary.py, etc.). This will make it easier to review and to later merge into the corresponding structure withinlettuce/ - Typo:
parameterizeshould beparametrize - Remove all lines containing
OLD - change default arguments to the values you suggested above
- since TODOs are already here as issues, you could remove those lines
- Do you need
torch.autograd? - Since you are using so many args, this could be useful to save all the overloads into local variables (should be simple enough to refactor): https://docs.python.org/3/library/argparse.html#the-namespace-object
- Remove redundant
if Truehttps://github.com/MaxBille/lettuce/blob/ea1705f8bce28146723efd2359d8f9ba8b81b185/examples/advanced_projects/efficient_bounce_back_obstacle/01a_script_cylinder_lowRe.py#L279 - Since you have so much input-parsing, wouldn't it make sense to create a separate file / function for this?
- I like the idea of saving the output in the Jupyter notebook. However, it is currently a bit out of place. I'd suggest naming only master-files
xy_[...]. So, if we keep the notebooks, move the scripts into a subfolder. That could look quite nice, too. - I do not get the last lines of
01a[...]. Could you move those comments to the corresponding lines of code or into the file head? https://github.com/MaxBille/lettuce/blob/ea1705f8bce28146723efd2359d8f9ba8b81b185/examples/advanced_projects/efficient_bounce_back_obstacle/01a_script_cylinder_lowRe.py#L320C3-L320C10
| self.f_collided_gt = None | ||
| # will be populated in initialize_f_collided() method | ||
|
|
||
| # DEPRECATED: got moved to method initialize f_collided |
There was a problem hiding this comment.
will be removed in final/release/merge version. I keep sections like this in the code, to remind me of past versions and various ways to do stuff.
| def make_no_streaming_mask(self, f_shape, context: Context): | ||
| # no_stream_mask has to be dimensions: (q,x,y,z) (z optional), but CAN be (x,y,z) (z optional). | ||
| # ...in the latter case, torch.where broadcasts the mask to (q,x,y,z), so ALL q populations of a lattice-node are marked equally | ||
| # return torch.tensor(self.mask, dtype=torch.bool) |
| # ...in the initial solution of your flow, especially if visualization or post-processing uses the field-values | ||
| # ...in the whole domain (including the boundary region)! | ||
|
|
||
| # return torch.tensor(self.mask, dtype=torch.bool) # self.context.convert_to_tensor(self.mask) |
| self.f_index_gt[:, 3]], | ||
| self.flow.stencil.e[self.f_index_gt[:, 0]].float()) | ||
|
|
||
| # TODO: find a way to use pre- and post-Streaming Populations for bounce... |
examples/advanced_projects/efficient_bounce_back_obstacle/obstacle_cylinder.py
Outdated
Show resolved
Hide resolved
examples/advanced_projects/efficient_bounce_back_obstacle/obstacle_cylinder.py
Outdated
Show resolved
Hide resolved
| mask=self.in_mask, | ||
| velocity=self.u_inlet) # (is this still true??): works with a 1 x D vector or an ny x D vector thanks to einsum-magic in EquilibriumBoundaryPU | ||
|
|
||
| lateral_boundary = None # stays None if lateral walls are not specified... (NOT IMPLEMENTED YET, see below) |
There was a problem hiding this comment.
I think we may just remove all channel-related definitions for now. The most interesting part is how the cylinder is handled, right, @MaxBille ?
examples/advanced_projects/efficient_bounce_back_obstacle/obstacle_cylinder.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Do these changes break the old code or fix something? If they just work with everything else, OK. If they are required as a fix, please add this in a separate issue
…ample to validate against MP2 and cylinder-paper data; to be tested...
- comments - print-statements - ToDos - revert changes in .ipynbs (less clutter in later PR)
…to fork/MaxBille/270-efficient_hwbb_and_ibb
…numerically there are diffs. of ~1% in mean Drag... this might be due to the new pre/ost-boundary strategy of lettuce 2025. Needs further investigation (issue already open). Further improvements and corrections: - implemented lateral walls option (for FWBB) - removed some comments and old code sections. NEXT will be output/data/vtk cleaning and example .ipynb script for execution
- methods for force coefficient plotting and analysis were outsourced to data_processing_and_plotting.py - files for NaN-, HighMa-, and Progress-Reporter created (but work in progress)
…ed profile-data-post-processing und -plotting. implemented advanced vtk reporter (3D with step start and end and 2D for XY-slices)
…al of un-implemented reporter-files.
…r flow with 01_script_cylinder_simulation.py through ipynb: 00_run_parameterized_project.ipynb added "show" parameter to plotting-reporters methods, to not only plot and save but also show the plotted data
…to 270-efficient_hwbb_and_ibb
There was a problem hiding this comment.
@MaxBille did you keep these changes intentionally?
| "h5py==3.11.0", | ||
| "matplotlib>=3.9.2", | ||
| "mmh3>=4.1.0", | ||
| "notebook>=7.4.7", |
There was a problem hiding this comment.
@MaxBille didn't you add these changes separately?
| -> use the ProfilePlotter in post-processing to further process | ||
| and plot data! | ||
| """ | ||
|
|
| """ | ||
| output the mask as a vtk-file for visualizatione etc. | ||
|
|
||
| UPDATE 28.08.2024 (MBille: outputs mask as cell data. cell data represents the approx. |
There was a problem hiding this comment.
Is UPDATE necessary? Can't this be a permanent comment?
Description
(Work in Progress)
Associated to issue #270 and related to feature requests #271 , #273 . See respective issue descriptions.
Checklist
__init__examples/advanced_flows/orexamples/simple_flows/tests/relevant files and changes
examples/advanced_projects/efficient_bounce_back_obstacle/00_run_parameterized_project.ipynbwith two examples of parametrized calls of the main simulation-script to run:01_script_cylinder_simulation.pycontains:simulation()ebb_simulation.pythat improves the regular simulation class to use post-streaming boundaries and let boundaries get post-collision but pre-streaming information on populations, needed for their bounce back algorithm (for HWBB and IBB).obstacle_cylinder.py: advanced obstacle flow with a symmetrical cylinder in 2D or 3D that can be run with periodic or solid boundary channel walls and efficient bounce back boundaries for the solid cylinder itself.data_processing_and_plotting.pyutility.data_processing_and_plotting.pyutility. Gives statistics and frequency of a periodic signal (used for drag and lift in this project)data_processing_and_plotting.pyutility. It allows the loading of reference data, processing of profile reporter data and plotting of both.