Skip to content
Snippets Groups Projects
Commit ecc72c5d authored by Thomas Fetzer's avatar Thomas Fetzer
Browse files

[rans] Fix volVars update and update vtk fields

parent 6a38604e
No related branches found
No related tags found
2 merge requests!856Feature/zeroeq,!851Feature/rans
...@@ -3,4 +3,5 @@ install(FILES ...@@ -3,4 +3,5 @@ install(FILES
model.hh model.hh
problem.hh problem.hh
volumevariables.hh volumevariables.hh
vtkoutputfields.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/freeflow/rans) DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/freeflow/rans)
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <dumux/freeflow/nonisothermal/model.hh> #include <dumux/freeflow/nonisothermal/model.hh>
#include "volumevariables.hh" #include "volumevariables.hh"
#include "vtkoutputfields.hh"
#include <dumux/material/fluidstates/immiscible.hh> #include <dumux/material/fluidstates/immiscible.hh>
#include <dumux/discretization/methods.hh> #include <dumux/discretization/methods.hh>
...@@ -74,6 +75,9 @@ SET_BOOL_PROP(RANS, EnableInertiaTerms, true); //!< Explicitly force the conside ...@@ -74,6 +75,9 @@ SET_BOOL_PROP(RANS, EnableInertiaTerms, true); //!< Explicitly force the conside
//! The volume variables //! The volume variables
SET_TYPE_PROP(RANS, VolumeVariables, RANSVolumeVariables<TypeTag>); SET_TYPE_PROP(RANS, VolumeVariables, RANSVolumeVariables<TypeTag>);
//! The specific vtk output fields
SET_TYPE_PROP(RANS, VtkOutputFields, RANSVtkOutputFields<TypeTag>);
// \} // \}
} }
......
...@@ -82,12 +82,8 @@ public: ...@@ -82,12 +82,8 @@ public:
const Element &element, const Element &element,
const SubControlVolume& scv) const SubControlVolume& scv)
{ {
ParentType::completeFluidState(elemSol, problem, element, scv, fluidState_); ParentType::update(elemSol, problem, element, scv);
dynamicEddyViscosity_ = scv.dofPosition()[1] * scv.dofPosition()[1]; dynamicEddyViscosity_ = std::max(0.0, scv.dofPosition()[1] * (0.2469 - scv.dofPosition()[1])); // TODO preliminary
std::cout << dynamicEddyViscosity_ << " "
<< asImp_().viscosity(defaultPhaseIdx) << " "
<< effectiveViscosity(defaultPhaseIdx) << " "
<< std::endl;
}; };
/*! /*!
...@@ -159,7 +155,7 @@ public: ...@@ -159,7 +155,7 @@ public:
const Element &element, const Element &element,
const SubControlVolume &scv) const SubControlVolume &scv)
{ {
completeFluidState(elemSol, problem, element, scv, this->fluidState_); update(elemSol, problem, element, scv);
} }
/*! /*!
......
// -*- 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 2 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/>. *
*****************************************************************************/
/*!
* \file
* \ingroup RANSModel
* \copydoc Dumux::RANSVtkOutputFields
*/
#ifndef DUMUX_RANS_VTK_OUTPUT_FIELDS_HH
#define DUMUX_RANS_VTK_OUTPUT_FIELDS_HH
#include <dune/common/fvector.hh>
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
#include <dumux/discretization/methods.hh>
namespace Dumux
{
/*!
* \ingroup RANSModel
* \brief Adds vtk output fields for the Reynolds-Averaged Navier-Stokes model
*/
template<class TypeTag>
class RANSVtkOutputFields
{
using Indices = typename GET_PROP_TYPE(TypeTag, Indices);
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using FaceVariables = typename GET_PROP_TYPE(TypeTag, FaceVariables);
using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimensionworld>;
// Helper type used for tag dispatching (to add discretization-specific fields).
template<DiscretizationMethods method>
using MethodType = std::integral_constant<DiscretizationMethods, method>;
public:
//! Initialize the Navier-Stokes specific vtk output fields.
template <class VtkOutputModule>
static void init(VtkOutputModule& vtk)
{
vtk.addVolumeVariable([](const VolumeVariables& v){ return v.pressure(); }, "p [Pa]");
vtk.addVolumeVariable([](const VolumeVariables& v){ return v.pressure() - 1e5; }, "p_rel [Pa]");
vtk.addVolumeVariable([](const VolumeVariables& v){ return v.density(); }, "rho [kg/m^3]");
vtk.addVolumeVariable([](const VolumeVariables& v){ return v.viscosity() / v.density(); }, "nu [m^2/s]");
vtk.addVolumeVariable([](const VolumeVariables& v){ return v.dynamicEddyViscosity() / v.density(); }, "nu_t [m^2/s]");
// add discretization-specific fields
const auto discType = MethodType<GET_PROP_VALUE(TypeTag, DiscretizationMethod)>();
additionalOutput_(vtk, discType);
}
private:
//! Adds discretization-specific fields (nothing by default).
template <class VtkOutputModule, class AnyMethod>
static void additionalOutput_(VtkOutputModule& vtk, AnyMethod)
{ }
//! Adds discretization-specific fields (velocity vectors on the faces for the staggered discretization).
template <class VtkOutputModule>
static void additionalOutput_(VtkOutputModule& vtk, MethodType<DiscretizationMethods::Staggered>)
{
const bool writeFaceVars = getParamFromGroup<bool>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "Vtk.WriteFaceData", false);
if(writeFaceVars)
{
auto faceVelocityVector = [](const SubControlVolumeFace& scvf, const FaceVariables& f)
{
GlobalPosition velocity(0.0);
velocity[scvf.directionIndex()] = f.velocitySelf();
return velocity;
};
vtk.addFaceVariable(faceVelocityVector, "faceVelocity");
}
}
};
} // end namespace Dumux
#endif
...@@ -199,8 +199,11 @@ public: ...@@ -199,8 +199,11 @@ public:
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
{ {
PrimaryVariables values; PrimaryVariables values;
values[pressureIdx] = 1.1e+5; values[pressureIdx] = 1.0e+5;
values[velocityXIdx] = 0.0; if(isInlet(globalPos))
{
values[velocityXIdx] = inletVelocity_;
}
values[velocityYIdx] = 0.0; values[velocityYIdx] = 0.0;
return values; return values;
......
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