/*
Copyright (C) 2011, 2012 by the authors of the ASPECT code.
This file is part of ASPECT.
ASPECT 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, or (at your option)
any later version.
ASPECT 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 ASPECT; see the file doc/COPYING. If not see
.
*/
/* $Id: box.cc 878 2012-04-03 10:28:04Z bangerth $ */
#include
#include
#include
#include
namespace aspect
{
namespace BoundaryTemperature
{
// ------------------------------ Box -------------------
template
double
ConvBox2D::
temperature (const GeometryModel::Interface &geometry_model,
const unsigned int boundary_indicator,
const Point &location) const
{
// verify that the geometry is in fact a box since only
// for this geometry do we know for sure what boundary indicators it
// uses and what they mean
Assert (dynamic_cast*>(&geometry_model)
!= 0,
ExcMessage ("This boundary model is only implemented if the geometry is "
"in fact a box."));
switch (boundary_indicator)
{
case 2:
return bottom_temperature;
case 3:
return top_temperature;
default:
Assert (false, ExcMessage ("Unknown boundary indicator."));
return std::numeric_limits::quiet_NaN();
}
}
template
double
ConvBox2D::
minimal_temperature () const
{
return fmin(top_temperature,bottom_temperature);
}
template
double
ConvBox2D::
maximal_temperature () const
{
return fmax(top_temperature,bottom_temperature);
}
template
void
ConvBox2D::declare_parameters (ParameterHandler &prm)
{
prm.enter_subsection("Boundary temperature model");
{
prm.enter_subsection("Convection Box 2D");
{
prm.declare_entry ("Top temperature", "0",
Patterns::Double (),
"Temperature at the Top boundary. Units: K.");
prm.declare_entry ("Bottom temperature", "6000",
Patterns::Double (),
"Temperature at the Bottom boundary (core mantle boundary). Units: K.");
}
prm.leave_subsection ();
}
prm.leave_subsection ();
}
template
void
ConvBox2D::parse_parameters (ParameterHandler &prm)
{
prm.enter_subsection("Boundary temperature model");
{
prm.enter_subsection("Convection Box 2D");
{
top_temperature = prm.get_double ("Top temperature");
bottom_temperature = prm.get_double ("Bottom temperature");
}
prm.leave_subsection ();
}
prm.leave_subsection ();
}
}
}
// explicit instantiations
namespace aspect
{
namespace BoundaryTemperature
{
ASPECT_REGISTER_BOUNDARY_TEMPERATURE_MODEL(ConvBox2D,
"ConvBox2D",
"A model in which the temperature is chosen constant on "
"the top and bottom sides of a box.");
}
}