From 8b095b24ada5970a3b051f7b7ed79c3f8213ec6b Mon Sep 17 00:00:00 2001 From: James McClure Date: Mon, 5 Oct 2020 14:36:26 -0400 Subject: [PATCH] added mix gradient --- cpu/MixedGradient.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 cpu/MixedGradient.cpp diff --git a/cpu/MixedGradient.cpp b/cpu/MixedGradient.cpp new file mode 100644 index 00000000..8aa7c53f --- /dev/null +++ b/cpu/MixedGradient.cpp @@ -0,0 +1,48 @@ +/* Implement Mixed Gradient (Lee et al. JCP 2016)*/ + +extern "C" void ScaLBL_D3Q19_MixedGradient(int *Map, double *Phi, double *Gradient, int start, int finish, int Np, int Nx, int Ny, int Nz) +{ + static int D3Q19[18][3]={{1,0,0},{-1,0,0},{0,1,0},{0,-1,0},{0,0,1},{0,0,-1}, + {1,1,0},{-1,-1,0},{1,-1,0},{-1,1,0}, + {1,0,1},{-1,0,-1},{1,0,-1},{-1,0,1}, + {0,1,1},{0,-1,-1},{0,1,-1},{0,-1,1}}; + + int i,j,k,n,N; + int np,np2,nm; // neighbors + double v,vp,vp2,vm; // values at neighbors + double grad; + for (int idx=start; idx