Skip to content
Snippets Groups Projects
Commit b33296c8 authored by Timo Koch's avatar Timo Koch
Browse files

Revert "[ff][test] Add rotational-symmetric pipe flow test"

This reverts commit 37c21581.
parent d81477ae
No related branches found
No related tags found
1 merge request!2189Revert "Enable rotational-symmetric geometries for the staggered/freeflow models"
add_subdirectory(1d) add_subdirectory(1d)
add_subdirectory(2d) add_subdirectory(2d)
add_subdirectory(3d) add_subdirectory(3d)
add_subdirectory(pipe)
dune_symlink_to_source_files(FILES params.input)
dumux_add_test(NAME test_ff_stokes_channel_pipe
LABELS freeflow navierstokes
SOURCES main.cc
LABELS freeflow
CMAKE_GUARD HAVE_UMFPACK
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_CURRENT_BINARY_DIR}/test_ff_stokes_channel_pipe-00000.vtu
${CMAKE_CURRENT_BINARY_DIR}/test_ff_stokes_channel_pipe-00001.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_ff_stokes_channel_pipe params.input"
--zeroThreshold {"velocity_liq \(m/s\)":1e-12})
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#include <config.h>
#include <iostream>
#include <dune/common/parallel/mpihelper.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
#include <dumux/common/partial.hh>
#include <dumux/linear/seqsolverbackend.hh>
#include <dumux/assembly/diffmethod.hh>
#include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/staggeredvtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager_yasp.hh>
#include <dumux/assembly/staggeredfvassembler.hh>
#include <dumux/nonlinear/newtonsolver.hh>
#include "properties.hh"
int main(int argc, char** argv) try
{
using namespace Dumux;
// initialize MPI, finalize is done automatically on exit
const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
// parse command line arguments and input file
Parameters::init(argc, argv);
// Define the sub problem type tags
using TypeTag = Properties::TTag::PipeFlow;
// try to create a grid (from the given grid file or the input file)
Dumux::GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager;
gridManager.init();
// we compute on the leaf grid view
const auto& gridView = gridManager.grid().leafGridView();
// create the finite volume grid geometry
using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
auto gridGeometry = std::make_shared<GridGeometry>(gridView);
gridGeometry->update();
// the problem (initial and boundary conditions)
using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(gridGeometry);
// the solution vector
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector sol;
sol[GridGeometry::cellCenterIdx()].resize(gridGeometry->numCellCenterDofs());
sol[GridGeometry::faceIdx()].resize(gridGeometry->numFaceDofs());
problem->applyInitialSolution(sol);
// the grid variables
using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry);
gridVariables->init(sol);
// intialize the vtk output module
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
StaggeredVtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, sol, problem->name());
IOFields::initOutputModule(vtkWriter); // Add model specific output fields
vtkWriter.write(0.0);
// the assembler with time loop for instationary problem
using Assembler = StaggeredFVAssembler<TypeTag, DiffMethod::numeric>;
auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables);
// the linear solver
using LinearSolver = Dumux::UMFPackBackend;
auto linearSolver = std::make_shared<LinearSolver>();
// the non-linear solver
using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>;
NewtonSolver nonLinearSolver(assembler, linearSolver);
nonLinearSolver.solve(sol);
vtkWriter.write(1.0);
// print dumux end message
if (mpiHelper.rank() == 0)
Parameters::print();
return 0;
} // end main
catch (const Dumux::ParameterException &e)
{
std::cerr << std::endl << e << " ---> Abort!" << std::endl;
return 1;
}
catch (const Dune::DGFException & e)
{
std::cerr << "DGF exception thrown (" << e <<
"). Most likely, the DGF file name is wrong "
"or the DGF file is corrupted, "
"e.g. missing hash at end of file or wrong number (dimensions) of entries."
<< " ---> Abort!" << std::endl;
return 2;
}
catch (const Dune::Exception &e)
{
std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl;
return 3;
}
[Grid]
Positions0 = 0 0.1 # [m]
Positions1 = 0 1.0 # [m]
Cells0 = 10 # [-]
Cells1 = 100 # [-]
Grading0 = 1
Grading1 = 1
[Problem]
Name = pipe
MeanInletVelocity = 0.1 # [m/s]
[Vtk]
OutputName = test_ff_stokes_channel
[Problem]
EnableGravity = false
EnableInertiaTerms = false
[Vtk]
AddVelocity = 1
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#ifndef DUMUX_TEST_FREEFLOW_PIPE_PROBLEM_HH
#define DUMUX_TEST_FREEFLOW_PIPE_PROBLEM_HH
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
#include <dumux/freeflow/navierstokes/problem.hh>
#include <dumux/freeflow/navierstokes/boundarytypes.hh>
namespace Dumux {
/*!
* \brief Freeflow problem for pipe flow
* Simulation of a radially-symmetric pipe flow with circular cross-section
*/
template <class TypeTag>
class FreeFlowPipeProblem : public NavierStokesProblem<TypeTag>
{
using ParentType = NavierStokesProblem<TypeTag>;
using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using GridView = typename GridGeometry::GridView;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
using Element = typename GridView::template Codim<0>::Entity;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using BoundaryTypes = NavierStokesBoundaryTypes<PrimaryVariables::size()>;
public:
FreeFlowPipeProblem(std::shared_ptr<const GridGeometry> gridGeometry)
: ParentType(gridGeometry)
{
name_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
meanInletVelocity_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.MeanInletVelocity");
}
const std::string& name() const
{
return name_;
}
Scalar temperature() const
{ return 293.15; }
/*!
* \brief Specifies which kind of boundary condition should be
* used for which equation on a given boundary segment.
*/
BoundaryTypes boundaryTypes(const Element& element,
const SubControlVolumeFace& scvf) const
{
BoundaryTypes values;
const auto& globalPos = scvf.dofPosition();
// inlet
if (onLowerBoundary_(globalPos))
{
values.setDirichlet(Indices::velocityXIdx);
values.setDirichlet(Indices::velocityYIdx);
}
// outlet
else if (onUpperBoundary_(globalPos))
{
values.setDirichlet(Indices::pressureIdx);
}
// pipe centerline
else if (onInnerBoundary_(globalPos))
{
values.setAllSymmetry();
}
// pipe wall
else if (onOuterBoundary_(globalPos))
{
values.setDirichlet(Indices::velocityXIdx);
values.setDirichlet(Indices::velocityYIdx);
}
return values;
}
/*!
* \brief Evaluates the boundary conditions for a Dirichlet control volume.
*/
PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
{
return initialAtPos(globalPos);
}
/*!
* \brief Evaluates the initial value for a control volume.
*/
PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
{
PrimaryVariables values(0.0);
// paraboloid velocity profile
const auto pipeRadius = this->gridGeometry().bBoxMax()[0] - this->gridGeometry().bBoxMin()[0];
const auto r = globalPos[0] - this->gridGeometry().bBoxMin()[0];
values[Indices::velocityXIdx] = 0.0;
values[Indices::velocityYIdx] = 2.0*meanInletVelocity_*(1.0 - r*r/(pipeRadius*pipeRadius));
values[Indices::pressureIdx] = 1e5;
return values;
}
private:
bool onInnerBoundary_(const GlobalPosition &globalPos) const
{ return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_; }
bool onOuterBoundary_(const GlobalPosition &globalPos) const
{ return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_; }
bool onLowerBoundary_(const GlobalPosition &globalPos) const
{ return globalPos[1] < this->gridGeometry().bBoxMin()[1] + eps_; }
bool onUpperBoundary_(const GlobalPosition &globalPos) const
{ return globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_; }
static constexpr Scalar eps_ = 1e-6;
std::string name_;
Scalar meanInletVelocity_;
};
} // end namespace Dumux
#endif
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#ifndef DUMUX_TEST_FREEFLOW_PIPE_PROPERTIES_HH
#define DUMUX_TEST_FREEFLOW_PIPE_PROPERTIES_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/common/properties.hh>
#include <dumux/discretization/staggered/freeflow/properties.hh>
#include <dumux/discretization/rotationsymmetricgridgeometrytraits.hh>
#include <dumux/freeflow/navierstokes/model.hh>
#include <dumux/material/fluidsystems/1pgas.hh>
#include <dumux/material/components/air.hh>
#include "problem.hh"
namespace Dumux::Properties {
// Create new type tags
namespace TTag {
struct PipeFlow { using InheritsFrom = std::tuple<NavierStokes, StaggeredFreeFlowModel>; };
} // end namespace TTag
// the fluid system
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::PipeFlow>
{
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = FluidSystems::OnePGas<Scalar, Dumux::Components::Air<Scalar> > ;
};
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::PipeFlow>
{ using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; };
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::PipeFlow>
{ using type = FreeFlowPipeProblem<TypeTag> ; };
template<class TypeTag>
struct EnableGridGeometryCache<TypeTag, TTag::PipeFlow> { static constexpr bool value = true; };
template<class TypeTag>
struct EnableGridFluxVariablesCache<TypeTag, TTag::PipeFlow> { static constexpr bool value = true; };
template<class TypeTag>
struct EnableGridVolumeVariablesCache<TypeTag, TTag::PipeFlow> { static constexpr bool value = true; };
// rotation-symmetric grid geometry forming a cylinder channel
template<class TypeTag>
struct GridGeometry<TypeTag, TTag::PipeFlow>
{
static constexpr auto upwindSchemeOrder = getPropValue<TypeTag, Properties::UpwindSchemeOrder>();
static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridGeometryCache>();
using GridView = typename GetPropType<TypeTag, Properties::Grid>::LeafGridView;
using DefaultTraits = StaggeredFreeFlowDefaultFVGridGeometryTraits<GridView, upwindSchemeOrder>;
struct GGTraits : public DefaultTraits
{
using SubControlVolume = RotationSymmetricSubControlVolume<typename DefaultTraits::SubControlVolume, RotationPolicy::toroid>;
using SubControlVolumeFace = RotationSymmetricSubControlVolumeFace<typename DefaultTraits::SubControlVolumeFace, RotationPolicy::toroid>;
struct PublicTraits
{
using CellSubControlVolume = SubControlVolume;
using CellSubControlVolumeFace = SubControlVolumeFace;
using FaceSubControlVolume = RotationSymmetricSubControlVolume<typename DefaultTraits::PublicTraits::FaceSubControlVolume, RotationPolicy::toroid>;
using FaceLateralSubControlVolumeFace = RotationSymmetricSubControlVolumeFace<typename DefaultTraits::PublicTraits::FaceLateralSubControlVolumeFace, RotationPolicy::toroid>;
using FaceFrontalSubControlVolumeFace = RotationSymmetricSubControlVolumeFace<typename DefaultTraits::PublicTraits::FaceFrontalSubControlVolumeFace, RotationPolicy::toroid>;
};
};
using type = StaggeredFVGridGeometry<GridView, enableCache, GGTraits>;
};
} // end namespace Dumux::Properties
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment