updating mixed gradient test
This commit is contained in:
parent
aa04ad4898
commit
b828f6e5e6
@ -10,9 +10,9 @@ color lattice boltzmann model
|
||||
#include <time.h>
|
||||
|
||||
ScaLBL_FreeLeeModel::ScaLBL_FreeLeeModel(int RANK, int NP, const Utilities::MPI& COMM):
|
||||
rank(RANK), nprocs(NP), Restart(0),timestep(0),timestepMax(0),tauA(0),tauB(0),tauM(0),rhoA(0),rhoB(0),W(0),gamma(0),kappa(0),beta(0),
|
||||
rank(RANK), nprocs(NP), Restart(0),timestep(0),timestepMax(2),tauA(1.0),tauB(1.0),tauM(1.0),rhoA(1.0),rhoB(1.0),W(5.0),gamma(0.001),kappa(0.0075),beta(0.0024),
|
||||
Fx(0),Fy(0),Fz(0),flux(0),din(0),dout(0),inletA(0),inletB(0),outletA(0),outletB(0),
|
||||
tau(0),rho0(0),
|
||||
tau(1.0),rho0(1.0),
|
||||
Nx(0),Ny(0),Nz(0),N(0),Np(0),nprocx(0),nprocy(0),nprocz(0),BoundaryCondition(0),Lx(0),Ly(0),Lz(0),comm(COMM)
|
||||
{
|
||||
|
||||
@ -797,7 +797,7 @@ void ScaLBL_FreeLeeModel::Run_TwoFluid(){
|
||||
kappa, beta, W, Fx, Fy, Fz, Nxh, Nxh*Nyh, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
ScaLBL_Comm->Barrier();
|
||||
|
||||
printf("write debug \n");
|
||||
printf("write debug strideY=%i strideZ = %i \n",Nxh, Nxh*Nyh);
|
||||
WriteDebug_TwoFluid();
|
||||
|
||||
// *************EVEN TIMESTEP*************
|
||||
@ -1178,9 +1178,9 @@ void ScaLBL_FreeLeeModel::MGTest(){
|
||||
comm.barrier();
|
||||
|
||||
ScaLBL_Comm_WideHalo->Send(Phi);
|
||||
ScaLBL_D3Q9_MGTest(dvcMap,Phi,ColorGrad,Nx,Nx*Ny, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
ScaLBL_D3Q9_MGTest(dvcMap,Phi,ColorGrad,Nxh,Nxh*Nyh, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
ScaLBL_Comm_WideHalo->Recv(Phi);
|
||||
ScaLBL_D3Q9_MGTest(dvcMap,Phi,ColorGrad,Nx,Nx*Ny, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
ScaLBL_D3Q9_MGTest(dvcMap,Phi,ColorGrad,Nxh,Nxh*Nyh, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
|
||||
//check the sum of ColorGrad
|
||||
double cgx_loc = 0.0;
|
||||
|
@ -9,14 +9,15 @@
|
||||
#include "common/Utilities.h"
|
||||
#include "models/FreeLeeModel.h"
|
||||
|
||||
inline void Initialize_DummyPhaseField(ScaLBL_FreeLeeModel &LeeModel){
|
||||
inline void Initialize_Mask(ScaLBL_FreeLeeModel &LeeModel){
|
||||
// initialize a bubble
|
||||
int i,j,k,n;
|
||||
int rank = LeeModel.Mask->rank();
|
||||
int Nx = LeeModel.Mask->Nx;
|
||||
int Ny = LeeModel.Mask->Ny;
|
||||
int Nz = LeeModel.Mask->Nz;
|
||||
if (rank == 0) cout << "Setting up dummy phase field..." << endl;
|
||||
if (rank == 0) printf(" initialize mask...\n");
|
||||
|
||||
for (k=0;k<Nz;k++){
|
||||
for (j=0;j<Ny;j++){
|
||||
for (i=0;i<Nx;i++){
|
||||
@ -28,6 +29,33 @@ inline void Initialize_DummyPhaseField(ScaLBL_FreeLeeModel &LeeModel){
|
||||
}
|
||||
}
|
||||
|
||||
inline void Initialize_DummyPhaseField(ScaLBL_FreeLeeModel &LeeModel, double ax, double ay, double az){
|
||||
// initialize a bubble
|
||||
int i,j,k,n;
|
||||
int rank = LeeModel.Mask->rank();
|
||||
int Nx = LeeModel.Mask->Nx;
|
||||
int Ny = LeeModel.Mask->Ny;
|
||||
int Nz = LeeModel.Mask->Nz;
|
||||
if (rank == 0) printf("Setting up dummy phase field with gradient {x,y,z} = {%f , %f , %f}...\n",ax,ay,az);
|
||||
|
||||
double * Dummy;
|
||||
int Nh = (Nx+2)*(Ny+2)*(Nz+2);
|
||||
Dummy = new double [(Nx+2)*(Ny+2)*(Nz+2)];
|
||||
for (k=0;k<Nz;k++){
|
||||
for (j=0;j<Ny;j++){
|
||||
for (i=0;i<Nx;i++){
|
||||
n = k*Nx*Ny + j*Nz + i;
|
||||
LeeModel.Mask->id[n]=1;
|
||||
LeeModel.id[n] = LeeModel.Mask->id[n];
|
||||
int nh = (k+1)*(Nx+2)*(Ny+2) + (j+1)*(Nx+2) + i+1;
|
||||
Dummy[nh] = ax*double(i) + ay*double(j) + az*double(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
ScaLBL_CopyToDevice(LeeModel.Phi, Dummy, sizeof(double)*Nh);
|
||||
|
||||
LeeModel.MGTest();
|
||||
}
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
@ -66,14 +94,14 @@ int main( int argc, char **argv )
|
||||
ScaLBL_FreeLeeModel LeeModel( rank, nprocs, comm );
|
||||
LeeModel.ReadParams( filename );
|
||||
LeeModel.SetDomain();
|
||||
Initialize_DummyPhaseField(LeeModel);
|
||||
LeeModel.Create_DummyPhase_MGTest();
|
||||
LeeModel.MGTest();
|
||||
Initialize_Mask(LeeModel);
|
||||
//LeeModel.Create_DummyPhase_MGTest();
|
||||
LeeModel.Create_TwoFluid();
|
||||
|
||||
Initialize_DummyPhaseField(LeeModel,1.0, 2.0, 3.0);
|
||||
LeeModel.WriteDebug_TwoFluid();
|
||||
|
||||
PROFILE_STOP( "Main" );
|
||||
auto file = db->getWithDefault<std::string>( "TimerFile", "TestMixedGrad" );
|
||||
auto level = db->getWithDefault<int>( "TimerLevel", 1 );
|
||||
PROFILE_SAVE( file, level );
|
||||
// ****************************************************
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user