本文整理汇总了C++中BCPtr::addZeroMeanConstraint方法的典型用法代码示例。如果您正苦于以下问题:C++ BCPtr::addZeroMeanConstraint方法的具体用法?C++ BCPtr::addZeroMeanConstraint怎么用?C++ BCPtr::addZeroMeanConstraint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BCPtr
的用法示例。
在下文中一共展示了BCPtr::addZeroMeanConstraint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
VarPtr tau2 = vf->testVar("tau2", HDIV);
VarPtr q = vf->testVar("q", HGRAD);
BFPtr bf = Teuchos::rcp( new BF(vf) );
bf->addTerm(1./mu*sigma1, tau1);
bf->addTerm(1./mu*sigma2, tau2);
bf->addTerm(u1, tau1->div());
bf->addTerm(u2, tau2->div());
bf->addTerm(-u1hat, tau1->dot_normal());
bf->addTerm(-u2hat, tau2->dot_normal());
bf->addTerm(sigma1, v1->grad());
bf->addTerm(sigma2, v2->grad());
bf->addTerm(-p, v1->dx());
bf->addTerm(-p, v2->dy());
bf->addTerm(t1c, v1);
bf->addTerm(t2c, v2);
bf->addTerm(mu*permInv*u1, v1);
bf->addTerm(mu*permInv*u2, v2);
bf->addTerm(-u1, q->dx());
bf->addTerm(-u2, q->dy());
bf->addTerm(u1hat, q->times_normal_x());
bf->addTerm(u2hat, q->times_normal_y());
RHSPtr rhs = RHS::rhs();
BCPtr bc = BC::bc();
SpatialFilterPtr y_equals_one = SpatialFilter::matchingY(1.0);
SpatialFilterPtr y_equals_zero = SpatialFilter::matchingY(0);
SpatialFilterPtr x_equals_one = SpatialFilter::matchingX(1.0);
SpatialFilterPtr x_equals_zero = SpatialFilter::matchingX(0.0);
bc->addDirichlet(u1hat, y_equals_zero, u1_exact);
bc->addDirichlet(u2hat, y_equals_zero, u2_exact);
bc->addDirichlet(u1hat, x_equals_zero, u1_exact);
bc->addDirichlet(u2hat, x_equals_zero, u2_exact);
bc->addDirichlet(u1hat, y_equals_one, u1_exact);
bc->addDirichlet(u2hat, y_equals_one, u2_exact);
bc->addDirichlet(u1hat, x_equals_one, u1_exact);
bc->addDirichlet(u2hat, x_equals_one, u2_exact);
bc->addZeroMeanConstraint(p);
MeshPtr mesh = MeshFactory::quadMesh(bf, k+1, delta_k, 1, 1, 4, 4);
map<string, IPPtr> brinkmanIPs;
brinkmanIPs["Graph"] = bf->graphNorm();
brinkmanIPs["Decoupled"] = Teuchos::rcp(new IP);
brinkmanIPs["Decoupled"]->addTerm(tau1);
brinkmanIPs["Decoupled"]->addTerm(tau2);
brinkmanIPs["Decoupled"]->addTerm(tau1->div());
brinkmanIPs["Decoupled"]->addTerm(tau2->div());
brinkmanIPs["Decoupled"]->addTerm(permInv*v1);
brinkmanIPs["Decoupled"]->addTerm(permInv*v2);
brinkmanIPs["Decoupled"]->addTerm(v1->grad());
brinkmanIPs["Decoupled"]->addTerm(v2->grad());
brinkmanIPs["Decoupled"]->addTerm(q);
brinkmanIPs["Decoupled"]->addTerm(q->grad());
// brinkmanIPs["CoupledRobust"] = Teuchos::rcp(new IP);
// brinkmanIPs["CoupledRobust"]->addTerm(tau->div()-beta*v->grad());
// brinkmanIPs["CoupledRobust"]->addTerm(Function<double>::min(one/Function<double>::h(),Function<double>::constant(1./sqrt(epsilon)))*tau);
// brinkmanIPs["CoupledRobust"]->addTerm(sqrt(epsilon)*v->grad());
// brinkmanIPs["CoupledRobust"]->addTerm(beta*v->grad());
// brinkmanIPs["CoupledRobust"]->addTerm(Function<double>::min(sqrt(epsilon)*one/Function<double>::h(),one)*v);
IPPtr ip = brinkmanIPs[norm];
SolutionPtr soln = TSolution<double>::solution(mesh, bc, rhs, ip);
double threshold = 0.20;
RefinementStrategy refStrategy(soln, threshold);
ostringstream refName;
refName << "brinkman";
HDF5Exporter exporter(mesh,refName.str());
for (int refIndex=0; refIndex <= numRefs; refIndex++)
{
soln->solve(false);
double energyError = soln->energyErrorTotal();
if (commRank == 0)
{
// if (refIndex > 0)
// refStrategy.printRefinementStatistics(refIndex-1);
cout << "Refinement:\t " << refIndex << " \tElements:\t " << mesh->numActiveElements()
<< " \tDOFs:\t " << mesh->numGlobalDofs() << " \tEnergy Error:\t " << energyError << endl;
}
exporter.exportSolution(soln, refIndex);
if (refIndex != numRefs)
refStrategy.refine();
}
return 0;
}