CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Understanding about updateCoeffs() in solidDisplacementFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/146503-understanding-about-updatecoeffs-soliddisplacementfoam.html)

Annier December 30, 2014 06:11

Understanding about updateCoeffs() in solidDisplacementFoam
 
Hi,
In solidDisplacementFoam solver,at tractionDisplacementFvPatchVectorField.C, there is a following piece of code for updateCoeffs().
Code:

void tractionDisplacementFvPatchVectorField::updateCoeffs()
{
...
gradient() =
    (
        (traction_ - pressure_*n)/rho
      + twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD)
    )/twoMuLambda;
...
fixedGradientFvPatchVectorField::updateCoeffs();
}

Whereas, in stressedFoam solver, at tractionDisplacementFvPatchVectorField.C;the corresponding code is:
Code:

void tractionDisplacementFvPatchVectorField::updateCoeffs()
{
...
gradient() =
    (
        (traction_ - pressure_*n)/rho.value()
      - (n & (mu.value()*gradU.T() - (mu + lambda).value()*gradU))
      - n*tr(gradU)*lambda.value()
    )/(2.0*mu + lambda).value();

fixedGradientFvPatchVectorField::updateCoeffs();
}

1. What does the value() assign to mu in mu.value()?
2. Similarly, the meaning of gradU.T().
3. Do they convert a scalar to a matrix of given size?
4. Is there a layman way to understand the process of coefficients being updated?


Yours
Anil Kunwar

wyldckat December 30, 2014 07:31

Greetings Anil Kunwar,

I'll only be able to answer a few of your questions:
Quote:

Originally Posted by Annier (Post 525532)
1. What does the value() assign to mu in mu.value()?

"mu" is a dimensioned scalar, the method "value()" gets access to only the value itself. Otherwise, the operations would try to do the necessary mathematics including units.

Quote:

Originally Posted by Annier (Post 525532)
2. Similarly, the meaning of gradU.T().

"T()" - Transposes the vector/matrix. For more details: http://openfoamwiki.net/index.php/Op...s_Guide_Errata

Quote:

Originally Posted by Annier (Post 525532)
3. Do they convert a scalar to a matrix of given size?

Uhm... the calculations are automatically made by taking into account all values in the patch or field, depending on the context. This is why there isn't a "for" loop in that code that goes along all faces of a patch or all the cells of a mesh.

Quote:

Originally Posted by Annier (Post 525532)
4. Is there a layman way to understand the process of coefficients being updated?

You'll have to be more specific to which coefficients you're referring to.

Best regards,
Bruno

Annier December 30, 2014 09:38

Hi Bruno,
Thank you very much for making me understand more about OpenFOAM code structure.
I studied about updateCoeffs() in this thread http://www.cfd-online.com/Forums/ope...m-solvers.html
Some of my understandings are:
  • The updateCoeffs() ,is defined at the boundary for updating the coefficients as per the gradient specified in the BC file.
  • The updateCoeffs() is first defined virtually at the GeometricBoundaryField.C and overloaded (redefined) later in the specific derived classes such as fixedGradientFvPatchVectorField.C.
  • Another function evaluate(), are also defined at the Boundaries.
  • These functions are virtual functions of C++.
  • They are important functions associated with the boundary conditions subroutines.

Still, there are many things I need to know further, in order to conceptualize how the coefficients are updated [updateCoeffs()] and evaluated [evaluate()] at the boundaries.
Where is the source location of fixedGradientFvPatchVectorField.C?
Thank you.

Yours
Anil Kunwar

wyldckat December 30, 2014 10:55

Quick answer:
  • You can search in the source code online here: https://github.com/OpenFOAM/OpenFOAM-2.3.x
  • You can search in the online code documentation: http://www.openfoam.com/docs/cpp/
  • You can search in the source code you are currently using, as explained here: http://openfoamwiki.net/index.php/In...with_the_Shell
    Quote:

    • Finding all dictionary files that end with "Dict" in the tutorials folder:
      Code:

      find $FOAM_TUTORIALS -name "*Dict"
    • Finding all dictionary files that end with "Dict" in the applications folder:
      Code:

      find $FOAM_APP -name "*Dict"
    • Finding which tutorial files use the boundary condition "slip":
      Code:

      find $FOAM_TUTORIALS -type f | xargs grep -sl 'slip'
    • Find where the code for the boundary condition "slip" is located:
      Code:

      find $FOAM_SRC -name "*slip*"


Annier January 1, 2015 06:23

Hi Bruno,

Thank you very much. I will try to learn the things.




Yours
Anil Kunwar


All times are GMT -4. The time now is 22:36.