mikaem / Oasis

54 stars 49 forks source link

Run channel.py example with LES model #39

Closed bragostin closed 3 years ago

bragostin commented 3 years ago

First thank you for creating Oasis, this is such a powerful addition to Fenics! I was reading two of your articles:

It is written that the LES turbulence models can run with the problems/channel.py example. It converges but it looks like it is set for laminar flow. Then I set les_model = "Wale" in NS_parameters.update of channel.py but then I get the following error:

Traceback (most recent call last):
  File "NSfracStep.py", line 139, in <module>
    vars().update(les_setup(**vars()))
  File "../oasis/solvers/NSfracStep/LES/Wale.py", line 34, in les_setup
    bcs_nut = derived_bcs(CG1, bcs['u0'], u_)
  File "../oasis/solvers/NSfracStep/LES/common.py", line 15, in derived_bcs
    subdomain = original_bcs[0].user_sub_domain()
AttributeError: 'DirichletBC' object has no attribute 'user_sub_domain'

Can this example actually run with the LES Wale model?

bragostin commented 3 years ago

I managed to make run with the following changes: in oasis/solvers/NSfracStep/LES/Wale.py replace

from dolfin import (Function, FunctionSpace, assemble, TestFunction, sym, grad, tr,
    Identity, dx, Max, inner, MeshFunction, DirichletBC, Constant)

with

from dolfin import (Function, FunctionSpace, assemble, TestFunction, sym, grad, tr,
    Identity, dx, inner, MeshFunction, DirichletBC, Constant)
from ufl import Max

in fenicstools/StructuredGrid.py l. 252 replace f = h5py.File(filename, 'w', driver='mpio', comm=comm) with f = h5py.File(filename, 'w')

in solvers/NFracStep/LES/common.py replace user_sub_domain() with user_subdomain()

in common/utilities.py replace instances variable.array() with np.array(variable)