13 static LoggerPtr loggerConvTest(Logger::getLogger(
"ConvTest"));
28 fCap.
SetUp(ER, gamma, m, pt, logHardening, logBulkModulus, a0, e0);
36 return Hash(
"TPZYCDruckerPragerPV");
48 std::cout <<
"Method not implemented." << std::endl;
65 sigma.
XX() = sigmaPV[0];
66 sigma.
YY() = sigmaPV[1];
67 sigma.
ZZ() = sigmaPV[2];
69 const REAL p = sigma.
I1() / 3.;
70 const REAL sqrt3 =
sqrt(3);
80 const REAL sqrt3 =
sqrt(3);
81 REAL sqrtj2 = sqrt3 *
abs(
fM * (xi / sqrt3 -
fPt)) / 3.;
82 REAL rho = M_SQRT2*sqrtj2;
85 returnValue[2] = beta;
93 STATE I1Trial = (sigma_trial_pv[0] + sigma_trial_pv[1] + sigma_trial_pv[2]);
94 STATE I1Proj = (sigma_proj_pv[0] + sigma_proj_pv[1] + sigma_proj_pv[2]);
99 return fCap.
ResLFunc(sigma_trial_pv, theta, beta, a, aPrev);
103 STATE log_a =
log(a);
105 STATE log_a0_log_a = log_a0 - log_a;
118 return ((1. / (3. *
fER.
K()))*(carttrial[0] - cart[0])*(carttrial[0] - cart[0]))
119 +(1. / (2. *
fER.
G()))*((carttrial[1] - cart[1])*(carttrial[1] - cart[1])+(carttrial[2] - cart[2])*(carttrial[2] - cart[2]));
129 const REAL sqrt3 =
sqrt(3);
130 const STATE sbeta =
sin(beta);
131 const STATE cbeta =
cos(beta);
132 const REAL K =
fER.
K();
133 const REAL G =
fER.
G();
134 const STATE sig1trial = sigma_trial_pv[0];
135 const STATE sig2trial = sigma_trial_pv[1];
136 const STATE sig3trial = sigma_trial_pv[2];
138 fxn[0] = ((6 * xi - 6 * sig1trial) * G + 3 * M_SQRT2 * (cbeta * sig2trial + sbeta * sig3trial) * K *
fM + (2 * xi - 2 * sqrt3 *
fPt) * K *
pow(
fM, 2)) / (9 * G * K);
139 fxn[1] = M_SQRT2 * ((sqrt3 * sbeta *
fPt * sig2trial - sqrt3 * cbeta *
fPt * sig3trial + (cbeta * sig3trial - sbeta * sig2trial) * xi) *
fM) / (3 * G);
149 const REAL sqrt3 =
sqrt(3);
150 const STATE sbeta =
sin(beta);
151 const STATE cbeta =
cos(beta);
152 const REAL K =
fER.
K();
153 const REAL G =
fER.
G();
154 const STATE sig1trial = sigma_trial_pv[0];
155 const STATE sig2trial = sigma_trial_pv[1];
156 const STATE sig3trial = sigma_trial_pv[2];
159 jac(0, 0) = 2. / (3. * K) + 2. *
pow(
fM, 2.) / (9. * G);
160 jac(0, 1) =
fM * M_SQRT2 * (cbeta * sig3trial - sbeta * sig2trial) / (3. * G);
162 jac(1, 0) = jac(0, 1);
163 jac(1, 1) = M_SQRT2 * ((sqrt3 * cbeta *
fPt * sig2trial + sqrt3 * sbeta *
fPt * sig3trial - (sbeta * sig3trial + cbeta * sig2trial) * xi) *
fM) / (3. * G);
172 const REAL sqrt3 =
sqrt(3);
174 REAL xi_distance = std::numeric_limits<REAL>::max();
177 STATE beta =
atan2(sigma_trial_star[2], sigma_trial_star[1]);
179 const REAL initial_xi_guess =
fPt*sqrt3;
180 const REAL final_xi_guess = (
fPt - (1 +
fCap.
fGamma) * aPrev) * sqrt3;
181 const unsigned int n_steps_xi = 40;
182 const REAL xi_interval = (initial_xi_guess - final_xi_guess) / n_steps_xi;
183 for (
unsigned int i = 0; i < n_steps_xi; ++i) {
184 REAL xi_guess = initial_xi_guess + i*xi_interval;
186 if (
fabs(distance) <
fabs(xi_distance)) {
188 xi_distance = distance;
193 REAL residual_norm = std::numeric_limits<REAL>::max();
198 for (
unsigned int i = 0; i < 30; ++i) {
202 for (
unsigned int k = 0; k < 2; ++k) {
205 residual_norm =
Norm(sol);
208 if (loggerConvTest->isDebugEnabled()) {
209 std::stringstream outfile;
210 outfile << i <<
" " <<
log(residual_norm) << endl;
220 if (residual_norm < tol)
break;
228 STATE aGuess = aPrev;
229 STATE resl =
ResLF1(sigma_trial_pv, sigma, aGuess, aPrev);
232 resl =
ResLF1(sigma_trial_pv, sigma, aGuess, aPrev);
235 for (count = 0; count < 30; ++count) {
236 STATE dresl =
DResLF1(sigma_trial_pv, sigma, aGuess, aPrev);
244 aGuess -= resl / dresl;
245 resl =
ResLF1(sigma_trial_pv, sigma, aGuess, aPrev);
246 if (
fabs(resl) < tol)
break;
268 bool require_gradient_Q =
true;
270 require_gradient_Q =
false;
275 if (!(gradient->
Rows() == 3 && gradient->
Cols() == 3)) {
276 std::cerr <<
"Unable to compute the gradient operator. Required gradient array dimensions are 3x3." << std::endl;
280 if (require_gradient_Q) {
286 this->
Phi(sigma_trial_pv, aPrev, yield);
287 STATE I1 = sigma_trial_pv[0] + sigma_trial_pv[1] + sigma_trial_pv[2];
289 if (I1 / 3. >=
fPt - aPrev) {
293 sigma_pv = sigma_trial_pv;
300 sigma_pv = sigma_trial_pv;
310 beta = sigmaHWCyl[2];
313 if (
fabs(dist) > tol) {
324 const REAL sqrt3 =
sqrt(3);
325 const STATE sbeta =
sin(beta);
326 const STATE cbeta =
cos(beta);
327 const REAL G =
fER.
G();
328 const REAL K =
fER.
K();
330 ddist_dsigmatrial(0, 0) = -2. / (3. * K);
331 ddist_dsigmatrial(0, 1) = M_SQRT2 * cbeta *
fM / (3. * G);
332 ddist_dsigmatrial(0, 2) = M_SQRT2 * sbeta *
fM / (3. * G);
334 ddist_dsigmatrial(1, 0) = 0.;
335 ddist_dsigmatrial(1, 1) = -(M_SQRT2 * sbeta * xi - M_SQRT2 * sqrt3 * sbeta *
fPt) *
fM / (3. * G);
336 ddist_dsigmatrial(1, 2) = (M_SQRT2 * cbeta * xi - M_SQRT2 * sqrt3 * cbeta *
fPt) *
fM / (3. * G);
344 const REAL sqrt3 =
sqrt(3);
345 const REAL sqrt27 =
pow(3, 1.5);
346 const STATE sbeta =
sin(beta);
347 const STATE cbeta =
cos(beta);
349 DFunccart(0, 0) = -(2. * sqrt3 * cbeta *
fM - sqrt27) / 9.;
350 DFunccart(0, 1) = (2 * sqrt3 * sbeta * xi - 6 * sbeta *
fPt) *
fM / 9.;
352 DFunccart(1, 0) = -((sqrt3 * sbeta - cbeta) *
fM - 3.) / sqrt27;
353 DFunccart(1, 1) = -((-3 * sbeta - sqrt27 * cbeta) *
fPt + (sqrt3 * sbeta + 3 * cbeta) * xi) *
fM / 9.;
355 DFunccart(2, 0) = (3. + (sqrt3 * sbeta + cbeta) *
fM) / sqrt27;
356 DFunccart(2, 1) = -((sqrt27 * cbeta - 3. * sbeta) *
fPt + (sqrt3 * sbeta - 3 * cbeta) * xi) *
fM / 9.;
365 this->
Phi(sigma_trial_pv, aPrev, yield);
366 STATE I1 = sigma_trial_pv[0] + sigma_trial_pv[1] + sigma_trial_pv[2];
368 if (I1 / 3. >=
fPt - aPrev) {
380 DFunccart.
Multiply(ddist_dsigmatrial, GradSigma);
383 sigma = sigma_trial_pv;
396 jac.Solve_LU(&ddist_dsigmatrial);
397 DF2Cart(theta, beta, aProj, DFunccart);
398 DFunccart.
Multiply(ddist_dsigmatrial, GradSigma);
401 sigma = sigma_trial_pv;
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 ...
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
bool IsZero(long double a)
Returns if the value a is close Zero as the allowable tolerance.
int Solve_LU(TPZFMatrix< TVar > *B, std::list< int64_t > &singular)
Solves the linear system using LU method .
void GradF1SigmaTrial(const TPZVec< REAL > &sigma_trial_pv, const REAL xi, const REAL beta, const REAL aProj, TPZFNMatrix< 6, STATE > &ddist_dsigmatrial) const
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.
STATE DResLF1(const TPZVec< STATE > &sigma_trial_pv, const TPZVec< STATE > &sigma_proj_pv, const STATE a, const STATE aPrev) const
void SurfaceInCyl(const REAL theta, const REAL beta, const REAL a, TPZVec< REAL > &returnValue) const
void ProjectToSurfaceF2(const TPZVec< REAL > &sigma_trial_pv, const REAL aPrev, TPZVec< REAL > &sigma, REAL &aProj, const REAL tol) const
REAL bFromTheta(REAL theta) const
virtual void resize(const int64_t newsize)
void ProjectSigma(const TPZVec< REAL > &sigma_trial_pv, const REAL aPrev, TPZVec< REAL > &sigma_pv, REAL &aProj, int &m_type, TPZFMatrix< REAL > *gradient=NULL) const
void GradF2SigmaTrial(const TPZVec< REAL > &sigma_trial_pv, const REAL theta, const REAL beta, const REAL aProj, TPZFNMatrix< 9, STATE > &ddist_dsigmatrial) const
STATE PlasticVolumetricStrain(STATE a) const
void Phi(TPZVec< REAL > sigmaPV, REAL a, TPZVec< REAL > &phi) const
void DDistanceToSurfaceF2(const TPZVec< STATE > &sigma_trial_pv, const STATE theta, const STATE beta, const REAL a, const REAL aPrev, TPZVec< STATE > &fxn) const
virtual void Identity()
Converts the matrix in an identity matrix.
void D2DistanceToSurfaceF1(const TPZVec< STATE > &sigma_trial_pv, const STATE xi, const STATE beta, TPZFNMatrix< 4, STATE > &jac) const
void SurfaceParam(const TPZVec< STATE > &sigma_pv, const STATE a, STATE &theta, STATE &beta) const
virtual ~TPZYCDruckerPragerPV()
REAL ResLF2(const TPZVec< STATE > &sigma_trial_pv, const STATE theta, const STATE beta, const REAL a, const REAL aPrev) const
REAL bFromTheta(REAL theta) const
TinyFad< 8, T > abs(const TinyFad< 8, T > &in)
void DDistanceToSurface(const TPZVec< STATE > &sigma_trial_pv, const STATE theta, const STATE beta, const REAL a, const REAL aPrev, TPZVec< STATE > &fxn) const
void SurfaceParamF2(const TPZVec< STATE > &sigma_pv, const STATE a, STATE &theta, STATE &beta, const REAL tol=1e-5) const
void SetUp(const TPZElasticResponse &ER, REAL gamma, REAL m, REAL pt, REAL logHardening, REAL logBulkModulus, REAL a0, REAL e0)
REAL bFromP(const REAL p, const REAL a) const
void Phi(TPZVec< REAL > sigmaPV, REAL a, TPZVec< REAL > &phi) const
TPZYCDruckerPragerPV & operator=(const TPZYCDruckerPragerPV &other)
void ProjectSigmaDep(const TPZVec< REAL > &sigma_trial_pv, const REAL aPrev, TPZVec< REAL > &sigma, REAL &aProj, TPZFMatrix< REAL > &GradSigma) const
REAL InitialDamage(const TPZVec< REAL > &stress_p) const
void Read(TPZStream &buf, void *context) override
read objects from the stream
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 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.
REAL ResLF1(const TPZVec< STATE > &sigma_trial_pv, const TPZVec< STATE > &sigma_proj_pv, const STATE a, const STATE aPrev) const
REAL bFromP(const REAL p, const REAL a) const
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 DF2Cart(STATE theta, STATE beta, STATE a, TPZFNMatrix< 9, STATE > &DFunccart) const
void SurfaceF2InCyl(const REAL theta, const REAL beta, const REAL a, TPZVec< REAL > &returnValue) const
int32_t Hash(std::string str)
long double gamma(unsigned int n)
Evaluate the factorial of a integer.
void SurfaceParamF1(const TPZVec< STATE > &sigma_pv, STATE &xi, STATE &beta, const REAL tol=1e-5) const
void DDistanceToSurfaceF1(const TPZVec< STATE > &sigma_trial_pv, const STATE theta, const STATE beta, TPZVec< STATE > &fxn) const
void ProjectToSurface(const TPZVec< REAL > &sigma_trial, const REAL aPrev, TPZVec< REAL > &sigma, REAL &aProj, const REAL tol) const
void D2DistanceToSurfaceF2(const TPZVec< STATE > &sigma_trial_pv, const STATE theta, const STATE beta, const REAL a, TPZFNMatrix< 9, STATE > &jac) const
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.
REAL dist(TPZVec< T1 > &vec1, TPZVec< T1 > &vec2)
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
void SetElasticResponse(const TPZElasticResponse &ER)
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
REAL DistanceToSurfaceF1(const TPZVec< REAL > &sigma_trial_pv, const REAL xi, const REAL beta) const
int64_t Cols() const
Returns number of cols.
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.
void SurfaceF1InCyl(const REAL xi, const REAL beta, TPZVec< REAL > &returnValue) const
clarg::argString m("-m", "input matrix file name (text format)", "matrix.txt")
REAL DistanceToSurfaceF2(const TPZVec< REAL > &sigma_trial_pv, const REAL theta, const REAL beta, const REAL a) const
void ProjectToSurfaceF1(const TPZVec< REAL > &sigma_trial_pv, const REAL aPrev, TPZVec< REAL > &sigma, REAL &aProj, const REAL tol) const
virtual int ClassId() const override
Define the class id associated with the class.
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 DF1Cart(STATE xi, STATE beta, TPZFNMatrix< 6, STATE > &DFunccart) const
void Read(TPZStream &buf, void *context) override
read objects from the stream
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...