Week 4 Challenge- Compiling C++ libraries
Week 4 Challenge : Compiling C++ libraries
In this challenge, we will copy a specified folder from the library into our run folder and use wmake to compile the shared library associated with this. We will also write detailed explanations on the following decomposition algorithms
Decomposition of mesh and flow field data
To decompose the mesh and flow field, we use decomposePar utility.We divide the flow field and give it to different processors. The aim is to break up the domain with minimal effort but in such a way to guarantee an economic solution. The geometry and flowfield is broken according to set of commands specified in a dictionary found in decomposeParDict that is located in the aerofoil of tutorial folder(we used it).
There are four methods of decomposition as specified by the method keyword
- simple-Simple geometrical decomposition in which the domain is split into pieces by direction. Here (2,2,1) means 2 pieces in x and y direction each and 1 piece in z direction.
- Hierarchical-This type of geometrical decomposition is similar to simple except the user specifies the order in which the directional split is done. For instance, first in the y-direction, then the x-direction and so on.
- scotch-This type of geometrical decomposition requires no geometric input from the user and attempts to minimise the number of processor boundaries. The user can specify a weighting for the decomposition between processors, through an optional processorWeights keyword that can be useful on machines with different performance between each processor. There is also an optional keyword entry strategy that controls the decomposition strategy through a complex string supplied to scotch.
- manual-This decomposition is where the user directly specifies the allocation of each cell to a particular processor.

- In the above, numberOfSubdomains and method are compulsory entries where the former represent the total number of subdomains and the latter represent the method of decomposition
- The values specified aside with n represent total number of subdomains in x,y,z directions.
- Note that numberOfSubdomains must equal the product of the numbers inside the bracket.
To visualize this, in each folder after execution of decomposePar command,
Hierarchical


Video1: Demonstrating effect of hierarchical decomposition
Simple

Video2: Demonstrating effect of simple decomposition
Scotch

While specifying scotch as the method, make sure to leave out the scotchcoeffs as blank with a pair of braces.

Video3: Demonstrating the effect of scotch decomposition
Inferences
- From the above videos, we can conclude that scotch provides a better decomposition as compared to the other two techniques.
- Simple method provided the craziest of decomposition.
- The hierarchy of precedence of choosing the method shall be: manual>scotch>hierarchical>simple
Copying solver from lagrangian library and compiling

Steps followed
- Go to solvers folder by typing cd $FOAM_SOLVERS.
- Check out for the DPMFoam solver.
- Go to run folder and type cp -r $FOAM_SOLVERS/lagrangian/DPMFoam DPMFOAM.
- This will copy the contents to a new folder DPMFOAM in the run folder.
- Next, go to Make/files and edit the EXE to $(FOAM_USER_APPBIN)/DPMFOAM
- Note that DPMFOAM is the renamed solver.
- Once done, type wmake.
- To check whether wmake has compiled the libraries, go to cd $FOAM_USER_APPBIN
- If you see DPMFOAM there, then wmake has been compiled perfectly.