espressomd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Wink, Markus
Subject: [ESPResSo-users] Implementation of boundaries, lb_boundaries.cpp
Date: Tue, 4 Feb 2014 12:30:07 +0000

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.

 

Lets take the example of the wall, since this should be quite easy to understand. Here some parts of the source code (lb-boundaries.cpp), I did not fully understood.  

 

276          dist = 1e99;

                […]

         

280         case LB_BOUNDARY_WAL:

281                calculate_wall_dist((Particle*) NULL, pos, (Particle*) NULL, &lb_boundaries[n].c.wal, &dist_tmp, dist_vec);

282                        break;

                […]

 

309            if (dist_tmp<dist || n == 0) {

310              dist = dist_tmp;

311              the_boundary = n;

312            }

                […]

 

315             if (dist <= 0 && the_boundary >= 0 && n_lb_boundaries > 0) {

316               lbfields[get_linear_index(x,y,z,lblattice.halo_grid)].boundary = the_boundary+1;

317               //printf("boundindex %i: \n", get_linear_index(x,y,z,lblattice.halo_grid));  

318          }

319          else {

320            lbfields[get_linear_index(x,y,z,lblattice.halo_grid)].boundary = 0;

 

 

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.

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?

 

I would be very thankful, if someone could help me out.

 

Greetings

 

Markus Wink

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]