Beispiel #1
0
def euler_operator(discr, eos, boundaries, cv, time=0.0):
    r"""Compute RHS of the Euler flow equations.

    Returns
    -------
    numpy.ndarray
        The right-hand-side of the Euler flow equations:

        .. math::

            \dot{\mathbf{q}} = - \nabla\cdot\mathbf{F} +
                (\mathbf{F}\cdot\hat{n})_{\partial\Omega}

    Parameters
    ----------
    cv: :class:`mirgecom.fluid.ConservedVars`
        Fluid conserved state object with the conserved variables.

    boundaries
        Dictionary of boundary functions, one for each valid btag

    time
        Time

    eos: mirgecom.eos.GasEOS
        Implementing the pressure and temperature functions for
        returning pressure and temperature as a function of the state q.

    Returns
    -------
    numpy.ndarray
        Agglomerated object array of DOF arrays representing the RHS of the Euler
        flow equations.
    """
    inviscid_flux_vol = inviscid_flux(discr, eos, cv)
    inviscid_flux_bnd = (inviscid_facial_flux(
        discr, eos=eos, cv_tpair=interior_trace_pair(discr, cv)) + sum(
            inviscid_facial_flux(
                discr,
                eos=eos,
                cv_tpair=TracePair(
                    part_tpair.dd,
                    interior=make_conserved(discr.dim, q=part_tpair.int),
                    exterior=make_conserved(discr.dim, q=part_tpair.ext)))
            for part_tpair in cross_rank_trace_pairs(discr, cv.join())) +
                         sum(boundaries[btag].inviscid_boundary_flux(
                             discr, btag=btag, cv=cv, eos=eos, time=time)
                             for btag in boundaries))
    q = -div_operator(discr, inviscid_flux_vol.join(),
                      inviscid_flux_bnd.join())
    return make_conserved(discr.dim, q=q)
Beispiel #2
0
 def op(u):
     return div_operator(discr, dd_vol, dd_faces,
                         u, get_flux(interior_trace_pair(discr, u)))
Beispiel #3
0
def euler_operator(discr,
                   state,
                   gas_model,
                   boundaries,
                   time=0.0,
                   quadrature_tag=None):
    r"""Compute RHS of the Euler flow equations.

    Returns
    -------
    numpy.ndarray
        The right-hand-side of the Euler flow equations:

        .. math::

            \dot{\mathbf{q}} = - \nabla\cdot\mathbf{F} +
                (\mathbf{F}\cdot\hat{n})_{\partial\Omega}

    Parameters
    ----------
    state: :class:`~mirgecom.gas_model.FluidState`

        Fluid state object with the conserved state, and dependent
        quantities.

    boundaries

        Dictionary of boundary functions, one for each valid btag

    time

        Time

    gas_model: :class:`~mirgecom.gas_model.GasModel`

        Physical gas model including equation of state, transport,
        and kinetic properties as required by fluid state

    quadrature_tag

        An optional identifier denoting a particular quadrature
        discretization to use during operator evaluations.
        The default value is *None*.

    Returns
    -------
    :class:`mirgecom.fluid.ConservedVars`
    """
    dd_base_vol = DOFDesc("vol")
    dd_quad_vol = DOFDesc("vol", quadrature_tag)
    dd_quad_faces = DOFDesc("all_faces", quadrature_tag)

    # project pair to the quadrature discretization and update dd to quad
    def _interp_to_surf_quad(utpair):
        local_dd = utpair.dd
        local_dd_quad = local_dd.with_discr_tag(quadrature_tag)
        return TracePair(local_dd_quad,
                         interior=op.project(discr, local_dd, local_dd_quad,
                                             utpair.int),
                         exterior=op.project(discr, local_dd, local_dd_quad,
                                             utpair.ext))

    boundary_states_quad = {
        btag:
        project_fluid_state(discr, dd_base_vol,
                            as_dofdesc(btag).with_discr_tag(quadrature_tag),
                            state, gas_model)
        for btag in boundaries
    }

    # performs MPI communication of CV if needed
    cv_interior_pairs = [
        # Get the interior trace pairs onto the surface quadrature
        # discretization (if any)
        _interp_to_surf_quad(tpair)
        for tpair in interior_trace_pairs(discr, state.cv)
    ]

    tseed_interior_pairs = None
    if state.is_mixture:
        # If this is a mixture, we need to exchange the temperature field because
        # mixture pressure (used in the inviscid flux calculations) depends on
        # temperature and we need to seed the temperature calculation for the
        # (+) part of the partition boundary with the remote temperature data.
        tseed_interior_pairs = [
            # Get the interior trace pairs onto the surface quadrature
            # discretization (if any)
            _interp_to_surf_quad(tpair)
            for tpair in interior_trace_pairs(discr, state.temperature)
        ]

    interior_states_quad = make_fluid_state_trace_pairs(
        cv_interior_pairs, gas_model, tseed_interior_pairs)

    # Interpolate the fluid state to the volume quadrature grid
    # (this includes the conserved and dependent quantities)
    vol_state_quad = project_fluid_state(discr, dd_base_vol, dd_quad_vol,
                                         state, gas_model)

    # Compute volume contributions
    inviscid_flux_vol = inviscid_flux(vol_state_quad)
    # Compute interface contributions
    inviscid_flux_bnd = (

        # Interior faces
        sum(
            inviscid_facial_flux(discr, state_pair)
            for state_pair in interior_states_quad)

        # Domain boundary faces
        + sum(boundaries[btag].inviscid_divergence_flux(
            discr,
            as_dofdesc(btag).with_discr_tag(quadrature_tag),
            gas_model,
            state_minus=boundary_states_quad[btag],
            time=time) for btag in boundaries))

    return -div_operator(discr, dd_quad_vol, dd_quad_faces, inviscid_flux_vol,
                         inviscid_flux_bnd)