Skip to content

Simple LES and RANS models added with `extend_simul_class`

We want to be able to do something like:

from fluidsim.solvers.ns3d.solver import Simul
from fluidsim.base.turb_model import SmagorinskyModel, extend_simul_class

Simul = extend_simul_class(Simul, SmagorinskyModel)
params = Simul.create_default_params()
params.turb_model.enable = True
params.turb_model.type = "smagorinsky"
params.turb_model.smagorinsky.C = 0.18

...

sim = Simul(params)
sim.turb_model

Here, we want to limit ourselves to simple models which only change the non linear terms and do not need other solved variables.

I guess we need to modify a bit fluidsim/base/solvers/base.py and the solvers (for example fluidsim/solvers/ns3d/solver.py) (see !308 (merged)).

I first wrote:

        if self.is_turb_model_enabled:
            tendencies_fft += self.turb_model.get_model()

but we should define get_model as

    def get_model(self, **kwargs):
        ...

and give some variables already computed/available in tendencies_nonlin.

There should be a class for the sim.turb_model object (very similar to the equivalent class for forcing) and classes for specific turbulence models (very similar to SpecificForcing).

I don't know if we need to compute the turbulent model for each call of tendencies_nonlin or just once per time step (as for the forcing).

Edited by Pierre Augier
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information