69 int ndata = datavec.
size();
70 for (
int idata=0; idata < ndata ; idata++) {
71 datavec[idata].SetAllRequirements(
false);
72 datavec[idata].fNeedsSol =
true;
78 int ndata = datavec.
size();
79 for (
int idata=0; idata < ndata ; idata++) {
80 datavec[idata].SetAllRequirements(
false);
81 datavec[idata].fNeedsSol =
true;
158 STATE divu = datavec[ub].divsol[0][0];
160 REAL jac_det = datavec[ub].detjac;
162 int nphiu = datavec[ub].fVecShapeIndex.
NElements();
163 int nphip = phi_ps.
Rows();
165 int firstp = nphiu + firstu;
168 STATE p = datavec[pb].sol[0][0];
177 for (
int iu = 0; iu < nphiu; iu++)
180 v_i = datavec[ub].fVecShapeIndex[iu].first;
181 s_i = datavec[ub].fVecShapeIndex[iu].second;
183 STATE u_dot_phi_u_i = 0.0;
184 for (
int i = 0; i < u.
size(); i++) {
185 phi_u_i(i,0) = phi_us(s_i,0) * datavec[ub].fNormalVec(i,v_i);
186 u_dot_phi_u_i += u[i]*phi_u_i(i,0);
189 ef(iu + firstu) += weight * ( u_dot_phi_u_i - p * div_on_master(iu,0));
191 for (
int ju = 0; ju < nphiu; ju++)
194 v_j = datavec[ub].fVecShapeIndex[ju].first;
195 s_j = datavec[ub].fVecShapeIndex[ju].second;
197 STATE phi_u_j_dot_phi_u_i = 0.0;
198 for (
int j = 0; j < u.
size(); j++) {
199 phi_u_j(j,0) = phi_us(s_j,0) * datavec[ub].fNormalVec(j,v_j);
200 phi_u_j_dot_phi_u_i += phi_u_j(j,0)*phi_u_i(j,0);
203 ek(iu + firstu,ju + firstu) += weight * phi_u_j_dot_phi_u_i;
206 for (
int jp = 0; jp < nphip; jp++)
208 ek(iu + firstu, jp + firstp) += weight * ( - div_on_master(iu,0) ) * phi_ps(jp,0);
218 for (
int ip = 0; ip < nphip; ip++)
221 ef(ip + firstp) += -1.0 * weight * (divu - f[0]) * phi_ps(ip,0);
223 for (
int ju = 0; ju < nphiu; ju++)
225 ek(ip + firstp, ju + firstu) += -1.0 * weight * div_on_master(ju,0) * phi_ps(ip,0);
235 this->
Contribute(datavec, weight, ekfake, ef);
253 int nphiu = phi_us.
Rows();
259 bc_data[0] = bc.
Val2()(0,0);
267 STATE p_D = bc_data[0];
268 for (
int iu = 0; iu < nphiu; iu++)
270 ef(iu + firstu) += weight * p_D * phi_us(iu,0);
278 for (
int iu = 0; iu < nphiu; iu++)
280 STATE un_N = bc_data[0], un = u[0];
281 ef(iu + firstu) += weight *
gBigNumber * (un - un_N) * phi_us(iu,0);
283 for (
int ju = 0; ju < nphiu; ju++)
286 ek(iu + firstu,ju + firstu) += weight * gBigNumber * phi_us(ju,0) * phi_us(iu,0);
294 default: std::cout <<
"This BC doesn't exist." << std::endl;
318 if(!strcmp(
"q",name.c_str()))
return 1;
319 if(!strcmp(
"p",name.c_str()))
return 2;
320 if(!strcmp(
"q_exact",name.c_str()))
return 3;
321 if(!strcmp(
"p_exact",name.c_str()))
return 4;
322 if(!strcmp(
"f_exact",name.c_str()))
return 5;
323 if(!strcmp(
"div_q",name.c_str()))
return 6;
330 if(var == 2)
return 1;
332 if(var == 4)
return 1;
333 if(var == 5)
return 1;
334 if(var == 6)
return 1;
353 u = datavec[ub].sol[0];
354 p = datavec[pb].sol[0];
356 STATE div_u = datavec[ub].divsol[0][0];
359 for (
int i=0; i < this->
Dimension(); i++)
378 for (
int i=0; i < this->
Dimension(); i++)
429 for(
int i = 0; i < this->
Dimension(); i++) {
433 STATE div_error = div_u - du_exact(3,0);
436 STATE p_error = p[0] - u_exact[0];
437 errors[0] = p_error*p_error;
440 for(
int i = 0; i < this->
Dimension(); i++) {
441 STATE d_error = u[i] - du_exact(i,0);
442 errors[1] += d_error*d_error;
446 errors[2]= div_error * div_error;
This material consider exactly just laplace equation (i.e. coefficient equal to 1) ...
virtual void Execute(const TPZVec< REAL > &x, TPZVec< TVar > &f, TPZFMatrix< TVar > &df)
Performs function computation.
int NSolutionVariables(int var) override
size of the current variable (1 -> scalar, 3-> vector, 9 -> Tensor )
TPZDualPoisson()
default constructor
clarg::argBool bc("-bc", "binary checkpoints", false)
TPZMaterial & operator=(const TPZMaterial ©)
operator =
virtual int VariableIndex(const std::string &name)
Returns the variable index associated with the name.
void SetAllRequirements(bool set)
Set all flags at once.
int VariableIndex(const std::string &name) override
Variable index based on variable naming.
TPZDualPoisson & operator=(const TPZDualPoisson &other)
assignment operator
This class implements a simple vector storage scheme for a templated class T. Utility.
int Dimension() const override
return the euclidean dimension of the weak statement
TPZFMatrix< STATE > & Val2(int loadcase=0)
virtual void Print(std::ostream &out=std::cout)
Prints out the data associated with the material.
This abstract class defines the behaviour which each derived class needs to implement.
void Solution(TPZMaterialData &data, int var, TPZVec< STATE > &Solout) override
Postprocess required variables.
TPZAutoPointer< TPZFunction< STATE > > & ForcingFunction()
Returns a procedure as source function for the material.
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...
int NEvalErrors() override
Number of errors being computed = { 0-> h1, 1 ->L2 primal, 2 L2 dual}.
void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
Boundary contribute without jacobian matrix.
#define DebugStop()
Returns a message to user put a breakpoint in.
void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
Volumetric contribute without jacobian matrix.
TPZAutoPointer< TPZFunction< STATE > > fForcingFunctionExact
Pointer to exact solution function, needed to calculate exact error.
virtual int ClassId() const override
unique class identifier
This class defines the boundary condition for TPZMaterial objects.
virtual int HasForcingFunctionExact()
Directive that gives true if the material has a function exact.
std::string Name() override
print material name
int64_t Rows() const
Returns number of rows.
virtual int HasForcingFunction()
Directive that gives true if the material has a forcing function.
~TPZDualPoisson()
default desconstructor
virtual int NStateVariables() const override
return the number of state variables associated with each trial function
static REAL gBigNumber
Big number to penalization method, used for Dirichlet conditions.
void Read(TPZStream &buf, void *context) override
write class from disk
int32_t Hash(std::string str)
virtual void Write(TPZStream &buf, int withclassid) const override
write class in disk
int ClassId() const override
Unique identifier for serialization purposes.
virtual int NSolutionVariables(int var)
Returns the number of variables associated with the variable indexed by var.
void FillBoundaryConditionDataRequirement(int type, TPZMaterialData &data) override
fill requirements for bounadry contribute methods
TPZAutoPointer< TPZFunction< STATE > > fForcingFunction
Pointer to forcing function, it is the right member at differential equation.
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.
Defines the interface for saving and reading data. Persistency.
int64_t NElements() const
Returns the number of elements of the vector.
TPZMaterial * NewMaterial() override
return a material object from a this object
void FillDataRequirements(TPZMaterialData &data) override
fill requirements for volumetric contribute methods
void Errors(TPZVec< REAL > &x, TPZVec< STATE > &u, TPZFMatrix< STATE > &du, TPZFMatrix< REAL > &axes, TPZVec< STATE > &flux, TPZVec< STATE > &u_exact, TPZFMatrix< STATE > &du_exact, TPZVec< REAL > &error) override
Compute errors, no comments!!!
void Print(std::ostream &out) override
print all material information
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...