# turbulence models with extend_simul_class

This is a quite foundational MR which fixes #116 (closed) (Simple LES and RANS models added with `extend_simul_class`

).

There are quite a lot of changes at different levels:

- Base fluidsim things (in
`fluidsim/base/solvers`

,`fluidsim/base/forcing`

,`fluidsim/base/turb_model/base.py`

). Just interesting for fluidsim core developers. - Implementation of a model (class
`SmagorinskyModel`

in`fluidsim/base/turb_model/smagorinsky.py`

) - Testing (
`fluidsim/base/turb_model/test_turb_model.py`

) - Examples (
`doc/examples/kolmo_flow`

and`doc/test_cases/Taylor_Green_vortices/run_simul_les_smago.py`

)

If you want to take inspiration to implement another model, you should look only at `fluidsim.base.turb_model.smagorinsky.SmagorinskyModel`

and the associated test class.

More work needed on this subject:

- For now, it works only for the
`ns3d`

solver - The outputs do not take into account the forcing added by the turbulent model (see for example
`sim.output.spatial_means.plot_dt_E`

) - It would be nice to improve testing by checking that the model works as expected
- It would be nice to implement the dynamic Smagorinsky model

A question: for now the model is recomputed each time `turb_model.get_forcing`

is called, i.e. each time `sim.tendencies_nonlin`

is called (for example 4 times per time step for the RK4 time stepping scheme). Would it be sufficient to compute it once per time step?

**Warning:** to try this code, one must really reinstall Fluidsim from source, which means update the source (`hg pull; hg up turb_model`

), and then `cd lib; pip install -e .; cd ..`

(to install the modified version of `fluidsim_core`

) and then `pip install -e .`

(to recompile a modified extension).

One can check that everything is fine by running `pytest fluidsim/base/turb_model`

.