예제 #1
0
def test_diffusion_CrankNicolson3D_ADI_GMRES():
    sim = ppf.Simulation("test")
    sim.init_sim_Diffusion([5, 5, 5],
                           solver="crank-nicolson",
                           gmres=True,
                           adi=True)
    sim.simulate(2)
예제 #2
0
def test_ncomponent_very_small():
    "Tests what happens when the seed exceeds the size of the sim region"
    "Doesnt normally happen, but may for the multiple seeds case when a seed is near the edge, or for a 1d simulation"
    sim = ppf.Simulation("test")
    print("Current directory is: " + os.getcwd())
    sim.init_sim_NComponent([5, 5], tdb_path="./tests/Ni-Cu_Ideal.tdb")
    sim.simulate(2)
예제 #3
0
def test_4_loading_absolute_path():
    sim = ppf.Simulation()
    sim.load_simulation(file_path="save_folder/step_5.npz")
    print(sim.fields[0].data)
    data1 = sim.fields[0].data
    sim.load_simulation(file_path="save_folder/step_10.npz")
    print(sim.fields[0].data)
    #check to see that the saved data files are different for different time steps
    assert (not (sim.fields[0].data[0] == data1[0]))
예제 #4
0
def test_2_loading_step_number():
    sim = ppf.Simulation(save_path="save_folder")
    sim.load_simulation(step=5)
    print(sim.fields[0].data)
    data1 = sim.fields[0].data
    sim.load_simulation(step=10)
    print(sim.fields[0].data)
    #check to see that the saved data files are different for different time steps
    assert (not (sim.fields[0].data[0] == data1[0]))
예제 #5
0
def test_warren1995():
    sim = ppf.Simulation("test")
    sim.init_sim_Warren1995([20, 20])
    sim.simulate(2)
예제 #6
0
def test_diffusion_CrankNicolson2D_GMRES():
    sim = ppf.Simulation("test")
    sim.init_sim_Diffusion([10, 10], solver="crank-nicolson", gmres=True)
    sim.simulate(2)
예제 #7
0
def test_diffusion_default2dexplicit():
    sim = ppf.Simulation("test")
    sim.init_sim_Diffusion([10, 10])
    sim.simulate(2)
예제 #8
0
def test_diffusion_CrankNicolson1D():
    sim = ppf.Simulation("test")
    sim.init_sim_Diffusion([10], solver="crank-nicolson")
    sim.simulate(2)
예제 #9
0
def test_diffusion_Implicit3D_ADI_GMRES():
    sim = ppf.Simulation("test")
    sim.init_sim_Diffusion([5, 5, 5], solver="implicit", gmres=True, adi=True)
    sim.simulate(2)
예제 #10
0
def test_diffusion_Implicit3D():
    sim = ppf.Simulation("test")
    sim.init_sim_Diffusion([5, 5, 5], solver="implicit")
    sim.simulate(2)
예제 #11
0
def test_diffusion_Implicit2D_ADI():
    sim = ppf.Simulation("test")
    sim.init_sim_Diffusion([10, 10], solver="implicit", adi=True)
    sim.simulate(2)
예제 #12
0
def test_diffusion_Implicit1D_GMRES():
    sim = ppf.Simulation("test")
    sim.init_sim_Diffusion([10], solver="implicit", gmres=True)
    sim.simulate(2)
예제 #13
0
def test_ncomponent_1d_actual():
    "Tests a 1d sim"
    sim = ppf.Simulation("test")
    print("Current directory is: " + os.getcwd())
    sim.init_sim_NComponent([20], tdb_path="./tests/Ni-Cu_Ideal.tdb")
    sim.simulate(2)
예제 #14
0
def test_ncomponent_1d():
    "Tests a 2d sim, but with one dimension of length 1, equivalent to a 1d simulation"
    sim = ppf.Simulation("test")
    print("Current directory is: " + os.getcwd())
    sim.init_sim_NComponent([20, 1], tdb_path="./tests/Ni-Cu_Ideal.tdb")
    sim.simulate(2)
예제 #15
0
def test_1_saving():
    sim = ppf.Simulation(save_path="save_folder")
    sim.init_sim_Diffusion([10])
    sim._time_steps_per_checkpoint = 5
    sim.simulate(10)
예제 #16
0
import sys
sys.path.insert(0, "../..")
import pyphasefield as ppf

sim = ppf.Simulation("data/diffusion_test")
sim.init_sim_Diffusion([20])
print(sim.fields[0])
sim.simulate(100)
print(sim.fields[0])
예제 #17
0
import sys
sys.path.insert(0, "../..")
import pyphasefield as ppf

sim = ppf.Simulation(save_path="data/warren1995_test")
sim.init_sim_Warren1995([200, 200], diamond_size=10)
print(sim.fields[0])
print(sim.fields[1])
sim.simulate(1000)
print(sim.fields[0])
print(sim.fields[1])
sim.plot_field()
예제 #18
0
import sys
sys.path.insert(0, "../..")
import pyphasefield as ppf

saveloc = input("What folder in data to save under?")
sim = ppf.Simulation(save_path="data/" + saveloc)
conc = float(input("Initial concentration? [0.40831 is recommended!]"))
sim.init_sim_NComponent(dim=[100, 100],
                        sim_type="seed",
                        initial_temperature=1574,
                        initial_concentration_array=[conc])
initial_step = int(input("What step to load from? (-1 = new simulation)"))
if (initial_step == -1):
    sim.save_simulation()
else:
    sim.load_simulation(step=initial_step)
sim._time_steps_per_checkpoint = 200
sim._boundary_conditions_type = ["periodic", "periodic"]

totalsteps = int(input("How many steps to run?"))
progress_bar_steps = int(totalsteps / 20)
for i in range(20):
    sim.simulate(progress_bar_steps)
    print(
        str((i + 1) * progress_bar_steps) + " steps completed out of " +
        str(totalsteps))
sim.simulate(totalsteps - 20 * progress_bar_steps)
print("Completed!")
예제 #19
0
def test_ncomponent():
    "Simple Test of N-Component model, minimum size to avoid seed overstepping bounds"
    sim = ppf.Simulation("test")
    print("Current directory is: " + os.getcwd())
    sim.init_sim_NComponent([10, 10], tdb_path="./tests/Ni-Cu_Ideal.tdb")
    sim.simulate(2)