debugging componentLabel
This commit is contained in:
parent
94987c365f
commit
6b21967e57
@ -238,7 +238,7 @@ public:
|
||||
}
|
||||
|
||||
void Initialize();
|
||||
void SetupCubes(Domain &Dm);
|
||||
// void SetupCubes(Domain &Dm);
|
||||
void UpdateMeshValues();
|
||||
void UpdateSolid();
|
||||
void ComputeDelPhi();
|
||||
@ -334,7 +334,7 @@ void TwoPhase::Initialize(){
|
||||
Jwn = Kwn = efawns = 0.0;
|
||||
trJwn = trawn = trRwn = 0.0;
|
||||
}
|
||||
|
||||
/*
|
||||
void TwoPhase::SetupCubes(Domain &Dm){
|
||||
int i,j,k;
|
||||
kstart = 1;
|
||||
@ -354,7 +354,7 @@ void TwoPhase::SetupCubes(Domain &Dm){
|
||||
}
|
||||
ncubes = nc;
|
||||
}
|
||||
|
||||
*/
|
||||
void TwoPhase::UpdateSolid(){
|
||||
Dm.CommunicateMeshHalo(SDs);
|
||||
//...........................................................................
|
||||
@ -430,11 +430,9 @@ void TwoPhase::ComputeLocal(){
|
||||
int i,j,k,n;
|
||||
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 (int c=0;c<ncubes;c++){
|
||||
// Get cube from the list
|
||||
i = cubeList(0,c);
|
||||
j = cubeList(1,c);
|
||||
k = cubeList(2,c);
|
||||
for (k=1; k<Nz-1; k++){
|
||||
for (j=1; j<Ny-1; j++){
|
||||
for (i=1; i<Nx-1; i++){
|
||||
//...........................................................................
|
||||
n_nw_pts=n_ns_pts=n_ws_pts=n_nws_pts=n_local_sol_pts=n_local_nws_pts=0;
|
||||
n_nw_tris=n_ns_tris=n_ws_tris=n_nws_seg=n_local_sol_tris=0;
|
||||
@ -529,6 +527,8 @@ void TwoPhase::ComputeLocal(){
|
||||
}
|
||||
//...........................................................................
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TwoPhase::ComponentAverages(){
|
||||
@ -549,11 +549,9 @@ void TwoPhase::ComponentAverages(){
|
||||
printf("Number of non-wetting phase components is %i \n",NumberComponents_NWP);
|
||||
}
|
||||
|
||||
for (int c=0;c<ncubes;c++){
|
||||
// Get cube from the list
|
||||
i = cubeList(0,c);
|
||||
j = cubeList(1,c);
|
||||
k = cubeList(2,c);
|
||||
for (k=1; k<Nz-1; k++){
|
||||
for (j=1; j<Ny-1; j++){
|
||||
for (i=1; i<Nx-1; i++){
|
||||
|
||||
LabelWP=GetCubeLabel(i,j,k,Label_WP);
|
||||
LabelNWP=GetCubeLabel(i,j,k,Label_NWP);
|
||||
@ -635,12 +633,12 @@ void TwoPhase::ComponentAverages(){
|
||||
// Compute the normal speed of the interface
|
||||
pmmc_InterfaceSpeed(dPdt, SDn_x, SDn_y, SDn_z, CubeValues, nw_pts, nw_tris,
|
||||
NormalVector, InterfaceSpeed, vawn, i, j, k, n_nw_pts, n_nw_tris);
|
||||
ComponentAverages_WP(VAWNX,LabelWP) += vawn(0);
|
||||
ComponentAverages_WP(VAWNY,LabelWP) += vawn(1);
|
||||
ComponentAverages_WP(VAWNZ,LabelWP) += vawn(2);
|
||||
ComponentAverages_NWP(VAWNX,LabelNWP) += vawn(0);
|
||||
ComponentAverages_NWP(VAWNY,LabelNWP) += vawn(1);
|
||||
ComponentAverages_NWP(VAWNZ,LabelNWP) += vawn(2);
|
||||
ComponentAverages_WP(VWNX,LabelWP) += vawn(0);
|
||||
ComponentAverages_WP(VWNY,LabelWP) += vawn(1);
|
||||
ComponentAverages_WP(VWNZ,LabelWP) += vawn(2);
|
||||
ComponentAverages_NWP(VWNX,LabelNWP) += vawn(0);
|
||||
ComponentAverages_NWP(VWNY,LabelNWP) += vawn(1);
|
||||
ComponentAverages_NWP(VWNZ,LabelNWP) += vawn(2);
|
||||
|
||||
// Interfacial Area
|
||||
TempLocal = pmmc_CubeSurfaceOrientation(Gwn,nw_pts,nw_tris,n_nw_tris);
|
||||
@ -674,12 +672,12 @@ void TwoPhase::ComponentAverages(){
|
||||
// Kinematic velocity of the common curve
|
||||
pmmc_CommonCurveSpeed(CubeValues, dPdt, vawns, SDn_x, SDn_y, SDn_z,SDs_x,SDs_y,SDs_z,
|
||||
local_nws_pts,i,j,k,n_local_nws_pts);
|
||||
ComponentAverages_WP(VAWNSX,LabelWP) += vawns(0);
|
||||
ComponentAverages_WP(VAWNSY,LabelWP) += vawns(1);
|
||||
ComponentAverages_WP(VAWNSZ,LabelWP) += vawns(2);
|
||||
ComponentAverages_NWP(VAWNSX,LabelNWP) += vawns(0);
|
||||
ComponentAverages_NWP(VAWNSY,LabelNWP) += vawns(1);
|
||||
ComponentAverages_NWP(VAWNSZ,LabelNWP) += vawns(2);
|
||||
ComponentAverages_WP(VWNSX,LabelWP) += vawns(0);
|
||||
ComponentAverages_WP(VWNSY,LabelWP) += vawns(1);
|
||||
ComponentAverages_WP(VWNSZ,LabelWP) += vawns(2);
|
||||
ComponentAverages_NWP(VWNSX,LabelNWP) += vawns(0);
|
||||
ComponentAverages_NWP(VWNSY,LabelNWP) += vawns(1);
|
||||
ComponentAverages_NWP(VWNSZ,LabelNWP) += vawns(2);
|
||||
|
||||
// Curvature of the common curve
|
||||
pmmc_CurveCurvature(SDn, SDs, SDn_x, SDn_y, SDn_z, SDs_x, SDs_y,
|
||||
@ -710,7 +708,8 @@ void TwoPhase::ComponentAverages(){
|
||||
//...........................................................................
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -850,12 +849,12 @@ void TwoPhase::SortBlobs(){
|
||||
//printf("-----------------------------------------------\n");
|
||||
int TempLabel,a,aa,bb,i,j,k,idx;
|
||||
double TempValue;
|
||||
IntArray OldLabel(nblobs_global);
|
||||
for (a=0; a<nblobs_global; a++) OldLabel(a) = a;
|
||||
IntArray OldLabel(NumberComponents_NWP);
|
||||
for (a=0; a<NumberComponents_NWP; a++) OldLabel(a) = a;
|
||||
// Sort the blob averages based on volume
|
||||
for (aa=0; aa<nblobs_global-1; aa++){
|
||||
for ( bb=aa+1; bb<nblobs_global; bb++){
|
||||
if (BlobAverages(0,aa) < BlobAverages(0,bb)){
|
||||
if (ComponentAverages_NWP(0,aa) < ComponentAverages_NWP(0,bb)){
|
||||
// Exchange location of blobs aa and bb
|
||||
//printf("Switch blob %i with %i \n", OldLabel(aa),OldLabel(bb));
|
||||
// switch the label
|
||||
@ -864,16 +863,16 @@ void TwoPhase::SortBlobs(){
|
||||
OldLabel(aa) = TempLabel;
|
||||
// switch the averages
|
||||
for (idx=0; idx<BLOB_AVG_COUNT; idx++){
|
||||
TempValue = BlobAverages(idx,bb);
|
||||
BlobAverages(idx,bb) = BlobAverages(idx,aa);
|
||||
BlobAverages(idx,aa) = TempValue;
|
||||
TempValue = ComponentAverages_NWP(idx,bb);
|
||||
ComponentAverages_NWP(idx,bb) = ComponentAverages_NWP(idx,aa);
|
||||
ComponentAverages_NWP(idx,aa) = TempValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IntArray NewLabel(nblobs_global);
|
||||
for (aa=0; aa<nblobs_global; aa++){
|
||||
IntArray NewLabel(NumberComponents_NWP);
|
||||
for (aa=0; aa<NumberComponents_NWP; aa++){
|
||||
// Match the new label for original blob aa
|
||||
bb=0;
|
||||
while (OldLabel(bb) != aa) bb++;
|
||||
@ -885,9 +884,9 @@ void TwoPhase::SortBlobs(){
|
||||
for (k=0; k<Nz; k++){
|
||||
for (j=0; j<Ny; j++){
|
||||
for (i=0; i<Nx; i++){
|
||||
if (BlobLabel(i,j,k) > -1){
|
||||
TempLabel = NewLabel(BlobLabel(i,j,k));
|
||||
BlobLabel(i,j,k) = TempLabel;
|
||||
if (Label_NWP(i,j,k) > -1){
|
||||
TempLabel = NewLabel(Label_NWP(i,j,k));
|
||||
Label_NWP(i,j,k) = TempLabel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,11 +67,11 @@ inline void WriteBlobStates(TwoPhase TCAT, double D, double porosity){
|
||||
pw = TCAT.paw_global;
|
||||
aws = TCAT.aws;
|
||||
// Compute the averages over the entire non-wetting phase
|
||||
printf("Writing blobstates.tcat for %i components \n",TCAT.nblobs_global);
|
||||
printf("Writing blobstates.tcat for %i components \n",TCAT.NumberComponents_NWP);
|
||||
FILE *BLOBSTATES;
|
||||
BLOBSTATES = fopen("./blobstates.tcat","w");
|
||||
if (BLOBSTATES==NULL) ERROR("Cannot open blobstates.tcat for writing");
|
||||
for (a=0; a<TCAT.nblobs_global; a++){
|
||||
for (a=0; a<TCAT.NumberComponents_NWP; a++){
|
||||
vol_n += TCAT.ComponentAverages_NWP(0,a);
|
||||
pan += TCAT.ComponentAverages_NWP(2,a)*TCAT.ComponentAverages_NWP(0,a);
|
||||
awn += TCAT.ComponentAverages_NWP(3,a);
|
||||
@ -87,7 +87,7 @@ inline void WriteBlobStates(TwoPhase TCAT, double D, double porosity){
|
||||
// Compute the pore voume (sum of wetting an non-wetting phase volumes)
|
||||
PoreVolume=TCAT.wp_volume_global + nwp_volume;
|
||||
// Subtract off portions of non-wetting phase in order of size
|
||||
for (a=TCAT.nblobs_global-1; a>0; a--){
|
||||
for (a=TCAT.NumberComponents_NWP-1; a>0; a--){
|
||||
// Subtract the features one-by-one
|
||||
vol_n -= TCAT.ComponentAverages_NWP(0,a);
|
||||
pan -= TCAT.ComponentAverages_NWP(2,a)*TCAT.ComponentAverages_NWP(0,a);
|
||||
@ -356,11 +356,11 @@ int main(int argc, char **argv)
|
||||
pw = Averages.paw_global;
|
||||
aws = Averages.aws;
|
||||
// Compute the averages over the entire non-wetting phase
|
||||
printf("Writing blobstates.tcat for %i components \n",Averages.nblobs_global);
|
||||
printf("Writing blobstates.tcat for %i components \n",Averages.NumberComponents_NWP);
|
||||
FILE *BLOBSTATES;
|
||||
BLOBSTATES = fopen("./blobstates.tcat","w");
|
||||
if (BLOBSTATES==NULL) ERROR("Cannot open blobstates.tcat for writing");
|
||||
for (a=0; a<Averages.nblobs_global; a++){
|
||||
for (a=0; a<Averages.NumberComponents_NWP; a++){
|
||||
vol_n += Averages.ComponentAverages_NWP(0,a);
|
||||
pan += Averages.ComponentAverages_NWP(2,a)*Averages.ComponentAverages_NWP(0,a);
|
||||
awn += Averages.ComponentAverages_NWP(3,a);
|
||||
@ -376,7 +376,7 @@ int main(int argc, char **argv)
|
||||
// Compute the pore voume (sum of wetting an non-wetting phase volumes)
|
||||
PoreVolume=Averages.wp_volume_global + nwp_volume;
|
||||
// Subtract off portions of non-wetting phase in order of size
|
||||
for (a=Averages.nblobs_global-1; a>0; a--){
|
||||
for (a=Averages.NumberComponents_NWP-1; a>0; a--){
|
||||
// Subtract the features one-by-one
|
||||
vol_n -= Averages.ComponentAverages_NWP(0,a);
|
||||
pan -= Averages.ComponentAverages_NWP(2,a)*Averages.ComponentAverages_NWP(0,a);
|
||||
|
Loading…
Reference in New Issue
Block a user