[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ESPResSo-users] Implementation of boundaries, lb_boundaries.cpp
From: |
Stefan Kesselheim |
Subject: |
Re: [ESPResSo-users] Implementation of boundaries, lb_boundaries.cpp |
Date: |
Tue, 4 Feb 2014 13:44:32 +0100 |
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