https://gitlab.opengeosys.org/ogs/ogs.git
Revision 69ca768c760c492caa2a825fea3b9e22fa5d4c69 authored by Dmitri Naumov on 04 October 2023, 08:29:10 UTC, committed by Dmitri Naumov on 05 October 2023, 13:14:07 UTC
Presence of ice phase at slightly positive temperatures with shallow
sigmoid function for ice phase should not affect the results much but
only for amount of ice formed. In the simulation the initial ice volume
fraction is 0.0379... . Displacement and stress are read from previous
simulation's steady-state result.

Incorrect update of phi_fr_prev causes pressure to drop significantly in
the first step, which is unexpected, since everything is in equilibrium.
Temperature load starts only after 10 steps at t=10000s.
1 parent 277410a
Raw File
Tip revision: 69ca768c760c492caa2a825fea3b9e22fa5d4c69 authored by Dmitri Naumov on 04 October 2023, 08:29:10 UTC
[T/THM] Heat transport in stationary flow w/ ice
Tip revision: 69ca768
ForwardDifferencesJacobianAssembler.h
/**
 * \file
 * \copyright
 * Copyright (c) 2012-2023, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 */

#pragma once

#include "AbstractJacobianAssembler.h"

namespace ProcessLib
{
//! Assembles the Jacobian matrix using forward differences.
class ForwardDifferencesJacobianAssembler final
    : public AbstractJacobianAssembler
{
public:
    //! Constructs a new instance.
    //!
    //! \param absolute_epsilons perturbations of the components of the local
    //! solution vector used for evaluating the finite differences.
    //!
    //! \note The size of \c absolute_epsilons defines the "number of
    //! components" of the local solution vector (This is not the number of
    //! elements of the vector!). Therefore the size of the local solution
    //! vector must be divisible by the size of \c absolute_epsilons. This is
    //! the only consistency check performed. It is not checked whether said
    //! "number of components" is sensible. E.g., one could pass one epsilon per
    //! node, which would be valid but would not make sense at all.
    explicit ForwardDifferencesJacobianAssembler(
        std::vector<double>&& absolute_epsilons);

    //! Assembles the Jacobian, the matrices \f$M\f$ and \f$K\f$, and the vector
    //! \f$b\f$.
    //! For the assembly the assemble() method of the given \c local_assembler
    //! is called several times and the Jacobian is built from finite
    //! differences.
    //! The number of calls of the assemble() method is \f$2N+1\f$ if \f$N\f$ is
    //! the size of \c local_x.
    //!
    //! \attention It is assumed that the local vectors and matrices are ordered
    //! by component.
    void assembleWithJacobian(LocalAssemblerInterface& local_assembler,
                              double const t, double const dt,
                              std::vector<double> const& local_x_data,
                              std::vector<double> const& local_x_prev_data,
                              std::vector<double>& local_M_data,
                              std::vector<double>& local_K_data,
                              std::vector<double>& local_b_data,
                              std::vector<double>& local_Jac_data) override;

    std::unique_ptr<AbstractJacobianAssembler> copy() const override;

private:
    std::vector<double> const _absolute_epsilons;

    // temporary data only stored here in order to avoid frequent memory
    // reallocations.
    std::vector<double> _local_M_data;
    std::vector<double> _local_K_data;
    std::vector<double> _local_b_data;
    std::vector<double> _local_x_perturbed_data;
};

}  // namespace ProcessLib
back to top