2015-06-29 23:05:26 -04:00
|
|
|
/* ScaLBL.h
|
|
|
|
|
* Header file for Scalable Lattice Boltzmann Library
|
2015-06-30 11:33:27 -04:00
|
|
|
* Separate implementations for GPU and CPU must both follow the conventions defined in this header
|
|
|
|
|
* This libarry contains the essential components of the LBM
|
2015-06-29 23:05:26 -04:00
|
|
|
* - streaming implementations
|
2015-06-30 11:44:03 -04:00
|
|
|
* - collision terms to model various physics
|
2015-06-29 23:05:26 -04:00
|
|
|
* - communication framework for the LBM
|
2015-06-30 11:33:27 -04:00
|
|
|
* Refer to Domain.h for setup of parallel domains
|
2015-06-29 23:05:26 -04:00
|
|
|
*/
|
2018-03-08 13:03:22 -05:00
|
|
|
#ifndef ScalLBL_H
|
|
|
|
|
#define ScalLBL_H
|
|
|
|
|
#include "common/Domain.h"
|
2015-06-29 23:05:26 -04:00
|
|
|
|
2018-04-14 21:01:16 -04:00
|
|
|
extern "C" int ScaLBL_SetDevice(int rank);
|
2018-04-14 20:33:45 -04:00
|
|
|
|
2016-11-23 16:16:48 -05:00
|
|
|
extern "C" void ScaLBL_AllocateDeviceMemory(void** address, size_t size);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2017-10-01 11:46:22 -04:00
|
|
|
extern "C" void ScaLBL_FreeDeviceMemory(void* pointer);
|
2015-06-30 11:53:15 -04:00
|
|
|
|
2016-11-23 16:16:48 -05:00
|
|
|
extern "C" void ScaLBL_CopyToDevice(void* dest, const void* source, size_t size);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2016-11-23 16:16:48 -05:00
|
|
|
extern "C" void ScaLBL_CopyToHost(void* dest, const void* source, size_t size);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-04-03 20:13:35 -04:00
|
|
|
extern "C" void ScaLBL_AllocateZeroCopy(void** address, size_t size);
|
|
|
|
|
|
|
|
|
|
extern "C" void ScaLBL_CopyToZeroCopy(void* dest, const void* source, size_t size);
|
|
|
|
|
|
2016-11-23 16:16:48 -05:00
|
|
|
extern "C" void ScaLBL_DeviceBarrier();
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2016-11-23 16:16:48 -05:00
|
|
|
extern "C" void ScaLBL_D3Q19_Pack(int q, int *list, int start, int count, double *sendbuf, double *dist, int N);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2017-10-01 11:46:22 -04:00
|
|
|
extern "C" void ScaLBL_D3Q19_Unpack(int q, int *list, int start, int count, double *recvbuf, double *dist, int N);
|
2018-01-24 10:05:48 -05:00
|
|
|
|
|
|
|
|
extern "C" void ScaLBL_D3Q7_Unpack(int q, int *list, int start, int count, double *recvbuf, double *dist, int N);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2016-11-23 16:16:48 -05:00
|
|
|
extern "C" void ScaLBL_Scalar_Pack(int *list, int count, double *sendbuf, double *Data, int N);
|
2015-06-30 11:49:06 -04:00
|
|
|
|
2016-11-23 16:16:48 -05:00
|
|
|
extern "C" void ScaLBL_Scalar_Unpack(int *list, int count, double *recvbuf, double *Data, int N);
|
2015-06-30 11:49:06 -04:00
|
|
|
|
2016-11-23 16:16:48 -05:00
|
|
|
extern "C" void ScaLBL_PackDenD3Q7(int *list, int count, double *sendbuf, int number, double *Data, int N);
|
2015-06-30 11:49:06 -04:00
|
|
|
|
2016-11-23 16:16:48 -05:00
|
|
|
extern "C" void ScaLBL_UnpackDenD3Q7(int *list, int count, double *recvbuf, int number, double *Data, int N);
|
2015-06-30 11:49:06 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_D3Q19_Init(double *Dist, int Np);
|
|
|
|
|
|
|
|
|
|
extern "C" void ScaLBL_D3Q19_Momentum(double *dist, double *vel, int Np);
|
2015-06-30 11:49:06 -04:00
|
|
|
|
2018-01-26 10:19:37 -05:00
|
|
|
extern "C" void ScaLBL_D3Q19_Pressure(double *dist, double *press, int Np);
|
2015-06-30 11:49:06 -04:00
|
|
|
|
2018-03-29 22:54:36 -04:00
|
|
|
// BGK MODEL
|
|
|
|
|
extern "C" void ScaLBL_D3Q19_AAeven_BGK(double *dist, int start, int finish, int Np, double rlx, double Fx, double Fy, double Fz);
|
|
|
|
|
|
|
|
|
|
extern "C" void ScaLBL_D3Q19_AAodd_BGK(int *neighborList, double *dist, int start, int finish, int Np, double rlx, double Fx, double Fy, double Fz);
|
|
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
// MRT MODEL
|
|
|
|
|
extern "C" void ScaLBL_D3Q19_AAeven_MRT(double *dist, int start, int finish, int Np, double rlx_setA, double rlx_setB, double Fx,
|
|
|
|
|
double Fy, double Fz);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_D3Q19_AAodd_MRT(int *d_neighborList, double *dist, int start, int finish, int Np,
|
|
|
|
|
double rlx_setA, double rlx_setB, double Fx, double Fy, double Fz);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
// COLOR MODEL
|
2017-10-01 11:46:22 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_D3Q19_AAeven_Color(int *Map, double *dist, double *Aq, double *Bq, double *Den, double *Phi,
|
|
|
|
|
double *Vel, double rhoA, double rhoB, double tauA, double tauB, double alpha, double beta,
|
|
|
|
|
double Fx, double Fy, double Fz, int strideY, int strideZ, int start, int finish, int Np);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_D3Q19_AAodd_Color(int *d_neighborList, int *Map, double *dist, double *Aq, double *Bq, double *Den,
|
|
|
|
|
double *Phi, double *Vel, double rhoA, double rhoB, double tauA, double tauB, double alpha, double beta,
|
|
|
|
|
double Fx, double Fy, double Fz, int strideY, int strideZ, int start, int finish, int Np);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_D3Q7_AAodd_PhaseField(int *NeighborList, int *Map, double *Aq, double *Bq,
|
|
|
|
|
double *Den, double *Phi, int start, int finish, int Np);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_D3Q7_AAeven_PhaseField(int *Map, double *Aq, double *Bq, double *Den, double *Phi,
|
|
|
|
|
int start, int finish, int Np);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_D3Q19_Gradient(int *Map, double *Phi, double *ColorGrad, int start, int finish, int Np, int Nx, int Ny, int Nz);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_PhaseField_Init(int *Map, double *Phi, double *Den, double *Aq, double *Bq, int Np);
|
2017-10-01 11:46:22 -04:00
|
|
|
|
2018-04-24 17:05:46 -04:00
|
|
|
// Density functional hydrodynamics LBM
|
|
|
|
|
extern "C" void ScaLBL_D3Q19_AAeven_DFH(int *neighborList, double *dist, double *Aq, double *Bq, double *Den, double *Phi,
|
|
|
|
|
double *SolidPotential, double rhoA, double rhoB, double tauA, double tauB, double alpha, double beta,
|
|
|
|
|
double Fx, double Fy, double Fz, int start, int finish, int Np);
|
|
|
|
|
|
|
|
|
|
extern "C" void ScaLBL_D3Q19_AAodd_DFH(int *neighborList, double *dist, double *Aq, double *Bq, double *Den,
|
|
|
|
|
double *Phi, double *SolidPotential, double rhoA, double rhoB, double tauA, double tauB, double alpha, double beta,
|
|
|
|
|
double Fx, double Fy, double Fz, int start, int finish, int Np);
|
|
|
|
|
|
|
|
|
|
extern "C" void ScaLBL_D3Q7_AAodd_DFH(int *NeighborList, double *Aq, double *Bq, double *Den, double *Phi, int start, int finish, int Np);
|
|
|
|
|
|
|
|
|
|
extern "C" void ScaLBL_D3Q7_AAeven_DFH(double *Aq, double *Bq, double *Den, double *Phi, int start, int finish, int Np);
|
2017-10-01 11:46:22 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
// BOUNDARY CONDITION ROUTINES
|
2017-10-01 11:46:22 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
//extern "C" void ScaLBL_D3Q19_Pressure_BC_z(double *disteven, double *distodd, double din,
|
|
|
|
|
// int Nx, int Ny, int Nz);
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_Pressure_BC_Z(double *disteven, double *distodd, double dout,
|
|
|
|
|
// int Nx, int Ny, int Nz, int outlet);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_D3Q19_AAodd_Pressure_BC_z(int *neighborList, int *list, double *dist, double din, int count, int Np);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_D3Q19_AAodd_Pressure_BC_Z(int *neighborList, int *list, double *dist, double dout, int count, int Np);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_D3Q19_AAeven_Pressure_BC_z(int *list, double *dist, double din, int count, int Np);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_D3Q19_AAeven_Pressure_BC_Z(int *list, double *dist, double dout, int count, int Np);
|
2017-02-15 16:38:44 -05:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" double ScaLBL_D3Q19_AAodd_Flux_BC_z(int *neighborList, int *list, double *dist, double flux,
|
|
|
|
|
double area, int count, int N);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" double ScaLBL_D3Q19_AAeven_Flux_BC_z(int *list, double *dist, double flux, double area,
|
|
|
|
|
int count, int N);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-03-19 11:16:05 -04:00
|
|
|
//extern "C" void ScaLBL_Color_BC(int *list, int *Map, double *Phi, double *Den, double vA, double vB, int count, int Np);
|
|
|
|
|
|
|
|
|
|
extern "C" void ScaLBL_Color_BC_z(int *list, int *Map, double *Phi, double *Den, double vA, double vB, int count, int Np);
|
|
|
|
|
|
|
|
|
|
extern "C" void ScaLBL_Color_BC_Z(int *list, int *Map, double *Phi, double *Den, double vA, double vB, int count, int Np);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
extern "C" void ScaLBL_SetSlice_z(double *Phi, double value, int Nx, int Ny, int Nz, int Slice);
|
2015-06-30 11:33:27 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
// LIST OF DEPRECATED FUNCTIONS (probably delete)
|
2015-06-29 23:05:26 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
//extern "C" double ScaLBL_D3Q19_Flux_BC_z(double *disteven, double *distodd, double flux,
|
|
|
|
|
// int Nx, int Ny, int Nz);
|
2015-07-18 16:01:14 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
//extern "C" double ScaLBL_D3Q19_Flux_BC_Z(double *disteven, double *distodd, double flux,
|
|
|
|
|
// int Nx, int Ny, int Nz, int outlet);
|
2015-07-18 16:01:14 -04:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
//extern "C" void ScaLBL_D3Q19_Velocity_BC_z(double *disteven, double *distodd, double uz,
|
|
|
|
|
// int Nx, int Ny, int Nz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_Velocity_BC_Z(double *disteven, double *distodd, double uz,
|
|
|
|
|
// int Nx, int Ny, int Nz, int outlet);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_Color_BC_z(double *Phi, double *Den, double *A_even, double *A_odd,
|
|
|
|
|
// double *B_even, double *B_odd, int Nx, int Ny, int Nz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_Color_BC_Z(double *Phi, double *Den, double *A_even, double *A_odd,
|
|
|
|
|
// double *B_even, double *B_odd, int Nx, int Ny, int Nz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_AAeven_Compact(char *ID, double *d_dist, int Np);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_AAodd_Compact(char *ID,int *d_neighborList, double *d_dist, int Np);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_ComputePhaseField(char *ID, double *Phi, double *Den, int N);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q7_Init(double *Dist, double *Den, int Np);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q7_Init(char *ID, double *f_even, double *f_odd, double *Den, int Nx, int Ny, int Nz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q7_Swap(char *ID, double *disteven, double *distodd, int Nx, int Ny, int Nz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q7_Density(char *ID, double *disteven, double *distodd, double *Den,
|
|
|
|
|
// int Nx, int Ny, int Nz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_AA_Init(double *f_even, double *f_odd, int Np);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_Init(char *ID, double *f_even, double *f_odd, int Nx, int Ny, int Nz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_Swap(char *ID, double *disteven, double *distodd, int Nx, int Ny, int Nz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_Swap_Compact(int *neighborList, double *disteven, double *distodd, int Np);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_MRT(char *ID, double *f_even, double *f_odd, double rlxA, double rlxB,
|
|
|
|
|
// double Fx, double Fy, double Fz,int Nx, int Ny, int Nz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_Color_Init(char *ID, double *Den, double *Phi, double das, double dbs, int Nx, int Ny, int Nz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_ColorDistance_Init(char *ID, double *Den, double *Phi, double *Distance,
|
|
|
|
|
// double das, double dbs, double beta, double xp, int Nx, int Ny, int Nz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_ColorGradient(char *ID, double *phi, double *ColorGrad, int Nx, int Ny, int Nz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_ColorCollide( char *ID, double *disteven, double *distodd, double *phi, double *ColorGrad,
|
|
|
|
|
// double *Velocity, int Nx, int Ny, int Nz,double rlx_setA, double rlx_setB,
|
|
|
|
|
// double alpha, double beta, double Fx, double Fy, double Fz);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q7_ColorCollideMass(char *ID, double *A_even, double *A_odd, double *B_even, double *B_odd,
|
|
|
|
|
// double *Den, double *Phi, double *ColorGrad, double *Velocity, double beta, int N, bool pBC);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_AAeven_Color(double *dist, double *Aq, double *Bq, double *Den, double *Vel,
|
|
|
|
|
// double *ColorGrad, double rhoA, double rhoB, double tauA, double tauB, double alpha, double beta,
|
|
|
|
|
// double Fx, double Fy, double Fz, int start, int finish, int Np);
|
|
|
|
|
|
|
|
|
|
//extern "C" void ScaLBL_D3Q19_AAodd_Color(int *d_neighborList, double *dist, double *Aq, double *Bq, double *Den, double *Vel,
|
|
|
|
|
// double *ColorGrad, double rhoA, double rhoB, double tauA, double tauB, double alpha, double beta,
|
|
|
|
|
// double Fx, double Fy, double Fz, int start, int finish, int Np);
|
|
|
|
|
|
|
|
|
|
/*extern "C" void ScaLBL_D3Q19_AAeven_ColorMomentum(double *dist, double *Den, double *Vel,
|
|
|
|
|
double *ColorGrad, double rhoA, double rhoB, double tauA, double tauB, double alpha, double beta,
|
|
|
|
|
double Fx, double Fy, double Fz, int start, int finish, int Np);
|
|
|
|
|
|
|
|
|
|
extern "C" void ScaLBL_D3Q19_AAodd_ColorMomentum(int *d_neighborList, double *dist, double *Den, double *Vel,
|
|
|
|
|
double *ColorGrad, double rhoA, double rhoB, double tauA, double tauB, double alpha, double beta,
|
|
|
|
|
double Fx, double Fy, double Fz, int start, int finish, int Np);
|
|
|
|
|
|
|
|
|
|
extern "C" void ScaLBL_D3Q19_AAeven_ColorMass(double *Aq, double *Bq, double *Den, double *Vel,
|
|
|
|
|
double *ColorGrad, double beta, int start, int finish, int Np);
|
|
|
|
|
|
|
|
|
|
extern "C" void ScaLBL_D3Q19_AAodd_ColorMass(int *d_neighborList, double *Aq, double *Bq, double *Den, double *Vel,
|
|
|
|
|
double *ColorGrad, double beta, int start, int finish, int Np);
|
2018-01-26 20:42:31 -05:00
|
|
|
*/
|
2018-01-24 10:05:48 -05:00
|
|
|
/*
|
|
|
|
|
class ScaLBL_Color{
|
|
|
|
|
public:
|
|
|
|
|
ScaLBL_Color(Domain &Dm);
|
|
|
|
|
~ScaLBL_Color();
|
|
|
|
|
|
|
|
|
|
int *NeighborList;
|
|
|
|
|
int *dvcMap;
|
|
|
|
|
// double *f_even,*f_odd;
|
|
|
|
|
double *fq, *Aq, *Bq;
|
|
|
|
|
double *Den, *Phi;
|
|
|
|
|
double *ColorGrad;
|
|
|
|
|
double *Vel;
|
|
|
|
|
double *Pressure;
|
|
|
|
|
ScaLBL_Communicator ScaLBL_Comm;
|
|
|
|
|
//Create a second communicator based on the regular data layout
|
|
|
|
|
ScaLBL_Communicator ScaLBL_Comm_Regular;
|
|
|
|
|
|
|
|
|
|
void Initialize(Domain &Dm);
|
|
|
|
|
void Run(int ×tep);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void ScaLBL_Color::ScaLBL_Color(Domain &Dm){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScaLBL_Color::Initialize(Domain &Dm){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScaLBL_Color::Run(int ×tep){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
*/
|
2015-07-19 12:08:40 -04:00
|
|
|
|
2015-06-29 23:05:26 -04:00
|
|
|
class ScaLBL_Communicator{
|
2015-06-30 12:14:04 -04:00
|
|
|
public:
|
|
|
|
|
//......................................................................................
|
2015-06-30 11:53:15 -04:00
|
|
|
ScaLBL_Communicator(Domain &Dm);
|
2018-01-24 10:05:48 -05:00
|
|
|
|
2017-10-01 11:46:22 -04:00
|
|
|
//ScaLBL_Communicator(Domain &Dm, IntArray &Map);
|
2015-06-30 11:53:15 -04:00
|
|
|
~ScaLBL_Communicator();
|
2015-06-30 12:14:04 -04:00
|
|
|
//......................................................................................
|
|
|
|
|
unsigned long int CommunicationCount,SendCount,RecvCount;
|
2018-01-24 10:05:48 -05:00
|
|
|
int Nx,Ny,Nz,N;
|
|
|
|
|
int next;
|
2018-04-05 14:35:03 -04:00
|
|
|
int first_interior,last_interior;
|
2018-03-19 10:40:50 -04:00
|
|
|
int BoundaryCondition;
|
2015-06-30 12:14:04 -04:00
|
|
|
//......................................................................................
|
|
|
|
|
// Set up for D319 distributions
|
|
|
|
|
// - determines how much memory is allocated
|
|
|
|
|
// - buffers are reused to send D3Q7 distributions and halo exchange as needed
|
|
|
|
|
//......................................................................................
|
|
|
|
|
// Buffers to store data sent and recieved by this MPI process
|
|
|
|
|
double *sendbuf_x, *sendbuf_y, *sendbuf_z, *sendbuf_X, *sendbuf_Y, *sendbuf_Z;
|
|
|
|
|
double *sendbuf_xy, *sendbuf_yz, *sendbuf_xz, *sendbuf_Xy, *sendbuf_Yz, *sendbuf_xZ;
|
|
|
|
|
double *sendbuf_xY, *sendbuf_yZ, *sendbuf_Xz, *sendbuf_XY, *sendbuf_YZ, *sendbuf_XZ;
|
|
|
|
|
double *recvbuf_x, *recvbuf_y, *recvbuf_z, *recvbuf_X, *recvbuf_Y, *recvbuf_Z;
|
|
|
|
|
double *recvbuf_xy, *recvbuf_yz, *recvbuf_xz, *recvbuf_Xy, *recvbuf_Yz, *recvbuf_xZ;
|
|
|
|
|
double *recvbuf_xY, *recvbuf_yZ, *recvbuf_Xz, *recvbuf_XY, *recvbuf_YZ, *recvbuf_XZ;
|
|
|
|
|
//......................................................................................
|
|
|
|
|
|
2018-04-05 15:03:41 -04:00
|
|
|
int MemoryOptimizedLayoutAA(IntArray &Map, int *neighborList, char *id, int Np);
|
2017-10-01 11:46:22 -04:00
|
|
|
void MemoryOptimizedLayout(IntArray &Map, int *neighborList, char *id, int Np);
|
2018-01-24 10:05:48 -05:00
|
|
|
void MemoryOptimizedLayoutFull(IntArray &Map, int *neighborList, char *id, int Np);
|
|
|
|
|
void MemoryDenseLayout(IntArray &Map, int *neighborList, char *id, int Np);
|
|
|
|
|
void MemoryDenseLayoutFull(IntArray &Map, int *neighborList, char *id, int Np);
|
2015-06-30 12:14:04 -04:00
|
|
|
void SendD3Q19(double *f_even, double *f_odd);
|
|
|
|
|
void RecvD3Q19(double *f_even, double *f_odd);
|
2018-01-24 10:05:48 -05:00
|
|
|
void SendD3Q19AA(double *f_even, double *f_odd);
|
|
|
|
|
void RecvD3Q19AA(double *f_even, double *f_odd);
|
|
|
|
|
void SendD3Q19AA(double *dist);
|
|
|
|
|
void RecvD3Q19AA(double *dist);
|
2015-06-30 12:14:04 -04:00
|
|
|
void BiSendD3Q7(double *A_even, double *A_odd, double *B_even, double *B_odd);
|
|
|
|
|
void BiRecvD3Q7(double *A_even, double *A_odd, double *B_even, double *B_odd);
|
2018-01-24 10:05:48 -05:00
|
|
|
void BiSendD3Q7AA(double *Aq, double *Bq);
|
|
|
|
|
void BiRecvD3Q7AA(double *Aq, double *Bq);
|
2018-03-29 10:04:30 -04:00
|
|
|
void TriSendD3Q7AA(double *Aq, double *Bq, double *Cq);
|
|
|
|
|
void TriRecvD3Q7AA(double *Aq, double *Bq, double *Cq);
|
2015-06-30 12:14:04 -04:00
|
|
|
void SendHalo(double *data);
|
|
|
|
|
void RecvHalo(double *data);
|
2018-02-09 23:32:17 -05:00
|
|
|
void RegularLayout(IntArray map, double *data, DoubleArray ®data);
|
2018-01-26 15:19:50 -05:00
|
|
|
|
2018-01-24 10:05:48 -05:00
|
|
|
// Routines to set boundary conditions
|
|
|
|
|
void Color_BC_z(int *Map, double *Phi, double *Den, double vA, double vB);
|
|
|
|
|
void Color_BC_Z(int *Map, double *Phi, double *Den, double vA, double vB);
|
|
|
|
|
void D3Q19_Pressure_BC_z(int *neighborList, double *fq, double din, int time);
|
|
|
|
|
void D3Q19_Pressure_BC_Z(int *neighborList, double *fq, double dout, int time);
|
|
|
|
|
double D3Q19_Flux_BC_z(int *neighborList, double *fq, double flux, int time);
|
|
|
|
|
|
|
|
|
|
void TestSendD3Q19(double *f_even, double *f_odd);
|
|
|
|
|
void TestRecvD3Q19(double *f_even, double *f_odd);
|
2015-06-30 12:14:04 -04:00
|
|
|
|
2017-10-01 11:46:22 -04:00
|
|
|
// Debugging and unit testing functions
|
|
|
|
|
void PrintD3Q19();
|
|
|
|
|
|
2015-06-29 23:05:26 -04:00
|
|
|
private:
|
2018-01-24 10:05:48 -05:00
|
|
|
//void D3Q19_MapRecv_OLD(int q, int Cqx, int Cqy, int Cqz, int *list, int start, int count, int *d3q19_recvlist);
|
|
|
|
|
void D3Q19_MapRecv(int Cqx, int Cqy, int Cqz, int *list, int start, int count, int *d3q19_recvlist);
|
2017-10-01 11:46:22 -04:00
|
|
|
|
2015-06-30 11:33:27 -04:00
|
|
|
bool Lock; // use Lock to make sure only one call at a time to protect data in transit
|
2018-01-24 10:05:48 -05:00
|
|
|
// only one set of Send requests can be active at any time (per instance)
|
2015-06-29 23:05:26 -04:00
|
|
|
int i,j,k,n;
|
2018-01-24 10:05:48 -05:00
|
|
|
int iproc,jproc,kproc;
|
|
|
|
|
int nprocx,nprocy,nprocz;
|
2015-06-29 23:05:26 -04:00
|
|
|
int sendtag,recvtag;
|
2015-06-30 11:33:27 -04:00
|
|
|
// Give the object it's own MPI communicator
|
|
|
|
|
RankInfoStruct rank_info;
|
|
|
|
|
MPI_Group Group; // Group of processors associated with this domain
|
|
|
|
|
MPI_Comm MPI_COMM_SCALBL; // MPI Communicator for this domain
|
2015-06-29 23:05:26 -04:00
|
|
|
MPI_Request req1[18],req2[18];
|
|
|
|
|
MPI_Status stat1[18],stat2[18];
|
|
|
|
|
//......................................................................................
|
2015-06-30 11:33:27 -04:00
|
|
|
// MPI ranks for all 18 neighbors
|
|
|
|
|
//......................................................................................
|
|
|
|
|
// These variables are all private to prevent external things from modifying them!!
|
|
|
|
|
//......................................................................................
|
2015-06-30 12:28:57 -04:00
|
|
|
int rank;
|
2015-06-30 11:33:27 -04:00
|
|
|
int rank_x,rank_y,rank_z,rank_X,rank_Y,rank_Z;
|
|
|
|
|
int rank_xy,rank_XY,rank_xY,rank_Xy;
|
|
|
|
|
int rank_xz,rank_XZ,rank_xZ,rank_Xz;
|
|
|
|
|
int rank_yz,rank_YZ,rank_yZ,rank_Yz;
|
2015-06-29 23:05:26 -04:00
|
|
|
//......................................................................................
|
2018-01-24 10:05:48 -05:00
|
|
|
|
2015-06-29 23:05:26 -04:00
|
|
|
//......................................................................................
|
|
|
|
|
int sendCount_x, sendCount_y, sendCount_z, sendCount_X, sendCount_Y, sendCount_Z;
|
|
|
|
|
int sendCount_xy, sendCount_yz, sendCount_xz, sendCount_Xy, sendCount_Yz, sendCount_xZ;
|
|
|
|
|
int sendCount_xY, sendCount_yZ, sendCount_Xz, sendCount_XY, sendCount_YZ, sendCount_XZ;
|
|
|
|
|
//......................................................................................
|
|
|
|
|
int recvCount_x, recvCount_y, recvCount_z, recvCount_X, recvCount_Y, recvCount_Z;
|
|
|
|
|
int recvCount_xy, recvCount_yz, recvCount_xz, recvCount_Xy, recvCount_Yz, recvCount_xZ;
|
|
|
|
|
int recvCount_xY, recvCount_yZ, recvCount_Xz, recvCount_XY, recvCount_YZ, recvCount_XZ;
|
|
|
|
|
//......................................................................................
|
|
|
|
|
// Send buffers that reside on the compute device
|
|
|
|
|
int *dvcSendList_x, *dvcSendList_y, *dvcSendList_z, *dvcSendList_X, *dvcSendList_Y, *dvcSendList_Z;
|
|
|
|
|
int *dvcSendList_xy, *dvcSendList_yz, *dvcSendList_xz, *dvcSendList_Xy, *dvcSendList_Yz, *dvcSendList_xZ;
|
|
|
|
|
int *dvcSendList_xY, *dvcSendList_yZ, *dvcSendList_Xz, *dvcSendList_XY, *dvcSendList_YZ, *dvcSendList_XZ;
|
|
|
|
|
// Recieve buffers that reside on the compute device
|
|
|
|
|
int *dvcRecvList_x, *dvcRecvList_y, *dvcRecvList_z, *dvcRecvList_X, *dvcRecvList_Y, *dvcRecvList_Z;
|
|
|
|
|
int *dvcRecvList_xy, *dvcRecvList_yz, *dvcRecvList_xz, *dvcRecvList_Xy, *dvcRecvList_Yz, *dvcRecvList_xZ;
|
|
|
|
|
int *dvcRecvList_xY, *dvcRecvList_yZ, *dvcRecvList_Xz, *dvcRecvList_XY, *dvcRecvList_YZ, *dvcRecvList_XZ;
|
2017-10-01 11:46:22 -04:00
|
|
|
// Recieve buffers for the distributions
|
|
|
|
|
int *dvcRecvDist_x, *dvcRecvDist_y, *dvcRecvDist_z, *dvcRecvDist_X, *dvcRecvDist_Y, *dvcRecvDist_Z;
|
|
|
|
|
int *dvcRecvDist_xy, *dvcRecvDist_yz, *dvcRecvDist_xz, *dvcRecvDist_Xy, *dvcRecvDist_Yz, *dvcRecvDist_xZ;
|
|
|
|
|
int *dvcRecvDist_xY, *dvcRecvDist_yZ, *dvcRecvDist_Xz, *dvcRecvDist_XY, *dvcRecvDist_YZ, *dvcRecvDist_XZ;
|
2015-06-30 11:33:27 -04:00
|
|
|
//......................................................................................
|
|
|
|
|
|
2015-06-29 23:05:26 -04:00
|
|
|
};
|
|
|
|
|
|
2017-10-01 11:46:22 -04:00
|
|
|
|
2018-03-08 13:03:22 -05:00
|
|
|
#endif
|