# Understanding about updateCoeffs() in solidDisplacementFoam

 Register Blogs Members List Search Today's Posts Mark Forums Read

 December 30, 2014, 07:11 Understanding about updateCoeffs() in solidDisplacementFoam #1 Member   Anil Kunwar Join Date: Jun 2013 Posts: 55 Rep Power: 5 Sponsored Links 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::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

December 30, 2014, 08:31
#2
Super Moderator

Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108
Greetings Anil Kunwar,

Quote:
 Originally Posted by Annier 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 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 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 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

 December 30, 2014, 10:38 #3 Member   Anil Kunwar Join Date: Jun 2013 Posts: 55 Rep Power: 5 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 Last edited by Annier; December 30, 2014 at 12:02. Reason: rectified the link

December 30, 2014, 11:55
#4
Super Moderator

Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108
• 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*"`

 January 1, 2015, 07:23 #5 Member   Anil Kunwar Join Date: Jun 2013 Posts: 55 Rep Power: 5 Hi Bruno, Thank you very much. I will try to learn the things. Yours Anil Kunwar Last edited by Annier; January 1, 2015 at 10:56.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post irishdave OpenFOAM Running, Solving & CFD 29 May 3, 2017 08:59 philippose OpenFOAM Programming & Development 7 August 3, 2016 10:00 lixx OpenFOAM Programming & Development 4 May 3, 2015 13:11 Annier OpenFOAM Running, Solving & CFD 1 January 5, 2015 11:50 johndeas OpenFOAM 5 May 21, 2014 07:11