Merge branch 'master' of github.com:JamesEMcClure/LBPM-WIA
This commit is contained in:
@@ -103,6 +103,9 @@ TwoPhase::TwoPhase(std::shared_ptr <Domain> dm):
|
||||
Volume=(Nx-2)*(Ny-2)*(Nz-2)*Dm->nprocx()*Dm->nprocy()*Dm->nprocz()*1.0;
|
||||
|
||||
TempID = new char[Nx*Ny*Nz];
|
||||
|
||||
wet_morph = std::shared_ptr<Minkowski>(new Minkowski(Dm));
|
||||
nonwet_morph = std::shared_ptr<Minkowski>(new Minkowski(Dm));
|
||||
|
||||
// Global arrays
|
||||
PhaseID.resize(Nx,Ny,Nz); PhaseID.fill(0);
|
||||
@@ -180,7 +183,9 @@ TwoPhase::TwoPhase(std::shared_ptr <Domain> dm):
|
||||
fprintf(TIMELOG,"Gnsxx Gnsyy Gnszz Gnsxy Gnsxz Gnsyz ");
|
||||
fprintf(TIMELOG,"trawn trJwn trRwn "); //trimmed curvature,
|
||||
fprintf(TIMELOG,"wwndnw wwnsdnwn Jwnwwndnw "); //kinematic quantities,
|
||||
fprintf(TIMELOG,"Euler Kn Jn An\n"); //miknowski measures,
|
||||
fprintf(TIMELOG,"Vw Aw Jw Xw "); //miknowski measures,
|
||||
fprintf(TIMELOG,"Vn An Jn Xn\n"); //miknowski measures,
|
||||
// fprintf(TIMELOG,"Euler Kn Jn An\n"); //miknowski measures,
|
||||
}
|
||||
|
||||
NWPLOG = fopen("components.NWP.tcat","a+");
|
||||
@@ -209,7 +214,9 @@ TwoPhase::TwoPhase(std::shared_ptr <Domain> dm):
|
||||
fprintf(TIMELOG,"Gnsxx Gnsyy Gnszz Gnsxy Gnsxz Gnsyz ");
|
||||
fprintf(TIMELOG,"trawn trJwn trRwn "); //trimmed curvature,
|
||||
fprintf(TIMELOG,"wwndnw wwnsdnwn Jwnwwndnw "); //kinematic quantities,
|
||||
fprintf(TIMELOG,"Euler Kn Jn An\n"); //miknowski measures,
|
||||
fprintf(TIMELOG,"Vw Aw Jw Xw "); //miknowski measures,
|
||||
fprintf(TIMELOG,"Vn An Jn Xn\n"); //miknowski measures,
|
||||
// fprintf(TIMELOG,"Euler Kn Jn An\n"); //miknowski measures,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,7 +579,7 @@ void TwoPhase::ComputeLocal()
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
Array <char> phase_label(Nx,Ny,Nz);
|
||||
Array <double> phase_distance(Nx,Ny,Nz);
|
||||
// Analyze the wetting fluid
|
||||
@@ -597,8 +604,8 @@ void TwoPhase::ComputeLocal()
|
||||
}
|
||||
}
|
||||
CalcDist(phase_distance,phase_label,*Dm);
|
||||
wet_morph.ComputeScalar(phase_distance,0.f);
|
||||
printf("generating distance at rank=%i \n",Dm->rank());
|
||||
wet_morph->ComputeScalar(phase_distance,0.f);
|
||||
//printf("generating distance at rank=%i \n",Dm->rank());
|
||||
// Analyze the wetting fluid
|
||||
for (k=0; k<Nz; k++){
|
||||
for (j=0; j<Ny; j++){
|
||||
@@ -620,12 +627,12 @@ void TwoPhase::ComputeLocal()
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("calculate distance at rank=%i \n",Dm->rank());
|
||||
//printf("calculate distance at rank=%i \n",Dm->rank());
|
||||
CalcDist(phase_distance,phase_label,*Dm);
|
||||
printf("morphological analysis at rank=%i \n",Dm->rank());
|
||||
nonwet_morph.ComputeScalar(phase_distance,0.f);
|
||||
printf("rank=%i completed \n",Dm->rank());
|
||||
*/
|
||||
//printf("morphological analysis at rank=%i \n",Dm->rank());
|
||||
nonwet_morph->ComputeScalar(phase_distance,0.f);
|
||||
//printf("rank=%i completed \n",Dm->rank());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1076,129 +1083,6 @@ void TwoPhase::ComponentAverages()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TwoPhase::WriteSurfaces(int logcount)
|
||||
{
|
||||
int i,j,k;
|
||||
int ncubes=(Nx-1)*(Ny-1)*(Nz-1);
|
||||
Point P,A,B,C;
|
||||
|
||||
std::shared_ptr<IO::TriList> wn_mesh( new IO::TriList() );
|
||||
wn_mesh->A.reserve(8*ncubes);
|
||||
wn_mesh->B.reserve(8*ncubes);
|
||||
wn_mesh->C.reserve(8*ncubes);
|
||||
|
||||
std::shared_ptr<IO::TriList> ns_mesh( new IO::TriList() );
|
||||
ns_mesh->A.reserve(8*ncubes);
|
||||
ns_mesh->B.reserve(8*ncubes);
|
||||
ns_mesh->C.reserve(8*ncubes);
|
||||
|
||||
std::shared_ptr<IO::TriList> ws_mesh( new IO::TriList() );
|
||||
ws_mesh->A.reserve(8*ncubes);
|
||||
ws_mesh->B.reserve(8*ncubes);
|
||||
ws_mesh->C.reserve(8*ncubes);
|
||||
|
||||
for (k=1; k<Nz-1; k++){
|
||||
for (j=1; j<Ny-1; j++){
|
||||
for (i=1; i<Nx-1; i++){ // Get cube from the list
|
||||
|
||||
//...........................................................................
|
||||
// Construct the interfaces and common curve
|
||||
pmmc_ConstructLocalCube(SDs, SDn, solid_isovalue, fluid_isovalue,
|
||||
nw_pts, nw_tris, Values, ns_pts, ns_tris, ws_pts, ws_tris,
|
||||
local_nws_pts, nws_pts, nws_seg, local_sol_pts, local_sol_tris,
|
||||
n_local_sol_tris, n_local_sol_pts, n_nw_pts, n_nw_tris,
|
||||
n_ws_pts, n_ws_tris, n_ns_tris, n_ns_pts, n_local_nws_pts, n_nws_pts, n_nws_seg,
|
||||
i, j, k, Nx, Ny, Nz);
|
||||
|
||||
//.......................................................................................
|
||||
// Write the triangle lists to text file
|
||||
for (int r=0;r<n_nw_tris;r++){
|
||||
A = nw_pts(nw_tris(0,r));
|
||||
B = nw_pts(nw_tris(1,r));
|
||||
C = nw_pts(nw_tris(2,r));
|
||||
// compare the trianlge orientation against the color gradient
|
||||
// Orientation of the triangle
|
||||
double tri_normal_x = (A.y-B.y)*(B.z-C.z) - (A.z-B.z)*(B.y-C.y);
|
||||
double tri_normal_y = (A.z-B.z)*(B.x-C.x) - (A.x-B.x)*(B.z-C.z);
|
||||
double tri_normal_z = (A.x-B.x)*(B.y-C.y) - (A.y-B.y)*(B.x-C.x);
|
||||
|
||||
double normal_x = SDn_x(i,j,k);
|
||||
double normal_y = SDn_y(i,j,k);
|
||||
double normal_z = SDn_z(i,j,k);
|
||||
|
||||
// If the normals don't point in the same direction, flip the orientation of the triangle
|
||||
// Right hand rule for triangle orientation is used to determine rendering for most software
|
||||
if (normal_x*tri_normal_x + normal_y*tri_normal_y + normal_z*tri_normal_z < 0.0){
|
||||
P = A;
|
||||
A = C;
|
||||
C = P;
|
||||
}
|
||||
// Remap the points
|
||||
A.x += 1.0*Dm->iproc()*(Nx-2);
|
||||
A.y += 1.0*Dm->jproc()*(Nx-2);
|
||||
A.z += 1.0*Dm->kproc()*(Nx-2);
|
||||
B.x += 1.0*Dm->iproc()*(Nx-2);
|
||||
B.y += 1.0*Dm->jproc()*(Nx-2);
|
||||
B.z += 1.0*Dm->kproc()*(Nx-2);
|
||||
C.x += 1.0*Dm->iproc()*(Nx-2);
|
||||
C.y += 1.0*Dm->jproc()*(Nx-2);
|
||||
C.z += 1.0*Dm->kproc()*(Nx-2);
|
||||
wn_mesh->A.push_back(A);
|
||||
wn_mesh->B.push_back(B);
|
||||
wn_mesh->C.push_back(C);
|
||||
}
|
||||
for (int r=0;r<n_ws_tris;r++){
|
||||
A = ws_pts(ws_tris(0,r));
|
||||
B = ws_pts(ws_tris(1,r));
|
||||
C = ws_pts(ws_tris(2,r));
|
||||
// Remap the points
|
||||
A.x += 1.0*Dm->iproc()*(Nx-2);
|
||||
A.y += 1.0*Dm->jproc()*(Nx-2);
|
||||
A.z += 1.0*Dm->kproc()*(Nx-2);
|
||||
B.x += 1.0*Dm->iproc()*(Nx-2);
|
||||
B.y += 1.0*Dm->jproc()*(Nx-2);
|
||||
B.z += 1.0*Dm->kproc()*(Nx-2);
|
||||
C.x += 1.0*Dm->iproc()*(Nx-2);
|
||||
C.y += 1.0*Dm->jproc()*(Nx-2);
|
||||
C.z += 1.0*Dm->kproc()*(Nx-2);
|
||||
ws_mesh->A.push_back(A);
|
||||
ws_mesh->B.push_back(B);
|
||||
ws_mesh->C.push_back(C);
|
||||
}
|
||||
for (int r=0;r<n_ns_tris;r++){
|
||||
A = ns_pts(ns_tris(0,r));
|
||||
B = ns_pts(ns_tris(1,r));
|
||||
C = ns_pts(ns_tris(2,r));
|
||||
// Remap the points
|
||||
A.x += 1.0*Dm->iproc()*(Nx-2);
|
||||
A.y += 1.0*Dm->jproc()*(Nx-2);
|
||||
A.z += 1.0*Dm->kproc()*(Nx-2);
|
||||
B.x += 1.0*Dm->iproc()*(Nx-2);
|
||||
B.y += 1.0*Dm->jproc()*(Nx-2);
|
||||
B.z += 1.0*Dm->kproc()*(Nx-2);
|
||||
C.x += 1.0*Dm->iproc()*(Nx-2);
|
||||
C.y += 1.0*Dm->jproc()*(Nx-2);
|
||||
C.z += 1.0*Dm->kproc()*(Nx-2);
|
||||
ns_mesh->A.push_back(A);
|
||||
ns_mesh->B.push_back(B);
|
||||
ns_mesh->C.push_back(C);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<IO::MeshDataStruct> meshData(4);
|
||||
meshData[0].meshName = "wn-tris";
|
||||
meshData[0].mesh = wn_mesh;
|
||||
meshData[1].meshName = "ws-tris";
|
||||
meshData[1].mesh = ws_mesh;
|
||||
meshData[2].meshName = "ns-tris";
|
||||
meshData[2].mesh = ns_mesh;
|
||||
IO::writeData( logcount, meshData, Dm->Comm );
|
||||
|
||||
}
|
||||
|
||||
void TwoPhase::Reduce()
|
||||
{
|
||||
int i;
|
||||
@@ -1327,7 +1211,9 @@ 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
|
||||
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 %.5g\n",euler_global, Kn_global, Jn_global, An_global); // minkowski measures
|
||||
fprintf(TIMELOG,"%.5g %.5g %.5g %.5g ",wet_morph->V(), wet_morph->A(), wet_morph->J(), wet_morph->X());
|
||||
fprintf(TIMELOG,"%.5g %.5g %.5g %.5g\n",nonwet_morph->V(), nonwet_morph->A(), nonwet_morph->J(), nonwet_morph->X());
|
||||
// fprintf(TIMELOG,"%.5g %.5g %.5g %.5g\n",euler_global, Kn_global, Jn_global, An_global); // minkowski measures
|
||||
fflush(TIMELOG);
|
||||
}
|
||||
else{
|
||||
@@ -1352,7 +1238,9 @@ void TwoPhase::PrintAll(int timestep)
|
||||
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 ",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->Ai, wet_morph->Ji, wet_morph->Xi);
|
||||
fprintf(TIMELOG,"%.5g %.5g %.5g %.5g\n",nonwet_morph->Vi, nonwet_morph->Ai, nonwet_morph->Ji, nonwet_morph->Xi);
|
||||
// fprintf(TIMELOG,"%.5g %.5g %.5g %.5g\n",euler, Kn, Jn, An); // minkowski measures
|
||||
fflush(TIMELOG);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user