Examples of ParticleFull


Examples of org.openpixi.pixi.physics.particles.ParticleFull

    Settings stt = GridTestCommon.getCommonSettings();
    stt.setInterpolator(new CloudInCell());
    stt.setGridSolver(new SimpleSolver());

    // Add single particle
    Particle p = new ParticleFull();
    p.setX(x1);
    p.setY(y1);
    p.setVx((x2 - x1) / stt.getTimeStep());
    p.setVy((y2 - y1) / stt.getTimeStep());
    p.setMass(1);
    p.setCharge(charge);
    stt.addParticle(p);

    Simulation s = new Simulation(stt);
    s.prepareAllParticles();

    // The simulation always creates its own copy of particles
    // (in fact the setting class does so)
    // and we would like to obtain the reference to our initial particle p.
    p = s.particles.get(0);

    // Advance particle
    s.particlePush();

    //Remember old values after boundary check
    double sx = p.getPrevX();
    double sy = p.getPrevY();

    // Calculate current
    s.getInterpolation().interpolateToGrid(s.particles, s.grid, s.tstep);

    double jx = GridTestCommon.getJxSum(s.grid);
    double jy = GridTestCommon.getJySum(s.grid);

    if (VERBOSE) System.out.println("Total current " + text + ": jx = " + jx + ", jy = " + jy
        + " (from " + sx + ", " + sy + " to " + p.getX() + ", " + p.getY() + ")");

    GridTestCommon.checkSignJx(s.grid);
    GridTestCommon.checkSignJy(s.grid);

//    This is what ChargeConservingAreaWeightningTest test for (current during timestep)
//    assertAlmostEquals(text + ", jx", charge * (p.x - sx), jx, ACCURACY_LIMIT);
//    assertAlmostEquals(text + ", jy", charge * (p.y - sy), jy, ACCURACY_LIMIT);
//    This is what is appropriate for CIC: momentary current
    assertAlmostEquals(text + ", jx", charge * p.getVx(), jx, ACCURACY_LIMIT);
    assertAlmostEquals(text + ", jy", charge * p.getVy(), jy, ACCURACY_LIMIT);
  }
View Full Code Here

Examples of org.openpixi.pixi.physics.particles.ParticleFull

    Settings stt = GridTestCommon.getCommonSettings();
    stt.setInterpolator(new CloudInCell());
    stt.setGridSolver(new SimpleSolver());

    // Add single particle
    Particle p = new ParticleFull();
    p.setX(x1);
    p.setY(y1);
    p.setVx(vx);
    p.setVy(vy);
    p.setMass(1);
    p.setCharge(charge);
    stt.addParticle(p);

    ConstantForce force = new ConstantForce();
    force.ex = ex;
    force.bz = bz;
    stt.addForce(force);

    Simulation s = new Simulation(stt);
    s.prepareAllParticles();

    // Advance particle
    s.particlePush();

    // The simulation always creates its own copy of particles
    // (in fact the setting class does so)
    // and we would like to obtain the reference to our initial particle p.
    p = s.particles.get(0);

    //Remember old values after boundary check
    double sx = p.getPrevX();
    double sy = p.getPrevY();

    // Calculate current
    s.getInterpolation().interpolateToGrid(s.particles, s.grid, s.tstep);

    double jx = GridTestCommon.getJxSum(s.grid);
    double jy = GridTestCommon.getJySum(s.grid);

    if (VERBOSE) System.out.println("Total current " + text + ": jx = " + jx + ", jy = " + jy
        + " (from " + sx + ", " + sy + " to " + p.getX() + ", " + p.getY() + ")");

    GridTestCommon.checkSignJx(s.grid);
    GridTestCommon.checkSignJy(s.grid);

//    This is what ChargeConservingAreaWeightningTest test for (current during timestep)
//    assertAlmostEquals(text + ", jx", charge * (p.x - sx), jx, ACCURACY_LIMIT);
//    assertAlmostEquals(text + ", jy", charge * (p.y - sy), jy, ACCURACY_LIMIT);
//    This is what is appropriate for CIC: momentary current
    assertAlmostEquals(text + ", jx", charge * p.getVx(), jx, ACCURACY_LIMIT);
    assertAlmostEquals(text + ", jy", charge * p.getVy(), jy, ACCURACY_LIMIT);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.