5.4. Spectral filters¶
mirgecom.filter
is for filters and filter-related constructs.
Discussion of the spectral filter design can be found in: [Hesthaven_2008], Section 5.3
5.4.1. Mode Response Functions¶
5.4.2. Helper Functions¶
- mirgecom.filter.make_spectral_filter(actx, group, cutoff, mode_response_function)[source]¶
Create a spectral filter with the provided mode_response_function.
This routine returns a filter operator in the modal basis designed to apply the user-provided mode_response_function to the spectral modes beyond the user-provided cutoff.
- Parameters:
actx (
arraycontext.ArrayContext
) – Aarraycontext.ArrayContext
associated with an array of degrees of freedomgroup (
meshmode.mesh.MeshElementGroup
) – Ameshmode.mesh.MeshElementGroup
from which the mode ids, element order, and dimension may be retrieved.cutoff (int) – Mode cutoff beyond which the filter will be applied, and below which the filter will preserve.
mode_response_function – A function that returns a filter weight for for each mode id.
- Returns:
filter – filter operator in the modal basis
- Return type:
- mirgecom.filter.apply_spectral_filter(actx, modal_field, discr, cutoff, mode_response_function)[source]¶
Apply the spectral filter, defined by the mode_response_function.
This routine returns filtered data in the modal basis, which has been applied using a user-provided mode_response_function to dampen modes beyond the user-provided cutoff.
- Parameters:
actx (
arraycontext.ArrayContext
) – Aarraycontext.ArrayContext
associated with an array of degrees of freedommodal_field (numpy.ndarray) – DOFArray or object array of DOFArrays denoting the modal data
discr (
meshmode.discretization.Discretization
) – Ameshmode.discretization.Discretization
describing the volume discretization the modal_field comes from.cutoff (int) – Mode cutoff beyond which the filter will be applied, and below which the filter will preserve.
mode_response_function – A function that returns a filter weight for for each mode id.
- Returns:
modal_field – DOFArray or object array of DOFArrays
- Return type:
5.4.3. Applying Filters¶
- mirgecom.filter.filter_modally(dcoll, cutoff, mode_resp_func, field, *, dd=DOFDesc(domain_tag=VolumeDomainTag(tag=<class 'grudge.dof_desc.VTAG_ALL'>), discretization_tag=<class 'grudge.dof_desc.DISCR_TAG_BASE'>))[source]¶
Stand-alone procedural interface to spectral filtering.
For each element group in the discretization, and restriction, This routine generates:
- a filter operator:
cutoff filters only modes above this mode id
- mode_resp_func function returns a filter coefficient
for a given mode
memoized into the array context
a filtered solution wherein the filter is applied to field.
- Parameters:
dcoll (
grudge.discretization.DiscretizationCollection
) – Grudge discretization with boundaries objectcutoff (int) – Mode below which field will not be filtered
mode_resp_func – Modal response function returns a filter coefficient for input mode id
field (
mirgecom.fluid.ConservedVars
) – An array container containing the relevant field(s) to filter.dd (grudge.dof_desc.DOFDesc) – Describe the type of DOF vector on which to operate. Must be on the base discretization.
- Returns:
result – An array container containing the filtered field(s).
- Return type:
5.4.4. Spectral Analysis Helpers¶
- mirgecom.filter.get_element_spectrum_from_modal_representation(actx, vol_discr, modal_fields, element_order)[source]¶
Get the Legendre Polynomial expansion for specified fields on elements.
- Parameters:
actx (
arraycontext.ArrayContext
) – Aarraycontext.ArrayContext
associated with an array of degrees of freedomvol_discr (
grudge.discretization.DiscretizationCollection
) – Grudge discretization for volume elements onlymodal_fields (numpy.ndarray) – Array of DOFArrays with modal respresentations for each field
element_order (int) – Polynomial order for the elements in the discretization
- Returns:
Array with the element modes accumulated into the corresponding “modes” for the polynomial basis functions for each field.
- Return type: