Skip to content

Solver algorithms

Sunil Anandatheertha edited this page Jun 28, 2021 · 10 revisions

All algorithms are executed inside the main trials loop. Basic structure of PXO is given below.

for trial_count = 1:TOTAL_TRIALS
      Initialization of parameters
      Monte Carlo Solver
      Analyze the grain structure
end

TOTAL_TRIALS defines the total number of repeats to be cariied out. Inside the Monte Carlo Solver, process branches out to different algorithms in a switch case statement. Each algorithm of the Monte Carlo Solver is described below.


Solver algorithm 01, [][][] Solver algorithm 0101

ALG 01 is one of the basic algorithm described in many research papers. Matrix access routes has been optimized for speed. Number of Calculations needed have also been kept at a bare minimum. Performance can be found here. Structure is below.

for ms = start:finalmcs % Number of Monte-Carlo time steps
    for pt = 1:numel(s) % Size of the domain = number of available lattice sites
         Energy minimization attempt will is here (generate a rand(1) for every lattice site (pt))
         Change site orientation if energy reduces
         Record the state variables if necessary
    end
end

Energy minimization attempt generates random number and depending on whther reduces energy or not, the orientation at a site is either updated with the new random orientation or the old is retained. In ALG 01, this is done for every point seperately.

ALG 0101 is ALG 01 with far fewer number of calculations than ALG 01. Basic structure is the same. But, instead of generating a random number for every point inside the inner loop, a matrix of random numbers is generated in every time step.

for ms = start:finalmcs % Number of Monte-Carlo time steps
    Generate a random orientation matrix for the lattice
    for pt = 1:numel(s) % Size of the domain = number of available lattice sites
         Energy minimization attempt will is here (access the previosuly made random matrix at location pt)
         Change site orientation if energy reduces
         Record the state variables if necessary
    end
end

This allows a speed up of almst 40%. More on performance is here. Usually, the 3rd step is commented out to reduce branching and to save time. You may uncomment as and when needed.


Solver algorithm 02, [][][] Solver algorithm 0201, [][][] Solver algorithm 0202


Solver algorithm 03, [][][] Solver algorithm 0301, [][][] Solver algorithm 0302

03 considers transition probability. 301 is 102 with transition probability. So this is faster than 3. 302 considers spatial distribution of transition probabilities. Does not work on rejection sampling, and is a bit slow.


Solver algorithm 04


Solver algorithm 05


Solver algorithm 06


Solver algorithm 07


Solver algorithm 08


Solver algorithm 09


Solver algorithm 10


Solver algorithm 11


Solver algorithm 12


Solver algorithm 13


Solver algorithm 14


Solver algorithm 15


Solver algorithm 16


Solver algorithm 17


Solver algorithm 18


Solver algorithm 19


Solver algorithm 20


Clone this wiki locally