1 /*!
2  * \file   mfront/include/MFront/BehaviourBrick/HookeStressPotentialBase.hxx
3  * \brief
4  * \author Thomas Helfer
5  * \date   20/03/2018
6  */
7 
8 #ifndef LIB_MFRONT_BEHAVIOURBRICK_HOOKESTRESSPOTENTIALBASE_HXX
9 #define LIB_MFRONT_BEHAVIOURBRICK_HOOKESTRESSPOTENTIALBASE_HXX
10 
11 #include "MFront/BehaviourBrick/StressPotential.hxx"
12 
13 namespace mfront {
14 
15   // forward declaration
16   struct LocalDataStructure;
17 
18   namespace bbrick {
19 
20     /*!
21      * \brief class describing the computation of the stress through the
22      * standard Hooke law.
23      */
24     struct HookeStressPotentialBase : StressPotential {
25       /*!
26        * \return the options associated with material properties which are valid
27        * for either an isotropic or an orthotropic behaviour.
28        * The following options are defined:
29        * - `young_modulus`
30        * - `poisson_ratio`
31        * - `thermal_expansion`
32        */
33       static std::vector<OptionDescription> getIsotropicBehaviourOptions();
34       /*!
35        * \return the options associated with material properties which are only
36        * valid for an orthotropic behaviour.
37        * The following options are defined:
38        * - `young_modulus1`
39        * - `young_modulus2`
40        * - `young_modulus3`
41        * - `poisson_ratio12`
42        * - `poisson_ratio23`
43        * - `poisson_ratio13`
44        * - `thermal_expansion1`
45        * - `thermal_expansion2`
46        * - `thermal_expansion3`
47        */
48       static std::vector<OptionDescription> getOrthotropicBehaviourOptions();
49       //! get options only valid for all behaviours
50       static std::vector<OptionDescription> getGeneralOptions();
51       //! constructor
52       HookeStressPotentialBase();
53       std::string getName() const override;
54       std::vector<OptionDescription> getOptions() const override;
55       void initialize(BehaviourDescription&,
56                       AbstractBehaviourDSL&,
57                       const DataMap&) override;
58       std::vector<Hypothesis> getSupportedModellingHypotheses(
59           const BehaviourDescription&,
60           const AbstractBehaviourDSL&) const override;
61       void completeVariableDeclaration(
62           BehaviourDescription&, const AbstractBehaviourDSL&) const override;
63       void endTreatment(BehaviourDescription&,
64                         const AbstractBehaviourDSL&) const override;
65       void writeStressDerivatives(BehaviourDescription&) const override;
66       void computeElasticPrediction(BehaviourDescription&) const override;
67       std::string getStressNormalisationFactor(
68           const BehaviourDescription&) const override;
69       std::string getEquivalentStressLowerBound(
70           const BehaviourDescription&) const override;
71       //! destructor
72       ~HookeStressPotentialBase() override;
73 
74      protected:
75       /*!
76        * \brief declared the `BehaviourData::ComputeStress` and
77        * `BehaviourData::ComputeFinalStress` code blocks when either the
78        * `BehaviourDescription::requiresStiffnessTensor` attribute or the
79        * `BehaviourDescription::computesStiffnessTensor` attribute
80        * has been set.
81        * \param[in] bd: behaviour description
82        */
83       virtual void declareComputeStressWhenStiffnessTensorIsDefined(
84           BehaviourDescription&) const = 0;
85       /*!
86        * \brief complete the variable description in the case of isotropic
87        * behaviours when the stiffness tensor is not defined.
88        * This method is meant to define the `BehaviourData::ComputeStress`
89        * and `BehaviourData::ComputeFinalStress` code blocks.
90        * \param[in] bd: behaviour description
91        * \param[in] d: local data structure
92        */
93       virtual void declareComputeStressForIsotropicBehaviour(
94           BehaviourDescription&, LocalDataStructure&) const = 0;
95       /*!
96        * \brief treat the case of orthotropic behaviours when the stiffness
97        * tensor is not defined.
98        * This case is generally not supported and lead to an error.
99        * \param[in] bd: behaviour description
100        */
101       virtual void declareComputeStressForOrthotropicBehaviour(
102           BehaviourDescription&) const;
103       /*!
104        * \brief add support for the AXISYMMETRICALGENERALISEDPLANESTRESS
105        * modelling hypothesis
106        * \param[in] bd: behaviour description
107        */
108       virtual void addAxisymmetricalGeneralisedPlaneStressSupport(
109           BehaviourDescription&, const AbstractBehaviourDSL&) const;
110       /*!
111        * \brief add support for the PLANESTRESS modelling hypothesis
112        * \param[in] bd: behaviour description
113        */
114       virtual void addPlaneStressSupport(BehaviourDescription&,
115                                          const AbstractBehaviourDSL&) const;
116       /*!
117        * \brief add the generic tangent operator computation
118        * \param[in] bd: behaviour description
119        */
120       virtual void addGenericTangentOperatorSupport(
121           BehaviourDescription&, const AbstractBehaviourDSL&) const = 0;
122       /*!
123        * \brief add the generic prediction operator computation
124        * \param[in] bd: behaviour description
125        */
126       virtual void addGenericPredictionOperatorSupport(
127           BehaviourDescription&) const = 0;
128       /*!
129        * \brief declare the compute elastic prediction method
130        * \param[in] bd: behaviour description
131        */
132       virtual void declareComputeElasticPredictionMethod(
133           BehaviourDescription&) const = 0;
134 
135       //! plane stress support;
136       bool pss = true;
137       //! generic prediction operator support
138       bool gto = true;
139       //! generic tangent operator support
140       bool gpo = true;
141     };  // end of struct HookeStressPotentialBase
142 
143   }  // end of namespace bbrick
144 
145 }  // end of namespace mfront
146 
147 #endif /* LIB_MFRONT_BEHAVIOURBRICK_HOOKESTRESSPOTENTIALBASE_HXX */
148