47 REAL ConvDirAx[3] = {0.};
51 for(di=0; di<
fDim; di++) {
52 for(dj=0; dj<
fDim; dj++) {
53 delx = (delx<
fabs(jacinv(di,dj))) ?
fabs(jacinv(di,dj)) : delx;
64 ConvDirAx[0] = axes(0,0)*fConvDir[0]+axes(0,1)*fConvDir[1]+axes(0,2)*fConvDir[2];
65 ConvDirAx[1] = axes(1,0)*fConvDir[0]+axes(1,1)*fConvDir[1]+axes(1,2)*fConvDir[2];
68 ConvDirAx[0] = axes(0,0)*fConvDir[0]+axes(0,1)*fConvDir[1]+axes(0,2)*fConvDir[2];
69 ConvDirAx[1] = axes(1,0)*fConvDir[0]+axes(1,1)*fConvDir[1]+axes(1,2)*fConvDir[2];
70 ConvDirAx[2] = axes(2,0)*fConvDir[0]+axes(2,1)*fConvDir[1]+axes(2,2)*fConvDir[2];
73 PZError <<
"TPZBurger::Contribute dimension error " << fDim << endl;
77 REAL signsol = (sol[0] < 0) ? -1. : +1.;
78 for(
int in = 0; in < phr; in++ ) {
83 for(kd = 0; kd <
fDim; kd++){
84 ef(in, 0) += -1. * weight * ( +
fK * ( dphi(kd,in) * dsol(kd,0) )
85 -
fC * ( ConvDirAx[kd]* dphi(kd,in) * sol[0]*sol[0]/
fSolRef )
86 +0.5 *
fSD * delx *
fC * dphiic * dsol(kd,0) * ConvDirAx[kd] *
fabs(sol[0])/
fSolRef );
89 for(
int jn = 0; jn < phr; jn++ ) {
91 for(kd=0; kd<
fDim; kd++) {
92 ek(in,jn) += weight * (
93 +
fK * ( dphi(kd,in) * dphi(kd,jn) )
94 -
fC * ( ConvDirAx[kd]* dphi(kd,in) * phi(jn) * 2.*sol[0]/
fSolRef )
95 +0.5 *
fSD * delx *
fC * dphiic * ConvDirAx[kd] * signsol * (dphi(kd,jn)*sol[0]+dsol(kd,0)*phi(jn,0))/
fSolRef 102 if ( !ek.
VerifySymmetry() ) cout << __PRETTY_FUNCTION__ <<
"\nMATRIZ NAO SIMETRICA" << endl;
112 int phr = phi.
Rows();
120 REAL ConvDirAx[3] = {0.};
124 for(di=0; di<
fDim; di++) {
125 for(dj=0; dj<
fDim; dj++) {
126 delx = (delx<
fabs(jacinv(di,dj))) ?
fabs(jacinv(di,dj)) : delx;
137 ConvDirAx[0] = axes(0,0)*fConvDir[0]+axes(0,1)*fConvDir[1]+axes(0,2)*fConvDir[2];
138 ConvDirAx[1] = axes(1,0)*fConvDir[0]+axes(1,1)*fConvDir[1]+axes(1,2)*fConvDir[2];
141 ConvDirAx[0] = axes(0,0)*fConvDir[0]+axes(0,1)*fConvDir[1]+axes(0,2)*fConvDir[2];
142 ConvDirAx[1] = axes(1,0)*fConvDir[0]+axes(1,1)*fConvDir[1]+axes(1,2)*fConvDir[2];
143 ConvDirAx[2] = axes(2,0)*fConvDir[0]+axes(2,1)*fConvDir[1]+axes(2,2)*fConvDir[2];
146 PZError <<
"TPZBurger::Contribute dimension error " << fDim << endl;
150 REAL signsol = (sol[0] < 0) ? -1. : +1.;
151 for(
int in = 0; in < phr; in++ ) {
154 for(kd = 0; kd<
fDim; kd++) dphiic += ConvDirAx[kd]*dphi(kd,in);
156 for(kd = 0; kd<
fDim; kd++) norm += (ConvDirAx[kd]*
fC) * (ConvDirAx[kd]*
fC);
160 for(kd = 0; kd <
fDim; kd++){
161 ef(in, 0) += -1. * weight * ( +
fK * ( dphi(kd,in) * dsol(kd,0) )
162 -fC * ( ConvDirAx[kd]* dphi(kd,in) * sol[0]*sol[0]/
fSolRef )
163 +0.5 *
fSD * delx * fC * dphiic * dsol(kd,0) * ConvDirAx[kd] *
fabs(sol[0])/
fSolRef );
166 for(
int jn = 0; jn < phr; jn++ ) {
167 ek(in, jn) += weight * (0.5*
fSD*delx*fC*dphiic*
fXf*phi(jn,0)*signsol/
fSolRef);
168 for(kd=0; kd<
fDim; kd++) {
169 ek(in,jn) += weight * (
170 +
fK * ( dphi(kd,in) * dphi(kd,jn) )
171 -fC * ( ConvDirAx[kd]* dphi(kd,in) * phi(jn) * 2.*sol[0]/
fSolRef )
172 +0.5 *
fSD * delx * fC * dphiic * ConvDirAx[kd] * signsol * (dphi(kd,jn)*sol[0]+dsol(kd,0)*phi(jn,0))/
fSolRef 179 if ( !ek.
VerifySymmetry() ) cout << __PRETTY_FUNCTION__ <<
"\nMATRIZ NAO SIMETRICA" << endl;
188 int numbersol = data.
sol.
size();
197 int phr = phi.
Rows();
200 v2[0] = bc.
Val2()(0,0);
204 for(in = 0 ; in < phr; in++) {
206 for (jn = 0 ; jn < phr; jn++) {
207 ek(in,jn) +=
gBigNumber * phi(in,0) * phi(jn,0) * weight;
214 for(in = 0 ; in < phi.
Rows(); in++) {
215 ef(in,0) += v2[0] * phi(in,0) * weight;
221 cout << __PRETTY_FUNCTION__ <<
" at line " << __LINE__ <<
" not implemented\n";
229 if (
fDim == 1)
PZError << __PRETTY_FUNCTION__ <<
" - ERROR! The normal vector is not available for 1D TPZInterpolatedElement\n";
231 normal[0] = axes(0,1);
232 normal[1] = axes(1,1);
235 normal[0] = axes(0,2);
236 normal[1] = axes(1,2);
237 normal[2] = axes(2,2);
239 REAL ConvNormal = 0.;
240 for(
id=0;
id<
fDim;
id++) ConvNormal +=
fC*
fConvDir[
id]*normal[
id];
241 if(ConvNormal > 0.) {
242 for(il=0; il<phr; il++) {
243 for(jl=0; jl<phr; jl++) {
244 ek(il,jl) += weight * ConvNormal * phi(il)*phi(jl)*2.*sol[0]/
fSolRef;
246 ef(il,0) += -1. * weight * ConvNormal * phi(il) * sol[0]*sol[0]/
fSolRef;
250 if (ConvNormal < 0.) std::cout <<
"Boundary condition error: inflow detected in outflow boundary condition: ConvNormal = " << ConvNormal <<
"\n";
256 PZError << __PRETTY_FUNCTION__ <<
" at line " << __LINE__ <<
" - Error! Wrong boundary condition type\n";
262 if ( !ek.
VerifySymmetry( 1.e-3 ) ) cout << __PRETTY_FUNCTION__ <<
"\nMATRIZ NAO SIMETRICA" << endl;
270 int numbersol = dataleft.
sol.
size();
271 if (numbersol != 1) {
288 int nrowl = phiL.
Rows();
289 int nrowr = phiR.
Rows();
293 REAL ConvNormal = 0.;
294 for(
id=0;
id<
fDim;
id++) ConvNormal +=
fC *
fConvDir[
id]*normal[
id];
295 if(ConvNormal > 0.) {
296 for(il=0; il<nrowl; il++) {
297 ef(il, 0) += -1. * weight * ConvNormal * phiL(il) * solL[0]*solL[0]/
fSolRef;
298 for(jl=0; jl<nrowl; jl++) {
299 ek(il,jl) += weight * ConvNormal * phiL(il)*phiL(jl) *2.*solL[0]/
fSolRef;
302 for(ir=0; ir<nrowr; ir++) {
303 ef(ir+nrowl,0) += -1. * (-1. * weight * ConvNormal * phiR(ir) * solL[0]*solL[0]/
fSolRef);
304 for(jl=0; jl<nrowl; jl++) {
305 ek(ir+nrowl,jl) -= weight * ConvNormal * phiR(ir) * phiL(jl) * 2.*solL[0]/
fSolRef;
309 for(ir=0; ir<nrowr; ir++) {
310 ef(ir+nrowl,0) += -1. * (-1. * weight * ConvNormal * phiR(ir) * solR[0]*solR[0]/
fSolRef );
311 for(jr=0; jr<nrowr; jr++) {
312 ek(ir+nrowl,jr+nrowl) -= weight * ConvNormal * phiR(ir) * phiR(jr) *2.*solR[0]/
fSolRef;
315 for(il=0; il<nrowl; il++) {
316 ef(il,0) += -1. * weight * ConvNormal * phiL(il) * solR[0]*solR[0]/
fSolRef;
317 for(jr=0; jr<nrowr; jr++) {
318 ek(il,jr+nrowl) += weight * ConvNormal * phiL(il) * phiR(jr) * 2.*solR[0]/
fSolRef;
330 REAL DSolLNormal = 0.;
331 REAL DSolRNormal = 0.;
332 for(
id=0;
id<
fDim;
id++) {
333 DSolLNormal += dsolL(
id,0)*normal[id];
334 DSolRNormal += dsolR(
id,0)*normal[id];
338 for(il=0; il<nrowl; il++) {
339 REAL dphiLinormal = 0.;
340 for(
id=0;
id<
fDim;
id++) {
341 dphiLinormal += dphiL(
id,il)*normal[id];
344 ef(il,0) += -1. * (weight * leftK * (this->
fSymmetry * 0.5 * dphiLinormal*solL[0]-0.5*DSolLNormal*phiL(il,0)));
346 for(jl=0; jl<nrowl; jl++) {
347 REAL dphiLjnormal = 0.;
348 for(
id=0;
id<
fDim;
id++) {
349 dphiLjnormal += dphiL(
id,jl)*normal[id];
351 ek(il,jl) += weight * leftK * (
352 this->
fSymmetry * 0.5*dphiLinormal*phiL(jl,0)-0.5*dphiLjnormal*phiL(il,0)
358 for(ir=0; ir<nrowr; ir++) {
359 REAL dphiRinormal = 0.;
360 for(
id=0;
id<
fDim;
id++) {
361 dphiRinormal += dphiR(
id,ir)*normal[id];
365 ef(ir+nrowl,0) += -1. * weight * rightK * ( this->
fSymmetry * (-0.5 * dphiRinormal * solR[0] ) + 0.5 * DSolRNormal * phiR(ir) );
367 for(jr=0; jr<nrowr; jr++) {
368 REAL dphiRjnormal = 0.;
369 for(
id=0;
id<
fDim;
id++) {
370 dphiRjnormal += dphiR(
id,jr)*normal[id];
372 ek(ir+nrowl,jr+nrowl) += weight * rightK * (
373 this->
fSymmetry * (-0.5 * dphiRinormal * phiR(jr) ) + 0.5 * dphiRjnormal * phiR(ir)
379 for(il=0; il<nrowl; il++) {
380 REAL dphiLinormal = 0.;
381 for(
id=0;
id<
fDim;
id++) {
382 dphiLinormal += dphiL(
id,il)*normal[id];
386 ef(il,0) += -1. * weight * ( this->
fSymmetry * (-0.5 * dphiLinormal * leftK * solR[0] ) - 0.5 * DSolRNormal * rightK * phiL(il) );
388 for(jr=0; jr<nrowr; jr++) {
389 REAL dphiRjnormal = 0.;
390 for(
id=0;
id<
fDim;
id++) {
391 dphiRjnormal += dphiR(
id,jr)*normal[id];
393 ek(il,jr+nrowl) += weight * (
394 this->
fSymmetry * (-0.5 * dphiLinormal * leftK * phiR(jr) ) - 0.5 * dphiRjnormal * rightK * phiL(il)
400 for(ir=0; ir<nrowr; ir++) {
401 REAL dphiRinormal = 0.;
402 for(
id=0;
id<
fDim;
id++) {
403 dphiRinormal += dphiR(
id,ir)*normal[id];
407 ef(ir+nrowl,0) += -1. * weight * (this->
fSymmetry * 0.5 * dphiRinormal * rightK * solL[0] + 0.5 * DSolLNormal * leftK * phiR(ir));
409 for(jl=0; jl<nrowl; jl++) {
410 REAL dphiLjnormal = 0.;
411 for(
id=0;
id<
fDim;
id++) {
412 dphiLjnormal += dphiL(
id,jl)*normal[id];
414 ek(ir+nrowl,jl) += weight * (
415 this->
fSymmetry * 0.5 * dphiRinormal * rightK * phiL(jl) + 0.5 * dphiLjnormal * leftK * phiR(ir)
421 if ( !ek.
VerifySymmetry() ) cout << __PRETTY_FUNCTION__ <<
"\nMATRIZ NAO SIMETRICA" << endl;
430 int numbersol = dataleft.
sol.
size();
431 if (numbersol != 1) {
446 REAL ConvNormal = 0.;
447 for(
id=0;
id<
fDim;
id++) ConvNormal +=
fC *
fConvDir[
id]*normal[
id];
450 REAL DSolLNormal = 0.;
451 for(
id=0;
id<
fDim;
id++) {
452 DSolLNormal += dsolL(
id,0)*normal[id];
459 for(il=0; il<nrowl; il++) {
460 REAL dphiLinormal = 0.;
461 for(
id=0;
id<
fDim;
id++) {
462 dphiLinormal += dphiL(
id,il)*normal[id];
467 ef(il,0) += -1. * weight*
fK*(this->
fSymmetry * dphiLinormal * solL[0] - DSolLNormal * phiL(il,0));
469 for(jl=0; jl<nrowl; jl++) {
470 REAL dphiLjnormal = 0.;
471 for(
id=0;
id<
fDim;
id++) {
472 dphiLjnormal += dphiL(
id,jl)*normal[id];
474 ek(il,jl) += weight*
fK*(this->
fSymmetry * dphiLinormal * phiL(jl,0) - dphiLjnormal * phiL(il,0));
479 if(ConvNormal > 0.) {
480 for(il=0; il<nrowl; il++) {
481 ef(il,0) += -1. * weight * ConvNormal * phiL(il) * solL[0]*solL[0]/
fSolRef;
482 for(jl=0; jl<nrowl; jl++) {
483 ek(il,jl) += weight * ConvNormal * phiL(il)*phiL(jl) * 2.*solL[0]/
fSolRef;
487 for(il=0; il<nrowl; il++) {
488 ef(il,0) -= weight * ConvNormal * bc.
Val2()(0,0) * phiL(il);
494 for(il=0; il<nrowl; il++) {
495 ef(il,0) += weight*phiL(il,0)*bc.
Val2()(0,0);
500 if(ConvNormal > 0.) {
501 for(il=0; il<nrowl; il++) {
502 for(jl=0; jl<nrowl; jl++) {
503 ek(il,jl) += weight * ConvNormal * phiL(il)*phiL(jl) *2.*solL[0]/
fSolRef;
505 ef(il,0) += -1. * weight * ConvNormal * phiL(il) * solL[0]*solL[0]/
fSolRef;
509 if (ConvNormal < 0.){
510 std::cout <<
"Boundary condition error: inflow detected in outflow boundary condition: ConvNormal = " << ConvNormal <<
"\n";
516 PZError << __PRETTY_FUNCTION__ <<
" - Wrong boundary condition type\n";
520 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
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...
TPZManVector< REAL, 3 > normal
normal to the element at the integration point
Implements a vector class which allows to use external storage provided by the user. Utility.
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
clarg::argBool bc("-bc", "binary checkpoints", false)
STATE fSD
Multiplication value for the streamline diffusion term.
int ClassId() const override
Unique identifier for serialization purposes.
TPZGradSolVec dsol
vector of the derivatives of the solution 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
static int gStabilizationScheme
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.
int64_t Rows() const
Returns number of rows.
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...
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
Contains the TPZBurger class which implements a linear convection equation using a burger flux...
static REAL gBigNumber
Big number to penalization method, used for Dirichlet conditions.
int32_t Hash(std::string str)
virtual ~TPZBurger()
Destructor.
virtual int VerifySymmetry(REAL tol=1.e-13) const
Checks if current matrix value is symmetric.
TPZBurger(int nummat, int dim)
Constructor with id of material and dimension of the space.
TPZAutoPointer< TPZFunction< STATE > > fForcingFunction
Pointer to forcing function, it is the right member at differential equation.
void ContributeGradStab(TPZVec< REAL > &x, TPZFMatrix< REAL > &jacinv, TPZVec< STATE > &sol, TPZFMatrix< STATE > &dsol, REAL weight, TPZFMatrix< REAL > &axes, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
REAL fConvDir[3]
Direction of the convection operator.
int fDim
Problem dimension.
void SetConvectionTerm(TPZFMatrix< STATE > &dsol, TPZFMatrix< REAL > &axes)
Sets convection term.
void ContributeSUPG(TPZVec< REAL > &x, TPZFMatrix< REAL > &jacinv, TPZVec< STATE > &sol, TPZFMatrix< STATE > &dsol, REAL weight, TPZFMatrix< REAL > &axes, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
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...
#define PZError
Defines the output device to error messages and the DebugStop() function.
This class implements a linear convection equation using a burger flux instead of the linear flux...
virtual int ClassId() const override
Unique identifier for serialization purposes.