1 /*!
2  * \file   StressPotential.hxx
3  * \brief
4  * \author Thomas Helfer
5  * \date   20/03/2018
6  * \copyright Copyright (C) 2006-2018 CEA/DEN, EDF R&D. All rights
7  * reserved.
8  * This project is publicly released under either the GNU GPL Licence
9  * or the CECILL-A licence. A copy of thoses licences are delivered
10  * with the sources of TFEL. CEA or EDF may also distribute this
11  * project under specific licensing conditions.
12  * <!-- Local IspellDict: english -->
13  */
14 
15 #ifndef LIB_MFRONT_BEHAVIOURBRICK_STRESSPOTENTIAL_HXX
16 #define LIB_MFRONT_BEHAVIOURBRICK_STRESSPOTENTIAL_HXX
17 
18 #include <map>
19 #include <string>
20 #include <vector>
21 #include "TFEL/Material/ModellingHypothesis.hxx"
22 #include "MFront/VariableDescription.hxx"
23 #include "MFront/BehaviourDescription.hxx"
24 
25 namespace tfel {
26   namespace utilities {
27     // forward declaration
28     struct Data;
29   }  // end of namespace utilities
30 }  // end of namespace tfel
31 
32 namespace mfront {
33 
34   // forward declaration
35   struct AbstractBehaviourDSL;
36 
37   namespace bbrick {
38 
39     // forward declaration
40     struct OptionDescription;
41 
42     /*!
43      * \brief class describing the computation of the stress.
44      */
45     struct StressPotential {
46       //! a simple alias
47       using DataMap = std::map<std::string, tfel::utilities::Data>;
48       //! a simple alias
49       using ModellingHypothesis = tfel::material::ModellingHypothesis;
50       //! a simple alias
51       using Hypothesis = ModellingHypothesis::Hypothesis;
52       //! a simple alias
53       using MaterialProperty = BehaviourDescription::MaterialProperty;
54       //! \return the name of the stress potential
55       virtual std::string getName() const = 0;
56       //! \return the stress potential option description
57       virtual std::vector<OptionDescription> getOptions() const = 0;
58       /*!
59        * \param[in,out] bd: behaviour description
60        * \param[in,out] dsl: abstract behaviour dsl
61        * \param[in] d: options
62        */
63       virtual void initialize(BehaviourDescription&,
64                               AbstractBehaviourDSL&,
65                               const DataMap&) = 0;
66       /*!
67        * \brief This method returns the list of supported modelling
68        * hypotheses that are supported by the stress potential.
69        *
70        * This method is called after the input file processing. Two
71        * cases may arise:
72        * - if the user has specified a list of supported modelling
73        *   hypotheses, this list is used to check if the user's request
74        *   can be fulfilled. If the stress potential returns an empty list, it
75        *   means that the stress potential does not have any restriction.
76        * - if the user has not specified the list of supported modelling
77        *   hypotheses, this method is used to select a list of supported
78        *   modelling hypotheses. If the stress potential returns an empty list,
79        *   it means that the stress potential does not participate to the
80        *   modelling hypotheses selection. If all the stress potentials returns
81        *   an empty list, a set of default modelling hypotheses is selected.
82        *
83        * \param[in/out] bd: behaviour description
84        * \param[in] dsl: abstract behaviour dsl
85        */
86       virtual std::vector<Hypothesis> getSupportedModellingHypotheses(
87           const BehaviourDescription&, const AbstractBehaviourDSL&) const = 0;
88       /*!
89        * \brief complete the variable description
90        * \param[in] dsl: abstract behaviour dsl
91 
92        */
93       virtual void completeVariableDeclaration(
94           BehaviourDescription&, const AbstractBehaviourDSL&) const = 0;
95       /*!
96        * \brief method called at the end of the input file processing
97        * \param[in/out] bd: behaviour description
98        * \param[in] dsl: abstract behaviour dsl
99        */
100       virtual void endTreatment(BehaviourDescription&,
101                                 const AbstractBehaviourDSL&) const = 0;
102       /*!
103        * \brief add the definition of the stress derivatives with respect to
104        * the integration variables used to define it. This definition is added
105        * to the `BehaviourData::Integrator` code block before the definition of
106        * the implicit system.
107        * \param[in/out] bd: behaviour description
108        */
109       virtual void writeStressDerivatives(BehaviourDescription&) const = 0;
110       /*!
111        * \brief compute the derivatives of a variable \f$v\f$ knowing the
112        * derivative of \f$\frac{d\,v}{d\underline{s}}\f$ where
113        * \f$\underline{s}\f$ is the effective stress.
114        * \param[in] bd: behaviour description
115        * \param[in] t: variable type
116        * \param[in] v: variable name
117        * \param[in] dfv_ds: derivative of the implicit equation associated to v
118        * with respect to the effective stress
119        * \param[in] b: boolean static that the flow criterion is deviatoric
120        */
121       virtual std::string computeDerivatives(const BehaviourDescription&,
122                                              const std::string&,
123                                              const std::string&,
124                                              const std::string&,
125                                              const bool) const = 0;
126       /*!
127        * \brief add the lines that defines `sigel`, the elastic prediction of
128        * the stress. This definition is added
129        * to the `BehaviourData::BeforeInitializeLocalVariables` code block.
130        * \param[in/out] bd: behaviour description
131        */
132       virtual void computeElasticPrediction(BehaviourDescription&) const = 0;
133       /*!
134        * \brief return an expression that can be used to normalise implicit
135        * equations of the order of the stress
136        * \param[in] bd: behaviour description
137        */
138       virtual std::string getStressNormalisationFactor(
139           const BehaviourDescription&) const = 0;
140       /*!
141        * \brief return an expression that can be used as a lower bound for the
142        * equivalent stress,
143        * \param[in] bd: behaviour description
144        */
145       virtual std::string getEquivalentStressLowerBound(
146           const BehaviourDescription&) const = 0;
147       //! destructor
148       virtual ~StressPotential();
149     };  // end of struct StressPotential
150 
151   }  // end of namespace bbrick
152 
153 }  // end of namespace mfront
154 
155 #endif /* LIB_MFRONT_BEHAVIOURBRICK_STRESSPOTENTIAL_HXX */
156