diff --git a/dumux/io/cakegridcreator.hh b/dumux/io/cakegridcreator.hh index d22c8eba89e7045d2c5aa938ecbe907dc7c75e33..67b8c269a9db30d5b3fd8ffcef89d1bc5e299bf6 100644 --- a/dumux/io/cakegridcreator.hh +++ b/dumux/io/cakegridcreator.hh @@ -269,7 +269,7 @@ public: std::cout << " -> h " << height * length << std::endl; } - // if not do power spacing + // if grading factor is not 1.0, do power law spacing else { height = (1.0 - gradingFactor) / (1.0 - pow(gradingFactor, numCells)); @@ -366,8 +366,10 @@ public: v[indices[0]] = cos(dA[j])*wellRadius + cos(dA[j])*dR[i]; v[indices[1]] = sin(dA[j])*wellRadius + sin(dA[j])*dR[i]; if (verbose) + { std::cout << "Coordinates of : " << v[0] << " " << v[1] << " " << v[2] << std::endl; + } gridFactory.insertVertex(v); } } diff --git a/dumux/io/gridcreator.hh b/dumux/io/gridcreator.hh index 30c51a1d86a0f2f1306db8e975a2a1e9ac3f610e..94f18994a79f1454d027447f1a5ba25706595449 100644 --- a/dumux/io/gridcreator.hh +++ b/dumux/io/gridcreator.hh @@ -796,13 +796,15 @@ public: // reverse behavior for negative values if (gradingFactor < 0.0) { - gradingFactor = -gradingFactor; + using std::abs; + gradingFactor = abs(gradingFactor); if (gradingFactor < 1.0) { increasingCellSize = true; } } + // if the grading factor is exactly 1.0 do equal spacing if (gradingFactor > 1.0 - 1e-7 && gradingFactor < 1.0 + 1e-7) { height = 1.0 / numCells; @@ -811,6 +813,7 @@ public: std::cout << " -> h " << height * length << std::endl; } } + // if grading factor is not 1.0, do power law spacing else { height = (1.0 - gradingFactor) / (1.0 - pow(gradingFactor, numCells)); diff --git a/test/io/gridcreator/test_gridcreator_cake.cc b/test/io/gridcreator/test_gridcreator_cake.cc index 0cdf73bf0a7a6699b851ac16f441f102bc6911c7..7f9d0b7fd1caa052498d67149522287a2a29bebd 100644 --- a/test/io/gridcreator/test_gridcreator_cake.cc +++ b/test/io/gridcreator/test_gridcreator_cake.cc @@ -37,7 +37,7 @@ namespace Dumux namespace Properties { NEW_TYPE_TAG(GridCreatorCakeTest, INHERITS_FROM(NumericModel)); -// Set the grid type +// Set the grid type #if HAVE_DUNE_ALUGRID SET_TYPE_PROP(GridCreatorCakeTest, Grid, Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming>); #elif HAVE_UG @@ -61,10 +61,10 @@ int main(int argc, char** argv) // Read the parameters from the input file using ParameterTree = typename GET_PROP(TypeTag, ParameterTree); - //First read parameters from input file + // first read parameters from input file Dune::ParameterTreeParser::readINITree("test_gridcreator_cake.input", ParameterTree::tree()); - //Make the grid + // make the grid Dune::Timer timer; GridCreator::makeGrid(); std::cout << "Constructing cake grid with " << GridCreator::grid().leafGridView().size(0) << " elements took "