Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66712958
main.cpp
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
Wed, Jun 12, 13:50
Size
1 KB
Mime Type
text/x-c
Expires
Fri, Jun 14, 13:50 (2 d)
Engine
blob
Format
Raw Data
Handle
18265396
Attached To
rTSUNAMIPROJECT PHPC-TSUNAMI-PROJECT
main.cpp
View Options
#include <iostream>
#include <sstream>
#include <mpi.h>
#include "simulation.h"
// Define the constants
#define G 127267.200000000
// Gravity, 9.82*(3.6)^2*1000 in [km / hr^2]
#define SIZE 500
// Size of map, Size*Size [km]
#define NX 2001
// Number of cells in each direction on the grid
#define TEND 0.20
// Simulation time in hours [hr]
#define DIR "../MatlabSource/"
#define OUTPUT "../MatlabSource/OUT.bin"
int
main
(
int
argc
,
char
*
argv
[])
{
// initialize MPI
MPI_Init
(
&
argc
,
&
argv
);
int
prank
,
psize
;
// Usefull to debug
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
prank
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
psize
);
printf
(
"I’m process %d out of %d
\n
"
,
prank
+
1
,
psize
);
// compute the constant
double
DX
=
SIZE
*
1.0
/
NX
;
//std::cout << G << " " << SIZE << " " << NX << " " << TEND << " dx: "<< DX << std::endl;
// Construct the simulation
Simulation
simu
(
NX
,
G
,
SIZE
,
TEND
,
DX
,
DIR
,
OUTPUT
,
MPI_COMM_WORLD
);
// Compute the simulation
float
totalTime
;
int
k
;
std
::
tie
(
totalTime
,
k
)
=
simu
.
compute
();
std
::
cout
<<
"Total time : "
<<
totalTime
<<
" Number of steps : "
<<
k
<<
std
::
endl
;
// Close MPI
MPI_Finalize
();
}
Event Timeline
Log In to Comment