AMReX-Combustion / PeleC

An AMR code for compressible reacting flow simulations
https://amrex-combustion.github.io/PeleC
Other
162 stars 73 forks source link

Clarification Needed on LES Extrapolation Warning and SGS Model Implementation #803

Open JhonCordova opened 6 months ago

JhonCordova commented 6 months ago

Hello,

I am working with LES and I would like to know specifically what this message means: 'WARNING -- Need to implement LES extrap here, see diffusion,' which appears in the getLESTerm method defined in LES.cpp. Could you please provide me with more information?

void
PeleC::getLESTerm(
  amrex::Real time,
  amrex::Real dt,
  amrex::MultiFab& LESTerm,
  amrex::Real reflux_factor)
{
  BL_PROFILE("PeleC::getLESTerm()");

  if (!do_les) {
    LESTerm.setVal(0, 0, NVAR, LESTerm.nGrow());
    return;
  }

  if (verbose != 0) {
    amrex::Print() << "... Computing LES term at time " << time << std::endl;
  }

  switch (les_model) {

  case 0:
    getSmagorinskyLESTerm(time, dt, LESTerm, reflux_factor);
    break;

  case 1:
    getDynamicSmagorinskyLESTerm(time, dt, LESTerm, reflux_factor);
    break;

  default:
    amrex::Error("Invalid les_model number.");
    break;
  }

  amrex::Print()
    << "WARNING -- Need to implement LES extrap here, see diffusion"
    << std::endl;

  // Filter the SGS source term
  if (use_explicit_filter) {
    les_filter.apply_filter(LESTerm, filtered_les_source);
    LESTerm.define(
      grids, dmap, NVAR, filtered_les_source.nGrow(), amrex::MFInfo(),
      Factory());
    amrex::MultiFab::Copy(
      LESTerm, filtered_les_source, 0, 0, NVAR, filtered_les_source.nGrow());
  }
}

Additionally, I want to implement a one equation SGS model in LES. I have seen in the PeleC documentation, specifically in the equations section, that there are two advected quantities, Ak and Bk, that can be used. How can I enable their use in PeleC? How do I define them?

Thank you.

marchdf commented 6 months ago

Hi, the warning in there refers to this: https://github.com/AMReX-Combustion/PeleC/blob/development/Source/Diffusion.cpp#L533 that may or may not be missing depending on that case. I think that (in most cases) we don't need it. And actually the diffusion source term doesn't have ghost cells. So my guess is that you can ignore it.

For the other question, @bperry65 has used them more recently and can help.

baperry2 commented 6 months ago

The capability to add additional transported variables is a bit convoluted unfortunately. Note AUX and ADV variables are essentially treated the same so it doesn't matter much which you use, and everything follows the same below regardless of which you use. This capability was most recently updated in #743, so you can check there for a bit more information, but not everything is documented. Here's a brief overview:

JhonCordova commented 6 months ago

Thank you for the answers; I'll review the references. Do you have any reference books that can help me gain a more detailed understanding of the numerical modeling described in the solver?

baperry2 commented 5 months ago

What aspect of the numerical modeling are you interested in references on? A lot of it builds on methods that have been built over time and documented in various papers, not sure if there is a good single textbook reference.

For example, for Godunov/PPM stuff, you could start with this JCP https://www.sciencedirect.com/science/article/pii/S0021999108001435, but it may also be helpful to work backward through its references and forward through works that cite it.