23 static LoggerPtr logger(Logger::getLogger(
"pz.mesh.sbfemvolume"));
58 int nsides = Ref2D->
NSides();
60 for (is = 0; is < nsides; is++) {
79 tr = SkeletonSide.NeighbourSideTransform(thisside);
93 data2d.
dsol[0].Redim(dim2, nstate);
96 int npoint = intpoints.
NPoints();
97 for (
int ip = 0; ip < npoint; ip++) {
100 intpoints.
Point(ip, xi, weight);
101 tr.Apply(xi, xiquad);
103 xivol[dim2 - 1] = -0.5;
106 Ref1D->
Jacobian(xi, jacobian, axes, detjac, jacinv);
108 Ref2D->
X(xivol, data2d.
x);
114 for (
int i = 0; i < 3; i++) {
115 norm += (axes(0, i) - data2d.
axes(0, i))*(axes(0, i) - data2d.
axes(0, i));
126 if (logger->isDebugEnabled()) {
127 std::stringstream sout;
128 sout <<
"x 2d " << data1d.
x << std::endl;
133 sout <<
"detjac = " << data2d.
detjac << std::endl;
139 if (logger->isDebugEnabled()) {
140 std::stringstream sout;
144 gradx.
Print(
"gradx ", sout);
151 for (
int i = 0; i < nshape; i++) {
152 for (
int j = 0; j < nshape; j++) {
153 for (
int st = 0; st < nstate; st++) {
154 M0.
fMat(i * nstate + st, j * nstate + st) += weight * data1d.
phi(i, 0) * data1d.
phi(j, 0) *
fDensity;
161 if (
Norm(ef) > 1.e-6) {
166 for (
int i = 0; i < nstate * nshape; i++) {
167 for (
int j = 0; j < nstate * nshape; j++) {
168 E0.
fMat(i, j) = ek(i, j);
169 E1.
fMat(j, i) = ek(i, j + nstate * nshape);
170 E2.
fMat(i, j) = ek(i + nstate*nshape, j + nstate * nshape);
179 for (
int i = 0; i < 3; i++) {
180 ax1[i] = axes2D.
g(0, i);
181 ax2[i] = axes2D.
g(1, i);
182 Cross(ax1, ax2, ax3);
184 for (
int i = 0; i < 3; i++) {
185 axes3D(0, i) = ax1[i];
186 axes3D(1, i) = ax2[i];
187 axes3D(2, i) = ax3[i];
203 for (
int i = 0; i < 3; i++) {
204 for (
int j = 0; j < 3; j++) {
205 for (
int k = 0; k < 3; k++) {
206 ident1(i, j) += axes3D(i, k) * axes3D(j, k);
207 ident2(i, j) += jac3D(i, k) * jacinv3D(k, j);
211 for (
int i = 0; i < 3; i++) {
212 for (
int j = 0; j < 3; j++) {
213 if (
fabs(ident1(i, j) - identity(i, j)) > 1.e-6) {
216 if (
fabs(ident2(i, j) - identity(i, j)) > 1.e-6) {
231 int64_t nshape = data2d.
phi.
Rows() / 2;
232 for (
int ish = 0; ish < nshape; ish++) {
233 data2d.
phi(ish + nshape, 0) = data1d.
phi(ish, 0);
234 for (
int d = 0; d < dim - 1; d++) {
235 data2d.
dphi(d, ish + nshape) = data1d.
dphi(d, ish);
236 data2d.
dphi(d, ish) = 0.;
238 data2d.
dphi(dim - 1, ish) = -data1d.
phi(ish) / 2.;
239 data2d.
dphi(dim - 1, ish + nshape) = 0.;
255 for (
int i = 0; i < nrow; i++) {
256 for (
int j = 0; j < phi.Cols(); j++) {
289 REAL sbfemparam = (1. - qsi[dim - 1]) / 2.;
290 if (sbfemparam < 0.) {
291 std::cout <<
"sbfemparam " << sbfemparam << std::endl;
295 for (
int i = 0; i < dim - 1; i++) {
300 qsi[dim - 1] = 1. - 2.e-6;
303 qsi[dim - 1] = 1. - 2.e-4;
323 int nshape = data1d.
phi.
Rows();
331 if (logger->isDebugEnabled()) {
336 std::stringstream sout;
337 sout <<
"coefficients " << coefcol << std::endl;
342 for (
int s = 0; s < sol.
size(); s++) {
346 for (
int c = 0; c < numeig; c++) {
347 std::complex<double> xiexp;
348 std::complex<double> xiexpm1;
359 for (
int i = 0; i < nphixi; i++) {
365 if (s == 0 && logger->isDebugEnabled()) {
366 std::stringstream sout;
367 sout <<
"uh_xi " << uh_xi << std::endl;
368 sout <<
"Duh_xi " << Duh_xi << std::endl;
375 sol[s].Resize(nstate);
379 for (
int ishape = 0; ishape < nshape; ishape++) {
380 for (
int istate = 0; istate < nstate; istate++) {
381 sol[s][istate] += data1d.
phi(ishape) * uh_xi[ishape * nstate + istate].real();
382 dsolxi[istate] += data1d.
phi(ishape) * Duh_xi[ishape * nstate + istate].real();
383 for (
int d = 0; d < dim - 1; d++) {
384 dsollow(d, istate) += data1d.
dphi(d, ishape) * uh_xi[ishape * nstate + istate].real();
388 for (
int istate = 0; istate < nstate; istate++) {
389 for (
int d = 0; d < dim - 1; d++) {
390 dsolxieta(d, istate) = dsollow(d, istate);
392 dsolxieta(dim - 1, istate) = -dsolxi[istate] / 2.;
394 dsol[s].
Resize(dim, nstate);
396 for (
int istate = 0; istate < nstate; istate++) {
397 for (
int d1 = 0; d1 < dim; d1++) {
398 for (
int d2 = 0; d2 < dim; d2++) {
399 dsol[s](d1, istate) += data2d.
jacinv(d2, d1) * dsolxieta(d2, istate);
427 if (logger->isDebugEnabled()) {
428 std::stringstream sout;
434 int matid = Ref2D->MaterialId();
439 phi.
Redim(CoefficientLoc.
Cols() * nstate, 1);
440 dphidxi.
Redim(dim*nstate, CoefficientLoc.
Cols());
442 REAL sbfemparam = (1. - qsi[dim - 1]) / 2.;
443 if (sbfemparam < 0.) {
444 std::cout <<
"sbfemparam " << sbfemparam << std::endl;
448 for (
int i = 0; i < dim - 1; i++) {
453 qsi[dim - 1] = 1. - 2.e-6;
456 qsi[dim - 1] = 1. - 2.e-4;
475 int nshape = data1d.
phi.
Rows();
483 if (logger->isDebugEnabled()) {
486 for (
int i = 0; i < CoefficientLoc.
Rows(); i++) {
487 coefcol[i] = CoefficientLoc(i, eq);
489 std::stringstream sout;
490 sout <<
"coefficients " << coefcol << std::endl;
495 for (
int s = 0; s < CoefficientLoc.
Cols(); s++) {
499 for (
int c = 0; c < numeig; c++) {
500 std::complex<double> xiexp;
501 std::complex<double> xiexpm1;
512 for (
int i = 0; i < nphixi; i++) {
513 uh_xi[i] += CoefficientLoc(c, s) * xiexp *
fPhi(i, c);
514 Duh_xi[i] += -CoefficientLoc(c, s)*(
fEigenvalues[c] + 0.5 * (dim - 2)) * xiexpm1 *
fPhi(i, c);
518 if (s == 1 && logger->isDebugEnabled()) {
519 std::stringstream sout;
520 sout <<
"uh_xi " << uh_xi << std::endl;
521 sout <<
"Duh_xi " << Duh_xi << std::endl;
530 for (
int ishape = 0; ishape < nshape; ishape++) {
531 for (
int istate = 0; istate < nstate; istate++) {
532 phi(s * nstate + istate, 0) += data1d.
phi(ishape) * uh_xi[ishape * nstate + istate].real();
534 dsolxi[istate] += data1d.
phi(ishape) * Duh_xi[ishape * nstate + istate].real();
535 for (
int d = 0; d < dim - 1; d++) {
536 dsollow(d, istate) += data1d.
dphi(d, ishape) * uh_xi[ishape * nstate + istate].real();
540 for (
int istate = 0; istate < nstate; istate++) {
541 for (
int d = 0; d < dim - 1; d++) {
542 dsolxieta(d, istate) = dsollow(d, istate);
544 dsolxieta(dim - 1, istate) = -dsolxi[istate] / 2.;
546 for (
int istate = 0; istate < nstate; istate++) {
547 for (
int d1 = 0; d1 < dim; d1++) {
548 for (
int d2 = 0; d2 < dim; d2++) {
550 dphidxi(istate * nstate + d1, s) += data2d.
jacinv(d2, d1) * dsolxieta(d2, istate);
590 }
else if (ty ==
ECube) {
609 PZError <<
"TPZInterpolatedElement::EvaluateError : no material for this element\n";
613 if (dynamic_cast<TPZBndCond *> (material)) {
614 std::cout <<
"Exiting EvaluateError - null error - boundary condition material.";
619 if (ref->
Dimension() < problemdimension)
return;
644 int nintpoints = intrule->
NPoints();
646 for (
int nint = 0; nint < nintpoints; nint++) {
648 intrule->
Point(nint, intpoint, weight);
657 ref->
X(intpoint, data.
x);
660 fp(data.
x, u_exact, du_exact);
662 material->
Errors(data.
x, data.
sol[0], data.
dsol[0], data.
axes, flux_el, u_exact, du_exact, values);
664 for (
int ier = 0; ier < NErrors; ier++)
665 errors[ier] += values[ier] * weight;
670 for (
int ier = 0; ier < NErrors; ier++) {
671 errors[ier] =
sqrt(errors[ier]);
684 ordervec[dim - 1] = 10;
685 if (10 < order + 6) ordervec[dim - 1] = order + 6;
693 std::map<int64_t, int> globtolocal;
698 for (
int ic = 0; ic < nc; ic++) {
701 firsteq[ic + 1] = firsteq[ic] + c.
NShape() * c.
NState();
706 for (
int ic = 0; ic < nc; ic++) {
712 for (
int ic = 0; ic < nc; ic++) {
715 if (globtolocal.find(cindex) == globtolocal.end()) {
721 int locfirst = firsteq[globtolocal[cindex]];
722 for (
int eq = 0; eq < neq; eq++) {
744 const int nshape = this->
NShapeF();
746 data.
phi.
Redim(nstate * nshape*dim, 1);
747 data.
dphi.
Redim(dim*nstate, nshape * nstate);
748 data.
dphix.
Redim(dim*nstate, nshape * nstate);
754 int64_t nsol = data.
sol.
size();
755 for (int64_t is = 0; is < nsol; is++) {
757 data.
dsol[is].Redim(dim, nstate);
768 PZError <<
"\nERROR AT " << __PRETTY_FUNCTION__ <<
" - this->Reference() == NULL\n";
772 ref->
Jacobian(intpoint, jacobian, axes, detjac, jacinv);
773 this->
Shape(intpoint, phi, dphidx);
virtual void Solution(TPZMaterialData &data, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
virtual void GetOrder(TPZVec< int > &ord) const =0
Gets the order of the integration rule for each dimension of the master element.
int64_t fElementGroupIndex
index of element group
Represents a graphical mesh used for post processing purposes. Post processing.
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 BuildCornerConnectList(std::set< int64_t > &connectindexes) const =0
adds the connect indexes associated with base shape functions to the set
virtual int NPoints() const =0
Returns number of points for the cubature rule related.
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
bool IsZero(long double a)
Returns if the value a is close Zero as the allowable tolerance.
virtual void Errors(TPZMaterialData &data, TPZVec< STATE > &u_exact, TPZFMatrix< STATE > &du_exact, TPZVec< REAL > &errors)
TPZManVector< REAL, 3 > x
value of the coordinate at the integration point
virtual void InitMaterialData(TPZMaterialData &data)
Initialize a material data and its attributes based on element dimension, number of state variables a...
virtual void Shape(TPZVec< REAL > &qsi, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphidxi)
Computes the shape function set at the point x.
virtual void ComputeShape(TPZVec< REAL > &intpoint, TPZVec< REAL > &X, TPZFMatrix< REAL > &jacobian, TPZFMatrix< REAL > &axes, REAL &detjac, TPZFMatrix< REAL > &jacinv, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< REAL > &dphidx)
Compute shape functions based on master element in the classical FEM manner.
int MaterialId() const
Returns the material index of the element.
void CreateGraphicalElement(TPZGraphMesh &, int)
Creates corresponding graphical element(s) if the dimension matches graphical elements are used to ge...
void ExtendShapeFunctions(TPZMaterialData &data1d, TPZMaterialData &data2d)
extend the border shape functions for SBFem computations
TPZFNMatrix< 30, std::complex< double > > fPhi
Section of the phi vector associated with this volume element.
clarg::argInt dimension("-d", "Matrices dimension M x M", 1000)
int64_t fSkeleton
index of the skeleton element
TPZFNMatrix< 660, REAL > dphi
values of the derivative of the shape functions over the master element
TPZFNMatrix< 1000, STATE > fMat
Pointer to a blocked matrix object.
virtual int NShapeF() const
It returns the shapes number of the element.
To export a graphical two-dimensional discontinuous element. Post processing.
To export a graphical three dimensional discontinuous element. Post processing.
virtual void Identity()
Converts the matrix in an identity matrix.
void SetPhiEigVal(TPZFMatrix< std::complex< double > > &phi, TPZManVector< std::complex< double > > &eigval)
initialize the data structures of the eigenvectors and eigenvalues associated with this volume elemen...
virtual int Dimension() const =0
Returns the integrable dimension of the material.
virtual int NStateVariables() const =0
Returns the number of state variables associated with the material.
TPZManVector< std::complex< double > > fEigenvalues
Eigenvlues associated with the internal shape functions.
TPZGradSolVec dsol
vector of the derivatives of the solution at the integration point
MShapeFunctionType fShapeType
TPZFNMatrix< 9, REAL > jacinv
value of the inverse of the jacobian at the integration point
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
virtual void Print(std::ostream &out=std::cout) const
Prints element data.
REAL val(STATE &number)
Returns value of the variable.
TPZGeoMesh * Mesh() const
Returns the mesh to which the element belongs.
virtual int NSides() const =0
Returns the number of connectivities of the element.
virtual void InitMaterialData(TPZMaterialData &data)
Initialize a material data and its attributes based on element dimension, number of state variables a...
virtual const TPZIntPoints & GetIntegrationRule() const override=0
Returns a reference to an integration rule suitable for integrating the interior of the element...
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)=0
It computes a contribution to the stiffness matrix and load vector at one integration point...
virtual int SideDimension(int side) const =0
Return the dimension of side.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
TPZFNMatrix< 9, REAL > jacobian
value of the jacobian at the integration point
TPZFMatrix< std::complex< double > > & PhiInverse()
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
TPZFNMatrix< 660, REAL > dphix
values of the derivative of the shape functions
TPZCompEl * fElementGroup
pointer to the element group computational element
Abstract class defining integration rules. Numerical Integration.
virtual void SetPreferredOrder(int order)
Defines the desired order for entire element.
This abstract class defines the behaviour which each derived class needs to implement.
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
virtual TPZIntPoints * CreateSideIntegrationRule(int side, int order)=0
Creates an integration rule for the topology of the corresponding side and able to integrate a polyno...
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
int Zero() override
Makes Zero all the elements.
int64_t size() const
Returns the number of elements of the vector.
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...
TPZCompEl * Element(int64_t iel)
virtual int NEvalErrors()
Returns the number of norm errors. Default is 3: energy, L2 and H1.
virtual void BuildCornerConnectList(std::set< int64_t > &connectindexes) const
adds the connect indexes associated with base shape functions to the set
Implements the graphical element for a prism using a degenerated cube element. Post processing...
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Contains the TPZGraphElQ2dd class which implements the graphical two-dimensional discontinuous elemen...
TPZCompEl * CreateSBFemCompEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
virtual void FillDataRequirements(TPZMaterialData &data)
Fill material data parameter with necessary requirements for the.
#define DebugStop()
Returns a message to user put a breakpoint in.
virtual void SetOrder(TPZVec< int > &ord, int type=0)=0
Sets the order of the cubature rule.
virtual void LoadCoef(TPZFMatrix< std::complex< double > > &coef)
Loads the solution within the internal data structure of the element.
Contains the TPZGraphElPrismMapped class which implements the graphical element for a prism using a d...
static void Convert2Axes(const TPZFMatrix< REAL > &dphi, const TPZFMatrix< REAL > &jacinv, TPZFMatrix< REAL > &dphidx)
convert a shapefunction derivative in xi-eta to a function derivative in axes
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
TPZCompMesh * Mesh() const
Return a pointer to the grid of the element.
virtual void Solution(TPZVec< REAL > &qsi, int var, TPZVec< STATE > &sol)
Calculates the solution - sol - for the variable var at point qsi, where qsi is expressed in terms of...
int Dimension() const
Returns the dimension of the simulation.
virtual MElementType Type() const =0
Returns the element type acording to pzeltype.h.
void Jacobian(TPZVec< REAL > &qsi, TPZFMatrix< REAL > &jac, TPZFMatrix< REAL > &axes, REAL &detjac, TPZFMatrix< REAL > &jacinv) const
Compute a decomposition of the gradient of the mapping function, as a rotation matrix (Jacobian) and ...
TPZMaterial * FindMaterial(int id)
Find the material with identity id.
unsigned int NShape() 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 AdjustAxes3D(const TPZFMatrix< REAL > &axes2D, TPZFMatrix< REAL > &axes3D, TPZFMatrix< REAL > &jac3D, TPZFMatrix< REAL > &jacinv3D, REAL detjac)
adjust the axes and jacobian of the 3D element
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
virtual void PRefine(int order)=0
Change the preferred order for the element and proceed the adjust of the aproximation space taking ...
virtual void PRefine(int order)
Change the preferred order for the element and proceed the adjust of the aproximation space taking ...
virtual void InitializeElementMatrix(TPZElementMatrix &ek, TPZElementMatrix &ef)
Initialize element matrix in which is computed CalcStiff.
Contains declaration of TPZCompMesh class which is a repository for computational elements...
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
virtual TPZConnect & Connect(int i) const
Returns a pointer to the ith node.
virtual int GetPreferredOrder()
Returns the prefered order for the element.
unsigned char NState() const
Number of state variables associated with the connect.
virtual int64_t ConnectIndex(int i) const =0
Returns the index of the ith connectivity of the element.
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
Implements the interfaces for TPZCompElDisc, TPZInterfaceElement and TPZInterpolatedElement. Computational element.
virtual int NConnects() const =0
Returns the number of nodes of the element.
virtual void SetPreferredOrder(int order)=0
Defines the desired order for entire element.
virtual void SetIntegrationRule(int order)
virtual int Dimension() const
Dimension of the element.
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.
virtual int Dimension() const =0
Returns the dimension of the element.
virtual TPZTransform< REAL > SideToSideTransform(int sidefrom, int sideto)=0
Compute the transformation between the master element space of one side of an element to the master e...
void SetSkeleton(int64_t skeleton)
Data structure initialization.
int64_t Id() const
Returns the Id of the element.
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
virtual void X(TPZVec< REAL > &qsi, TPZVec< REAL > &result) const =0
Return the coordinate in real space of the point coordinate in the master element space...
This class implements a geometric mesh for the pz environment. Geometry.
virtual int GetMaxOrder() const
Returns the minimum order to integrate polinomials exactly for all implemented cubature rules...
MElementType
Define the element types.
void ComputeKMatrices(TPZElementMatrix &E0, TPZElementMatrix &E1, TPZElementMatrix &E2, TPZElementMatrix &M0)
Compute the E0, E1 and E2 matrices.
void EvaluateError(std::function< void(const TPZVec< REAL > &loc, TPZVec< STATE > &val, TPZFMatrix< STATE > &deriv)> fp, TPZVec< REAL > &errors, bool store_error)
Performs an error estimate on the elemen.
TPZFNMatrix< 30, std::complex< double > > fCoeficients
Multiplier coeficients associated with the solution.
Implements computational mesh. Computational Mesh.
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.
Contains declaration of TPZInterpolatedElement class which implements computational element of the in...
void Fill(const T ©, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
REAL fDensity
Density associated with the mass matrix.
TPZSBFemVolume(TPZCompMesh &mesh, TPZGeoEl *gel, int64_t &index)
int64_t Cols() const
Returns number of cols.
virtual void Print(std::ostream &out) const
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
void SetElementGroupIndex(int64_t index)
Initialize the data structure indicating the group index.
virtual void ComputeRequiredData(TPZMaterialData &data, TPZVec< REAL > &qsi)
Compute and fill data with requested attributes.
TPZManVector< int64_t > fLocalIndices
vector of local indices of multipliers in the group
TPZIntPoints * fIntRule
pointer to the integration rule
int fPreferredOrder
Preferred polynomial order.
Defines the interface of a computational element. Computational Element.
virtual void ComputeSolution(TPZVec< REAL > &qsi, TPZSolVec &sol, TPZGradSolVec &dsol, TPZFMatrix< REAL > &axes)
Computes solution and its derivatives in the local coordinate qsi.
TPZSolVec sol
vector of the solutions at the integration point
void Transpose(TPZMatrix< TVar > *const T) const override
It makes *T the transpose of current matrix.
Contains the TPZGraphElQ3dd class which implements the graphical three dimensional discontinuous elem...
REAL detjac
determinant of the jacobian
TVar & g(const int64_t row, const int64_t col) const
Implements computational element based on an interpolation space. Computational Element.
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
virtual void Point(int i, TPZVec< REAL > &pos, REAL &w) const =0
Returns i-th point at master element and related weight.
#define PZError
Defines the output device to error messages and the DebugStop() function.
void Cross(const TPZVec< T > &x1, const TPZVec< T > &x2, TPZVec< T > &result)
void InitializeIntegrationRule()