52 int numbersol = data.
sol.
size();
74 STATE ConvDirAx[3] = {0.};
78 for(di=0; di<
fDim; di++) {
79 for(dj=0; dj<
fDim; dj++) {
80 delx = (delx<
fabs(jacinv(di,dj))) ?
fabs(jacinv(di,dj)) : delx;
91 ConvDirAx[0] = axes(0,0)*fConvDir[0]+axes(0,1)*fConvDir[1]+axes(0,2)*fConvDir[2];
92 ConvDirAx[1] = axes(1,0)*fConvDir[0]+axes(1,1)*fConvDir[1]+axes(1,2)*fConvDir[2];
95 ConvDirAx[0] = axes(0,0)*fConvDir[0]+axes(0,1)*fConvDir[1]+axes(0,2)*fConvDir[2];
96 ConvDirAx[1] = axes(1,0)*fConvDir[0]+axes(1,1)*fConvDir[1]+axes(1,2)*fConvDir[2];
97 ConvDirAx[2] = axes(2,0)*fConvDir[0]+axes(2,1)*fConvDir[1]+axes(2,2)*fConvDir[2];
100 PZError <<
"TPZNonLinearPoisson3d::Contribute dimension error " << fDim << endl;
104 for(
int in = 0; in < phr; in++ ) {
107 for(kd = 0; kd<
fDim; kd++) dphiic += ConvDirAx[kd]*dphi(kd,in);
108 ef(in, 0) += - weight * (
fXf*phi(in,0) + 0.5*
fSD*delx*
fC*dphiic*
fXf );
109 for(kd = 0; kd <
fDim; kd++){
110 ef(in, 0) += -1. * weight * ( +
fK * ( dphi(kd,in) * dsol(kd,0) )
111 -
fC * ( ConvDirAx[kd]* dphi(kd,in) * sol[0] ) );
114 for(
int jn = 0; jn < phr; jn++ ) {
115 for(kd=0; kd<
fDim; kd++) {
116 ek(in,jn) += weight * (
117 +
fK * ( dphi(kd,in) * dphi(kd,jn) )
118 -
fC * ( ConvDirAx[kd]* dphi(kd,in) * phi(jn) ) );
125 for(
int in = 0; in < phr; in++ ) {
128 for(kd = 0; kd<
fDim; kd++) dphiic += ConvDirAx[kd]*dphi(kd,in);
129 ef(in, 0) += - weight * ( + 0.5*
fSD*delx*
fC*dphiic*
fXf );
130 for(kd = 0; kd <
fDim; kd++){
131 ef(in, 0) += -1. * weight * ( +0.5 *
fSD * delx *
fC * dphiic * dsol(kd,0) * ConvDirAx[kd] );
134 for(
int jn = 0; jn < phr; jn++ ) {
135 for(kd=0; kd<
fDim; kd++) {
136 ek(in,jn) += weight * (
137 +0.5 *
fSD * delx *
fC * dphiic * dphi(kd,jn)* ConvDirAx[kd]
149 for(
int d = 0; d <
fDim; d++) dsolNorm += dsol(d,0)*dsol(d,0);
150 dsolNorm =
sqrt(dsolNorm);
151 if (dsolNorm < 1e-16) dsolNorm = 1.;
155 for(
int in = 0; in < phr; in++ ){
159 for(kd = 0; kd<
fDim; kd++) dphiic += dsol(kd,0) * dphi(kd,in) / dsolNorm;
161 ef(in, 0) += - weight * ( 0.5*
fSD*delx* dphiic*
fXf );
164 for(kd = 0; kd <
fDim; kd++){
165 aux += dphiic * dsol(kd,0)*(
fC*ConvDirAx[kd]);
167 ef(in,0) += -1.* ( +0.5 *
fSD * delx * aux * weight );
169 for(
int jn = 0; jn < phr; jn++ ) {
170 STATE DdphiicDalpha = 0.;
171 for(kd = 0; kd<
fDim; kd++) DdphiicDalpha += dphi(kd,jn)*dphi(kd,in)/dsolNorm;
173 for(kd=0; kd<
fDim; kd++) {
174 aux += (
fC*ConvDirAx[kd]) * ( dphiic*dphi(kd,jn) + dsol(kd,0)*DdphiicDalpha );
176 ek(in,jn) += +0.5 *
fSD * delx * aux * weight;
184 if ( !ek.
VerifySymmetry() ) cout << __PRETTY_FUNCTION__ <<
"\nMATRIZ NAO SIMETRICA" << endl;
193 int numbersol = data.
sol.
size();
194 if (numbersol != 1) {
207 int phr = phi.
Rows();
215 STATE ConvDirAx[3] = {0.};
219 for(di=0; di<
fDim; di++) {
220 for(dj=0; dj<
fDim; dj++) {
221 delx = (delx<
fabs(jacinv(di,dj))) ?
fabs(jacinv(di,dj)) : delx;
232 ConvDirAx[0] = axes(0,0)*fConvDir[0]+axes(0,1)*fConvDir[1]+axes(0,2)*fConvDir[2];
233 ConvDirAx[1] = axes(1,0)*fConvDir[0]+axes(1,1)*fConvDir[1]+axes(1,2)*fConvDir[2];
236 ConvDirAx[0] = axes(0,0)*fConvDir[0]+axes(0,1)*fConvDir[1]+axes(0,2)*fConvDir[2];
237 ConvDirAx[1] = axes(1,0)*fConvDir[0]+axes(1,1)*fConvDir[1]+axes(1,2)*fConvDir[2];
238 ConvDirAx[2] = axes(2,0)*fConvDir[0]+axes(2,1)*fConvDir[1]+axes(2,2)*fConvDir[2];
241 PZError <<
"TPZNonLinearPoisson3d::Contribute dimension error " << fDim << endl;
245 for(
int in = 0; in < phr; in++ ) {
248 for(kd = 0; kd<
fDim; kd++) dphiic += ConvDirAx[kd]*dphi(kd,in);
249 ef(in, 0) += - weight * (
fXf*phi(in,0) + 0.5*
fSD*delx*
fC*dphiic*
fXf );
250 for(kd = 0; kd <
fDim; kd++){
251 ef(in, 0) += -1. * weight * ( +
fK * ( dphi(kd,in) * dsol(kd,0) )
252 -
fC * ( ConvDirAx[kd]* dphi(kd,in) * sol[0] ) );
259 for(
int in = 0; in < phr; in++ ) {
262 for(kd = 0; kd<
fDim; kd++) dphiic += ConvDirAx[kd]*dphi(kd,in);
263 ef(in, 0) += - weight * ( + 0.5*
fSD*delx*
fC*dphiic*
fXf );
264 for(kd = 0; kd <
fDim; kd++){
265 ef(in, 0) += -1. * weight * ( +0.5 *
fSD * delx *
fC * dphiic * dsol(kd,0) * ConvDirAx[kd] );
276 for(
int d = 0; d <
fDim; d++) dsolNorm += dsol(d,0)*dsol(d,0);
277 dsolNorm =
sqrt(dsolNorm);
278 if (dsolNorm < 1e-16) dsolNorm = 1.;
282 for(
int in = 0; in < phr; in++ ){
286 for(kd = 0; kd<
fDim; kd++) dphiic += dsol(kd,0) * dphi(kd,in) / dsolNorm;
288 ef(in, 0) += - weight * ( 0.5*
fSD*delx* dphiic*
fXf );
291 for(kd = 0; kd <
fDim; kd++){
292 aux += dphiic * dsol(kd,0)*(
fC*ConvDirAx[kd]);
294 ef(in,0) += -1.* ( +0.5 *
fSD * delx * aux * weight );
308 int numbersol = data.
sol.
size();
309 if (numbersol != 1) {
316 int phr = phi.
Rows();
319 v2[0] = bc.
Val2()(0,0);
323 for(in = 0 ; in < phr; in++) {
325 for (jn = 0 ; jn < phr; jn++) {
326 ek(in,jn) +=
gBigNumber * phi(in,0) * phi(jn,0) * weight;
333 for(in = 0 ; in < phi.
Rows(); in++) {
334 ef(in,0) += v2[0] * phi(in,0) * weight;
340 cout << __PRETTY_FUNCTION__ <<
" at line " << __LINE__ <<
" not implemented\n";
347 PZError <<
"Error at " << __PRETTY_FUNCTION__
348 <<
" - the outflow boundary condition can not be implemented for referred elements derived from TPZInterpolatedElement\n";
353 if (
fDim == 1)
PZError << __PRETTY_FUNCTION__ <<
" - ERROR! The normal vector is not available for 1D TPZInterpolatedElement\n";
355 normal[0] = axes(0,1);
356 normal[1] = axes(1,1);
359 normal[0] = axes(0,2);
360 normal[1] = axes(1,2);
361 normal[2] = axes(2,2);
363 STATE ConvNormal = 0.;
364 for(
id=0;
id<
fDim;
id++) ConvNormal +=
fC*
fConvDir[
id]*normal[
id];
365 if(ConvNormal > 0.) {
366 for(il=0; il<phr; il++) {
367 for(jl=0; jl<phr; jl++) {
368 ek(il,jl) += weight * ConvNormal * phi(il)*phi(jl);
370 ef(il,0) += -1. * weight * ConvNormal * phi(il) * sol[0];
374 if (ConvNormal < 0.) std::cout <<
"Boundary condition error: inflow detected in outflow boundary condition: ConvNormal = " << ConvNormal <<
"\n";
380 PZError << __PRETTY_FUNCTION__ <<
" at line " << __LINE__ <<
" - Error! Wrong boundary condition type\n";
386 if ( !ek.
VerifySymmetry( 1.e-3 ) ) cout << __PRETTY_FUNCTION__ <<
"\nMATRIZ NAO SIMETRICA" << endl;
399 int numbersol = dataleft.
sol.
size();
400 if (numbersol != 1) {
413 const int nrowl = phiL.
Rows();
414 const int nrowr = phiR.
Rows();
417 STATE ConvNormal = 0.;
418 for(
int id=0;
id<
fDim;
id++) ConvNormal +=
fC *
fConvDir[
id]*normal[
id];
419 if(ConvNormal > 0.) {
420 for(
int il=0; il<nrowl; il++) {
421 ef(il, 0) += -1. * weight * ConvNormal * phiL(il) * solL[0];
422 for(
int jl=0; jl<nrowl; jl++) {
423 ek(il,jl) += weight * ConvNormal * phiL(il)*phiL(jl);
426 for(
int ir=0; ir<nrowr; ir++) {
427 ef(ir+nrowl,0) += -1. * (-1. * weight * ConvNormal * phiR(ir) * solL[0] );
428 for(
int jl=0; jl<nrowl; jl++) {
429 ek(ir+nrowl,jl) -= weight * ConvNormal * phiR(ir) * phiL(jl);
433 for(
int ir=0; ir<nrowr; ir++) {
434 ef(ir+nrowl,0) += -1. * (-1. * weight * ConvNormal * phiR(ir) * solR[0] );
435 for(
int jr=0; jr<nrowr; jr++) {
436 ek(ir+nrowl,jr+nrowl) -= weight * ConvNormal * phiR(ir) * phiR(jr);
439 for(
int il=0; il<nrowl; il++) {
440 ef(il,0) += -1. * weight * ConvNormal * phiL(il) * solR[0];
441 for(
int jr=0; jr<nrowr; jr++) {
442 ek(il,jr+nrowl) += weight * ConvNormal * phiL(il) * phiR(jr);
454 STATE DSolLNormal = 0.;
455 STATE DSolRNormal = 0.;
456 for(
int id=0;
id<
fDim;
id++) {
457 DSolLNormal += dsolL(
id,0)*normal[id];
458 DSolRNormal += dsolR(
id,0)*normal[id];
462 for(
int il=0; il<nrowl; il++) {
463 STATE dphiLinormal = 0.;
464 for(
int id=0;
id<
fDim;
id++) {
465 dphiLinormal += dphiL(
id,il)*normal[id];
469 ef(il,0) += -1. * (weight * leftK * (this->
fSymmetry * 0.5 * dphiLinormal*solL[0]-0.5*DSolLNormal*phiL(il,0)));
471 for(
int jl=0; jl<nrowl; jl++) {
472 STATE dphiLjnormal = 0.;
473 for(
int id=0;
id<
fDim;
id++) {
474 dphiLjnormal += dphiL(
id,jl)*normal[id];
476 ek(il,jl) += weight * leftK * (
477 this->
fSymmetry * 0.5*dphiLinormal*phiL(jl,0)-0.5*dphiLjnormal*phiL(il,0)
483 for(
int ir=0; ir<nrowr; ir++) {
484 STATE dphiRinormal = 0.;
485 for(
int id=0;
id<
fDim;
id++) {
486 dphiRinormal += dphiR(
id,ir)*normal[id];
490 ef(ir+nrowl,0) += -1. * weight * rightK * ( this->
fSymmetry * (-0.5 * dphiRinormal * solR[0] ) + 0.5 * DSolRNormal * phiR(ir) );
492 for(
int jr=0; jr<nrowr; jr++) {
493 STATE dphiRjnormal = 0.;
494 for(
int id=0;
id<
fDim;
id++) {
495 dphiRjnormal += dphiR(
id,jr)*normal[id];
497 ek(ir+nrowl,jr+nrowl) += weight * rightK * (
498 this->
fSymmetry * (-0.5 * dphiRinormal * phiR(jr) ) + 0.5 * dphiRjnormal * phiR(ir)
504 for(
int il=0; il<nrowl; il++) {
505 STATE dphiLinormal = 0.;
506 for(
int id=0;
id<
fDim;
id++) {
507 dphiLinormal += dphiL(
id,il)*normal[id];
511 ef(il,0) += -1. * weight * ( this->
fSymmetry * (-0.5 * dphiLinormal * leftK * solR[0] ) - 0.5 * DSolRNormal * rightK * phiL(il) );
513 for(
int jr=0; jr<nrowr; jr++) {
514 STATE dphiRjnormal = 0.;
515 for(
int id=0;
id<
fDim;
id++) {
516 dphiRjnormal += dphiR(
id,jr)*normal[id];
518 ek(il,jr+nrowl) += weight * (
519 this->
fSymmetry * (-0.5 * dphiLinormal * leftK * phiR(jr) ) - 0.5 * dphiRjnormal * rightK * phiL(il)
525 for(
int ir=0; ir<nrowr; ir++) {
526 STATE dphiRinormal = 0.;
527 for(
int id=0;
id<
fDim;
id++) {
528 dphiRinormal += dphiR(
id,ir)*normal[id];
532 ef(ir+nrowl,0) += -1. * weight * (this->
fSymmetry * 0.5 * dphiRinormal * rightK * solL[0] + 0.5 * DSolLNormal * leftK * phiR(ir));
534 for(
int jl=0; jl<nrowl; jl++) {
535 STATE dphiLjnormal = 0.;
536 for(
int id=0;
id<
fDim;
id++) {
537 dphiLjnormal += dphiL(
id,jl)*normal[id];
539 ek(ir+nrowl,jl) += weight * (
540 this->
fSymmetry * 0.5 * dphiRinormal * rightK * phiL(jl) + 0.5 * dphiLjnormal * leftK * phiR(ir)
546 if ( !ek.
VerifySymmetry() ) cout << __PRETTY_FUNCTION__ <<
"\nMATRIZ NAO SIMETRICA" << endl;
558 int numbersol = dataleft.
sol.
size();
559 if (numbersol != 1) {
572 STATE ConvNormal = 0.;
573 for(
id=0;
id<
fDim;
id++) ConvNormal +=
fC *
fConvDir[
id]*normal[
id];
576 STATE DSolLNormal = 0.;
577 for(
id=0;
id<
fDim;
id++) {
578 DSolLNormal += dsolL(
id,0)*normal[id];
585 for(il=0; il<nrowl; il++) {
586 STATE dphiLinormal = 0.;
587 for(
id=0;
id<
fDim;
id++) {
588 dphiLinormal += dphiL(
id,il)*normal[id];
593 ef(il,0) += -1. * weight*
fK*(this->
fSymmetry * dphiLinormal * solL[0] - DSolLNormal * phiL(il,0));
595 for(jl=0; jl<nrowl; jl++) {
596 STATE dphiLjnormal = 0.;
597 for(
id=0;
id<
fDim;
id++) {
598 dphiLjnormal += dphiL(
id,jl)*normal[id];
600 ek(il,jl) += weight*
fK*(this->
fSymmetry * dphiLinormal * phiL(jl,0) - dphiLjnormal * phiL(il,0));
605 if(ConvNormal > 0.) {
606 for(il=0; il<nrowl; il++) {
607 ef(il,0) += -1. * weight * ConvNormal * phiL(il) * solL[0];
608 for(jl=0; jl<nrowl; jl++) {
609 ek(il,jl) += weight * ConvNormal * phiL(il)*phiL(jl);
613 for(il=0; il<nrowl; il++) {
614 ef(il,0) -= weight * ConvNormal * bc.
Val2()(0,0) * phiL(il);
620 for(il=0; il<nrowl; il++) {
621 ef(il,0) += weight*phiL(il,0)*bc.
Val2()(0,0);
626 if(ConvNormal > 0.) {
627 for(il=0; il<nrowl; il++) {
628 for(jl=0; jl<nrowl; jl++) {
629 ek(il,jl) += weight * ConvNormal * phiL(il)*phiL(jl);
631 ef(il,0) += -1. * weight * ConvNormal * phiL(il) * solL[0];
635 if (ConvNormal < 0.){
636 std::cout <<
"Boundary condition error: inflow detected in outflow boundary condition: ConvNormal = " << ConvNormal <<
"\n";
642 PZError << __PRETTY_FUNCTION__ <<
" - Wrong boundary condition type\n";
646 if ( !ek.
VerifySymmetry() ) cout << __PRETTY_FUNCTION__ <<
"\nMATRIZ NAO SIMETRICA" << endl;
virtual void Execute(const TPZVec< REAL > &x, TPZVec< TVar > &f, TPZFMatrix< TVar > &df)
Performs function computation.
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
Contains the TPZNonLinearPoisson3d class.
TPZManVector< REAL, 3 > normal
normal to the element at the integration point
TPZManVector< REAL, 3 > x
value of the coordinate at the integration point
void SetGradientStab(STATE sd=1.0)
Define gradient stabilization term.
clarg::argBool bc("-bc", "binary checkpoints", false)
STATE fSD
Multiplication value for the streamline diffusion term.
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
TPZGradSolVec dsol
vector of the derivatives of the solution at the integration point
TPZFNMatrix< 9, REAL > jacinv
value of the inverse of the jacobian at the integration point
TPZFMatrix< STATE > & Val2(int loadcase=0)
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
void SetConvectionTermInterface(TPZFMatrix< STATE > &dsolL, TPZFMatrix< STATE > &dsolR)
Sets convection term for ContributeInterface methods.
REAL fC
Variable which multiplies the convection term of the equation.
TPZFNMatrix< 660, REAL > dphix
values of the derivative of the shape functions
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
int64_t size() const
Returns the number of elements of the vector.
STATE fXf
Forcing function value.
STATE fK
Coeficient which multiplies the Laplacian operator.
#define DebugStop()
Returns a message to user put a breakpoint in.
This class defines the boundary condition for TPZMaterial objects.
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to stiffness matrix and load vector at one integration point...
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
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
TPZNonLinearPoisson3d(int nummat, int dim)
static REAL gBigNumber
Big number to penalization method, used for Dirichlet conditions.
int32_t Hash(std::string str)
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to the stiffness matrix and load vector at one BC integration point...
virtual int VerifySymmetry(REAL tol=1.e-13) const
Checks if current matrix value is symmetric.
TPZAutoPointer< TPZFunction< STATE > > fForcingFunction
Pointer to forcing function, it is the right member at differential equation.
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to the stiffness matrix and load vector at one integration point...
REAL fConvDir[3]
Direction of the convection operator.
int fDim
Problem dimension.
void SetConvectionTerm(TPZFMatrix< STATE > &dsol, TPZFMatrix< REAL > &axes)
Sets convection term.
void SetSUPGStab(STATE sd=1.0)
Define SUPG stabilization term.
REAL fSymmetry
Symmetry coefficient of elliptic term.
TPZSolVec sol
vector of the solutions at the integration point
This class implements a version of TPZMatPoisson3d where the convection term is given at each integr...
void SetNoStabilizationTerm()
Define no stabilization term.
virtual ~TPZNonLinearPoisson3d()
#define PZError
Defines the output device to error messages and the DebugStop() function.
int fStabilizationType
Stabilization term definition.
int ClassId() const override
Unique identifier for serialization purposes.
virtual int ClassId() const override
Unique identifier for serialization purposes.