CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   componentMixed BC in the motionU file (https://www.cfd-online.com/Forums/openfoam-pre-processing/130637-componentmixed-bc-motionu-file.html)

sasanghomi March 1, 2014 16:30

componentMixed BC in the motionU file
 
Hi Foamers ,

I want to know about this BC in the motionU file:
type componentMixed;
refValue uniform (0 0 0);
valueFraction uniform (1 0 1);


How does it work? I know it is a combination of Neuman and Dirichlet BCs. Actually I want to know the meaning of refValue uniform (0 0 0); and valueFraction uniform (1 0 1); exactly !!
Could anyone explain it mathematically ?

I appreciate your help.
Thanks and best regards
Sasan.


sasanghomi March 3, 2014 06:54

Any ideas? :(

wyldckat March 3, 2014 07:20

Greetings Sasan,
  1. Which OpenFOAM version are you referring to?
  2. Which tutorial case?
Best regards,
Bruno

sasanghomi March 3, 2014 09:09

1 Attachment(s)
Hi Dear Bruno,

Thanks for your reply.I am using OP 1.6-ext and about tutorial case , I should say Prof.Jasak has attached a test case about engine simulation in this thread : http://www.cfd-online.com/Forums/ope...changes-4.html
honestly, I need to know this BC in the motionU file in the zero (0) directory. Also I attached this test case here. Please help me to gain a lot of information about this BC.

I appreciate your help,
Thanks and best regards.
Sasan.

wyldckat March 3, 2014 13:41

Hi Sasan,

When in doubt, look at the source code. Here's what I've done:
  1. Went into the folder for the main source code libraries:
    Code:

    cd $FOAM_SRC
  2. Searched for the boundary condition in question:
    Code:

    find . -iname "*componentMixed*"
  3. The first one seems the most likely, namely the files at:
    Code:

    OpenFOAM/fields/PointPatchFields/derived/componentMixed/ComponentMixedPointPatchVectorField.*
  4. The class description in the ".H" file, says this:
    Quote:

    Code:

        ComponentMixedPointPatchVectorField. The boundary condition is a mix
        of a fixedValue and a zeroGradient boundary condition, where a
        fixedValue/zeroGradient mix may be different for each direction.

        I am still not sure how to do the fixedValue-fixedGradient
        combination.  HJ, date deleted


  5. Looking at the ".C" file, it's a buit tricky to figure out what-is-what:
    1. The method that has the description "Evaluate patch field" is the one responsible for the actual boundary condition field calculations. The specific code is this one:
      Code:

          vectorField values =
            cmptMultiply(refValue_, valueFraction_)
            + cmptMultiply(internalValues, vector::one - valueFraction_);

      For your example:
      Quote:

      refValue uniform (0 0 0);
      valueFraction uniform (1 0 1);

      It does this:
      Code:

      (0 0 0)*(1 0 1) + U * ((1 1 1) - (1 0 1)) =
      (0 0 0) + U * (0 1 0) =
      (0 Uy 0)

    2. The method that has the description "Set boundary condition to matrix", seems to do a manipulation to the equation matrix, by hacking into the mesh points for the patch which was assigned this boundary condition, by setting a constraint for each point on the patch. This requires us to look for what the class "MatrixType<vector>::ConstraintType" actually does.
  6. Another find command:
    Code:

    find . -iname "*MatrixType*"
    Gets me nothing... Ooops, that's because "MatrixType" is a object name place-holder, given that this is a template class. OK, let's do a broader search, this time searching inside certain files:
    Code:

    find . -name "*.[CH]" -type f | xargs grep -sl "ConstraintType"
  7. Looks like the file:
    Code:

    OpenFOAM/fields/PointPatchFields/PointPatchField/PointPatchField.H
    is a good candidate. But it's not it. It should be:
    Code:

    OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/BlockLduMatrix.H
  8. Ouch... this isn't good:
    Code:

    template<class Type>
    class BlockConstraint;
    //...
    typedef BlockConstraint<Type> ConstraintType;

    Now I gotta go look for where "BlockConstraint" is properly defined...
  9. Another search with find, leads me to these files:
    Code:

    OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/BlockConstraint/BlockConstraint.*
    What we're looking for is this constructor:
    Code:

            //- Construct from components
            BlockConstraint
            (
                const label row,
                const Type value,
                const Type& fixedCmpts = pTraits<Type>::one
            );

    The meaning of each variable:
    Code:

            //- Matrix row ID
            label rowID_;

            //- Fixed value
            Type value_;

            //- Fixed components (0-1) 1 = fixed, 0 = free
            Type fixedComponents_;

  10. All of this searching because of #5.b:
    Code:

            // create a constraint
            typename MatrixType<vector>::ConstraintType bc
            (
                curPoint,
                refValue_[pointI],
                cmptMag(valueFraction_[pointI])
            );

I hope you've understood all of that, because my brain just went:
Quote:

I don't want to look at C++ for the rest of the day.
Anyway, I believe that the answer is given on #4.a.

Best regards,
Bruno

sasanghomi March 3, 2014 16:15

Dear Bruno,

I really appreciated your help. I don't know how to thank you, honestly.
Thank you very much for your attention. :)

Best regards,
Sasan.


All times are GMT -4. The time now is 21:19.