analysis/TwoPhase.cpp

This commit is contained in:
James E McClure 2018-09-21 12:43:12 -04:00
commit 0269a6bbfa
5 changed files with 38 additions and 17 deletions

View File

@ -17,6 +17,13 @@
#define PI 3.14159265359 #define PI 3.14159265359
// Constructor // Constructor
Minkowski::Minkowski():
kstart(0), kfinish(0), isovalue(0), Volume(0),
LOGFILE(NULL), Dm(NULL), Vi(0), Vi_global(0)
{
}
Minkowski::Minkowski(std::shared_ptr <Domain> dm): Minkowski::Minkowski(std::shared_ptr <Domain> dm):
kstart(0), kfinish(0), isovalue(0), Volume(0), kstart(0), kfinish(0), isovalue(0), Volume(0),
LOGFILE(NULL), Dm(dm), Vi(0), Vi_global(0) LOGFILE(NULL), Dm(dm), Vi(0), Vi_global(0)
@ -39,7 +46,7 @@ Minkowski::Minkowski(std::shared_ptr <Domain> dm):
// Destructor // Destructor
Minkowski::~Minkowski() Minkowski::~Minkowski()
{ {
if ( LOGFILE!=NULL ) { fclose(LOGFILE); } // if ( LOGFILE!=NULL ) { fclose(LOGFILE); }
} }
double Minkowski::V(){ double Minkowski::V(){

View File

@ -46,6 +46,7 @@ public:
double X(); double X();
//........................................................................... //...........................................................................
Minkowski();
Minkowski(std::shared_ptr <Domain> Dm); Minkowski(std::shared_ptr <Domain> Dm);
~Minkowski(); ~Minkowski();
void ComputeScalar(const DoubleArray& Field, const double isovalue); void ComputeScalar(const DoubleArray& Field, const double isovalue);

View File

@ -97,6 +97,10 @@ TwoPhase::TwoPhase(std::shared_ptr <Domain> dm):
Vel_x.resize(Nx,Ny,Nz); Vel_x.fill(0); // Gradient of the phase indicator field Vel_x.resize(Nx,Ny,Nz); Vel_x.fill(0); // Gradient of the phase indicator field
Vel_y.resize(Nx,Ny,Nz); Vel_y.fill(0); Vel_y.resize(Nx,Ny,Nz); Vel_y.fill(0);
Vel_z.resize(Nx,Ny,Nz); Vel_z.fill(0); Vel_z.resize(Nx,Ny,Nz); Vel_z.fill(0);
wet_morph = Minkowski(Dm);
nonwet_morph = Minkowski(Dm);
//......................................... //.........................................
// Allocate cube storage space // Allocate cube storage space
CubeValues.resize(2,2,2); CubeValues.resize(2,2,2);
@ -150,7 +154,8 @@ TwoPhase::TwoPhase(std::shared_ptr <Domain> dm):
fprintf(TIMELOG,"Gnsxx Gnsyy Gnszz Gnsxy Gnsxz Gnsyz "); fprintf(TIMELOG,"Gnsxx Gnsyy Gnszz Gnsxy Gnsxz Gnsyz ");
fprintf(TIMELOG,"trawn trJwn trRwn "); //trimmed curvature, fprintf(TIMELOG,"trawn trJwn trRwn "); //trimmed curvature,
fprintf(TIMELOG,"wwndnw wwnsdnwn Jwnwwndnw "); //kinematic quantities, fprintf(TIMELOG,"wwndnw wwnsdnwn Jwnwwndnw "); //kinematic quantities,
fprintf(TIMELOG,"Euler Kn Jn An\n"); //miknowski measures, fprintf(TIMELOG,"Vw Jw Aw Xw "); //miknowski measures,
fprintf(TIMELOG,"Vn Jn An Xn\n"); //miknowski measures,
} }
NWPLOG = fopen("components.NWP.tcat","a+"); NWPLOG = fopen("components.NWP.tcat","a+");
@ -179,8 +184,9 @@ TwoPhase::TwoPhase(std::shared_ptr <Domain> dm):
fprintf(TIMELOG,"Gnsxx Gnsyy Gnszz Gnsxy Gnsxz Gnsyz "); fprintf(TIMELOG,"Gnsxx Gnsyy Gnszz Gnsxy Gnsxz Gnsyz ");
fprintf(TIMELOG,"trawn trJwn trRwn "); //trimmed curvature, fprintf(TIMELOG,"trawn trJwn trRwn "); //trimmed curvature,
fprintf(TIMELOG,"wwndnw wwnsdnwn Jwnwwndnw "); //kinematic quantities, fprintf(TIMELOG,"wwndnw wwnsdnwn Jwnwwndnw "); //kinematic quantities,
fprintf(TIMELOG,"Euler Kn Jn An\n"); //miknowski measures, fprintf(TIMELOG,"Vw Jw Aw Xw "); //miknowski measures,
} fprintf(TIMELOG,"Vn Jn An Xn\n"); //miknowski measures,
}
} }
@ -542,7 +548,6 @@ void TwoPhase::ComputeLocal()
} }
} }
} }
/*
Array <char> phase_label(Nx,Ny,Nz); Array <char> phase_label(Nx,Ny,Nz);
Array <double> phase_distance(Nx,Ny,Nz); Array <double> phase_distance(Nx,Ny,Nz);
// Analyze the wetting fluid // Analyze the wetting fluid
@ -568,7 +573,7 @@ void TwoPhase::ComputeLocal()
} }
CalcDist(phase_distance,phase_label,*Dm); CalcDist(phase_distance,phase_label,*Dm);
wet_morph.ComputeScalar(phase_distance,0.f); wet_morph.ComputeScalar(phase_distance,0.f);
printf("generating distance at rank=%i \n",Dm->rank());
// Analyze the wetting fluid // Analyze the wetting fluid
for (k=0; k<Nz; k++){ for (k=0; k<Nz; k++){
for (j=0; j<Ny; j++){ for (j=0; j<Ny; j++){
@ -590,12 +595,8 @@ void TwoPhase::ComputeLocal()
} }
} }
} }
printf("calculate distance at rank=%i \n",Dm->rank());
CalcDist(phase_distance,phase_label,*Dm); CalcDist(phase_distance,phase_label,*Dm);
printf("morphological analysis at rank=%i \n",Dm->rank());
nonwet_morph.ComputeScalar(phase_distance,0.f); nonwet_morph.ComputeScalar(phase_distance,0.f);
printf("rank=%i completed \n",Dm->rank());
*/
} }
@ -1297,7 +1298,10 @@ void TwoPhase::PrintAll(int timestep)
Gws_global(0),Gws_global(1),Gws_global(2),Gws_global(3),Gws_global(4),Gws_global(5)); // orientation of ws interface Gws_global(0),Gws_global(1),Gws_global(2),Gws_global(3),Gws_global(4),Gws_global(5)); // orientation of ws interface
fprintf(TIMELOG,"%.5g %.5g %.5g ",trawn_global, trJwn_global, trRwn_global); // Trimmed curvature fprintf(TIMELOG,"%.5g %.5g %.5g ",trawn_global, trJwn_global, trRwn_global); // Trimmed curvature
fprintf(TIMELOG,"%.5g %.5g %.5g ",wwndnw_global, wwnsdnwn_global, Jwnwwndnw_global); // kinematic quantities fprintf(TIMELOG,"%.5g %.5g %.5g ",wwndnw_global, wwnsdnwn_global, Jwnwwndnw_global); // kinematic quantities
fprintf(TIMELOG,"%.5g %.5g %.5g %.5g\n",euler_global, Kn_global, Jn_global, An_global); // minkowski measures fprintf(TIMELOG,"%.5g %.5g %.5g %.5g ", wet_morph.Vi_global, wet_morph.Ji_global, wet_morph.Ai_global, wet_morph.Xi_global); // minkowski measures
fprintf(TIMELOG,"%.5g %.5g %.5g %.5g\n", nonwet_morph.Vi_global, nonwet_morph.Ji_global, nonwet_morph.Ai_global, nonwet_morph.Xi_global); // minkowski measures
fflush(TIMELOG); fflush(TIMELOG);
} }
else{ else{
@ -1322,7 +1326,9 @@ void TwoPhase::PrintAll(int timestep)
Gws(0),Gws(1),Gws(2),Gws(3),Gws(4),Gws(5)); // orientation of ws interface Gws(0),Gws(1),Gws(2),Gws(3),Gws(4),Gws(5)); // orientation of ws interface
fprintf(TIMELOG,"%.5g %.5g %.5g ",trawn, trJwn, trRwn); // Trimmed curvature fprintf(TIMELOG,"%.5g %.5g %.5g ",trawn, trJwn, trRwn); // Trimmed curvature
fprintf(TIMELOG,"%.5g %.5g %.5g ",wwndnw, wwnsdnwn, Jwnwwndnw); // kinematic quantities fprintf(TIMELOG,"%.5g %.5g %.5g ",wwndnw, wwnsdnwn, Jwnwwndnw); // kinematic quantities
fprintf(TIMELOG,"%.5g %.5g %.5g %.5g\n",euler, Kn, Jn, An); // minkowski measures fprintf(TIMELOG,"%.5g %.5g %.5g %.5g ", wet_morph.Vi, wet_morph.Ji, wet_morph.Ai, wet_morph.Xi); // minkowski measures
fprintf(TIMELOG,"%.5g %.5g %.5g %.5g\n", nonwet_morph.Vi, nonwet_morph.Ji, nonwet_morph.Ai, nonwet_morph.Xi); // minkowski measures
fflush(TIMELOG); fflush(TIMELOG);
} }

