sixDoFRigidBodyDisplacementPointPatchVectorField::
sixDoFRigidBodyDisplacementPointPatchVectorField
(
    const pointPatch& p,
    const DimensionedField<vector, pointMesh>& iF
)
:
    fixedValuePointPatchField<vector>(p, iF),
    motion_(),
    initialPoints_(p.localPoints()),
    rhoInf_(1.0),
    rhoName_("rho"),
    lookupGravity_(-1),
    g_(vector::zero),
    curTimeIndex_(-1)
{}
Exemplo n.º 2
0
Foam::emptyPointPatchField<Type>::emptyPointPatchField
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF,
    const dictionary& dict
)
:
    pointPatchField<Type>(p, iF, dict)
{
    if (!isType<emptyPointPatch>(p))
    {
        FatalIOErrorInFunction
        (
            dict
        )   << "patch " << this->patch().index() << " not empty type. "
            << "Patch type = " << p.type()
            << exit(FatalIOError);
    }
}
Foam::symmetryPlanePointPatchField<Type>::symmetryPlanePointPatchField
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF,
    const dictionary& dict
)
:
    basicSymmetryPointPatchField<Type>(p, iF, dict),
    symmetryPlanePatch_(refCast<const symmetryPlanePointPatch>(p))
{
    if (!isType<symmetryPlanePointPatch>(p))
    {
        FatalIOErrorInFunction
        (
            dict
        )   << "patch " << this->patch().index() << " not symmetry type. "
            << "Patch type = " << p.type()
            << exit(FatalIOError);
    }
}
Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF,
    const dictionary& dict
)
:
    coupledPointPatchField<Type>(p, iF, dict),
    cyclicACMIPatch_(refCast<const cyclicACMIPointPatch>(p)),
    ppiPtr_(NULL),
    nbrPpiPtr_(NULL)
{
    if (!isType<cyclicACMIPointPatch>(p))
    {
        FatalIOErrorInFunction
        (
            dict
        )   << "patch " << this->patch().index() << " not cyclicACMI type. "
            << "Patch type = " << p.type()
            << exit(FatalIOError);
    }
}
uniformFixedValuePointPatchField<Type>::
uniformFixedValuePointPatchField
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF,
    const dictionary& dict
)
:
    fixedValuePointPatchField<Type>(p, iF, dict, false),
    uniformValue_(DataEntry<Type>::New("uniformValue", dict))
{
    if (dict.found("value"))
    {
        fixedValuePointPatchField<Type>::operator==
        (
            Field<Type>("value", dict, p.size())
        );
    }
    else
    {
        const scalar t = this->db().time().timeOutputValue();
        fixedValuePointPatchField<Type>::operator=(uniformValue_->value(t));
    }
}
Foam::
dissolMotionPointPatchVectorField::
dissolMotionPointPatchVectorField
(
    const pointPatch& p,
    const DimensionedField<vector, pointMesh>& iF,
    const dictionary& dict
)
:
  fixedValuePointPatchField<vector>(p, iF)
{
  if(debug) {
    Info << "dissolMotionPointPatchVectorField constructor 2"<<endl;
  }
  
  if (dict.found("value"))
  {
    this->operator==
    (
      vectorField("value", dict, p.size())
    );
  }
  else
  {
    WarningIn(
        "dissolMotionPointPatchVectorField constructor 2"
        "("
        "const pointPatch& p,"
        "const DimensionedField<vector, pointMesh>& iF,"
        "const dictionary& dict"
        ")"
    ) << "No value defined for " << this->internalField().name()
        << " on " << this->patch().name()
        << endl;
  }
  
  
  if (!dict.readIfPresent<scalar>("rlxTol", rlxTol))
  {
    rlxTol = 1.0e-6;
    WarningIn
    (
      "dissolMotionPointPatchVectorField constructor 2"
      "("
      "const fvPatch& p,"
      "const DimensionedField<Type, volMesh>& iF,"
      "const dictionary& dict"
      ")"
    )
      << "No value defined for rlxTol"
      << " on " << this->patch().name() << " therefore using "
      << rlxTol
      << endl;
  }
  if (!dict.readIfPresent<int>("q_norm_recalc", q_norm_recalc))
  {
    q_norm_recalc = 1;
    WarningIn
    (
      "dissolMotionPointPatchVectorField constructor 2"
      "("
      "const fvPatch& p,"
      "const DimensionedField<Type, volMesh>& iF,"
      "const dictionary& dict"
      ")"
    )
      << "No value defined for q_norm_recalc"
      << " on " << this->patch().name() << " therefore using "
      << q_norm_recalc
      << endl;
  }
  if (!dict.readIfPresent<scalar>("k_1", k_1))
  {
    k_1 = 1.0;
    WarningIn
    (
      "dissolMotionPointPatchVectorField constructor 2"
      "("
      "const fvPatch& p,"
      "const DimensionedField<Type, volMesh>& iF,"
      "const dictionary& dict"
      ")"
    )
      << "No value defined for k_1"
      << " on " << this->patch().name() << " therefore using "
      << k_1
      << endl;
  }
  if (!dict.readIfPresent<scalar>("k_2", k_2))
  {
    k_2 = 1.0;
    WarningIn
    (
      "dissolMotionPointPatchVectorField constructor 2"
      "("
      "const fvPatch& p,"
      "const DimensionedField<Type, volMesh>& iF,"
      "const dictionary& dict"
      ")"
    )
      << "No value defined for k_2"
      << " on " << this->patch().name() << " therefore using "
      << k_2
      << endl;
  }
  if (!dict.readIfPresent<int>("q_2", q_2))
  {
    q_2 = 1;
    WarningIn
    (
      "dissolMotionPointPatchVectorField constructor 2"
      "("
      "const fvPatch& p,"
      "const DimensionedField<Type, volMesh>& iF,"
      "const dictionary& dict"
      ")"
    )
      << "No value defined for q_2"
      << " on " << this->patch().name() << " therefore using "
      << q_2
      << endl;
  }


  if (!dict.readIfPresent<int>("q_norm_recalc_edge", q_norm_recalc_edge))
  {
    q_norm_recalc_edge = 1;
    WarningIn
    (
      "dissolMotionPointPatchVectorField constructor 2"
      "("
      "const fvPatch& p,"
      "const DimensionedField<Type, volMesh>& iF,"
      "const dictionary& dict"
      ")"
    )
      << "No value defined for q_norm_recalc_edge"
      << " on " << this->patch().name() << " therefore using "
      << q_norm_recalc_edge
      << endl;
  }
  if (!dict.readIfPresent<scalar>("k_1edge", k_1edge))
  {
    k_1edge = 1.0;
    WarningIn
    (
      "dissolMotionPointPatchVectorField constructor 2"
      "("
      "const fvPatch& p,"
      "const DimensionedField<Type, volMesh>& iF,"
      "const dictionary& dict"
      ")"
    )
      << "No value defined for k_1edge"
      << " on " << this->patch().name() << " therefore using "
      << k_1edge
      << endl;
  }
  if (!dict.readIfPresent<scalar>("k_2edge", k_2edge))
  {
    k_2edge = 1.0;
    WarningIn
    (
      "dissolMotionPointPatchVectorField constructor 2"
      "("
      "const fvPatch& p,"
      "const DimensionedField<Type, volMesh>& iF,"
      "const dictionary& dict"
      ")"
    )
      << "No value defined for k_2edge"
      << " on " << this->patch().name() << " therefore using "
      << k_2edge
      << endl;
  }
  if (!dict.readIfPresent<int>("q_2edge", q_2edge))
  {
    q_2edge = 1;
    WarningIn
    (
      "dissolMotionPointPatchVectorField constructor 2"
      "("
      "const fvPatch& p,"
      "const DimensionedField<Type, volMesh>& iF,"
      "const dictionary& dict"
      ")"
    )
      << "No value defined for q_2edge"
      << " on " << this->patch().name() << " therefore using "
      << q_2edge
      << endl;
  }
  
  if (!dict.readIfPresent<bool>("pinnedPoint", pinnedPoint))
  {
    pinnedPoint = false;
    WarningIn
    (
      "dissolMotionPointPatchVectorField constructor 2"
      "("
      "const fvPatch& p,"
      "const DimensionedField<scalar, volMesh>& iF,"
      "const dictionary& dict"
      ")"
    ) 
      << "No value defined for pinnedPoint"
      << " on " << this->patch().name() << " therefore using false"
      << endl;
  }

  
  
  if(debug) 
  {
    Info << "dissolMotionPointPatchVectorField constructor 2 "
            "calc_weights_surface"<<nl;
  }
  calc_weights_surface();
  
  if(debug) 
  {
    Info << "dissolMotionPointPatchVectorField constructor 2 "
            "make_lists_and_normals"<<nl;
  }
  make_lists_and_normals();
  
  /*
  for(int i=0; i<5; i++)
  {
    Info<<i<<" "<<surfWeights[i]<<"  "<<pinnedPointsNorm[i]<<nl;
  }
  std::exit(0);
  */
  
}
Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
(
    const word& patchFieldType,
    const word& actualPatchType,
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF
)
{
    if (debug)
    {
        Info<< "PointPatchField<Type>::"
               "New(const word&, const word&"
                ", const pointPatch&, const Field<Type>&) : "
               "constructing pointPatchField<Type>"
            << endl;
    }

    typename pointPatchConstructorTable::iterator cstrIter =
        pointPatchConstructorTablePtr_->find(patchFieldType);

    if (cstrIter == pointPatchConstructorTablePtr_->end())
    {
        FatalErrorIn
        (
            "PointPatchField<Type>::New"
            "(const word&, const word&, const pointPatch&, const Field<Type>&)"
        )   << "Unknown patchFieldType type "
            << patchFieldType << nl << nl
            << "Valid patchField types are :" << endl
            << pointPatchConstructorTablePtr_->sortedToc()
            << exit(FatalError);
    }

    autoPtr<pointPatchField<Type> > pfPtr(cstrIter()(p, iF));

    if
    (
        actualPatchType == word::null
     || actualPatchType != p.type()
    )
    {
        if (pfPtr().constraintType() != p.constraintType())
        {
            // Use default constraint type
            typename pointPatchConstructorTable::iterator patchTypeCstrIter =
                pointPatchConstructorTablePtr_->find(p.type());

            if (patchTypeCstrIter == pointPatchConstructorTablePtr_->end())
            {
                FatalErrorIn
                (
                    "PointPatchField<Type>::New"
                    "(const word&, const word&"
                    ", const pointPatch&, const Field<Type>&)"
                )   << "inconsistent patch and patchField types for \n"
                    << "    patch type " << p.type()
                    << " and patchField type " << patchFieldType
                    << exit(FatalError);
            }

            return patchTypeCstrIter()(p, iF);
        }
    }

    return pfPtr;
}
Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF,
    const dictionary& dict
)
{
    if (debug)
    {
        Info<< "PointPatchField<Type>::"
               "New(const pointPatch&, const Field<Type>&, const dictionary&)"
               " : constructing pointPatchField<Type>"
            << endl;
    }

    word patchFieldType(dict.lookup("type"));

    typename dictionaryConstructorTable::iterator cstrIter
        = dictionaryConstructorTablePtr_->find(patchFieldType);

    if (cstrIter == dictionaryConstructorTablePtr_->end())
    {
        if (!disallowGenericPointPatchField)
        {
            cstrIter = dictionaryConstructorTablePtr_->find("generic");
        }

        if (cstrIter == dictionaryConstructorTablePtr_->end())
        {
            FatalIOErrorIn
            (
                "PointPatchField<Type>::"
                "New(const pointPatch&, const Field<Type>&, const dictionary&)",
                dict
            )   << "Unknown patchField type " << patchFieldType
                << " for patch type " << p.type() << nl << nl
                << "Valid patchField types are :" << endl
                << dictionaryConstructorTablePtr_->sortedToc()
                << exit(FatalIOError);
        }
    }

    // Construct (but not necesarily returned)
    autoPtr<pointPatchField<Type> > pfPtr(cstrIter()(p, iF, dict));

    if
    (
       !dict.found("patchType")
     || word(dict.lookup("patchType")) != p.type()
    )
    {
        if (pfPtr().constraintType() == p.constraintType())
        {
            // Compatible (constraint-wise) with the patch type
            return pfPtr;
        }
        else
        {
            // Use default constraint type
            typename dictionaryConstructorTable::iterator patchTypeCstrIter
                = dictionaryConstructorTablePtr_->find(p.type());

            if (patchTypeCstrIter == pointPatchConstructorTablePtr_->end())
            {
                FatalIOErrorIn
                (
                    "PointPatchField<Type>const pointPatch&, "
                    "const Field<Type>&, const dictionary&)",
                    dict
                )   << "inconsistent patch and patchField types for \n"
                    << "    patch type " << p.type()
                    << " and patchField type " << patchFieldType
                    << exit(FatalIOError);
            }

            return patchTypeCstrIter()(p, iF, dict);
        }
    }

    return cstrIter()(p, iF, dict);
}