Foam::valuePointPatchField<Type>::valuePointPatchField
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF,
    const dictionary& dict,
    const bool valueRequired
)
:
    pointPatchField<Type>(p, iF, dict),
    Field<Type>(p.size())
{
    if (dict.found("value"))
    {
        Field<Type>::operator=
        (
            Field<Type>("value", dict, p.size())
        );
    }
    else if (!valueRequired)
    {
        Field<Type>::operator=(Zero);
    }
    else
    {
        FatalIOErrorInFunction
        (
            dict
        )   << "Essential entry 'value' missing"
            << exit(FatalIOError);
    }
}
groovyBCPointPatchField<Type>::groovyBCPointPatchField
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF,
    const dictionary& dict
)
:
    mixedPointPatchFieldType(p, iF),
    groovyBCCommon<Type>(dict,false,true),
    driver_(dict,getFvPatch(this->patch()))
{
    driver_.readVariablesAndTables(dict);

    if (dict.found("refValue")) {
        this->refValue() = Field<Type>("refValue", dict, p.size());
    } else {
        this->refValue() = pTraits<Type>::zero;
    }

    if (dict.found("value"))
    {
        Field<Type>::operator=
        (
            Field<Type>("value", dict, p.size())
        );
    }
    else
    {
        Field<Type>::operator=(this->refValue());
        WarningIn(
            "groovyBCPointPatchField<Type>::groovyBCPointPatchField"
            "("
            "const pointPatch& p,"
            "const DimensionedField<Type, pointMesh>& iF,"
            "const dictionary& dict"
            ")"
        ) << "No value defined for " << this->dimensionedInternalField().name()
            << " on " << this->patch().name() << " therefore using "
            << this->refValue()
            << endl;
    }

    //    this->refGrad() = pTraits<Type>::zero;
    if (dict.found("valueFraction")) {
        this->valueFraction() = Field<scalar>("valueFraction", dict, p.size());
    } else {
        this->valueFraction() = 1;
    }

    if(this->evaluateDuringConstruction()) {
        // make sure that this works with potentialFoam or other solvers that don't evaluate the BCs
        this->evaluate();
    } else {
        // mixed-BC DOES NOT call evaluate during construction
    }
}
Beispiel #3
0
Foam::mixedPointPatchField<Type>::mixedPointPatchField
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF
)
:
    valuePointPatchField<Type>(p, iF),
    refValue_(p.size()),
    valueFraction_(p.size())
{}
Beispiel #4
0
Foam::mixedPointPatchField<Type>::mixedPointPatchField
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF,
    const dictionary& dict
)
:
    valuePointPatchField<Type>(p, iF, dict, false),
    refValue_("refValue", dict, p.size()),
    valueFraction_("valueFraction", dict, p.size())
{}
oscillatingVelocityPointPatchVectorField::
oscillatingVelocityPointPatchVectorField
(
    const pointPatch& p,
    const DimensionedField<vector, pointMesh>& iF,
    const dictionary& dict
)
:
    fixedValuePointPatchVectorField(p, iF, dict),
    amplitude_(dict.lookup("amplitude")),
    omega_(readScalar(dict.lookup("omega")))
{
    if (!dict.found("value"))
    {
        updateCoeffs();
    }

    if (dict.found("p0"))
    {
        p0_ = vectorField("p0", dict , p.size());
    }
    else
    {
        p0_ = p.localPoints();
    }
}
angularOscillatingDisplacementPointPatchVectorField::
angularOscillatingDisplacementPointPatchVectorField
(
    const pointPatch& p,
    const DimensionedField<vector, pointMesh>& iF,
    const dictionary& dict
)
:
    fixedValuePointPatchVectorField(p, iF, dict),
    axis_(dict.lookup("axis")),
    origin_(dict.lookup("origin")),
    angle0_(readScalar(dict.lookup("angle0"))),
    amplitude_(readScalar(dict.lookup("amplitude"))),
    omega_(readScalar(dict.lookup("omega")))
{
    if (!dict.found("value"))
    {
        updateCoeffs();
    }

    if (dict.found("p0"))
    {
        p0_ = vectorField("p0", dict , p.size());
    }
    else
    {
        p0_ = p.localPoints();
    }
}
Foam::valuePointPatchField<Type>::valuePointPatchField
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF
)
:
    pointPatchField<Type>(p, iF),
    Field<Type>(p.size())
{}
Foam::
timeVaryingMappedFixedValuePointPatchField<Type>::
timeVaryingMappedFixedValuePointPatchField
(
    const pointPatch& p,
    const DimensionedField<Type, pointMesh>& iF,
    const dictionary& dict
)
:
    fixedValuePointPatchField<Type>(p, iF),
    fieldTableName_(iF.name()),
    setAverage_(readBool(dict.lookup("setAverage"))),
    perturb_(dict.lookupOrDefault("perturb", 1e-5)),
    mapMethod_
    (
        dict.lookupOrDefault<word>
        (
            "mapMethod",
            "planarInterpolation"
        )
    ),
    mapperPtr_(NULL),
    sampleTimes_(0),
    startSampleTime_(-1),
    startSampledValues_(0),
    startAverage_(pTraits<Type>::zero),
    endSampleTime_(-1),
    endSampledValues_(0),
    endAverage_(pTraits<Type>::zero),
    offset_()
{
    if (dict.found("offset"))
    {
        offset_ = DataEntry<Type>::New("offset", dict);
    }

    dict.readIfPresent("fieldTableName", fieldTableName_);

    if (dict.found("value"))
    {
        fixedValuePointPatchField<Type>::operator==
        (
            Field<Type>("value", dict, p.size())
        );
    }
    else
    {
        // Note: use evaluate to do updateCoeffs followed by a reset
        //       of the pointPatchField::updated_ flag. This is
        //       so if first use is in the next time step it retriggers
        //       a new update.
        pointPatchField<Type>::evaluate(Pstream::blocking);
    }
}
Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
(
    const pointPatch& completeMeshPatch,
    const pointPatch& procMeshPatch,
    const labelList& directAddr
)
:
    pointPatchFieldMapperPatchRef
    (
        completeMeshPatch,
        procMeshPatch
    ),
    directAddressing_(procMeshPatch.size(), -1)
{
    // Create the inverse-addressing of the patch point labels.
    labelList pointMap(completeMeshPatch.boundaryMesh().mesh().size(), -1);

    const labelList& completeMeshPatchPoints = completeMeshPatch.meshPoints();

    forAll(completeMeshPatchPoints, pointi)
    {
        pointMap[completeMeshPatchPoints[pointi]] = pointi;
    }

    // Use the inverse point addressing to create the addressing table for this
    // patch
    const labelList& procMeshPatchPoints = procMeshPatch.meshPoints();

    forAll(procMeshPatchPoints, pointi)
    {
        directAddressing_[pointi] =
            pointMap[directAddr[procMeshPatchPoints[pointi]]];
    }

    // Check that all the patch point addresses are set
    if (directAddressing_.size() && min(directAddressing_) < 0)
    {
        FatalErrorIn
        (
            "pointFieldDecomposer::patchFieldDecomposer()"
        )   << "Incomplete patch point addressing"
            << abort(FatalError);
    }
}
sixDoFRigidBodyDisplacementPointPatchVectorField::
sixDoFRigidBodyDisplacementPointPatchVectorField
(
    const pointPatch& p,
    const DimensionedField<vector, pointMesh>& iF,
    const dictionary& dict
)
:
    fixedValuePointPatchField<vector>(p, iF, dict),
    motion_(dict),
    rhoInf_(1.0),
    rhoName_(dict.lookupOrDefault<word>("rhoName", "rho")),
    lookupGravity_(-1),
    g_(vector::zero),
    relaxationFactor_(dict.lookupOrDefault<scalar>("relaxationFactor", 1))
{
    if (rhoName_ == "rhoInf")
    {
        rhoInf_ = readScalar(dict.lookup("rhoInf"));
    }

    if (dict.readIfPresent("g", g_))
    {
        lookupGravity_ = -2;
    }

    if (!dict.found("value"))
    {
        updateCoeffs();
    }

    if (dict.found("initialPoints"))
    {
        initialPoints_ = vectorField("initialPoints", dict , p.size());
    }
    else
    {
        initialPoints_ = p.localPoints();
    }
}
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);
  */
  
}