Source code for pyfr.solvers.acnavstokes.elements

# -*- coding: utf-8 -*-

from pyfr.solvers.aceuler.elements import BaseACFluidElements
from pyfr.solvers.baseadvecdiff import BaseAdvectionDiffusionElements

[docs]class ACNavierStokesElements(BaseACFluidElements, BaseAdvectionDiffusionElements):
[docs] @staticmethod def grad_con_to_pri(cons, grad_cons, cfg): return grad_cons
[docs] def set_backend(self, *args, **kwargs): super().set_backend(*args, **kwargs) # Can elide interior flux calculations at p = 0 if self.basis.order == 0: return # Register our flux kernels kprefix = 'pyfr.solvers.acnavstokes.kernels' self._be.pointwise.register(f'{kprefix}.tflux') self._be.pointwise.register(f'{kprefix}.tfluxlin') # Template parameters for the flux kernels tplargs = { 'ndims': self.ndims, 'nvars': self.nvars, 'nverts': len(self.basis.linspts), 'c': self.cfg.items_as('constants', float), 'jac_exprs': self.basis.jac_exprs } # Helpers c, l = 'curved', 'linear' r, s = self._mesh_regions, self._slice_mat if c in r and 'flux' not in self.antialias: self.kernels['tdisf_curved'] = lambda uin: self._be.kernel( 'tflux', tplargs=tplargs, dims=[self.nupts, r[c]], u=s(self.scal_upts[uin], c), f=s(self._vect_upts, c), smats=self.curved_smat_at('upts') ) elif c in r: self.kernels['tdisf_curved'] = lambda: self._be.kernel( 'tflux', tplargs=tplargs, dims=[self.nqpts, r[c]], u=s(self._scal_qpts, c), f=s(self._vect_qpts, c), smats=self.curved_smat_at('qpts') ) if l in r and 'flux' not in self.antialias: self.kernels['tdisf_linear'] = lambda uin: self._be.kernel( 'tfluxlin', tplargs=tplargs, dims=[self.nupts, r[l]], u=s(self.scal_upts[uin], l), f=s(self._vect_upts, l), verts=self.ploc_at('linspts', l), upts=self.upts ) elif l in r: self.kernels['tdisf_linear'] = lambda: self._be.kernel( 'tfluxlin', tplargs=tplargs, dims=[self.nqpts, r[l]], u=s(self._scal_qpts, l), f=s(self._vect_qpts, l), verts=self.ploc_at('linspts', l), upts=self.qpts )