本文整理汇总了C++中SolutionPtr::lagrangeConstraints方法的典型用法代码示例。如果您正苦于以下问题:C++ SolutionPtr::lagrangeConstraints方法的具体用法?C++ SolutionPtr::lagrangeConstraints怎么用?C++ SolutionPtr::lagrangeConstraints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolutionPtr
的用法示例。
在下文中一共展示了SolutionPtr::lagrangeConstraints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
FunctionPtr u1_prev = Function::solution(u1,solution);
FunctionPtr u2_prev = Function::solution(u2,solution);
FunctionPtr u1hat_prev = Function::solution(u1hat,solution);
FunctionPtr u2hat_prev = Function::solution(u2hat,solution);
//////////////////// SOLVE & REFINE ///////////////////////
FunctionPtr vorticity = Teuchos::rcp( new PreviousSolutionFunction(solution, - u1->dy() + u2->dx() ) );
// FunctionPtr vorticity = Teuchos::rcp( new PreviousSolutionFunction(solution,sigma12 - sigma21) );
RHSPtr streamRHS = RHS::rhs();
streamRHS->addTerm(vorticity * q_s);
((PreviousSolutionFunction*) vorticity.get())->setOverrideMeshCheck(true);
((PreviousSolutionFunction*) u1_prev.get())->setOverrideMeshCheck(true);
((PreviousSolutionFunction*) u2_prev.get())->setOverrideMeshCheck(true);
BCPtr streamBC = BC::bc();
// streamBC->addDirichlet(psin_hat, entireBoundary, u0_cross_n);
streamBC->addDirichlet(phi_hat, entireBoundary, zero);
// streamBC->addZeroMeanConstraint(phi);
IPPtr streamIP = Teuchos::rcp( new IP );
streamIP->addTerm(q_s);
streamIP->addTerm(q_s->grad());
streamIP->addTerm(v_s);
streamIP->addTerm(v_s->div());
SolutionPtr streamSolution = Teuchos::rcp( new Solution( streamMesh, streamBC, streamRHS, streamIP ) );
if (enforceLocalConservation)
{
FunctionPtr zero = Function::zero();
solution->lagrangeConstraints()->addConstraint(u1hat->times_normal_x() + u2hat->times_normal_y()==zero);
solnIncrement->lagrangeConstraints()->addConstraint(u1hat->times_normal_x() + u2hat->times_normal_y()==zero);
}
if (true)
{
FunctionPtr u1_incr = Function::solution(u1, solnIncrement);
FunctionPtr u2_incr = Function::solution(u2, solnIncrement);
FunctionPtr sigma11_incr = Function::solution(sigma11, solnIncrement);
FunctionPtr sigma12_incr = Function::solution(sigma12, solnIncrement);
FunctionPtr sigma21_incr = Function::solution(sigma21, solnIncrement);
FunctionPtr sigma22_incr = Function::solution(sigma22, solnIncrement);
FunctionPtr p_incr = Function::solution(p, solnIncrement);
FunctionPtr l2_incr = u1_incr * u1_incr + u2_incr * u2_incr + p_incr * p_incr
+ sigma11_incr * sigma11_incr + sigma12_incr * sigma12_incr
+ sigma21_incr * sigma21_incr + sigma22_incr * sigma22_incr;
double energyThreshold = 0.20;
Teuchos::RCP< RefinementStrategy > refinementStrategy = Teuchos::rcp( new RefinementStrategy( solnIncrement, energyThreshold ));
for (int i=0; i<ReValues.size(); i++)
{
double Re = ReValues[i];
Re_param->setValue(Re);
if (rank==0) cout << "Solving with Re = " << Re << ":\n";
double energyErrorTotal;
do
{
double incr_norm;
do
{
problem.iterate(useLineSearch);