Skip to content

Coupling between a Navier-Stokes and an Advection-Diffusion lattice

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Coupling between a Navier-Stokes and an Advection-Diffusion lattice

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #10421
    liu
    Participant

    dear ccommunity:
    This is a program to add a temperature field to a flow field, the original program looks like this
    “force[iD]= forcePrefactor[iD] * temperatureDifference;”
    If there is an additional force in the flow field itself, such as a volumetric force in the turbulence of a slot channel, should this procedure be changed to
    “force[iD]+= forcePrefactor[iD] * temperatureDifference;force[iD]= forcePrefactor[iD] * emperatureDifference;”
    Thanks!
    Here is the original full code:

    /// Coupling between a Navier-Stokes and an Advection-Diffusion lattice
    struct NavierStokesAdvectionDiffusionCoupling {
    static constexpr OperatorScope scope = OperatorScope::PerCellWithParameters;

    struct FORCE_PREFACTOR : public descriptors::FIELD_BASE<0,1> { };
    struct T0 : public descriptors::FIELD_BASE<1> { };

    using parameters = meta::list<FORCE_PREFACTOR,T0>;

    template <typename CELLS, typename PARAMETERS>
    void apply(CELLS& cells, PARAMETERS& parameters) any_platform
    {
    using V = typename CELLS::template value_t<names::NavierStokes>::value_t;
    using DESCRIPTOR = typename CELLS::template value_t<names::NavierStokes>::descriptor_t;

    auto& cellNSE = cells.template get<names::NavierStokes>();
    auto& cellADE = cells.template get<names::Temperature>();

    // computation of the bousinessq force
    auto force = cellNSE.template getFieldPointer<descriptors::FORCE>();
    auto forcePrefactor = parameters.template get<FORCE_PREFACTOR>();
    V temperatureDifference = cellADE.computeRho() – parameters.template get<T0>();
    for (unsigned iD = 0; iD < DESCRIPTOR::d; ++iD) {
    force[iD]= forcePrefactor[iD] * temperatureDifference;//external force
    }

    // Velocity coupling
    V u[DESCRIPTOR::d] { };
    cellNSE.computeU(u);
    cellADE.template setField<descriptors::VELOCITY>(u);
    }
    };

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.