Example #1
0
int main()
{
	Grid *g;
	ALLOC_1D(g, 1, Grid); // allocate memory for Grid
	gridInit(g); // initialize the grid
	ezIncInit(g);
	snapshotInit2d(g); // initialize snapshots

	/* do time stepping */
	for (Time = 0; Time < MaxTime; Time++) {
		updateH2d(g); // update magnetic field
		updateE2d(g); // update electric field
		Ez(SizeX / 2, SizeY / 2) = ezInc(Time, 0.0); // add a source
		snapshot2d(g); // take a snapshot (if appropriate)
	} // end of time-stepping
	
	return 0;

}
Example #2
0
int main()
{
	Grid *g;

	g = (Grid *)calloc(1, sizeof(Grid));
	gridInit(g);	// initialize 2D grid

	abcInit(g);	// initialize ABC
	tfsfInit(g);	// initialize TFSF boundary
	snapshotInit2d(g);	// initialize snapshots

	/* do time stepping */
	for (Time = 0; Time < MaxTime; Time++) {
		updateH2d(g);	// update magnetic fields
		tfsfUpdate(g);	// apply TFSF boundary
		updateE2d(g);	// update electric fields
		abc(g);	// apply ABC
		snapshot2d(g);	// take a snapshot (if appropriate)
	} // end of time-stepping

	return 0;
}