Updated Minkowski

This commit is contained in:
James E McClure
2018-06-07 12:11:15 -04:00
parent afc2767416
commit 2d8e1ca024
2 changed files with 62 additions and 57 deletions

View File

@@ -48,7 +48,7 @@ Minkowski::Minkowski(std::shared_ptr <Domain> dm):
{ {
// If LOGFILE is empty, write a short header to list the averages // If LOGFILE is empty, write a short header to list the averages
//fprintf(LOGFILE,"--------------------------------------------------------------------------------------\n"); //fprintf(LOGFILE,"--------------------------------------------------------------------------------------\n");
fprintf(LOGFILE,"Euler Kn Jn An\n"); //miknowski measures, fprintf(LOGFILE,"Vn An Jn Xn\n"); //miknowski measures,
} }
} }
} }
@@ -122,6 +122,7 @@ void Minkowski::ComputeLocal()
if (Dm->BoundaryCondition > 0 && Dm->kproc() == 0) kmin=4; if (Dm->BoundaryCondition > 0 && Dm->kproc() == 0) kmin=4;
if (Dm->BoundaryCondition > 0 && Dm->kproc() == Dm->nprocz()-1) kmax=Nz-4; if (Dm->BoundaryCondition > 0 && Dm->kproc() == Dm->nprocz()-1) kmax=Nz-4;
vol_n = euler = Jn = An = Kn = 0.0;
for (k=kmin; k<kmax; k++){ for (k=kmin; k<kmax; k++){
for (j=1; j<Ny-1; j++){ for (j=1; j<Ny-1; j++){
for (i=1; i<Nx-1; i++){ for (i=1; i<Nx-1; i++){
@@ -196,7 +197,6 @@ void Minkowski::Reduce()
MPI_Allreduce(&euler,&euler_global,1,MPI_DOUBLE,MPI_SUM,Dm->Comm); MPI_Allreduce(&euler,&euler_global,1,MPI_DOUBLE,MPI_SUM,Dm->Comm);
MPI_Allreduce(&An,&An_global,1,MPI_DOUBLE,MPI_SUM,Dm->Comm); MPI_Allreduce(&An,&An_global,1,MPI_DOUBLE,MPI_SUM,Dm->Comm);
MPI_Allreduce(&Jn,&Jn_global,1,MPI_DOUBLE,MPI_SUM,Dm->Comm); MPI_Allreduce(&Jn,&Jn_global,1,MPI_DOUBLE,MPI_SUM,Dm->Comm);
MPI_Barrier(Dm->Comm); MPI_Barrier(Dm->Comm);
// normalize to per unit volume basis // normalize to per unit volume basis

View File

@@ -103,6 +103,9 @@ int main(int argc, char **argv)
// Determine the maximum number of levels for the desired coarsen ratio // Determine the maximum number of levels for the desired coarsen ratio
int ratio[3] = {2,2,2}; int ratio[3] = {2,2,2};
//std::vector<size_t> ratio = {4,4,4}; //std::vector<size_t> ratio = {4,4,4};
// need to set up databases for each level of the mesh
std:vector<Database> multidomain_db;
std::vector<int> Nx(1,nx), Ny(1,ny), Nz(1,nz); std::vector<int> Nx(1,nx), Ny(1,ny), Nz(1,nz);
while ( Nx.back()%ratio[0]==0 && Nx.back()>8 && while ( Nx.back()%ratio[0]==0 && Nx.back()>8 &&
Ny.back()%ratio[1]==0 && Ny.back()>8 && Ny.back()%ratio[1]==0 && Ny.back()>8 &&
@@ -111,6 +114,8 @@ int main(int argc, char **argv)
Nx.push_back( Nx.back()/ratio[0] ); Nx.push_back( Nx.back()/ratio[0] );
Ny.push_back( Ny.back()/ratio[1] ); Ny.push_back( Ny.back()/ratio[1] );
Nz.push_back( Nz.back()/ratio[2] ); Nz.push_back( Nz.back()/ratio[2] );
// clone the domain and create coarse version based on Nx,Ny,Nz
//multidomain_db.push_back();
} }
int N_levels = Nx.size(); int N_levels = Nx.size();
@@ -118,7 +123,7 @@ int main(int argc, char **argv)
std::vector<std::shared_ptr<Domain>> Dm(N_levels); std::vector<std::shared_ptr<Domain>> Dm(N_levels);
for (int i=0; i<N_levels; i++) { for (int i=0; i<N_levels; i++) {
// This line is no good -- will create identical Domain structures instead of // This line is no good -- will create identical Domain structures instead of
// Need a way to define a coarse structure for the coarse domain // Need a way to define a coarse structure for the coarse domain (see above)
Dm[i].reset( new Domain(domain_db, comm) ); Dm[i].reset( new Domain(domain_db, comm) );
int N = (Nx[i]+2)*(Ny[i]+2)*(Nz[i]+2); int N = (Nx[i]+2)*(Ny[i]+2)*(Nz[i]+2);
for (int n=0; n<N; n++){ for (int n=0; n<N; n++){