Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80546044
simulation.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Sep 1, 08:05
Size
2 KB
Mime Type
text/x-c++
Expires
Tue, Sep 3, 08:05 (2 d)
Engine
blob
Format
Raw Data
Handle
20395227
Attached To
rTSUNAMIPROJECT PHPC-TSUNAMI-PROJECT
simulation.h
View Options
//
// Created by Arnaud Pannatier on 06.05.18.
// Based on the code of :
// - Nicolas Richart <nicolas.richart@epfl.ch>
// - Vincent Keller <vincent.keller@epfl.ch>
// - Vittoria Rezzonico <vittoria.rezzonico@epfl.ch>
// See the files AUTHORS and COPYRIGHT for the concerning information
//
#ifndef PHPCTSUNAMIPROJECT_SIMULATION_H
#define PHPCTSUNAMIPROJECT_SIMULATION_H
#include <tuple>
#include <string>
#include <mpi.h>
#include "double_buffer.h"
#include "grid.h"
class Simulation {
public:
Simulation(int NX_,double G_, int SIZE_,double TEND_, double DX_, std::string dir_, std::string output_, MPI_Comm communicator_);
/// Simulation I/O
void readInitialConditionsFromFile();
void writeResultsToFile();
/// perform the simulation
std::tuple<double, int> compute();
inline int x(){ return NX; };
inline int y(){ return NY; };
protected:
/// compute one step, fetch ghost cells and call compute row
void compute_step();
// Sequential computation that compute the next value for the i-est row
void compute_row (int i);
// Compute the next time step
void compute_mu_and_set_dt ();
// Usefull for creating grids of the proper local size
void resizeGrids(int nx, int ny);
private:
/// Global problem size
int NX,NY;
/// Directory of the files where to read the grids and write the results
std::string dir;
/// Output filename
std::string outputFilename;
/// Constant, timesteps and scalar variables useful for the simulation
double G, TEND, DX, dt, T, C;
/// Size of the Grid
int SIZE;
/// Grid that stores the actual data for the height and the velocity of the water
DoubleBuffer H, HV,HU;
/// Topology of the map
Grid Zdx,Zdy;
/// Local problem size
int local_x, local_y;
/// Local problem size without ghost cells
int write_x, write_y;
/// variables for iteration without the ghost cells
int x_start_mu, x_end_mu;
/// local offset
int offset_x, offset_y;
/// local neighbors
int north_prank, south_prank;
/// proc rank
int prank;
/// communicator size
int psize;
/// communicator
MPI_Comm communicator;
};
#endif //PHPCTSUNAMIPROJECT_SIMULATION_H
Event Timeline
Log In to Comment