Compute and define temperature on a cell.
› Forums › OpenLB › General Topics › Compute and define temperature on a cell.
- This topic has 5 replies, 3 voices, and was last updated 3 years, 8 months ago by Adrian.
-
AuthorPosts
-
April 26, 2022 at 4:51 pm #6506sahilbhapkar30Participant
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
SahilApril 27, 2022 at 9:04 am #6507jjessbergerParticipantDear 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,
JuliusApril 27, 2022 at 10:42 am #6514sahilbhapkar30ParticipantHello,
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 BhapkarApril 27, 2022 at 10:51 am #6515AdrianKeymasterRho is returned by-value from
olb::Cell::computeRho(). See e.g. Doxygen (ConstCell) for further method signatures.April 27, 2022 at 11:27 am #6517sahilbhapkar30ParticipantHello,
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
April 27, 2022 at 11:37 am #6518AdrianKeymasterThe signature of the
computeRhomethod you want to call is:T olb::ConstCell<T,DESCRIPTOR>::computeRho() consti.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(); -
AuthorPosts
- You must be logged in to reply to this topic.
