MFlowCode / MFC

Exascale simulation of multiphase/physics fluid dynamics
https://mflowcode.github.io
MIT License
143 stars 66 forks source link

New example cases: Lid-driven cavity (compressible), double Mach, and more #174

Open sbryngelson opened 1 year ago

sbryngelson commented 1 year ago

Simulate and add several new examples/test cases to the examples/ directory:

I will accept PRs that add these individually (they do not have to be added all at once). Please add small (in terms of MB) visualization images of the results to the example/ directory.

I will also accept additions to this list, particularly problems in 3D or multiphase 2D problems.

Update: More problems!

Can find refs in doi:10.1016/j.cpc.2024.109236

Original:

wilfonba commented 1 year ago

@sbryngelson How do you want to handle the cases that will require hardcoding analytic initial conditions?

sbryngelson commented 1 year ago

@wilfonba for cases with analytic functions, I think we should add some functionality to make this possible without commenting/uncommenting source code. I'm open to suggestions. Some example possibilities are

wilfonba commented 1 year ago

What do you think of having the user supply an additional input file with fypp functions that can be included in m_patches.f90?

sbryngelson commented 1 year ago

I'm not sure I understand, I would have to see a small example I think.

wilfonba commented 1 year ago

I'll put something together

henryleberre commented 1 year ago

@wilfonba I’d be happy to discuss possible toolchain implementations.

sbryngelson commented 1 year ago

@wilfonba What if, in the case.py file you could have something like

    'patch_icpp(1)%geometry': 15,
    'patch_icpp(1)%pres': '5*x',
    'patch_icpp(1)%vel(1)': = '10*sin(2*x**2)',
    ...

and then in m_patches.fpp or perhaps in m_assign_variables.fpp you would have something that copies/pastes these strings ('5*x' and '10*sin(2*x**2)') into a function that assigns the analytic values depending on the value of x_cc or x_cb or y_ or z_. Something analogous would be done for 2D/3D so you could also have

    'patch_icpp(1)%geometry': 7,
    'patch_icpp(1)%pres': '5*x*y',
    'patch_icpp(1)%vel(1)': '10*y*sin(2*x**2)',
    'patch_icpp(1)%vel(2)': '10*x*sin(2*y**2)',
    ...

for example, in 2D (note that 15 and 7 are the patch numbers associated with 1D and 2D analytical right now). All such analytic string expressions would have to be in Fortran syntax.

I think something like this would actually work really nicely and cleanly, and actually shouldn't require any toolchain changes (or only very small ones). It would require using fypp in pre_process, and a new macro to parse those analytic expressions into the Fortran code. @henryleberre can easily help with those parts easily.

This would actually be quite the improvement to the code, since we could remove all hard-coded analytic functions and basically never need to do that again!

wilfonba commented 1 year ago

That was the first idea that had come to mind for me as well, but I didn't think to parse the strings in Python rather than in Fortran and some googling suggested doing so in Fortran is rather difficult. I'm sure there's a python package somewhere that takes care of that already though, so I'll do it that way. It is the cleanest.

sbryngelson commented 1 year ago

So I think we don't want to parse the strings in Python at all (I may well stand corrected later).

Instead, we want to use fypp to copy-paste the Python strings into the Fortran code as raw code and do a fypp-powered substitution (like x -> x_cb(i), y -> y_cb(j)) so that you can loop through x/y/z space appropriately.

wilfonba commented 1 year ago

Ah, I see what you mean now. That makes sense.

sbryngelson commented 1 year ago

Ah, I see what you mean now. That makes sense.

I would like this printed and framed 😄

sbryngelson commented 1 year ago

Updated the issue in light of #176

sbryngelson commented 10 months ago

Riemann problem taken care of in #256

wilfonba commented 9 months ago

@sbryngelson the 2D single-material triple point problem here (https://arxiv.org/abs/2312.17042) might be worth adding to this.

sbryngelson commented 2 months ago