Package org.openpixi.pixi.physics

Examples of org.openpixi.pixi.physics.Settings


* Intended mainly for debugging.
*/
public class SimpleDistSimTest {

  public static void main(String[] args) {
    Settings settings = new Settings();
    settings.setNumOfNodes(2);
    settings.setNumOfThreads(2);
    settings.setGridCellsX(8);
    settings.setGridCellsY(8);
    settings.setSimulationWidth(10 * settings.getGridCellsX());
    settings.setSimulationHeight(10 * settings.getGridCellsY());
    settings.setNumOfParticles(100);
    // If number of iterations is set to 0 we get a simple test
    // of problem distribution and results collection (we must use runAtOnce() method of
    // the EmulatedDistributedEnvironment).
    settings.setIterations(100);

    IplServer.start();
    new EmulatedDistributedEnvironment(settings).runInSteps();
    IplServer.end();
    System.out.println("PASSED ..... simple distributed simulation test");
View Full Code Here


* OpenCL and also sequential simulations and then compares the results.
*/
public class LeapFrogHalfStepTest extends TestCase {

  public void testParallelSimulation() throws FileNotFoundException {
    Settings defaultSettings = new Settings();
    //defaultSettings.setTimeStep(0.1);
    defaultSettings.setGridCellsX(10);
    defaultSettings.setGridCellsY(10);
    defaultSettings.setNumOfParticles(100);
    defaultSettings.setIterations(100);
    defaultSettings.setParticleSolver(new LeapFrogHalfStep());
                defaultSettings.setInterpolator(new ChargeConservingCIC());
                defaultSettings.setOCLParticleSolver("leap frog half step");
                defaultSettings.setOCLGridInterpolator("charge conserving CIC");
               
    Simulation sequentialSimulation = new Simulation(defaultSettings);

    Settings openCLSettings = ClassCopier.copy(defaultSettings);
    Simulation openCLSimulation = new Simulation(openCLSettings);

    sequentialSimulation.run();
    openCLSimulation.run();

View Full Code Here

* OpenCL and also sequential simulations and then compares the results.
*/
public class BorisDampedTest extends TestCase {

  public void testParallelSimulation() throws FileNotFoundException {
    Settings defaultSettings = new Settings();
    //defaultSettings.setTimeStep(0.1);
    defaultSettings.setGridCellsX(10);
    defaultSettings.setGridCellsY(10);
    defaultSettings.setNumOfParticles(100);
    defaultSettings.setIterations(100);
    defaultSettings.setParticleSolver(new BorisDamped());
                defaultSettings.setInterpolator(new ChargeConservingCIC());
                defaultSettings.setOCLParticleSolver("boris damped");
                defaultSettings.setOCLGridInterpolator("charge conserving CIC");
               
    Simulation sequentialSimulation = new Simulation(defaultSettings);

    Settings openCLSettings = ClassCopier.copy(defaultSettings);
    Simulation openCLSimulation = new Simulation(openCLSettings);

    sequentialSimulation.run();
    openCLSimulation.run();

View Full Code Here

* OpenCL and also sequential simulations and then compares the results.
*/
public class EulerRichardsonTest extends TestCase {

  public void testParallelSimulation() throws FileNotFoundException {
    Settings defaultSettings = new Settings();
    //defaultSettings.setTimeStep(0.1);
    defaultSettings.setGridCellsX(10);
    defaultSettings.setGridCellsY(10);
    defaultSettings.setNumOfParticles(100);
    defaultSettings.setIterations(100);
    defaultSettings.setParticleSolver(new EulerRichardson());
                defaultSettings.setInterpolator(new ChargeConservingCIC());
                defaultSettings.setOCLParticleSolver("euler richardson");
                defaultSettings.setOCLGridInterpolator("charge conserving CIC");
               
    Simulation sequentialSimulation = new Simulation(defaultSettings);

    Settings openCLSettings = ClassCopier.copy(defaultSettings);
    Simulation openCLSimulation = new Simulation(openCLSettings);

    sequentialSimulation.run();
    openCLSimulation.run();

View Full Code Here

* Tests the class copier.
*/
public class ClassCopierTest extends TestCase {

  public void testCopy() throws Exception {
    Settings settings = new Settings();
    settings.setGridCellsX(14);

    Settings settings2 = ClassCopier.copy(settings);

    assertEquals(settings.getGridCellsX(), settings2.getGridCellsX());
    assertEquals(settings.getInterpolator(), settings2.getInterpolator());
  }
View Full Code Here

* OpenCL and also sequential simulations and then compares the results.
*/
public class CloudInCellTest extends TestCase {

  public void testParallelSimulation() throws FileNotFoundException {
    Settings defaultSettings = new Settings();
    //defaultSettings.setTimeStep(0.1);
    defaultSettings.setGridCellsX(10);
    defaultSettings.setGridCellsY(10);
    defaultSettings.setNumOfParticles(100);
    defaultSettings.setIterations(100);
    defaultSettings.setParticleSolver(new Boris());
                defaultSettings.setInterpolator(new CloudInCell());
                defaultSettings.setOCLParticleSolver("boris");
                defaultSettings.setOCLGridInterpolator("cloud in cell");
               
    Simulation sequentialSimulation = new Simulation(defaultSettings);

    Settings openCLSettings = ClassCopier.copy(defaultSettings);
    Simulation openCLSimulation = new Simulation(openCLSettings);

    sequentialSimulation.run();
    openCLSimulation.run();

View Full Code Here

* OpenCL and also sequential simulations and then compares the results.
*/
public class BorisTest extends TestCase {

  public void testParallelSimulation() throws FileNotFoundException {
    Settings defaultSettings = new Settings();
    //defaultSettings.setTimeStep(0.1);
    defaultSettings.setGridCellsX(10);
    defaultSettings.setGridCellsY(10);
    defaultSettings.setNumOfParticles(100);
    defaultSettings.setIterations(100);
    defaultSettings.setParticleSolver(new Boris());
                defaultSettings.setInterpolator(new ChargeConservingCIC());
                defaultSettings.setOCLParticleSolver("boris");
                defaultSettings.setOCLGridInterpolator("charge conserving CIC");
               
    Simulation sequentialSimulation = new Simulation(defaultSettings);

    Settings openCLSettings = ClassCopier.copy(defaultSettings);
    Simulation openCLSimulation = new Simulation(openCLSettings);

    sequentialSimulation.run();
    openCLSimulation.run();

View Full Code Here

* OpenCL and also sequential simulations and then compares the results.
*/
public class SemiImplicitEulerTest extends TestCase {

  public void testParallelSimulation() throws FileNotFoundException {
    Settings defaultSettings = new Settings();
    //defaultSettings.setTimeStep(0.1);
    defaultSettings.setGridCellsX(10);
    defaultSettings.setGridCellsY(10);
    defaultSettings.setNumOfParticles(100);
    defaultSettings.setIterations(100);
    defaultSettings.setParticleSolver(new SemiImplicitEuler());
                defaultSettings.setInterpolator(new ChargeConservingCIC());
                defaultSettings.setOCLParticleSolver("semiimplicit euler");
                defaultSettings.setOCLGridInterpolator("charge conserving CIC");
               
    Simulation sequentialSimulation = new Simulation(defaultSettings);

    Settings openCLSettings = ClassCopier.copy(defaultSettings);
    Simulation openCLSimulation = new Simulation(openCLSettings);

    sequentialSimulation.run();
    openCLSimulation.run();

View Full Code Here

   */
  public static void main(String[] args) throws FileNotFoundException, IOException, InterruptedException {
    Debug.checkAssertsEnabled();

    // Creates a settings class with the default parameters
    Settings settings = new Settings();

    // Checks if the user has specified at least one parameter.
    // If so creates a parser and uses the parameter as the
    // path to the settings file.
    if (args.length != 0) {
      Parser parser = new Parser(settings);
      parser.parse(args[0]);
    }

    // Reads out the settings that are needed for this UI.
    // This must be placed after the parsing process.
    iterations = settings.getIterations();
    runid = settings.getRunid();

    if (settings.getSimulationType() == 0) {
      // Creates the actual physics simulation that can be run iteratively.
      simulation = new Simulation(settings);
      // Creates the diagnostics wrapper class that knows about all
      // enabled diagnostic methods.
      diagnostics = new DiagnosticsScheduler(simulation.grid, simulation.particles, settings);

      // Checks if the user has specified at least two parameters
      // If this is not the case, the diagnostics output is disabled
      // the program will not output anything.
      if (args.length < 2) {
        dataOutput = new EmptyDataOutput();
      } else {
        // The program expects a directory (to which the output files will be saved) as its
        // second parameter. This checks if the directory is specified correctly. Tries to
        // fix it if not.
        if (args[1].substring(args[1].length() - 1) != System.getProperty("file.separator")) {
          args[1] = args[1] + System.getProperty("file.separator");
        }

        // Tries to create the output objects. If something is wrong with the specified
        // directory the program will give an error and terminate.
        try {
          dataOutput = new DataOutput(args[1], runid, simulation.grid);
        } catch (IOException e) {
          System.err.print("Something went wrong when creating output files for diagnostics! \n"
              + "Please specify an output directory with write access rights!\n"
              + "The directory that you specified was " + args[1] + "\n"
              + "Aborting...");
          return;
        }
      }

      //Performs diagnostics on the initial state of the simulation
      dataOutput.setIteration(0);
      diagnostics.performDiagnostics(0);
      diagnostics.output(dataOutput);

      for (int i = 0; i < iterations;) {
        // advance the simulation by one step
        simulation.step();

        i++;

        dataOutput.setIteration(i);
        diagnostics.performDiagnostics(i);
        diagnostics.output(dataOutput);
      }

      dataOutput.closeStreams();

      if (settings.getWriteToFile() == 1) {
        simulation.writeToFile();
      }

      ProfileInfo.printProfileInfo();

View Full Code Here

* OpenCL and also sequential simulations and then compares the results.
*/
public class LeapFrogTest extends TestCase {

  public void testParallelSimulation() throws FileNotFoundException {
    Settings defaultSettings = new Settings();
    //defaultSettings.setTimeStep(0.1);
    defaultSettings.setGridCellsX(10);
    defaultSettings.setGridCellsY(10);
    defaultSettings.setNumOfParticles(100);
    defaultSettings.setIterations(100);
    defaultSettings.setParticleSolver(new LeapFrog());
                defaultSettings.setInterpolator(new ChargeConservingCIC());
                defaultSettings.setOCLParticleSolver("leap frog");
                defaultSettings.setOCLGridInterpolator("charge conserving CIC");
               
    Simulation sequentialSimulation = new Simulation(defaultSettings);

    Settings openCLSettings = ClassCopier.copy(defaultSettings);
    Simulation openCLSimulation = new Simulation(openCLSettings);

    sequentialSimulation.run();
    openCLSimulation.run();

View Full Code Here

TOP

Related Classes of org.openpixi.pixi.physics.Settings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.