diff --git a/MaterialLib/FractureModels/CreateLinearElasticIsotropic.cpp b/MaterialLib/FractureModels/CreateLinearElasticIsotropic.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aab4712b5571d1408971f2457d7896c65e338667 --- /dev/null +++ b/MaterialLib/FractureModels/CreateLinearElasticIsotropic.cpp @@ -0,0 +1,61 @@ +/** + * \copyright + * Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include "CreateLinearElasticIsotropic.h" + +#include "LinearElasticIsotropic.h" + +namespace MaterialLib +{ +namespace Fracture +{ + +template <int DisplacementDim> +std::unique_ptr<FractureModelBase<DisplacementDim>> +createLinearElasticIsotropic( + std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters, + BaseLib::ConfigTree const& config) +{ + config.checkConfigParameter("type", "LinearElasticIsotropic"); + DBUG("Create LinearElasticIsotropic material"); + + // Youngs modulus + auto& Kn = ProcessLib::findParameter<double>( + config, "kn", parameters, 1); + + DBUG("Use '%s' as Kn parameter.", Kn.name.c_str()); + + // Poissons ratio + auto& Ks = ProcessLib::findParameter<double>( + config, "ks", parameters, 1); + + DBUG("Use '%s' as Ks parameter.", Ks.name.c_str()); + + typename LinearElasticIsotropic<DisplacementDim>::MaterialProperties mp{ + Kn, Ks}; + + return std::unique_ptr<LinearElasticIsotropic<DisplacementDim>>{ + new LinearElasticIsotropic<DisplacementDim>{mp}}; +} + + +template +std::unique_ptr<FractureModelBase<2>> +createLinearElasticIsotropic( + std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters, + BaseLib::ConfigTree const& config); + +template +std::unique_ptr<FractureModelBase<3>> +createLinearElasticIsotropic( + std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters, + BaseLib::ConfigTree const& config); + +} // namespace Fracture +} // namespace MaterialLib diff --git a/MaterialLib/FractureModels/CreateLinearElasticIsotropic.h b/MaterialLib/FractureModels/CreateLinearElasticIsotropic.h new file mode 100644 index 0000000000000000000000000000000000000000..72cbcdaedd9401213d02f5a2d0d4eef77c407a13 --- /dev/null +++ b/MaterialLib/FractureModels/CreateLinearElasticIsotropic.h @@ -0,0 +1,27 @@ +/** + * \copyright + * Copyright (c) 2012-2016, 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 "ProcessLib/Utils/ProcessUtils.h" // required for findParameter +#include "FractureModelBase.h" + +namespace MaterialLib +{ +namespace Fracture +{ + +template <int DisplacementDim> +std::unique_ptr<FractureModelBase<DisplacementDim>> +createLinearElasticIsotropic( + std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters, + BaseLib::ConfigTree const& config); + +} // namespace Fracture +} // namespace MaterialLib diff --git a/MaterialLib/FractureModels/LinearElasticIsotropic.cpp b/MaterialLib/FractureModels/LinearElasticIsotropic.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b7fbf541e0382c080d7cfae6676bfb71a8032a42 --- /dev/null +++ b/MaterialLib/FractureModels/LinearElasticIsotropic.cpp @@ -0,0 +1,48 @@ +/** + * \copyright + * Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include "LinearElasticIsotropic.h" + +namespace MaterialLib +{ +namespace Fracture +{ + +template <int DisplacementDim> +void LinearElasticIsotropic<DisplacementDim>::computeConstitutiveRelation( + double const t, + ProcessLib::SpatialPosition const& x, + Eigen::Ref<Eigen::VectorXd const> w_prev, + Eigen::Ref<Eigen::VectorXd const> w, + Eigen::Ref<Eigen::VectorXd const> sigma_prev, + Eigen::Ref<Eigen::VectorXd> sigma, + Eigen::Ref<Eigen::MatrixXd> C) +{ + const int index_ns = DisplacementDim - 1; + C.setZero(); + for (int i=0; i<index_ns; i++) + C(i,i) = _mp.shear_stiffness(t, x)[0]; + C(index_ns, index_ns) = _mp.normal_stiffness(t, x)[0]; + + sigma.noalias() = sigma_prev + C * (w - w_prev); + + // correct if fracture is opening + if (sigma[index_ns] > 0) + { + C.setZero(); + sigma.setZero(); + } +} + +template class LinearElasticIsotropic<2>; +template class LinearElasticIsotropic<3>; + + +} // namespace Fracture +} // namespace MaterialLib diff --git a/MaterialLib/FractureModels/LinearElasticIsotropic.h b/MaterialLib/FractureModels/LinearElasticIsotropic.h new file mode 100644 index 0000000000000000000000000000000000000000..fefaac9d968aa891527e98f3df82b16aadf3ee48 --- /dev/null +++ b/MaterialLib/FractureModels/LinearElasticIsotropic.h @@ -0,0 +1,73 @@ +/** + * \copyright + * Copyright (c) 2012-2016, 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 <Eigen/Eigen> + +#include "ProcessLib/Parameter/Parameter.h" + +#include "FractureModelBase.h" + +namespace MaterialLib +{ +namespace Fracture +{ + +template <int DisplacementDim> +class LinearElasticIsotropic final : public FractureModelBase<DisplacementDim> +{ +public: + /// Variables specific to the material model + struct MaterialProperties + { + using P = ProcessLib::Parameter<double>; + using X = ProcessLib::SpatialPosition; + + MaterialProperties(P const& normal_stiffness, P const& shear_stiffness) + : normal_stiffness(normal_stiffness), shear_stiffness(shear_stiffness) + { + } + + P const& normal_stiffness; + P const& shear_stiffness; + }; + +public: + explicit LinearElasticIsotropic( + MaterialProperties const& material_properties) + : _mp(material_properties) + { + } + + void computeConstitutiveRelation( + double const t, + ProcessLib::SpatialPosition const& x, + Eigen::Ref<Eigen::VectorXd const> w_prev, + Eigen::Ref<Eigen::VectorXd const> w, + Eigen::Ref<Eigen::VectorXd const> sigma_prev, + Eigen::Ref<Eigen::VectorXd> sigma, + Eigen::Ref<Eigen::MatrixXd> C) override; + +private: + MaterialProperties _mp; +}; + +} // namespace Fracture +} // namespace MaterialLib + +namespace MaterialLib +{ +namespace Fracture +{ +extern template class LinearElasticIsotropic<2>; +extern template class LinearElasticIsotropic<3>; +} // namespace Fractrue +} // namespace MaterialLib +