material template

Here we show the build-in material template.

/**
 * @class MaterialExample
 * @brief A MaterialExample material class.
 * @author tlc
 * @date 06/07/2018
 * @version 0.2.0
 * @file MaterialExample.h
 * @addtogroup Material-1D
 * @ingroup Material
 * @{
 */

#ifndef MATERIALEXAMPLE_H
#define MATERIALEXAMPLE_H

#include <Material/Material.h>

/**
 * \brief It is recommended to store data, especially constant data, in a simple
 * structure. The motivation is to obtain a clear interface so that store and recover
 * of objects will be easier.
 */
struct MaterialExampleData {
 const double elastic_modulus; // elastic modulus
 const double yield_stress;    // initial yield stress
 const double hardening_ratio; // hardening ratio
 const double beta;            // isotropic/kinematic hardening factor
 const double plastic_modulus; // plastic modulus
};

class MaterialExample final : MaterialExampleData, public Material {
 double current_back_stress = 0.;
 double current_plastic_strain = 0.;
 double trial_back_stress = 0.;
 double trial_plastic_strain = 0.;
public:
 explicit MaterialExample(unsigned = 0,  // tag
                          double = 2E5,  // elastic modulus
                          double = 400., // initial yield stress
                          double = .05,  // hardening ratio
                          double = 0.,   // isotropic/kinematic hardening factor
                          double = 0.    // density
 );

 void initialize(const shared_ptr<DomainBase>&) override;

 unique_ptr<Material> get_copy() override;

 int update_trial_status(const vec&) override;

 int clear_status() override;
 int commit_status() override;
 int reset_status() override;

 void print() override;
};

#endif

Last updated