Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory errors in nightly test for ABL Top BC implementation. #64

Merged
merged 2 commits into from
Dec 14, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/AssembleMomentumEdgeABLTopBC.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class AssembleMomentumEdgeABLTopBC : public SolverAlgorithm
stk::mesh::Part *part,
EquationSystem *eqSystem, std::vector<int>& grid_dims_,
std::vector<int>& horiz_bcs_, double z_sample_);
virtual ~AssembleMomentumEdgeABLTopBC() {}
virtual ~AssembleMomentumEdgeABLTopBC();
virtual void initialize_connectivity();

/** Main function to compute and set the boundary values.
Expand Down
33 changes: 30 additions & 3 deletions src/AssembleMomentumEdgeABLTopBC.C
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,32 @@ AssembleMomentumEdgeABLTopBC::AssembleMomentumEdgeABLTopBC(
bcVelocity_ = meta_data.get_field<VectorFieldType>(stk::topology::NODE_RANK, "cont_velocity_bc");
}

AssembleMomentumEdgeABLTopBC::~AssembleMomentumEdgeABLTopBC()
{
switch (horizBCType_) {
case 0:
fftw_destroy_plan(planFourier2dF_);
fftw_destroy_plan(planFourier2dB_);
break;

case 1:
fftw_destroy_plan(planSinx_);
fftw_destroy_plan(planCosx_);
fftw_destroy_plan(planFourieryF_);
fftw_destroy_plan(planFourieryB_);
break;

case 3:
fftw_destroy_plan(planSinx_);
fftw_destroy_plan(planCosx_);
fftw_destroy_plan(planSiny_);
fftw_destroy_plan(planCosy_);
break;
}

fftw_cleanup();
}

//--------------------------------------------------------------------------
//-------- initialize_connectivity -----------------------------------------
//--------------------------------------------------------------------------
Expand Down Expand Up @@ -269,9 +295,10 @@ AssembleMomentumEdgeABLTopBC::initialize()
fftw_plan_r2r_1d(ny+1, work.data(), work.data(), FFTW_REDFT00, flags);
break;
default:
printf("%s\n","BC not yet implemented");
exit(0);
}
throw std::runtime_error(
"AssembleMomentumEdgeABLTopBC::initialize(): Invalid value for "
"horizBCType_. Must be 0, 1, or 3.");
}

// Determine the vertical mesh distribution by sampling at the middle
// of the ix=0 face.
Expand Down