other nonNewtonian constitutive models
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › other nonNewtonian constitutive models
 This topic has 2 replies, 2 voices, and was last updated 1 year, 9 months ago by grasingerm.

AuthorPosts

September 27, 2022 at 3:53 am #6832grasingermParticipant
I see there is support for simulating powerlaw nonNewtonian fluids, but I am actually interested in other nonNewtonian constitutive models (e.g. Bingham, Carreau, etc.). Does anyone know of documentation which outlines how to do this?
I have some experience implementing these models in my own LBM code by adjusting the collision frequency locally as a function of the shear rate. Perhaps a similar thing can be done in OpenLB? Is this how the powerlaw model is implemented?
September 27, 2022 at 10:18 am #6835AdrianKeymasterOpenLB offers quite a lot of flexibility for extending and recombining already implemented models. From the software perspective it is straight forward to modify the local relaxation time. For illustration we can take a look at the declaration of the
PowerLawBGKdynamics
:template <typename T, typename DESCRIPTOR, typename MOMENTA=momenta::BulkTuple> using PowerLawBGKdynamics = dynamics::Tuple< T, DESCRIPTOR, MOMENTA, equilibria::SecondOrder, powerlaw::OmegaFromCell<collision::BGK> >;
These dynamics consist of given momenta (bulk by default but changeable via template parameter), second order equilibrium and a BGK collision locally modified to compute the relaxation frequency omega from the cell via
powerlaw::OmegaFromCell
.So in order to implement other nonNewtonian consitutive models you only need to implement the
powerlaw::OmegaFromCell
part and drop it into the declaration of your new dynamics. I would suggest to look at the code insrc/dynamics/powerLawBGKdynamics.h
for reference (also the various Smagorinskytype LES dynamics where the same facilities are used).For a very reduced overview:
template <typename COLLISION> struct CustomNonNewtonianOmegaFromCell { // [...] template <typename DESCRIPTOR, typename MOMENTA, typename EQUILIBRIUM> struct type { using MomentaF = typename MOMENTA::template type<DESCRIPTOR>; using CollisionO = typename COLLISION::template type<DESCRIPTOR, MOMENTA, EQUILIBRIUM>; template <typename CELL, typename PARAMETERS, typename V=typename CELL::value_t> CellStatistic<V> apply(CELL& cell, PARAMETERS& parameters) any_platform { V rho, u[DESCRIPTOR::d], pi[util::TensorVal<DESCRIPTOR>::n] { }; MomentaF().computeAllMomenta(cell, rho, u, pi); // momenta are computed here for usage in omega computation const V omega = // compute new omega here parameters.template set<descriptors::OMEGA>(omega); // default omega value is changed here return CollisionO().apply(cell, parameters); // arbitrary omegaaccepting collision operator is called here } }; };
Once this works our automatic code generator may be used to transparently transform this into performance optimized code.
I hope that this helps, feel free to ask further questions.
September 27, 2022 at 3:50 pm #6838grasingermParticipantThis is exactly what I was looking for. Thank you!

AuthorPosts
 You must be logged in to reply to this topic.