-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Material model for fracture deformation #1434
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
config.checkConfigParameter("type", "LinearElasticIsotropic"); | ||
DBUG("Create LinearElasticIsotropic material"); | ||
|
||
// Youngs modulus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Young's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
DBUG("Create LinearElasticIsotropic material"); | ||
|
||
// Youngs modulus | ||
auto& Kn = ProcessLib::findParameter<double>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not necessary. the variable is only passed to MaterialProperties constructor.
|
||
DBUG("Use '%s' as Kn parameter.", Kn.name.c_str()); | ||
|
||
// Poissons ratio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Poisson's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
7c3c67b
to
26e9312
Compare
@nagelt Could you have a look onto the material models please? |
I guess we are hitting this Qt bug. I also guess the workaround would be to add the proposed |
@bilke thanks! The workaround solved the error. |
Looks good to me. The code can be followed easily. Fixed size matrices would be sigma/w of (displacement_dim x 1) and the various K/C matrices (displacement_dim x displacement_dim), right? So it's one implementation for MC (2) and two for linear elastic (2,3). @endJunction coming back to Nori's question: How much do we need fixed size when you look at our standard M implementations? Aside from that I have no further comments on the content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only minor things from my side.
- Eigen::Ref maybe should be discussed.
- Regarding fixed-size Eigen matrices we probably should find a common policy at some point. @endJunction only uses fixed-size, if I remember correctly, and here there are only dynamic-size matrices.
@@ -17,7 +17,9 @@ | |||
#include <omp.h> | |||
#endif | |||
|
|||
#ifndef Q_MOC_RUN // to avoid Qt bug, https://bugreports.qt.io/browse/QTBUG-22829 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment that this is Qt4 specific? ✅
From the link above:
Until you port your code to Qt5 [...]
#ifndef MATERIALLIB_FRACTURE_CREATELINEARELASTICISOTROPIC_H_ | ||
#define MATERIALLIB_FRACTURE_CREATELINEARELASTICISOTROPIC_H_ | ||
|
||
#include "ProcessLib/Utils/ProcessUtils.h" // required for findParameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move to cpp file. ✅
#ifndef MATERIALLIB_FRACTURE_CREATEMOHRCOULOMB_H_ | ||
#define MATERIALLIB_FRACTURE_CREATEMOHRCOULOMB_H_ | ||
|
||
#include "ProcessLib/Utils/ProcessUtils.h" // required for findParameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: please move to cpp file. ✅
virtual void computeConstitutiveRelation( | ||
double const t, | ||
ProcessLib::SpatialPosition const& x, | ||
Eigen::Ref<Eigen::VectorXd const> w_prev, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eigen::Ref
wraps arbitrary Eigen expressions. I guess you really intend this. But should we really design our material models s.t. they take Eigen expressions as arguments rather than plain Eigen vectors/matrices?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using Ref
because it can simply take both fixed size and dynamic size Eigen objects. If the performance is important (I doubt because the number of fracture elements are not many), I can change it as Dima did in Solids::MechanicsBase
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a cool idea. However, I am not entirely sure if it reduces complexity (fixed & dynamic at the same time) or increases it (now we have to deal with Eigen::Ref, too).
Maybe at some point in the future there should be a discussion about the matrix types used in material models.
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]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimization idea: save _mp.shear_stiffness(t, x)[0]
to a temporary outside the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would postpone optimization until we figure out its necessity.
Eigen::Ref<Eigen::VectorXd const> w, | ||
Eigen::Ref<Eigen::VectorXd const> sigma_prev, | ||
Eigen::Ref<Eigen::VectorXd> sigma, | ||
Eigen::Ref<Eigen::MatrixXd> Kep) override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the parameter is alled Kep
does it have a slightly different meaning now than the C
from the base class method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"e" means elastic, "p" means plastic. Kep means it includes both elastic and plastic parts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation.
Eigen::Ref<Eigen::VectorXd> sigma, | ||
Eigen::Ref<Eigen::MatrixXd> Kep) | ||
{ | ||
if (DisplacementDim == 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be more work to static_assert this and to not add a specialization for DisplacementDim == 3
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not sure if it works. static_assert means we don't compile fracture stuff at all for 3D, but other fracture model such as elastic one can work with 3D.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
Eigen::MatrixXd Ke(2,2); | ||
Ke.setZero(); | ||
Ke(0,0) = mat.Ks; | ||
Ke(1,1) = mat.Kn; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimization idea: Maybe there is something possible with Eigen::MatrixXd::Diagonal(...) or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
postponed
} | ||
|
||
// check shear yield function (Fs) | ||
double const Fs = std::abs(sigma[0]) + sigma[1] * tan(mat.phi) - mat.c; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::tan, also below. ✅
P const& normal_stiffness, P const& shear_stiffness, | ||
P const& friction_angle, P const& dilatancy_angle, | ||
P const& cohesion) | ||
: normal_stiffness(normal_stiffness), shear_stiffness(shear_stiffness), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small improvement:
A warning is issued "declaration shadows a field of MaterialLib::Fracture::MohrCoulomb::MaterialProperties" for all constructor's arguments. I usually postfix the arguments with underscore: :white_check_mark:
MaterialProperties(P const& normal_stiffness_) : normal_stiffness(normal_stiffness_) {}
|
||
/// converts the given degrees to radians | ||
inline double to_radians(double degrees) { | ||
return degrees*boost::math::constants::pi<double>()/180.; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: There also is a direct pi/180 constant in boost called radians
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the info. but i don't see a reason to change current code.
/// sign function | ||
template <typename T> int sgn(T val) { | ||
return (T(0) < val) - (val < T(0)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sign function is already implemented in boost: #include <boost/math/special_functions/sign.hpp>
I'd prefer an existing function ✅
a787f6c
to
f3ae8bd
Compare
OpenGeoSys development has been moved to GitLab. |
This PR adds two models for fracture deformation, linear elastic and Mohr-Coulomb.
Remarks