<commit_before>/* -*-  mode: c++; indent-tabs-mode: nil -*- */

/* -------------------------------------------------------------------------
ATS

License: see $ATS_DIR/COPYRIGHT
Author: <NAME>
------------------------------------------------------------------------- */
#include "boost/algorithm/string/predicate.hpp"

#include "energy_bc_factory.hh"
#include "advection_factory.hh"

#include "PDE_DiffusionFactory.hh"
#include "PDE_Diffusion.hh"
#include "PDE_AdvectionUpwind.hh"
#include "LinearOperatorFactory.hh"
#include "upwind_cell_centered.hh"
#include "upwind_arithmetic_mean.hh"
#include "upwind_total_flux.hh"
#include "upwind_gravity_flux.hh"
#include "enthalpy_evaluator.hh"

#include "CompositeVectorFunction.hh"
#include "CompositeVectorFunctionFactory.hh"

#include "energy_base.hh"

#define MORE_DEBUG_FLAG 0


namespace Amanzi {
namespace Energy {


EnergyBase::EnergyBase(Teuchos::ParameterList& FElist,
                       const Teuchos::RCP<Teuchos::ParameterList>& plist,
                       const Teuchos::RCP<State>& S,
                       const Teuchos::RCP<TreeVector>& solution) :
    PK(FElist, plist, S, solution),
    PK_PhysicalBDF_Default(FElist, plist, S, solution),
    modify_predictor_with_consistent_faces_(false),
    modify_predictor_for_freezing_(false),
    coupled_to_subsurface_via_temp_(false),
    coupled_to_subsurface_via_flux_(false),
    coupled_to_surface_via_temp_(false),
    coupled_to_surface_via_flux_(false),
    niter_(0),
    flux_exists_(true),
    implicit_advection_(true) {

  if (!plist_->isParameter("conserved quantity key suffix"))
    plist_->set("conserved quantity key suffix", "energy");

  // set a default absolute tolerance
  if (domain_.find("surface") != std::string::npos) {
    mass_atol_ = plist_->get<double>("mass absolute error tolerance",
                                     .01 * 55000.);
  } else {
    mass_atol_ = plist_->get<double>("mass absolute error tolerance",
                                     .5 * .1 * 55000.);
  }

  if (!plist_->isParameter("absolute error tolerance")) {
    plist_->set("absolute error tolerance", 6.e-3);
  }
}


// -------------------------------------------------------------
// Setup
// -------------------------------------------------------------
void EnergyBase::Setup(const Teuchos::Ptr<State>& S) {<commit_msg>fixes default absolute tolerance in new energy error norm.  this recovers performance from pre-AGU<commit_after>/* -*-  mode: c++; indent-tabs-mode: nil -*- */

/* -------------------------------------------------------------------------
ATS

License: see $ATS_DIR/COPYRIGHT
Author: <NAME>
------------------------------------------------------------------------- */
#include "boost/algorithm/string/predicate.hpp"

#include "energy_bc_factory.hh"
#include "advection_factory.hh"

#include "PDE_DiffusionFactory.hh"
#include "PDE_Diffusion.hh"
#include "PDE_AdvectionUpwind.hh"
#include "LinearOperatorFactory.hh"
#include "upwind_cell_centered.hh"
#include "upwind_arithmetic_mean.hh"
#include "upwind_total_flux.hh"
#include "upwind_gravity_flux.hh"
#include "enthalpy_evaluator.hh"

#include "CompositeVectorFunction.hh"
#include "CompositeVectorFunctionFactory.hh"

#include "energy_base.hh"

#define MORE_DEBUG_FLAG 0


namespace Amanzi {
namespace Energy {


EnergyBase::EnergyBase(Teuchos::ParameterList& FElist,
                       const Teuchos::RCP<Teuchos::ParameterList>& plist,
                       const Teuchos::RCP<State>& S,
                       const Teuchos::RCP<TreeVector>& solution) :
    PK(FElist, plist, S, solution),
    PK_PhysicalBDF_Default(FElist, plist, S, solution),
    modify_predictor_with_consistent_faces_(false),
    modify_predictor_for_freezing_(false),
    coupled_to_subsurface_via_temp_(false),
    coupled_to_subsurface_via_flux_(false),
    coupled_to_surface_via_temp_(false),
    coupled_to_surface_via_flux_(false),
    niter_(0),
    flux_exists_(true),
    implicit_advection_(true) {

  if (!plist_->isParameter("conserved quantity key suffix"))
    plist_->set("conserved quantity key suffix", "energy");

  // set a default absolute tolerance
  if (domain_.find("surface") != std::string::npos) {
    mass_atol_ = plist_->get<double>("mass absolute error tolerance",
                                     .01 * 55000.);
  } else {
    mass_atol_ = plist_->get<double>("mass absolute error tolerance",
                                     .5 * .1 * 55000.);
  }

  if (!plist_->isParameter("absolute error tolerance")) {
    plist_->set("absolute error tolerance", 76.e-6); // energy of 1 degree C of water per mass_atol
  }
}


// -------------------------------------------------------------
// Setup
// -------------------------------------------------------------
void EnergyBase::Setup(const Teuchos::Ptr<State>& S) {
{'fraction_non_alphanumeric': 0.22332711829293558, 'fraction_numerical': 0.007872384503832609, 'mean_word_length': 2.3504510756419155, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1543394', 'n_tokens_mistral': 1463, 'n_tokens_neox': 1381, 'n_words': 268}