Skip to content

Compute and define temperature on a cell.

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Compute and define temperature on a cell.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #6506
    sahilbhapkar30
    Participant

    Hello,

    I want to compute and define the temperature on cell in the Advection-Diffusion dynamics. Like for the velocity, we have computeU and defineU for computing and defining the velocity on the cells, is there any function to compute and define the temperature on a cell?

    Thank-you
    Sahil

    #6507
    jjessberger
    Participant

    Dear Sahil,

    you can do that using the computeRho/ defineRho methods.

    Background: for Advection-Diffusion equations, the zeroth moment is the scalar quantity (= the temperature in your case). This moment is often called “rho” in the LBM theory.

    Yours,
    Julius

    #6514
    sahilbhapkar30
    Participant

    Hello,

    I tried earlier with computeRho and defineRho, however I got an error while compiling.

    cell.neighbor({n0,n1}).computeRho(u_neighbor1.data());

    So this is the code. I wanted to calculate the the temperature on this cell, where n0 is the normal in the tangential direction(0 in this case) and n1 is the normal in the y direction. This code works fine when I use the computeU and defineU functions. But for the Rho it is giving me the following error.

    error: no matching function for call to ‘olb::Cell<double, olb::descriptors::D2Q5<olb::descriptors::VELOCITY> >::computeRho(double*)’

    Could you please help me in solving the error?

    Thank-you,
    Sahil Bhapkar

    #6515
    Adrian
    Keymaster

    Rho is returned by-value from olb::Cell::computeRho(). See e.g. Doxygen (ConstCell) for further method signatures.

    #6517
    sahilbhapkar30
    Participant

    Hello,

    I visited the site and also the file src/core/cells.hh

    I initialized as follows:

    ConstCell<T,DESCRIPTOR> cell = blockLattice.get(iX, iY);

    T cell.neighbor({n0,n1}).computeRho(u_neighbor1.data());

    and I am still getting the error

    expected initializer before ‘.’ token
    240 | T cell.neighbor({n0,n1}).computeRho(u_neighbor1.data());
    | ^

    Could you please help me with it?

    Thank-you

    #6518
    Adrian
    Keymaster

    The signature of the computeRho method you want to call is:

    
    T olb::ConstCell<T,DESCRIPTOR>::computeRho() const
    

    i.e. it returns the value of rho as a value, not by writing it to a given pointer.

    This means that you need to write e.g.:

    
    T rho = cell.neighbor({n0,n1}).computeRho();
    
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.