Page MenuHomec4science

transport_stagger.hpp
No OneTemporary

File Metadata

Created
Fri, Aug 30, 05:27

transport_stagger.hpp

/* =============================================================================
Copyright (c) 2014-2017 F. Georget <fabieng@princeton.edu> Princeton University
Copyright (c) 2017 F. Georget <fabien.georget@epfl.ch> EPFL
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
============================================================================= */
#ifndef REACTMICP_CHLORIDE_TRANSPORTSTAGGER_HPP
#define REACTMICP_CHLORIDE_TRANSPORTSTAGGER_HPP
#include "reactmicp/solver/staggers_base/transport_stagger_base.hpp"
#include "variablesfwd.hpp"
#include "specmicp_common/pimpl_ptr.hpp"
#include "reactmicp/systems/chloride/transport_program_struct.hpp"
#include "reactmicp/systems/chloride/chem_stagger_base.hpp"
#include <memory>
namespace specmicp {
namespace dfpmsolver {
struct ParabolicDriverOptions;
} // end namespace dfpmsolver
namespace reactmicp {
namespace solver {
class ChemistryStaggerBase;
} // namespace solver
namespace systems {
namespace chloride {
using solver::VariablesBase;
using solver::StaggerReturnCode;
class BoundaryConditions;
//! The transport stager for the chloride system
class SPECMICP_DLL_PUBLIC ChlorideTransportStagger:
public solver::TransportStaggerBase
{
public:
ChlorideTransportStagger(
ChlorideVariablesPtr vars,
std::shared_ptr<BoundaryConditions> bcs
);
static std::shared_ptr<ChlorideTransportStagger> make(
ChlorideVariablesPtr vars,
std::shared_ptr<BoundaryConditions> bcs
) {
return std::make_shared<ChlorideTransportStagger>(vars, bcs);
}
~ChlorideTransportStagger() override;
//! \brief Initialize the stagger at the beginning of the computation
//!
//! \param var raw pointer to the variables
void initialize(VariablesBase * const var);
//! \brief Initialize the stagger at the beginning of an iteration
//!
//! This is where the first residual may be computed, the predictor saved, ...
//! \param dt the duration of the timestep
//! \param var raw pointer to the variables
void initialize_timestep(
scalar_t dt,
VariablesBase * const var
) override;
//! \brief Solve the equation for the timetep
//!
//! \param var raw pointer to the variables
StaggerReturnCode restart_timestep(
VariablesBase * const var
) override;
//! \brief Compute the residuals norm
//!
//! \param var raw pointer to the variables
scalar_t get_residual(
VariablesBase * const var
) override;
//! \brief Compute the residuals norm
//!
//! \param var raw pointer to the variables
scalar_t get_residual_0(
VariablesBase * const var
) override;
//! \brief Obtain the norm of the step size
//!
//! This is used to check if the algorithm has reach a stationary points.
//! It should look like : return main_variables.norm()
//!
//! \param var shared_ptr to the variables
scalar_t get_update(
VariablesBase * const var
) override;
//! \brief Print debug information when timestep has failed
void print_debug_information(
VariablesBase * const var
) override;
//! \brief Register the chemistry stagger
//!
//! Can be used to compute jacobian
void register_chemistry_stagger(std::shared_ptr<ChlorideChemistryStaggerBase> chem_stagger);
//! \brief Set the method to compute the finite difference EBE-Jacobian
void set_approximation_method(AdimSolutionPerturbationMethod method);
//! \brief Return a reference to the set of options for the parabolic solver
dfpmsolver::ParabolicDriverOptions& get_options();
void set_scaling(Vector scaling_vector);
private:
struct ChlorideTransportStaggerImpl;
utils::pimpl_ptr<ChlorideTransportStaggerImpl> m_impl;
};
} // namespace chloride
} // namespace systems
} // namespace reactmicp
} // namespace specmicp
#endif // REACTMICP_CHLORIDE_TRANSPORTSTAGGER_HPP

Event Timeline