-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allocate host and device memory, define data structure
- Loading branch information
Jiuzhou Tang
committed
Nov 21, 2016
1 parent
54858b7
commit 8311d52
Showing
12 changed files
with
643 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Dim=3 | ||
Nx=64, Ny=32, Nz=16 | ||
lx=4.0, ly=4.0, lz=4.0 | ||
XN=20 | ||
fA=0.5 | ||
Ns=100 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef _CONSTANTS_H | ||
#define _CONSTANTS_H | ||
#include <cmath> | ||
#include <cstdio> | ||
#include <cstdlib> | ||
#include <iostream> | ||
#include <fstream> | ||
#include <vector> | ||
using namespace std; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#include "field.h" | ||
// initialize the field with certain specification. | ||
int andsn_dim; | ||
int simple_num; | ||
int iter_counter; | ||
double lambda_andsn; | ||
double ***andsn_W_sp; | ||
double ***andsn_dW_sp; | ||
double *global_t_diff; | ||
double *yita; // pressure field | ||
|
||
void field_init(int field_type, GRID *grid, CHEMICAL *chemical, CHAIN *chain ) | ||
{ | ||
|
||
int i1,j1,k1; | ||
long K; | ||
double temp_coff=0.8; | ||
// init the pressure field | ||
// select the initial field type | ||
switch (field_type) { | ||
// random noise | ||
case 0 : { | ||
break; | ||
} | ||
// FCC | ||
case 1 : { | ||
|
||
break; | ||
} | ||
// BCC | ||
case 2 : { | ||
|
||
break; | ||
} | ||
// GYR | ||
case 3 : { | ||
|
||
break; | ||
} | ||
// HEX | ||
case 4 : { | ||
assert(grid->Dim==2 || grid->Dim==3); | ||
// the hexagonal structure is kept translation constant along the z axis, and the ratio of size on X and Y axis is sqrt(3) | ||
for (i1=0,K=0;i1<=grid->Nz;i1++) { // Z axis | ||
for (j1=0;j1<=grid->Ny;j1++) { // Y axis | ||
for (k1=0;k1<=grid->Nx;k1++,K++) { // X axis | ||
chemical->R_sp[0][K]=(chain->Blk_f[0])*(1.0+ \ | ||
temp_coff*cos(2.0*Pi*(j1+1)/grid->Ny)*cos(2.0*Pi*(k1+1)/grid->Nx)); | ||
} | ||
} | ||
|
||
} | ||
break; | ||
} | ||
// LAM | ||
case 5 : { | ||
// the sine-like lam is along the X axis | ||
for (i1=0,K=0;i1<=grid->Nz;i1++) { // Z axis | ||
for (j1=0;j1<=grid->Ny;j1++) { // Y axis | ||
for (k1=0;k1<=grid->Nx;k1++,K++) { // X axis | ||
chemical->R_sp[0][K]=(chain->Blk_f[0])*(1.0+ \ | ||
temp_coff*sin(2.0*Pi*(k1+1)/grid->Nx)); | ||
} | ||
} | ||
} | ||
|
||
|
||
break; | ||
} | ||
|
||
default : {} | ||
break; | ||
} | ||
|
||
// currently, only AB melts is supported, field initialization of more molecular species is to be implemented. | ||
for (i1=0,K=0;i1<=grid->Nz;i1++) { // Z axis | ||
for (j1=0;j1<=grid->Ny;j1++) { // Y axis | ||
for (k1=0;k1<=grid->Nx;k1++,K++) { // X axis | ||
chemical->R_sp[1][K]=1.0-chemical->R_sp[0][K]; | ||
chemical->W_sp[0][K]=chemical->XN[0][1]*chemical->R_sp[1][K]; | ||
chemical->W_sp[1][K]=chemical->XN[0][1]*chemical->R_sp[0][K]; | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef FIELD_H | ||
#define FIELD_H | ||
#include"struct.h" | ||
// parameters for anderson mixing | ||
extern int andsn_dim; | ||
extern int simple_num; | ||
extern int iter_counter; | ||
extern double lambda_andsn; | ||
extern double ***andsn_W_sp; | ||
extern double ***andsn_dW_sp; | ||
extern double *global_t_diff; | ||
extern double *yita; // pressure field | ||
|
||
void field_init(int field_type, GRID *grid, CHEMICAL *chemical, CHAIN *chain ); | ||
//void andsn_init( int andsn_dim,int num, double lambda, grid &Grid, chemical &Chemical, chain &Chain ); | ||
//void andsn_iterate_diblock(int andsn_dim, grid &Grid, chemical &Chemical, chain &Chain, cell &Cell ) ; | ||
//int indx_update_andsn(int index_i, int n_r); | ||
//void field_clean(CHEMICAL *chemical ); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
|
||
#include"struct.h" | ||
#include <helper_functions.h> | ||
#include "init_cuda.h" | ||
#include "field.h" | ||
|
||
void init_grid_cell(CUFFT_INFO *cufft_info,GPU_INFO *gpu_info, GRID *grid, CELL *cell); | ||
//void init_grid_cell(CUFFT_INFO *cufft_info,GPU_INFO *gpu_info, GRID *grid, CELL *cell); | ||
//void init_scft(CUFFT_INFO *cufft_info,GPU_INFO *gpu_info, GRID *grid, CELL *cell, CHEMICAL *chemical, CHAIN *chain); | ||
void init_AB_diblock_scft(CUFFT_INFO *cufft_info,GPU_INFO *gpu_info,GRID *grid, CELL *cell, CHEMICAL *chemical, CHAIN *chain); | ||
void AB_diblock_scft_driver(CUFFT_INFO *cufft_info,GPU_INFO *gpu_info,GRID *grid, CELL *cell, CHEMICAL *chemical, CHAIN *chain ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.