Skip to content

Percolation simulation of a N sized network with multi-threading in C++

Notifications You must be signed in to change notification settings

Val-Resh/Percolation-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Percolation Simulation

This program focuses on percolation theory. In simple terms, it is the finding of the point at which random network is fully connected. For greater detail on the theory, you can check the wikipedia links:
https://en.wikipedia.org/wiki/Percolation_theory
https://en.wikipedia.org/wiki/Percolation_threshold

Running Simulation

PercolationTest.sln contains the file structure required to build the project in Visual Studio. However, you can also use a preferred compiler instead.

The command to run depends on the OS you use. For windows, it is PercolationTest.exe 100 20
The first value indicates the size of the network. Input 100 generates a network of 10_000 nodes.
The second value is for the number of trials to run. Input 20 indicates that 20 simulations will be run before results are calculated.

Here's an example of the results after running the program.
results

Model

Percolation theory is applied in practice in various fields. For example, given a composite systems comprised of randomly distributed insulating and metallic materials: what fraction of the materials need to be metallic so that the composite system is an electrical conductor?
However, this program uses an abstract model, rather than a specific one. Yet, it could be interpreted as per requirements.

This is a model example:
model_example
The white/blue cells are open sites. The blue cells are the ones connected to the top. Percolation occurs when the top site connects to the bottom.

Calculation

To estimate the percolation threshold = Os/S where Os is the open sites and S is the total size.
Multiple threads are used to run various simulations at the same time concurrently.
Then mean is calculated as mean where T is the number of trials/simulations ran.
The standard deviation is calculated as deviation where Xi is the result of each simulation, the is the mean value and the T is the number of simulations. Finally, the 95% confidence interval is calculated as confidence where z is a constant value of 1.96, s is the standard deviation, and T the total size of simulations and the mean value.
For accuracy, at least 50 simulations are required to be run.

About

Percolation simulation of a N sized network with multi-threading in C++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages