espressomd-users
[Top][All Lists]

## Re: [ESPResSo-users] Implementation of boundaries, lb_boundaries.cpp

 From: Wink, Markus Subject: Re: [ESPResSo-users] Implementation of boundaries, lb_boundaries.cpp Date: Tue, 4 Feb 2014 13:23:15 +0000

```Hi all,

that helps a lot. So we are looking for the shortest distance of the node to
any lbboundary. That makes sense. Just to be clear: The variable
"n_lb_boundaries" describes the total number of lbboundaries. So if I had two
walls, and one rhomboid, the index n would run from 0 to 2. And "dist" would
finally be the minimum distance of the node to any of the three lbboundaries.
If that is the case, I think I understood it.

What do you mean by " and the number is the index of the lbboundary+1"? Does
that mean, that the first boundary gets the number 2, the second number 3 and
so on (that actually happened, when I used "lbboundary print boundary")? Is
there any particular reason, why that is done that way? Wouldn't it be
sufficient just to give boundaries the flag 1, and fluid nodes the flag 0? Or
is there any other part in the code, where one needs that additional
information?

Greetings

Markus

-----Ursprüngliche Nachricht-----
Gesendet: Dienstag, 4. Februar 2014 13:45
Betreff: Re: [ESPResSo-users] Implementation of boundaries, lb_boundaries.cpp

Hi Markus,
thanks for reading my beautiful code :-).

On Feb 4, 2014, at 1:30 PM, "Wink, Markus" <address@hidden> wrote:

> Dear all,
>
> I have got a question concerning the implementation of boundaries in the
> Lattice-Boltzmann source code (lb-boundaries.cpp). For that, a flag (stored
> in the structure "lbfields[k].boundary") is set to decide, whether the node
> is a fluid of boundary node.
>
> As far as I understood the code, the function "calculate_wall_dist" in line
> 281 calculates the distance of the node to the wall. The if-clause in line
> 309 compares that distance to the distance dist=1e99 and gives out the
> minimum. Line 315 ff. finally sets the flag to the structure
> lbfields.boundary.
>
> Here are my questions:
> 1)    A flag of 0 means fluid node, doesn't it? All boundary-nodes are 1 or
> bigger.

True. Values > 1 mean "this is a wall node" and the number is the index of the
lbboundary+1.

> 2)    Why do you initialize the variable "dist" with 1e99. I expected
> something like: compare the distances origin-node to origin-wall; if the
> first one is smaller, one gets a boundary node, otherwise a fluid-node. Where
> does that number come from?

We search for the lbboundary with the lowest distance to a particular node.
1e99 is larger than any other floating number, that we would expect there and
could also be a constant like LARGEST_FLOAT (I don't think such a thing is
defined in espresso).
We want to know the minimum distance to any boundary, and a negative value
indicates that a node is "in" the wall. 1e99 is just a simple coding trick to
avoid a bit of code. Probably unnecessary.

Did that help?
Cheers
Stefan

```