Skip to content
Snippets Groups Projects
Commit 664e6939 authored by Martin Bauer's avatar Martin Bauer
Browse files

Simplifications for entropic setup

- used these simplifications in double_shear_layer benchmark
parent 32197bd0
No related branches found
No related tags found
No related merge requests found
......@@ -191,8 +191,12 @@ def updateWithDefaultParameters(params, optParams, failOnUnknownParameter=True):
}
if 'relaxationRate' in params:
if 'relaxationRates' not in params:
params['relaxationRates'] = [params['relaxationRate'],
relaxationRateFromMagicNumber(params['relaxationRate'])]
if 'entropic' in params and params['entropic']:
params['relaxationRates'] = [params['relaxationRate']]
else:
params['relaxationRates'] = [params['relaxationRate'],
relaxationRateFromMagicNumber(params['relaxationRate'])]
del params['relaxationRate']
if failOnUnknownParameter:
......
......@@ -24,6 +24,7 @@ at :mod:`lbmpy.creationfunctions`. The only mandatory keyword parameter is ``rel
that defines the viscosity of the fluid (valid values being between 0 and 2).
"""
import numpy as np
import sympy as sp
from functools import partial
from pystencils.field import getLayoutOfArray, createNumpyArrayWithLayout
from pystencils.slicing import sliceFromDirection, addGhostLayers, removeGhostLayers, normalizeSlice, makeSlice
......@@ -270,6 +271,19 @@ class Scenario(object):
# Create kernel
if lbmKernel is None:
if methodParameters['entropic']:
newRelaxationRates = []
for rr in methodParameters['relaxationRates']:
if not isinstance(rr, sp.Symbol):
dummyVar = sp.Dummy()
newRelaxationRates.append(dummyVar)
kernelParams[dummyVar.name] = rr
else:
newRelaxationRates.append(rr)
if len(newRelaxationRates) < 2:
newRelaxationRates.append(sp.Dummy())
methodParameters['relaxationRates'] = newRelaxationRates
optimizationParams['pdfArr'] = self._pdfArrays[0]
methodParameters['optimizationParams'] = optimizationParams
self._lbmKernel = createLatticeBoltzmannFunction(**methodParameters)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment