Challenge

Week 4 Challenge- Compiling C++ libraries

    1. Copy the solver DPMFoam from the lagrangian library ( $FOAM_SOLVERS ) into your run folder ( $FOAM_RUN ) (use visual studio)
      • Use wmake libso to compile the shared library associated with this, after making the appropriate changes
      • Where is the resulting .so file found? (Attach image of the shared object file location)
      • Write a report on what you did and the challenges you faced

So, I copied the DPMFoam solver in the run folder called $ FOAM_RUN. And the steps are mentioned below.

Here, I located the DPMFoam in openfoam2306/applications/sollvers/langrangian and the copied it to the run folder $FOAM_RUN. 

Then, by using the wmake libso command, it results as follows.

And the source file is located in Make folder as shown below

  2. Write detailed explanations on the following decomposition algorithms:

      1. simple (2 2 1)
      2. scotch (Write a short note about how scotch decomposition is carried out)
      3. hierarchical

Decomposition algorithms are used in parallel computing to divide a computational domain into smaller subdomains that can be processed independently by multiple processors or nodes. These algorithms are crucial for achieving parallelism and load balancing in various scientific and engineering simulations. Here are explanations of some common decomposition algorithms:

1. Simple Decomposition (2D and 3D):

   2D: In 2D simple decomposition, the computational domain is divided into equal-sized rectangular subdomains. For example, if you have a 2D grid and want to decompose it into 4 subdomains, you might create a 2x2 grid of subdomains.

   3D: In 3D simple decomposition, the domain is divided into equal-sized cubic subdomains. This is similar to 2D decomposition, but extended into the third dimension.

   Simple decomposition is straightforward but may not always lead to optimal load balancing, especially if the computational workload is not evenly distributed across the domain.

2. Scotch Decomposition:

   Scotch (Scalable and efficient graph partitioning) is a library and set of tools for graph partitioning and parallel computing. In the context of computational simulations, Scotch can be used to partition the computational mesh into subdomains.

   Process: The Scotch algorithm considers the graph representation of the computational domain, where nodes represent elements (e.g., cells, triangles) and edges represent connections between elements.

   Algorithm: Scotch uses a multi-objective approach, considering aspects like load balancing and minimizing inter-processor communication. It aims to minimize the edge cuts in the graph while balancing the computational workload.

   Scotch decomposition is often favored for its ability to achieve good load balancing and minimize communication overhead.

3. Hierarchical Decomposition:

   Hierarchical decomposition involves a multi-level approach to partitioning a computational domain. It can be used with other decomposition methods, such as simple or Scotch, to improve load balancing.

   Process: In hierarchical decomposition, the domain is first divided into larger subdomains. Then, each of these larger subdomains can be further divided into smaller subdomains. This hierarchical structure continues until a suitable level of partitioning is achieved.

   Benefits: The hierarchical approach allows for more refined control over load balancing. You can adapt the level of subdivision to the specific requirements of your simulation.

Different decomposition algorithms may be more suitable for specific applications and problem domains. The choice of an algorithm often depends on factors such as the nature of the problem, the computational resources available, and the desired level of parallelism and load balancing.

These decomposition techniques are commonly used in parallel computing frameworks, including MPI (Message Passing Interface) and libraries like OpenFOAM, to efficiently distribute workloads across multiple processors or nodes in high-performance computing environments.

3.Take the incompressible/simpleFoam/pitzDaily case and visualize the decomposed mesh (use decomposeParDict) in ParaView for:

      1. simple (2 2 1)
      2. scotch (Write a short note about how scotch decomposition is carried out)
      3. hierarchical

After coping the simpleFoam/pitzDialy into the run folder, then inside the pitzDaily/system folder i changed the decomposeParDict source code file as follows:

simple (2 2 1):

Here, the number of subdomains are the product of n coefficients, then the results of the decomposePar command results as follows:

/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2306                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _fbf00d6b-20230626 OPENFOAM=2306 version=2306
Arch   : "LSB;label=32;scalar=64"
Exec   : decomposePar
Date   : Oct 11 2023
Time   : 20:55:11
Host   : pavan-VirtualBox
PID    : 4210
I/O    : uncollated
Case   : /home/pavan/OpenFOAM/pavan-v2306/run/my_tut/simpleFoam/pitzDaily
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time



Decomposing mesh

Create mesh

Calculating distribution of cells
Decomposition method simple [4] (region region0)

Finished decomposition in 0.01 s

Calculating original mesh data

Distributing cells to processors

Distributing faces to processors

Distributing points to processors

Constructing processor meshes

Processor 0
    Number of cells = 3024
    Number of points = 6344
    Number of faces shared with processor 1 = 29
    Number of faces shared with processor 2 = 118
    Number of processor patches = 2
    Number of processor faces = 147
    Number of boundary faces = 6195

Processor 1
    Number of cells = 3089
    Number of points = 6454
    Number of faces shared with processor 0 = 29
    Number of faces shared with processor 3 = 109
    Number of processor patches = 2
    Number of processor faces = 138
    Number of boundary faces = 6314

