Neumann temperature boundary
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Neumann temperature boundary
 This topic has 14 replies, 6 voices, and was last updated 5 months, 4 weeks ago by johanna.

AuthorPosts

May 6, 2022 at 2:17 pm #6546sahilbhapkar30Participant
Hello,
How can I impose the Neumann boundary condition in AdvectionDiffusion equation?
Is there any example where it does?Thankyou
SahilMay 9, 2022 at 4:52 pm #6558johannaParticipantHello Sahil,
unfortunately there is no example with Neumann boundary conditions for AdvectionDiffusion equations.
But you can simply use a difference quotient to transform your Neumann boundary into a Dirichlet boundary (fixed temperature boundary) and update it every timestep with a setBoundaryValues method.Best
JohannaMay 12, 2022 at 9:44 am #6561antoniowuParticipantHello Johanna,
I am also trying to implement the Neumann boundary condition for ADE. Can you please suggest how we can exact temperature data from the previous cells at nx1 and copy them to the outlet cells at nx?
Best,
AntonioMay 13, 2022 at 10:36 am #6562johannaParticipantHello Antonio,
you can access the temperature data via SuperLatticeDensity and then you could also convert it into an analytical functor with AnalyticalFfromSuperF…D if you have the physical coordinates for nx1.
Alternatively you could use a PostProcessor. There you could use for example blockLattice.get(iX1,iY).computeRho().
To set the boundary condition use in your App a setBoundaryValues method and the advectionDiffusionTemperatureBoundaries and set your value in every time step with LatticeName.defineRho(…)Best,
JohannaMay 18, 2022 at 2:33 pm #6575antoniowuParticipantHello Johanna,
Thank you so much for the suggestions. I’ve created an AnalyticalF with SuperLatticeDensity2D and AnalyticalFfromSuperF2D. Then I extracted the temperature data at nx1 by inputting all the points (nx1, iY) into the analytical functor. However, I am not quite sure how to use LatticeName.defineRho(…) to set DIFFERENT boundary values. I usually use LatticeName.defineRho(SuperGeometry, MaterialNumber, AnalyticalConst2D) which sets all the boundary cells at the same value. Can you please further suggest on this?
Code snippet:
SuperLatticeDensity2D<T, TDESCRIPTOR> temperature(ADlattice);
AnalyticalFfromSuperF2D<T> AnalyticalTemp(temperature);
T point[2];
T previoustemp[1];
std::vector<T> _c; //initiate a vector to store all the temperature data at nx1
_c.reserve(ny);for (int iY = 0; iY <= ny; iY++){
point[0] = nx1;
point[1] = iY;
AnalyticalTemp(previoustemp, point); //this calculates the temperature at nx1
_c.push_back(previoustemp[0]);
}
ADlattice.defineRho(…); //got lost hereRegards,
AntonioJune 4, 2022 at 7:16 pm #6618mathiasKeymasterDear Antonio,
for your task, I would rather recomment to write your own postProcessor.
Best
MathiasJune 15, 2022 at 7:49 am #6638antoniowuParticipantDear Mathias,
Thanks for your suggestion. I’ve created a new analytical functor to deal with this and it works now!
Cheers,
AntonioJune 15, 2022 at 11:05 pm #6640ramirofreileParticipantHello Antonio,
I have been trying to implement a Neumann boundary condition for the AD equation as well. Is there any chance you could share your way of implementing it to have it as a benchmark?
I would greatly appreciate it,Thank you,
Ramiro
July 8, 2022 at 7:56 am #6708antoniowuParticipantHello Ramiro,
You can just follow Johanna’s advice, which is what I did. Besides, I wrote an analytical functor to deal with boundary values at the layer before the outlet.
Regards,
AntonioSeptember 1, 2022 at 6:38 am #6780steed188ParticipantHello Johanna and Antoniowu,
I’m also writing the Neumann BC for ADlattice. I created a LocalPostProcessor3D and its corresponding PostProcessorGenerator3D. In LocalPostProcessor3D, the core is to calculate the density of the adjacent grid and assign it directly to the boundary grid. But it doesn’t seem to work.The core code of LocalPostProcessor3D is like this
template <typename T, typename descriptor>
void AdNeumannBoundaryProcessor3D<T, descriptor>::
processSubDomain(BlockLattice<T, descriptor> &blockLattice, int x0_, int x1_, int y0_,
int y1_, int z0_, int z1_)
{
int newX0, newX1, newY0, newY1, newZ0, newZ1;
if (util::intersect(
x0, x1, y0, y1, z0, z1,
x0_, x1_, y0_, y1_, z0_, z1_,
newX0, newX1, newY0, newY1, newZ0, newZ1))
{#ifdef PARALLEL_MODE_OMP
#pragma omp parallel for
#endif
T temperature = 0;for (int iX = newX0; iX <= newX1; ++iX)
{
for (int iY = newY0; iY <= newY1; ++iY)
{
for (int iZ = newZ0; iZ <= newZ1; ++iZ)
{
temperature = blockLattice.get(iX – direction[0], iY – direction[1], iZ – direction[2]).computeRho();
blockLattice.get(iX, iY, iZ).defineRho(temperature);
}
}
}
}
}And I call it like this:
PostProcessorGenerator3D<T, ADDESCRIPTOR> *ImplementADNeumann = new AdNeumannBoundaryProcessorGenerator3D<T, ADDESCRIPTOR>(x0, x1, y0, y1, z0, z1, directionX, directionY, directionZ);
adLattice.addPostProcessor(*ImplementOutletADNeumann);Do you have any ideas that what is wrong?
best wishes,
steed188September 21, 2022 at 9:00 am #6806johannaParticipantHello steed188,
sorry for the late response.
Can you describe why you think that it does not seem to work? Do you get a compilation error or does the result look not the way you expected it?Best,
JohannaSeptember 21, 2022 at 10:53 am #6807steed188ParticipantHi Johanna,
The compilation is OK, but the simulation diverges directly.
I posted the main program and the temperature NeumannBC I wrote on GitLab. Would you mind help checking where the problem is?https://gitlab.com/steed188/openlb
This is an LES + Boussinesq approximation simulation of the convective heat transfer problem.
The invocation of NeumannBC is in lines 512529 of CesT.cpp, and neumannBC is implemented in AdvectionDiffusionNeumannBoundaryProcessor3D.h.Thank you.
with best wishes,steed188
September 26, 2022 at 1:29 pm #6831johannaParticipantHello steed188,
please try first to use AdvectionDiffusionTemperatureBoundaries to check if it does really depend on the boundary condition.
Here we can not give such detailed support but as a cooperation project this would be possible. If this works for you just contact us.
Best wishes,
JohannaSeptember 27, 2022 at 10:50 am #6836steed188ParticipantHi Johanna,
Thank you. I’m interested in the cooperation project. How can I get further information?
Best wishes,steed188
September 27, 2022 at 1:14 pm #6837johannaParticipantHello steed188,
can you please send me more informations about the project and the points were you need some support at my mail adresse johanna.moedl@kit.edu. Then I can also give you some further informations.
I am looking forward to your hear from you.
Best wishes,
Johanna 
AuthorPosts
 You must be logged in to reply to this topic.