View File

@ -8,6 +8,8 @@
#include "common/Domain.h" #include "common/Domain.h"
#include "common/Communication.h" #include "common/Communication.h"
#include "analysis/analysis.h" #include "analysis/analysis.h"
#include "analysis/distance.h"
#include "analysis/Minkowski.h"
#include "shared_ptr.h" #include "shared_ptr.h"
#include "common/Utilities.h" #include "common/Utilities.h"
@ -141,6 +143,11 @@ public:
DoubleArray Vel_x; // Velocity DoubleArray Vel_x; // Velocity
DoubleArray Vel_y; DoubleArray Vel_y;
DoubleArray Vel_z; DoubleArray Vel_z;
DoubleArray PhaseDistance;
Minkowski wet_morph;
Minkowski nonwet_morph;
// Container for averages; // Container for averages;
DoubleArray ComponentAverages_WP; DoubleArray ComponentAverages_WP;
DoubleArray ComponentAverages_NWP; DoubleArray ComponentAverages_NWP;

View File

@ -6,7 +6,7 @@ cmake \
-D CMAKE_CXX_COMPILER:PATH=mpicxx \ -D CMAKE_CXX_COMPILER:PATH=mpicxx \
-D CMAKE_C_FLAGS="-g " \ -D CMAKE_C_FLAGS="-g " \
-D CMAKE_CXX_FLAGS="-g " \ -D CMAKE_CXX_FLAGS="-g " \
-D CXX_STD=11 \ -D CMAKE_CXX_STANDARD=14 \
-D MPI_COMPILER:BOOL=TRUE \ -D MPI_COMPILER:BOOL=TRUE \
-D MPIEXEC=mpirun \ -D MPIEXEC=mpirun \
-D USE_EXT_MPI_FOR_SERIAL_TESTS:BOOL=TRUE \ -D USE_EXT_MPI_FOR_SERIAL_TESTS:BOOL=TRUE \
@ -14,10 +14,10 @@ cmake \
-D CUDA_FLAGS="-arch sm_35" \ -D CUDA_FLAGS="-arch sm_35" \
-D CUDA_HOST_COMPILER="/usr/bin/gcc" \ -D CUDA_HOST_COMPILER="/usr/bin/gcc" \
-D USE_NETCDF=0 \ -D USE_NETCDF=0 \
-D HDF5_DIRECTORY="/home/mcclurej/TPL/hdf5/" \ -D HDF5_DIRECTORY="/opt/apps/hdf5/" \
-D HDF5_LIB="/home/mcclurej/TPL/hdf5/lib/libhdf5.a" \ -D HDF5_LIB="/opt/apps/hdf5/lib/libhdf5.a" \
-D SILO_LIB="/home/mcclurej/TPL/silo/lib/libsiloh5.a" \ -D SILO_LIB="/opt/apps/silo/lib/libsiloh5.a" \
-D SILO_DIRECTORY="/home/mcclurej/TPL/silo/" \ -D SILO_DIRECTORY="/opt/apps/silo/" \
-D NETCDF_DIRECTORY="/apps/netcdf/" \ -D NETCDF_DIRECTORY="/apps/netcdf/" \
-D USE_SILO=1 \ -D USE_SILO=1 \
-D USE_CUDA=0 \ -D USE_CUDA=0 \