common/TwoPhase.h: when averaging a system with external BC, do not compute the contribution from the inlet. tests/ComponenLabel.cpp: use the .LBM files instead of writing raw binary so that things can be visualized in VisIT

This commit is contained in:
James E McClure 2015-07-26 08:30:56 -04:00
parent a7b655f811
commit 3212187343
2 changed files with 51 additions and 4 deletions

View File

@ -452,10 +452,15 @@ void TwoPhase::UpdateMeshValues(){
}
void TwoPhase::ComputeLocal(){
int i,j,k,n;
int i,j,k,n,kmin,kmax;
int cube[8][3] = {{0,0,0},{1,0,0},{0,1,0},{1,1,0},{0,0,1},{1,0,1},{0,1,1},{1,1,1}};
for (k=1; k<Nz-1; k++){
// If external boundary conditions are set, do not average over the inlet
kmin=1; kmax=Nz-1;
if (Dm.BoundaryCondition > 0 && Dm.kproc == 0) kmin=4;
if (Dm.BoundaryCondition > 0 && Dm.kproc == Dm.nprocz-1) kmax=Nz-4;
for (k=kmin; k<kmax; k++){
for (j=1; j<Ny-1; j++){
for (i=1; i<Nx-1; i++){
//...........................................................................
@ -558,6 +563,7 @@ void TwoPhase::ComputeLocal(){
void TwoPhase::ComponentAverages(){
int i,j,k,n;
int kmin,kmax;
int LabelWP,LabelNWP;
double TempLocal;
@ -577,7 +583,12 @@ void TwoPhase::ComponentAverages(){
printf("Number of non-wetting phase components is %i \n",NumberComponents_NWP);
}
for (k=1; k<Nz-1; k++){
// If external boundary conditions are set, do not average over the inlet
kmin=1; kmax=Nz-1;
if (Dm.BoundaryCondition > 0 && Dm.kproc == 0) kmin=4;
if (Dm.BoundaryCondition > 0 && Dm.kproc == Dm.nprocz-1) kmax=Nz-4;
for (k=kmin; k<kmax; k++){
for (j=1; j<Ny-1; j++){
for (i=1; i<Nx-1; i++){

View File

@ -434,6 +434,42 @@ int main(int argc, char **argv)
Averages.SortBlobs();
Averages.PrintComponents(timestep);
// Create the MeshDataStruct
fillHalo<double> fillData(Dm.rank_info,Nx-2,Ny-2,Nz-2,1,1,1,0,1);
std::vector<IO::MeshDataStruct> meshData(1);
meshData[0].meshName = "domain";
meshData[0].mesh = std::shared_ptr<IO::DomainMesh>( new IO::DomainMesh(Dm.rank_info,Nx-2,Ny-2,Nz-2,Lx,Ly,Lz) );
std::shared_ptr<IO::Variable> PhaseVar( new IO::Variable() );
std::shared_ptr<IO::Variable> SignDistVar( new IO::Variable() );
std::shared_ptr<IO::Variable> LabelWPVar( new IO::Variable() );
std::shared_ptr<IO::Variable> LabelNWPVar( new IO::Variable() );
PhaseVar->name = "phase";
PhaseVar->type = IO::VolumeVariable;
PhaseVar->dim = 1;
PhaseVar->data.resize(Nx-2,Ny-2,Nz-2);
meshData[0].vars.push_back(PhaseVar);
SignDistVar->name = "SignDist";
SignDistVar->type = IO::VolumeVariable;
SignDistVar->dim = 1;
SignDistVar->data.resize(Nx-2,Ny-2,Nz-2);
meshData[0].vars.push_back(SignDistVar);
LabelNWPVar->name = "LabelNWP";
LabelNWPVar->type = IO::VolumeVariable;
LabelNWPVar->dim = 1;
LabelNWPVar->data.resize(Nx-2,Ny-2,Nz-2);
meshData[0].vars.push_back(LabelNWPVar);
LabelWPVar->name = "LabelWP";
LabelWPVar->type = IO::VolumeVariable;
LabelWPVar->dim = 1;
LabelWPVar->data.resize(Nx-2,Ny-2,Nz-2);
meshData[0].vars.push_back(LabelWPVar);
fillData.copy(Averages.SDn,PhaseVar->data);
fillData.copy(Averages.SDs,SignDistVar->data);
fillData.copy(Averages.Label_WP,LabelWPVar->data);
fillData.copy(Averages.Label_NWP,LabelNWPVar->data);
IO::writeData( 0, meshData, 2 );
/*
FILE *NWP_FILE;
NWP_FILE = fopen("NWP.dat","wb");
fwrite(Averages.Label_NWP.get(),4,Nx*Ny*Nz,NWP_FILE);
@ -448,7 +484,7 @@ int main(int argc, char **argv)
DISTANCE = fopen("SignDist.dat","wb");
fwrite(Averages.SDs.get(),8,Nx*Ny*Nz,DISTANCE);
fclose(DISTANCE);
*/
// ****************************************************
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();