Esempio n. 1
0
void Godunov::MultiPhase(const double & CFL, unsigned phase) {
	double t = 0;
	Cell leftCell;
	Cell rightCell;
	bool phaseInteraction;
	while (t < getMax()) {
		BoundaryConditions();
		for (unsigned i = 0; i < getCell().size(); ++i) {
            phaseInteraction = false;
			leftCell = getCell()[i % getCell().size()];
			rightCell = getCell()[(i + 1) % getCell().size()];
			if (i == getCell().size() - 2)
				continue;
			for (unsigned j = 0; j < phase; ++j)
				if (leftCell.getPhase()[j].getPhi()
						!= rightCell.getPhase()[j].getPhi()) {
					phaseInteraction = true;
					break;
				}
			if (!phaseInteraction) {
				for (unsigned j = 0; j < phase; ++j)
					detachedRiemann(leftCell, rightCell, i, j);
			}
		}
		computeDT(CFL);
		timeIntegration();
		for (unsigned i = 0; i < getCell().size(); ++i) {
			setCell()[i].computeScalFromCons();
		}
		t += getDt();
	}
}
void ParticleSystemSolver2::onAdvanceTimeStep(double timeStepInSeconds) {
    beginAdvanceTimeStep(timeStepInSeconds);

    Timer timer;
    accumulateForces(timeStepInSeconds);
    JET_INFO << "Accumulating forces took "
             << timer.durationInSeconds() << " seconds";

    timer.reset();
    timeIntegration(timeStepInSeconds);
    JET_INFO << "Time integration took "
             << timer.durationInSeconds() << " seconds";

    timer.reset();
    resolveCollision();
    JET_INFO << "Resolving collision took "
             << timer.durationInSeconds() << " seconds";

    endAdvanceTimeStep(timeStepInSeconds);
}
Esempio n. 3
0
void Godunov::SinglePhase(const double & CFL) {
	double t = 0;
	while (t < getMax()) {
		BoundaryConditions();
		for (unsigned i = 0; i < getCell().size(); ++i) {
			if (i == getCell().size() - 2)
				continue;
			RiemannSolver riemann(getCell()[i % getCell().size()],
					getCell()[(i + 1) % getCell().size()], 1);
			riemann.solve();
			riemann.phase_star_[0].Sample(0, setCell()[i].setPhase()[0].setU_half(),
					setCell()[i].setPhase()[0].setP_half(),
					setCell()[i].setPhase()[0].setD_half(), riemann.phase_star_[0].pstar[0]
                                                          , riemann.phase_star_[0].ustar[0]);
			setCell()[i].setPhase()[0].InterCellFlux();
		}
		computeDT(CFL);
		timeIntegration();
		for (unsigned i = 0; i < getCell().size(); ++i) {
			setCell()[i].setPhase()[0].computeScalFromCons();
		}
		t += getDt();
	}
}