Skip to content

Commit

Permalink
HexMesh: Allow verbosity flag in GeometricSpacing
Browse files Browse the repository at this point in the history
Allow user to control output of spacing array for stretched meshes.
  • Loading branch information
sayerhs committed Oct 2, 2017
1 parent 78c3a82 commit f340173
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/mesh/HexBlockMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,11 @@ void HexBlockMesh::generate_coordinates(const std::vector<stk::mesh::EntityId>&
VectorFieldType* coords = meta_.get_field<VectorFieldType>(
stk::topology::NODE_RANK, "coordinates");

// // TODO: implement stretching factors
// double dx = 1.0 / static_cast<double>(meshDims_[0]);
// double dy = 1.0 / static_cast<double>(meshDims_[1]);
// double dz = 1.0 / static_cast<double>(meshDims_[2]);
std::cout << "\t Generating x spacing: " << xspacing_type_ << std::endl;
xSpacing_->init_spacings();
std::cout << "\t Generating y spacing: " << yspacing_type_ << std::endl;
ySpacing_->init_spacings();
std::cout << "\t Generating z spacing: " << zspacing_type_ << std::endl;
zSpacing_->init_spacings();

auto& rxvec = xSpacing_->ratios();
Expand Down
8 changes: 5 additions & 3 deletions src/mesh/spacing/GeometricStretching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ GeometricStretching::GeometricStretching(
void GeometricStretching::load(const YAML::Node& node)
{
wind_utils::get_optional(node, "bidirectional", bidirectional_);
wind_utils::get_optional(node, "verbose", verbose_);
fac_ = node["stretching_factor"].as<double>();

int ny = bidirectional_? (numPts_ - 1)/2 + (numPts_ - 1) % 2: (numPts_ - 1);
Expand All @@ -48,6 +49,10 @@ void GeometricStretching::init_spacings()
unidirectional_stretching();
else
bidirectional_stretching();

if (verbose_)
for (int i=0; i < numPts_; i++)
std::cerr << i << "\t" << ratios_[i] << std::endl;
}

void GeometricStretching::bidirectional_stretching()
Expand All @@ -63,8 +68,6 @@ void GeometricStretching::bidirectional_stretching()
rfac *= fac_;
}

for (int i=0; i < numPts_; i++)
std::cerr << i << "\t" << ratios_[i] << std::endl;
}

void GeometricStretching::unidirectional_stretching()
Expand All @@ -73,7 +76,6 @@ void GeometricStretching::unidirectional_stretching()
double rfac = 1.0;
for (int i=1; i < numPts_; i++) {
ratios_[i] = ratios_[i-1] + fch_ * rfac;
std::cerr << i << "\t" << ratios_[i] << std::endl;
rfac *= fac_;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/mesh/spacing/GeometricStretching.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class GeometricStretching : public MeshSpacing

//! Flag indicating whether the geometric stretching is applied at both ends.
bool bidirectional_{false};

//! Flag indicating whether to dump spacing array to screen
bool verbose_{false};
};

} // nalu
Expand Down

0 comments on commit f340173

Please sign in to comment.