28 result.setZero(targetDim(),outputCols(u.cols()));
32 m_geometry->patch(m_patch).computeMap(mdGeo);
35 m_displacement->patch(m_patch).computeMap(mdDisp);
40 T YM = m_options.getReal(
"YoungsModulus");
41 T PR = m_options.getReal(
"PoissonsRatio");
42 T lambda = YM * PR / ( ( 1. + PR ) * ( 1. - 2. * PR ) );
43 T mu = YM / ( 2. * ( 1. + PR ) );
45 for (
index_t q = 0; q < u.cols(); ++q)
48 if (mdGeo.jacobian(q).determinant() <= 0)
49 gsInfo <<
"Invalid domain parametrization: J = " << mdGeo.jacobian(q).determinant() <<
50 " at point (" << u.col(q).transpose() <<
") of patch " << m_patch << std::endl;
51 if (
abs(mdGeo.jacobian(q).determinant()) > 1e-20)
52 dispGrad = mdDisp.jacobian(q)*(mdGeo.jacobian(q).cramerInverse());
55 eps = (dispGrad + dispGrad.transpose())/2;
57 sigma = lambda*eps.trace()*I + 2*mu*eps;
58 saveStress(sigma,result,q);
65 result.setZero(targetDim(),outputCols(u.cols()));
69 m_geometry->patch(m_patch).computeMap(mdGeo);
72 m_displacement->patch(m_patch).computeMap(mdDisp);
77 T YM = m_options.getReal(
"YoungsModulus");
78 T PR = m_options.getReal(
"PoissonsRatio");
79 T lambda = YM * PR / ( ( 1. + PR ) * ( 1. - 2. * PR ) );
80 T mu = YM / ( 2. * ( 1. + PR ) );
82 for (
index_t q = 0; q < u.cols(); ++q)
85 if (mdGeo.jacobian(q).determinant() <= 0)
86 gsInfo <<
"Invalid domain parametrization: J = " << mdGeo.jacobian(q).determinant() <<
87 " at point (" << u.col(q).transpose() <<
") of patch " << m_patch << std::endl;
88 if (
abs(mdGeo.jacobian(q).determinant()) > 1e-20)
89 F = I + mdDisp.jacobian(q)*(mdGeo.jacobian(q).cramerInverse());
92 T J = F.determinant();
94 gsInfo <<
"Invalid displacement field: J = " << J <<
95 " at point (" << u.col(q).transpose() <<
") of patch " << m_patch << std::endl;
100 E = (F.transpose() * F - I)/2;
101 S = lambda*E.trace()*I + 2*mu*E;
106 C = F.transpose() * F;
107 S = (lambda*log(J)-mu)*(C.cramerInverse()) + mu*I;
112 C = F.transpose() * F;
113 S = (lambda*(J*J-1)/2-mu)*(C.cramerInverse()) + mu*I;
116 sigma = F*S*F.transpose()/J;
117 saveStress(sigma,result,q);
122 void gsCauchyStressFunction<T>::mixedLinearElastic(
const gsMatrix<T> & u, gsMatrix<T> & result)
const
124 result.setZero(targetDim(),outputCols(u.cols()));
128 m_geometry->patch(m_patch).computeMap(mdGeo);
131 m_displacement->patch(m_patch).computeMap(mdDisp);
132 gsMatrix<T> presVals;
133 m_pressure->patch(m_patch).eval_into(u,presVals);
135 gsMatrix<T> I = gsMatrix<T>::Identity(m_dim,m_dim);
136 gsMatrix<T> sigma,eps,dispGrad;
138 T YM = m_options.getReal(
"YoungsModulus");
139 T PR = m_options.getReal(
"PoissonsRatio");
140 T mu = YM / ( 2. * ( 1. + PR ) );
142 for (
index_t q = 0; q < u.cols(); ++q)
145 if (mdGeo.jacobian(q).determinant() <= 0)
146 gsInfo <<
"Invalid domain parametrization: J = " << mdGeo.jacobian(q).determinant() <<
147 " at point (" << u.col(q).transpose() <<
") of patch " << m_patch << std::endl;
148 if (
abs(mdGeo.jacobian(q).determinant()) > 1e-20)
149 dispGrad = mdDisp.jacobian(q)*(mdGeo.jacobian(q).cramerInverse());
151 dispGrad = gsMatrix<T>::Zero(m_dim,m_dim);
152 eps = (dispGrad + dispGrad.transpose())/2;
154 sigma = presVals.at(q)*I + 2*mu*eps;
155 saveStress(sigma,result,q);
160 void gsCauchyStressFunction<T>::mixedNonLinearElastic(
const gsMatrix<T> & u, gsMatrix<T> & result)
const
162 result.setZero(targetDim(),outputCols(u.cols()));
166 m_geometry->patch(m_patch).computeMap(mdGeo);
169 m_displacement->patch(m_patch).computeMap(mdDisp);
170 gsMatrix<T> presVals;
171 m_pressure->patch(m_patch).eval_into(u,presVals);
173 gsMatrix<T> I = gsMatrix<T>::Identity(m_dim,m_dim);
174 gsMatrix<T> S,sigma,F,C,E;
176 T YM = m_options.getReal(
"YoungsModulus");
177 T PR = m_options.getReal(
"PoissonsRatio");
178 T mu = YM / ( 2. * ( 1. + PR ) );
180 for (
index_t q = 0; q < u.cols(); ++q)
182 if (mdGeo.jacobian(q).determinant() <= 0)
183 gsInfo <<
"Invalid domain parametrization: J = " << mdGeo.jacobian(q).determinant() <<
184 " at point (" << u.col(q).transpose() <<
") of patch " << m_patch << std::endl;
186 if (
abs(mdGeo.jacobian(q).determinant()) > 1e-20)
187 F = I + mdDisp.jacobian(q)*(mdGeo.jacobian(q).cramerInverse());
190 T J = F.determinant();
192 gsInfo <<
"Invalid displacement field: J = " << J <<
193 " at point (" << u.col(q).transpose() <<
") of patch " << m_patch << std::endl;
195 C = F.transpose() * F;
196 S = (presVals.at(q)-mu)*(C.cramerInverse()) + mu*I;
198 sigma = F*S*F.transpose()/J;
199 saveStress(sigma,result,q);
208 case stress_components::von_mises :
210 if (m_geometry->parDim() == 2)
211 result(0,q) = sqrt( S(0,0)*S(0,0) + S(1,1)*S(1,1) - S(0,0)*S(1,1) + 3*S(0,1)*S(0,1) );
212 if (m_geometry->parDim() == 3)
213 result(0,q) = sqrt(0.5*( pow(S(0,0)-S(1,1),2) + pow(S(0,0)-S(2,2),2) + pow(S(1,1)-S(2,2),2) +
214 6 * (pow(S(0,1),2) + pow(S(0,2),2) + pow(S(1,2),2) ) ) );
229 result.resize(1,u.cols());
234 m_geo.patch(m_patch).computeMap(mappingData);
236 for (
index_t i = 0; i < u.cols(); ++i)
237 result(0,i) = mappingData.jacobian(i).determinant();
243 result.setZero(targetDim(),u.cols());
246 m_geo.patch(m_patchGeo).invertPoints(u,paramPoints);
250 mdGeo.
points = paramPoints;
251 m_geo.patch(m_patchGeo).computeMap(mdGeo);
255 mdVel.
points = paramPoints;
256 m_vel.patch(m_patchVP).computeMap(mdVel);
259 m_pres.patch(m_patchVP).eval_into(paramPoints,pressureValues);
263 mdALE.
points = paramPoints;
264 m_ale.patch(m_patchGeo).computeMap(mdALE);
267 for (
index_t p = 0; p < paramPoints.cols(); ++p)
270 gsMatrix<T> physGradVel = mdVel.jacobian(p)*(mdGeo.jacobian(p).cramerInverse());
272 gsMatrix<T> physJacALE = I + mdALE.jacobian(p)*(mdGeo.jacobian(p).cramerInverse());
274 gsMatrix<T> invJacALE = physJacALE.cramerInverse();
277 - m_density*m_viscosity*(physGradVel*invJacALE +
278 invJacALE.transpose()*physGradVel.transpose());
280 gsMatrix<T> sigmaALE = physJacALE.determinant()*sigma*(invJacALE.transpose());
284 outerNormal(mdGeo,p,m_sideGeo,normal);
285 result.col(p) = sigmaALE * normal / normal.norm();
Compute Cauchy stresses for a previously computed/defined displacement field. Can be pushed into gsPi...
Definition: gsElasticityFunctions.h:29
Provides generic assembler routines.
Gradient of the object.
Definition: gsForwardDeclarations.h:73
S = lambda*ln(J)*C^-1 + mu*(I-C^-1)
Definition: gsBaseUtils.h:134
the gsMapData is a cache of pre-computed function (map) values.
Definition: gsFuncData.h:324
#define index_t
Definition: gsConfig.h:32
return von Mises stress as a scala
Definition: gsBaseUtils.h:114
sigma = 2*mu*eps + lambda*tr(eps)*I
Definition: gsBaseUtils.h:132
Provides useful classes derived from gsFunction which can be used for visualization or coupling...
T at(index_t i) const
Returns the i-th element of the vectorization of the matrix.
Definition: gsMatrix.h:211
#define gsInfo
Definition: gsDebug.h:43
void linearElastic(const gsMatrix< T > &u, gsMatrix< T > &result) const
computation routines for different material laws
Definition: gsElasticityFunctions.hpp:26
law
Definition: gsBaseUtils.h:128
virtual void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Each column of the input matrix (u) corresponds to one evaluation point. Each column of the output ma...
Definition: gsElasticityFunctions.hpp:227
void saveStress(const gsMatrix< T > &S, gsMatrix< T > &result, index_t q) const
save components of the stress tensor to the output matrix according to the m_type ...
Definition: gsElasticityFunctions.hpp:204
virtual void eval_into(const gsMatrix< T > &u, gsMatrix< T > &result) const
Each column of the input matrix (u) corresponds to one evaluation point. Each column of the output ma...
Definition: gsElasticityFunctions.hpp:241
return all components of the 2D stress tensor as a 2x2 matrix
Definition: gsBaseUtils.h:117
EIGEN_STRONG_INLINE abs_expr< E > abs(const E &u)
Absolute value.
Definition: gsExpressions.h:4486
gsMatrix< T > points
input (parametric) points
Definition: gsFuncData.h:348
Gradient transformation matrix.
Definition: gsForwardDeclarations.h:77
Definition: gsBaseUtils.h:119
S = 2*mu*E + lambda*tr(E)*I.
Definition: gsBaseUtils.h:133
Definition: gsBaseUtils.h:116
This object is a cache for computed values from an evaluator.
Definition: gsBaseUtils.h:121