[pyfr] 09/88: Split apart the artificial viscosity kernel.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Nov 16 12:05:24 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository pyfr.

commit 3a85827772a122fa0d486ddda4651921fc86ff5e
Author: Freddie Witherden <freddie at witherden.org>
Date:   Sat Apr 16 17:56:51 2016 -0700

    Split apart the artificial viscosity kernel.
---
 pyfr/solvers/navstokes/elements.py | 69 +++++++++++++++++---------------------
 pyfr/solvers/navstokes/system.py   |  6 ++--
 2 files changed, 35 insertions(+), 40 deletions(-)

diff --git a/pyfr/solvers/navstokes/elements.py b/pyfr/solvers/navstokes/elements.py
index b880a3a..12a6135 100644
--- a/pyfr/solvers/navstokes/elements.py
+++ b/pyfr/solvers/navstokes/elements.py
@@ -2,10 +2,8 @@
 
 import numpy as np
 
-from pyfr.backends.base.kernels import ComputeMetaKernel
 from pyfr.solvers.baseadvecdiff import BaseAdvectionDiffusionElements
 from pyfr.solvers.euler.elements import BaseFluidElements
-from pyfr.util import ndrange
 
 
 class NavierStokesElements(BaseFluidElements, BaseAdvectionDiffusionElements):
@@ -49,50 +47,45 @@ class NavierStokesElements(BaseFluidElements, BaseAdvectionDiffusionElements):
                     (nfpts, 1, neles), aliases=avis_upts_temp, tags=tags
                 )
 
+            # Entropy kernel
             backend.pointwise.register(
                 'pyfr.solvers.navstokes.kernels.entropy'
             )
-            backend.pointwise.register('pyfr.solvers.navstokes.kernels.avis')
 
-            def artf_vis():
-                # Compute entropy and save to avis_upts
-                ent = backend.kernel(
-                    'entropy', tplargs=tplargs, dims=[nupts, neles],
-                    u=self.scal_upts_inb, s=avis_upts
-                )
+            self.kernels['entropy'] = lambda: backend.kernel(
+                'entropy', tplargs=tplargs, dims=[nupts, neles],
+                u=self.scal_upts_inb, s=avis_upts
+            )
 
-                # Compute modal coefficients of entropy
-                rcpvdm = np.linalg.inv(self.basis.ubasis.vdm.T)
-                rcpvdm = self._be.const_matrix(rcpvdm, tags={'align'})
-                mul = backend.kernel(
-                    'mul', rcpvdm, avis_upts, out=avis_upts_temp
-                )
+            # Modal entropy coefficient kernel
+            rcpvdm = np.linalg.inv(self.basis.ubasis.vdm.T)
+            rcpvdm = self._be.const_matrix(rcpvdm, tags={'align'})
+            self.kernels['modal_entropy'] = lambda: backend.kernel(
+                'mul', rcpvdm, avis_upts, out=avis_upts_temp
+            )
 
-                # Additional constants for element-wise artificial viscosity
-                tplargs['c'].update(
-                    self.cfg.items_as('solver-artificial-viscosity', float)
-                )
-                tplargs.update(dict(
-                    nupts=nupts, nfpts=nfpts, order=self.basis.order,
-                    ubdegs=self.basis.ubasis.degrees,
-                ))
-
-                if 'flux' in self.antialias:
-                    ame_e = avis_qpts
-                    tplargs['nrow_amu'] = self.nqpts
-                else:
-                    ame_e = avis_upts
-                    tplargs['nrow_amu'] = nupts
-
-                # Element-wise artificial viscosity kernel
-                avis = backend.kernel(
-                    'avis', tplargs, dims=[neles], s=avis_upts_temp,
-                    amu_e=ame_e, amu_f=self._avis_fpts
-                )
+            # Artificial viscosity kernel
+            backend.pointwise.register('pyfr.solvers.navstokes.kernels.avis')
+            art_visc_tplargs = dict(
+                tplargs, nupts=nupts, nfpts=nfpts, order=self.basis.order,
+                ubdegs=self.basis.ubasis.degrees
+            )
+            art_visc_tplargs['c'].update(
+                self.cfg.items_as('solver-artificial-viscosity', float)
+            )
 
-                return ComputeMetaKernel([ent, mul, avis])
+            if 'flux' in self.antialias:
+                ame_e = avis_qpts
+                art_visc_tplargs['nrow_amu'] = self.nqpts
+            else:
+                ame_e = avis_upts
+                art_visc_tplargs['nrow_amu'] = nupts
 
-            self.kernels['avis'] = artf_vis
+            # Element-wise artificial viscosity kernel
+            self.kernels['art_visc'] = lambda: backend.kernel(
+                'avis', tplargs=art_visc_tplargs, dims=[neles],
+                s=avis_upts_temp, amu_e=ame_e, amu_f=self._avis_fpts
+            )
 
             tplargs['art_vis'] = 'mu'
         elif shock_capturing == 'none':
diff --git a/pyfr/solvers/navstokes/system.py b/pyfr/solvers/navstokes/system.py
index ed441cb..7d82b89 100644
--- a/pyfr/solvers/navstokes/system.py
+++ b/pyfr/solvers/navstokes/system.py
@@ -32,8 +32,10 @@ class NavierStokesSystem(BaseAdvectionDiffusionSystem):
         q1 << kernels['iint', 'con_u']()
         q1 << kernels['bcint', 'con_u'](t=t)
         q1 << kernels['eles', 'tgradpcoru_upts']()
-        if ('eles', 'avis') in kernels:
-            q1 << kernels['eles', 'avis']()
+        if ('eles', 'art_visc') in kernels:
+            q1 << kernels['eles', 'entropy']()
+            q1 << kernels['eles', 'modal_entropy']()
+            q1 << kernels['eles', 'art_visc']()
             q1 << kernels['mpiint', 'avis_fpts_pack']()
 
         q2 << kernels['mpiint', 'scal_fpts_send']()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyfr.git



More information about the debian-science-commits mailing list