From a2452fa70c9e4fe1cf3198d1d47b4a9fba459acd Mon Sep 17 00:00:00 2001 From: Andreas Lauser <and@poware.org> Date: Mon, 6 Dec 2010 18:02:21 +0000 Subject: [PATCH] 2p2cni: remove 2p2cni newton controller as far as I could see it was (1) unused (2) would not have worked. git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@4818 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- .../2p2cni/2p2cninewtoncontroller.hh | 158 ------------------ 1 file changed, 158 deletions(-) delete mode 100644 dumux/boxmodels/2p2cni/2p2cninewtoncontroller.hh diff --git a/dumux/boxmodels/2p2cni/2p2cninewtoncontroller.hh b/dumux/boxmodels/2p2cni/2p2cninewtoncontroller.hh deleted file mode 100644 index d8851687ef..0000000000 --- a/dumux/boxmodels/2p2cni/2p2cninewtoncontroller.hh +++ /dev/null @@ -1,158 +0,0 @@ -// $Id$ -/***************************************************************************** - * Copyright (C) 2008 by Bernd Flemisch, Andreas Lauser * - * Institute of Hydraulic Engineering * - * University of Stuttgart, Germany * - * email: <givenname>.<name>@iws.uni-stuttgart.de * - * * - * 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, as long as this copyright notice * - * is included in its original form. * - * * - * This program is distributed WITHOUT ANY WARRANTY. * - *****************************************************************************/ -/*! - * \file - * \brief A 2p2cni specific controller for the newton solver. - * - * This controller 'knows' what a 'physically meaningful' solution is - * which allows the newton method to abort quicker if the solution is - * way out of bounds. - */ -#ifndef DUMUX_2P2CNI_NEWTON_CONTROLLER_HH -#define DUMUX_2P2CNI_NEWTON_CONTROLLER_HH - -#include <dumux/nonlinear/newtoncontroller.hh> - -namespace Dumux { -/*! - * \ingroup TwoPTwoCNIModel - * \brief A 2p2cni specific controller for the newton solver. - * - * This controller 'knows' what a 'physically meaningful' solution is - * which allows the newton method to abort quicker if the solution is - * way out of bounds. - */ -template <class TypeTag> -class TwoPTwoCNINewtonController : public NewtonController<TypeTag > -{ - typedef NewtonController<TypeTag> ParentType; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(NewtonController)) Implementation; - - typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(Model)) Model; - typedef typename GET_PROP_TYPE(TypeTag, PTAG(NewtonMethod)) NewtonMethod; - - - typedef typename SolutionTypes::SolutionFunction SolutionFunction; - -public: - TwoPTwoCNINewtonController() - { - this->setRelTolerance(1e-5); - this->setTargetSteps(9); - this->setMaxSteps(18); - }; - - /*! - * \brief Suggest a new time step size based either on the number of newton - * iterations required or on the variable switch - * - * \param u The current global solution vector - * \param uOld The previous global solution vector - * - */ - void newtonEndStep(SolutionFunction &u, SolutionFunction &uOld) - { - // call the method of the base class - ParentType::model().localJacobian().updateStaticData(u, uOld); - ParentType::newtonEndStep(u, uOld); - } - - /*! - * \brief Suggest a new time stepsize based on the old time step size. - * - * The default behaviour is to suggest the old time step size - * scaled by the ratio between the target iterations and the - * iterations required to actually solve the last time step. - * - * \param oldTimeStep The old time step size - */ - Scalar suggestTimeStepSize(Scalar oldTimeStep) const - { - // use function of the newtoncontroller - return ParentType::suggestTimeStepSize(oldTimeStep); - } - - /*! - * \brief Returns true if another iteration should be done. - * - *\param u The global solution - */ - bool newtonProceed(SolutionFunction &u) - { - return ParentType::newtonProceed(u); - - bool baseProceed = ParentType::newtonProceed(u); - - // if we just switched some primary variables we - // proceed for at least for newton iterations if - // before we give up. - if (!baseProceed && - ParentType::model().switched() && - ParentType::numSteps_ < 4 && - !ParentType::newtonConverged()) - { - return true; - } - - return baseProceed; - } - -protected: - friend class NewtonController<TypeTag>; - //! called by the base class to get an indication of how physical - //! an iterative solution is 1 means "completely physical", 0 means - //! "completely unphysical" - Scalar physicalness_(SolutionFunction &u) - { - return 1.0; - - const Scalar switchVarNormFactor = 1e-1; // standardisation value - - // the maximum distance of a Sn value to a physically - // meaningful value. - Scalar maxSwitchVarDelta = 0; - Scalar maxPwDelta = 0; - Scalar switchVar; - Scalar pW; - - for (int idx = 0; idx < (int) (*u).size(); idx++) - { - pW = (*u)[idx][0]; - switchVar = (*u)[idx][1]; - - if (switchVar < 0) { - maxSwitchVarDelta = std::max(maxSwitchVarDelta, std::abs(switchVar)); - } - else if (switchVar > 1) { - maxSwitchVarDelta = std::max(maxSwitchVarDelta, std::abs(switchVar - 1)); - } - if (pW < 0.0){ - maxPwDelta = std::max(maxPwDelta, std::abs(pW/1e5)); - } - } - - // we accept solutions up to 1 percent bigger than 1 - // or smaller than 0 as being physical for numerical - // reasons... - Scalar phys = 1.01 - maxSwitchVarDelta/switchVarNormFactor - maxPwDelta; - - return std::min(1.0, phys); - } -}; -} - -#endif -- GitLab