Processor 2
    Number of cells = 3089
    Number of points = 6468
    Number of faces shared with processor 0 = 118
    Number of faces shared with processor 3 = 29
    Number of processor patches = 2
    Number of processor faces = 147
    Number of boundary faces = 6319

Processor 3
    Number of cells = 3023
    Number of points = 6322
    Number of faces shared with processor 1 = 109
    Number of faces shared with processor 2 = 29
    Number of processor patches = 2
    Number of processor faces = 138
    Number of boundary faces = 6182

Number of processor faces = 285
Max number of cells = 3089 (1.07157�ove average 3056.25)
Max number of processor patches = 2 (0�ove average 2)
Max number of faces between processors = 147 (3.15789�ove average 142.5)

Time = 0

Processor 0: field transfer
Processor 1: field transfer
Processor 2: field transfer
Processor 3: field transfer

End

Paraview:

scotch:

Here, the results of the scotch decomposer is as follows:

/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2306                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _fbf00d6b-20230626 OPENFOAM=2306 version=2306
Arch   : "LSB;label=32;scalar=64"
Exec   : decomposePar
Date   : Oct 11 2023
Time   : 22:06:00
Host   : pavan-VirtualBox
PID    : 6979
I/O    : uncollated
Case   : /home/pavan/OpenFOAM/pavan-v2306/run/my_tut/simpleFoam/pitzDaily
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time



Decomposing mesh

Create mesh

Calculating distribution of cells
Decomposition method scotch [4] (region region0)

Finished decomposition in 0.02 s

Calculating original mesh data

Distributing cells to processors

Distributing faces to processors

Distributing points to processors

Constructing processor meshes

Processor 0
    Number of cells = 3048
    Number of points = 6336
    Number of faces shared with processor 1 = 57
    Number of processor patches = 1
    Number of processor faces = 57
    Number of boundary faces = 6277

Processor 1
    Number of cells = 3064
    Number of points = 6352
    Number of faces shared with processor 0 = 57
    Number of faces shared with processor 3 = 59
    Number of processor patches = 2
    Number of processor faces = 116
    Number of boundary faces = 6234

Processor 2
    Number of cells = 3078
    Number of points = 6380
    Number of faces shared with processor 3 = 57
    Number of processor patches = 1
    Number of processor faces = 57
    Number of boundary faces = 6321

Processor 3
    Number of cells = 3035
    Number of points = 6296
    Number of faces shared with processor 1 = 59
    Number of faces shared with processor 2 = 57
    Number of processor patches = 2
    Number of processor faces = 116
    Number of boundary faces = 6178

Number of processor faces = 173
Max number of cells = 3078 (0.711656�ove average 3056.25)
Max number of processor patches = 2 (33.3333�ove average 1.5)
Max number of faces between processors = 116 (34.104�ove average 86.5)

Time = 0

Processor 0: field transfer
Processor 1: field transfer
Processor 2: field transfer
Processor 3: field transfer

End

Paraview:

hierarchical:

Here, the results of the hierarchical decomposer is as follows:

/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2306                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _fbf00d6b-20230626 OPENFOAM=2306 version=2306
Arch   : "LSB;label=32;scalar=64"
Exec   : decomposePar
Date   : Oct 11 2023
Time   : 22:43:54
Host   : pavan-VirtualBox
PID    : 5145
I/O    : uncollated
Case   : /home/pavan/OpenFOAM/pavan-v2306/run/my_tut/simpleFoam/pitzDaily
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time



Decomposing mesh

Create mesh

Calculating distribution of cells
Decomposition method hierarchical [4] (region region0)

Finished decomposition in 0.01 s

Calculating original mesh data

Distributing cells to processors

Distributing faces to processors

Distributing points to processors

Constructing processor meshes

Processor 0
    Number of cells = 3056
    Number of points = 6408
    Number of faces shared with processor 1 = 29
    Number of faces shared with processor 2 = 117
    Number of faces shared with processor 3 = 1
    Number of processor patches = 3
    Number of processor faces = 147
    Number of boundary faces = 6259

Processor 1
    Number of cells = 3056
    Number of points = 6388
    Number of faces shared with processor 0 = 29
    Number of faces shared with processor 3 = 109
    Number of processor patches = 2
    Number of processor faces = 138
    Number of boundary faces = 6248

Processor 2
    Number of cells = 3056
    Number of points = 6400
    Number of faces shared with processor 0 = 117
    Number of faces shared with processor 3 = 28
    Number of processor patches = 2
    Number of processor faces = 145
    Number of boundary faces = 6253

Processor 3
    Number of cells = 3057
    Number of points = 6390
    Number of faces shared with processor 0 = 1
    Number of faces shared with processor 1 = 109
    Number of faces shared with processor 2 = 28
    Number of processor patches = 3
    Number of processor faces = 138
    Number of boundary faces = 6250

Number of processor faces = 284
Max number of cells = 3057 (0.0245399�ove average 3056.25)
Max number of processor patches = 3 (20�ove average 2.5)
Max number of faces between processors = 147 (3.52113�ove average 142)

Time = 0

Processor 0: field transfer
Processor 1: field transfer
Processor 2: field transfer
Processor 3: field transfer

End
 

Paraview:

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.