15 static LoggerPtr loggerConvTest(Logger::getLogger(
"ConvTest"));
42 return Hash(
"TPZYCCamClayPV");
68 std::cout <<
"Method not implemented." << std::endl;
78 return (theta >= M_PI_2) ? 1. :
fGamma;
82 STATE log_a_a0 =
log(a /
fA0);
90 sigma.
XX() = sigmaPV[0];
91 sigma.
YY() = sigmaPV[1];
92 sigma.
ZZ() = sigmaPV[2];
94 const REAL p = sigma.
I1() / 3.;
95 const REAL q =
sqrt(3. * sigma.
J2());
101 const REAL SQRT1_3 =
sqrt(1 / 3.);
103 REAL sqrtj2 =
fM * SQRT1_3 * a *
sin(theta);
104 REAL xi = SQRT1_3*I1;
105 REAL rho = M_SQRT2*sqrtj2;
107 returnValue[1] = rho;
108 returnValue[2] = beta;
112 const STATE ctheta =
cos(theta);
114 const STATE I1Trial = (sigma_trial_pv[0])+(sigma_trial_pv[1])+(sigma_trial_pv[2]);
115 const STATE I1Proj = 3. * (
fPt - a * (1 + b * ctheta));
136 return ((1. / (3. * k))*(trial_cart[0] - projection_cart[0])*(trial_cart[0] - projection_cart[0]))
137 +(1. / (2. * g))*((trial_cart[1] - projection_cart[1])*(trial_cart[1] - projection_cart[1])+(trial_cart[2] - projection_cart[2])*(trial_cart[2] - projection_cart[2]));
141 const STATE stheta =
sin(theta);
142 const STATE ctheta =
cos(theta);
143 const STATE sbeta =
sin(beta);
144 const STATE cbeta =
cos(beta);
145 const REAL sqrt2_sqrt3 =
sqrt(2. / 3.);
146 const REAL sqrt3_3 =
sqrt(3.) / 3;
150 const STATE sig1 = ptcart[0];
151 const STATE sig2 = ptcart[1];
152 const STATE sig3 = ptcart[2];
154 fxn[0] = 2. * a * b * stheta /
fER.
K()*(-sqrt3_3 * sig1 +
fPt - a * (1 + b * ctheta)) + a *
fM * sqrt2_sqrt3 * ctheta * (-sig2 * cbeta - sig3 * sbeta + a *
fM * sqrt2_sqrt3 * stheta) /
fER.
G();
155 fxn[1] = a *
fM * sqrt2_sqrt3 * stheta * (sbeta * sig2 - cbeta * sig3) /
fER.
G();
156 fxn[2] =
ResLFunc(sigma_trial_pv, theta, beta, a, aPrev);
161 const STATE a2 =
pow(a, 2.);
162 const STATE b2 =
pow(b, 2.);
163 const STATE M2 =
pow(
fM, 2.);
164 const STATE stheta =
sin(theta);
165 const STATE stheta2 =
pow(stheta, 2.);
166 const STATE ctheta =
cos(theta);
167 const STATE ctheta2 =
pow(ctheta, 2);
168 const STATE sbeta =
sin(beta);
169 const STATE cbeta =
cos(beta);
170 const REAL sqrt2_sqrt3 =
sqrt(2. / 3.);
171 const REAL sqrt3_3 =
sqrt(3.) / 3;
174 const STATE sig1 = ptcart[0];
175 const STATE sig2 = ptcart[1];
176 const STATE sig3 = ptcart[2];
177 const STATE loga_a0 =
log(a /
fA0);
180 jac(0, 0) = 2. * a * b * ctheta * (-sqrt3_3 * sig1 +
fPt - a * (1 + b * ctheta)) /
fER.
K() + 2 * a2 * b2 * stheta2 /
fER.
K() - a *
fM * sqrt2_sqrt3 * stheta * (-sig2 * cbeta - sig3 * sbeta + a *
fM * sqrt2_sqrt3 * stheta) /
fER.
G() + 2. * a2 * M2 * ctheta2 / (3. *
fER.
G());
181 jac(0, 1) = a *
fM * sqrt2_sqrt3 * ctheta * (sbeta * sig2 - cbeta * sig3) /
fER.
G();
182 jac(0, 2) = 2. * b * stheta * (-sqrt3_3 * sig1 +
fPt - 2. * a * (1. + b * ctheta)) /
fER.
K() +
fM * sqrt2_sqrt3 * ctheta * (-sig2 * cbeta - sig3 * sbeta) /
fER.
G() + 4. * a * M2 * stheta * ctheta / (3. *
fER.
G());
183 jac(1, 0) = jac(0, 1);
184 jac(1, 1) = a *
fM * sqrt2_sqrt3 * stheta * (sbeta * sig2 + cbeta * sig3) /
fER.
G();
185 jac(1, 2) =
fM * sqrt2_sqrt3 * stheta * (sbeta * sig2 - cbeta * sig3) /
fER.
G();
186 jac(2, 0) = -3. * a * b*stheta;
193 REAL theta_distance = std::numeric_limits<REAL>::max();
196 const REAL initial_theta_guess = 0;
197 const REAL final_theta_guess = M_PI;
198 const unsigned int n_steps_theta = 40;
199 const REAL theta_interval = (final_theta_guess - initial_theta_guess) / n_steps_theta;
200 for (
unsigned int i = 0; i < n_steps_theta; ++i) {
201 REAL theta_guess = initial_theta_guess + i*theta_interval;
203 if (
fabs(distance) <
fabs(theta_distance)) {
205 theta_distance = distance;
210 REAL residual_norm = std::numeric_limits<REAL>::max();
216 for (
unsigned int i = 0; i < 30; ++i) {
220 for (
unsigned int k = 0; k < 3; ++k) {
223 residual_norm =
Norm(sol);
225 for (
unsigned int k = 0; k < 3; k++) {
232 if (loggerConvTest->isDebugEnabled()) {
233 std::stringstream outfile;
234 outfile << i <<
" " <<
log(residual_norm) << endl;
243 xn(0) = xn(0) - sol(0);
245 xn(2) = xn(2) - sol(2);
246 if (residual_norm < tol)
break;
249 STATE thetasol, betasol, asol;
263 REAL theta_distance = std::numeric_limits<REAL>::max();
266 REAL beta = sigma_cyl[2];
268 const REAL initial_theta_guess = 0;
269 const REAL final_theta_guess = M_PI;
270 const unsigned int n_steps_theta = 40;
271 const REAL theta_interval = (final_theta_guess - initial_theta_guess) / n_steps_theta;
272 for (
unsigned int i = 0; i < n_steps_theta; ++i) {
273 REAL theta_guess = initial_theta_guess + i*theta_interval;
275 if (
fabs(distance) <
fabs(theta_distance)) {
277 theta_distance = distance;
282 REAL residual_norm = std::numeric_limits<REAL>::max();
288 for (
unsigned int i = 0; i < 30; ++i) {
292 for (
unsigned int k = 0; k < 3; ++k) {
295 residual_norm =
Norm(sol);
298 if (loggerConvTest->isDebugEnabled()) {
299 std::stringstream outfile;
300 outfile << i <<
" " <<
log(residual_norm) << endl;
310 if (residual_norm < tol)
break;
313 STATE thetasol, betasol, asol;
327 bool require_gradient_Q =
true;
329 require_gradient_Q =
false;
334 if (!(gradient->
Rows() == 3 && gradient->
Cols() == 3)) {
335 std::cerr <<
"Unable to compute the gradient operator. Required gradient array dimensions are 3x3." << std::endl;
339 if (require_gradient_Q) {
346 this->
Phi(sigma_trial_pv, aPrev, yield);
348 if (yield[0] <= 0.) {
349 sigma_pv = sigma_trial_pv;
359 STATE I1 = sigmaHWCyl[0] *
sqrt(3.);
360 const REAL p = I1 / 3.;
361 const STATE b =
bFromP(p, a);
362 STATE costheta = (-I1 / 3. +
fPt - a) / (a * b);
363 STATE sqrtj2 = M_SQRT1_2 * sigmaHWCyl[1];
364 STATE sintheta =
sqrt(3.) * sqrtj2 / (a *
fM);
365 theta =
atan2(sintheta, costheta);
366 beta = sigmaHWCyl[2];
370 const STATE stheta =
sin(theta);
371 const STATE ctheta =
cos(theta);
372 const STATE sbeta =
sin(beta);
373 const STATE cbeta =
cos(beta);
375 const REAL sqrt3 =
sqrt(3.);
376 const REAL sqrt27 =
pow(3, 1.5);
378 ddist_dsigmatrial(0, 0) = -(2 * a * b * stheta *
fER.
G() + 2 * a * cbeta * ctheta *
fER.
K() *
fM) / (3 *
fER.
G() *
fER.
K());
379 ddist_dsigmatrial(0, 1) = -(2 * sqrt3 * a * b * stheta *
fER.
G()+(3 * a * sbeta - sqrt3 * a * cbeta) * ctheta *
fER.
K() *
fM) / (sqrt27 *
fER.
G() *
fER.
K());
380 ddist_dsigmatrial(0, 2) = ((3 * a * sbeta + sqrt3 * a * cbeta) * ctheta *
fER.
K() *
fM - 2 * sqrt3 * a * b * stheta *
fER.
G()) / (sqrt27 *
fER.
G() *
fER.
K());
382 ddist_dsigmatrial(1, 0) = (2 * a * sbeta * stheta *
fM) / (3 *
fER.
G());
383 ddist_dsigmatrial(1, 1) = -((3 * a * cbeta + sqrt3 * a * sbeta) * stheta *
fM) / (sqrt27 *
fER.
G());
384 ddist_dsigmatrial(1, 2) = -((sqrt3 * a * sbeta - 3 * a * cbeta) * stheta * fM) / (sqrt27 *
fER.
G());
386 ddist_dsigmatrial(2, 0) = 1.;
387 ddist_dsigmatrial(2, 1) = 1.;
388 ddist_dsigmatrial(2, 2) = 1.;
392 const STATE stheta =
sin(theta);
393 const STATE ctheta =
cos(theta);
394 const STATE sbeta =
sin(beta);
395 const STATE cbeta =
cos(beta);
397 const REAL sqrt3 =
sqrt(3.);
399 DFunccart(0, 0) = a * b * stheta + 2. * a * cbeta * ctheta *
fM / 3.;
400 DFunccart(0, 1) = -2 * a * sbeta * stheta *
fM / 3.;
401 DFunccart(0, 2) = -1 - b * ctheta + 2. * cbeta * stheta *
fM / 3.;
403 DFunccart(1, 0) = a * b * stheta + (sqrt3 * a * sbeta - a * cbeta) * ctheta *
fM / 3.;
404 DFunccart(1, 1) = ((sqrt3 * a * cbeta + a * sbeta) * stheta *
fM) / 3.;
405 DFunccart(1, 2) = -1 - b * ctheta + (sqrt3 * sbeta - cbeta) * stheta * fM / 3.;
407 DFunccart(2, 0) = -(sqrt3 * a * sbeta + a * cbeta) * ctheta * fM / 3. - a * b*stheta;
408 DFunccart(2, 1) = ((a * sbeta - sqrt3 * a * cbeta) * stheta * fM) / 3.;
409 DFunccart(2, 2) = -1 + b * ctheta + (sqrt3 * sbeta + cbeta) * stheta * fM / 3.;
414 this->
Phi(sigma_trial_pv, aPrev, yield);
416 if (yield[0] <= 0.) {
417 sigma = sigma_trial_pv;
421 const REAL
tol=1.e-5;
422 bool threeEigEqual = (
fabs(sigma_trial_pv[0] - sigma_trial_pv[1]) < tol &&
fabs(sigma_trial_pv[1] - sigma_trial_pv[2]) <
tol);
441 GradSigmaTrial(sigma_trial_pv, theta, beta, aProj, ddist_dsigmatrial);
443 jac.Solve_LU(&ddist_dsigmatrial);
444 DFuncCart(theta, beta, aProj, DFunccart);
445 DFunccart.
Multiply(ddist_dsigmatrial, GradSigma);
TPZFlopCounter atan2(const TPZFlopCounter &val1, const TPZFlopCounter &val2)
Returns the arc tangent in radians and increments the counter of the Arc Tangent. ATAN2 returns the ...
void ProjectSigma(const TPZVec< REAL > &sigma_trial, const REAL aPrev, TPZVec< REAL > &sigma, REAL &aProj, int &m_type, TPZFMatrix< REAL > *gradient=NULL) const
REAL DistanceToSurface(const TPZVec< REAL > &sigma_trial_pv, const REAL theta, const REAL beta, const REAL a) const
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
STATE PlasticVolumetricStrain(STATE a) const
int Solve_LU(TPZFMatrix< TVar > *B, std::list< int64_t > &singular)
Solves the linear system using LU method .
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
void SurfaceInCyl(const REAL theta, const REAL beta, const REAL a, TPZVec< REAL > &returnValue) const
REAL bFromTheta(REAL theta) const
virtual void resize(const int64_t newsize)
void SetElasticResponse(const TPZElasticResponse &ER)
void Read(TPZStream &buf, void *context) override
virtual int ClassId() const override
Define the class id associated with the class.
virtual void Identity()
Converts the matrix in an identity matrix.
void SurfaceParam(const TPZVec< STATE > &sigma_pv, const STATE a, STATE &theta, STATE &beta) const
void DDistanceToSurface(const TPZVec< STATE > &sigma_trial_pv, const STATE theta, const STATE beta, const REAL a, const REAL aPrev, TPZVec< STATE > &fxn) const
virtual ~TPZYCCamClayPV()
REAL bFromP(const REAL p, const REAL a) const
void Phi(TPZVec< REAL > sigmaPV, REAL a, TPZVec< REAL > &phi) const
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
REAL InitialDamage(const TPZVec< REAL > &stress_p) const
virtual void Write(const bool val)
REAL ResLFunc(const TPZVec< STATE > &sigma_trial_pv, STATE theta, STATE beta, REAL a, REAL aPrev) const
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
#define DebugStop()
Returns a message to user put a breakpoint in.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
int64_t Rows() const
Returns number of rows.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
void SetUp(const TPZElasticResponse &ER, REAL gamma, REAL m, REAL pt, REAL logHardening, REAL logBulkModulus, REAL a0, REAL e0)
void ProjectSigmaDep(const TPZVec< REAL > &sigma_trial, const REAL aPrev, TPZVec< REAL > &sigma, REAL &aProj, TPZFMatrix< REAL > &GradSigma) const
int32_t Hash(std::string str)
long double gamma(unsigned int n)
Evaluate the factorial of a integer.
void ProjectToSurface(const TPZVec< REAL > &sigma_trial, const REAL aPrev, TPZVec< REAL > &sigma, REAL &aProj, const REAL tol) const
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ log
virtual void Multiply(const TPZFMatrix< TVar > &A, TPZFMatrix< TVar > &res, int opt=0) const
It mutiplies itself by TPZMatrix<TVar>A putting the result in res.
void DFuncCart(STATE theta, STATE beta, STATE a, TPZFNMatrix< 9, STATE > &DFunccart) const
int64_t Cols() const
Returns number of cols.
void ProjectToSurfaceConstantBeta(const TPZVec< REAL > &sigma_trial_pv, const REAL aPrev, TPZVec< REAL > &sigma_pv, REAL &aProj, const REAL tol) const
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
void GradSigmaTrial(const TPZVec< REAL > &sigma_trial_pv, const REAL theta, const REAL beta, const REAL aProj, TPZFNMatrix< 9, STATE > &ddist_dsigmatrial) const
Defines the interface for saving and reading data. Persistency.
clarg::argString m("-m", "input matrix file name (text format)", "matrix.txt")
void D2DistanceToSurface(const TPZVec< STATE > &sigma_trial_pv, const STATE theta, const STATE beta, const REAL a, TPZFNMatrix< 9, STATE > &jac) const
TPZFlopCounter cos(const TPZFlopCounter &orig)
Returns the cosine in radians and increments the counter of the Cosine.
void Read(TPZStream &buf, void *context) override
read objects from the stream
void Write(TPZStream &buf, int withclassid) const override
virtual void Read(bool &val)