示例#1
0
void UpwindFactory::produce(Grid * g){
	if(contains(g)){
		return;
	}
	Divergence div(g);
	CellToFaceOperator F;
	F.setGrid(g);
	vector<Face*>::iterator it;
	for(it = g->faces.begin(); it != g->faces.end(); it++){
		if((*it) != 0 && (*it)->isBoundary()){
			FaceIndex faceIndex = (*it)->getIndex();
			Coord pos = (*it)->getCentroid();
			TinyVector<double,2> aSpeed = (*c)(pos);
			double a = sum(aSpeed*((*it)->getNormal()));
			if(a > 0){
				CellIndex upwind((*it)->getFrom()->getI(),(*it)->getFrom()->getJ());
				F.coefficients[faceIndex][upwind] = -a;
			}
			if(a < 0){
				F.constantTerm(faceIndex) = -a;
			}
		}
		else if((*it) != 0 && (*it)->isInterior()){
			FaceIndex faceIndex = (*it)->getIndex();
			Coord pos = (*it)->getCentroid();
			TinyVector<double,2> aSpeed = (*c)(pos);
			double a = sum(aSpeed*((*it)->getNormal()));
			if(a > 0){
				CellIndex upwind((*it)->getFrom()->getI(),(*it)->getFrom()->getJ());
				F.coefficients[faceIndex][upwind] = -a;
			}
			else if(a < 0){
				//cout << "Negative speed through face" << endl;
				CellIndex upwind((*it)->getTo()->getI(),(*it)->getTo()->getJ());
				F.coefficients[faceIndex][upwind] = -a;
			}
		}
	}
	operators[g] = new CellToCellOperator(div(F));
}
示例#2
0
void
Q2PPorepressureFlux::computeOffDiagJacobian(unsigned int jvar)
{
  upwind(false, true, jvar);
}
void
RichardsFullyUpwindFlux::computeOffDiagJacobian(unsigned int jvar)
{
  upwind(false, true, jvar);
  return;
}
void
RichardsFullyUpwindFlux::computeResidual()
{
  upwind(true, false, 0);
  return;
}
示例#5
0
void
Q2PSaturationFlux::computeJacobian()
{
  upwind(false, true, _var.number());
}
示例#6
0
void
Q2PSaturationFlux::computeResidual()
{
  upwind(true, false, 0);
}
示例#7
0
void
Q2PSaturationFlux::computeOffDiagJacobian(unsigned int jvar)
{
  upwind(false, true, jvar);
}
示例#8
0
void
Q2PSaturationFlux::computeOffDiagJacobian(MooseVariableFEBase & jvar)
{
  upwind(false, true, jvar.number());
}
示例#9
0
void
PorousFlowDarcyBase::computeResidual()
{
  upwind(JacRes::CALCULATE_RESIDUAL, 0.0);
}
示例#10
0
void
PorousFlowDarcyBase::computeOffDiagJacobian(unsigned int jvar)
{
  upwind(JacRes::CALCULATE_JACOBIAN, jvar);
}
示例#11
0
void
PorousFlowAdvectiveFlux::computeOffDiagJacobian(unsigned int jvar)
{
   upwind(CALCULATE_JACOBIAN, jvar);
}
示例#12
0
void
PorousFlowAdvectiveFlux::computeJacobian()
{
   upwind(CALCULATE_JACOBIAN, _var.number());
}
示例#13
0
void
PorousFlowAdvectiveFlux::computeResidual()
{
  upwind(CALCULATE_RESIDUAL, 0.0);
}
示例#14
0
void
RichardsFullyUpwindFlux::computeJacobian()
{
  upwind(false, true, _var.number());
  return;
}
示例#15
0
void
Q2PPorepressureFlux::computeResidual()
{
  upwind(true, false, 0);
}
示例#16
0
void
Q2PPorepressureFlux::computeJacobian()
{
  upwind(false, true, _var.number());
}
示例#17
0
void
PorousFlowDarcyBase::computeJacobian()
{
  upwind(JacRes::CALCULATE_JACOBIAN, _var.number());
}