Viewing 15 posts - 1 through 15 (of 15 total)
• Author
Posts
• #6546
sahilbhapkar30
Participant

Hello,

How can I impose the Neumann boundary condition in Advection-Diffusion equation?
Is there any example where it does?

Thank-you
Sahil

#6558
johanna
Participant

Hello Sahil,

unfortunately there is no example with Neumann boundary conditions for Advection-Diffusion 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
Johanna

#6561
antoniowu
Participant

Hello 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 nx-1 and copy them to the outlet cells at nx?

Best,
Antonio

#6562
johanna
Participant

Hello 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 nx-1.
Alternatively you could use a PostProcessor. There you could use for example blockLattice.get(iX-1,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,
Johanna

#6575
antoniowu
Participant

Hello Johanna,

Thank you so much for the suggestions. I’ve created an AnalyticalF with SuperLatticeDensity2D and AnalyticalFfromSuperF2D. Then I extracted the temperature data at nx-1 by inputting all the points (nx-1, 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:
AnalyticalFfromSuperF2D<T> AnalyticalTemp(temperature);
T point[2];
T previoustemp[1];
std::vector<T> _c; //initiate a vector to store all the temperature data at nx-1
_c.reserve(ny);

for (int iY = 0; iY <= ny; iY++){
point[0] = nx-1;
point[1] = iY;
AnalyticalTemp(previoustemp, point); //this calculates the temperature at nx-1
_c.push_back(previoustemp[0]);
}

Regards,
Antonio

#6618
mathias
Keymaster

Dear Antonio,

Best
Mathias

#6638
antoniowu
Participant

Dear Mathias,

Thanks for your suggestion. I’ve created a new analytical functor to deal with this and it works now!

Cheers,
Antonio

#6640
ramirofreile
Participant

Hello 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

#6708
antoniowu
Participant

Hello 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,
Antonio

#6780
steed188
Participant

Hello 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>
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:

Do you have any ideas that what is wrong?

best wishes,
steed188

#6806
johanna
Participant

Hello 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,
Johanna

#6807
steed188
Participant

Hi 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 512-529 of CesT.cpp, and neumannBC is implemented in AdvectionDiffusionNeumannBoundaryProcessor3D.h.

Thank you.
with best wishes,

steed188

#6831
johanna
Participant

Hello 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,
Johanna

#6836
steed188
Participant

Hi Johanna,
Thank you. I’m interested in the cooperation project. How can I get further information?
Best wishes,

steed188

#6837
johanna
Participant

Hello 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

Viewing 15 posts - 1 through 15 (of 15 total)
• You must be logged in to reply to this topic.