CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Loop through a volScalarField

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 30, 2020, 08:54
Default Loop through a volScalarField
  #1
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!


I wrote a small total lagrangian solid displacement solver, and I'm trying to create material models for it. The material model is simply returns the Lame's coefficients, BUT. If I loop through the field in my update() function in my material model, the solver gives some weird results.


For example:
Simple bilinear model, I have let's call Ee_, and Ep_, and based on the strain and stress i set the E_ from Ee_ and Ep_. If i loop through the list and set like "E_[i] = Ee_[i];", the results are reallly bad. If i set "E_ = Ee_;" without loop, it's working perfectly.
I wrote out the E_ field for both case and the are exactly the same...


Anyone any ideas? I'm pretty lost now.


Thanks!
simrego is offline   Reply With Quote

Old   January 30, 2020, 09:43
Default Solved
  #2
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
E_.correctBoundaryConditions(); did it. :S
simrego is offline   Reply With Quote

Old   January 30, 2020, 10:17
Default
  #3
Member
 
Emad Tandis
Join Date: Sep 2010
Posts: 77
Rep Power: 16
EmadTandis is on a distinguished road
Quote:
Originally Posted by simrego View Post
Hi!


I wrote a small total lagrangian solid displacement solver, and I'm trying to create material models for it. The material model is simply returns the Lame's coefficients, BUT. If I loop through the field in my update() function in my material model, the solver gives some weird results.


For example:
Simple bilinear model, I have let's call Ee_, and Ep_, and based on the strain and stress i set the E_ from Ee_ and Ep_. If i loop through the list and set like "E_[i] = Ee_[i];", the results are reallly bad. If i set "E_ = Ee_;" without loop, it's working perfectly.
I wrote out the E_ field for both case and the are exactly the same...


Anyone any ideas? I'm pretty lost now.


Thanks!
Hi,

I guess the difference is because for the loop case, you don't set boundaryFields but for E_=Ee_, not only cell field but also boundaries are set as well.
EmadTandis is offline   Reply With Quote

Old   January 30, 2020, 10:19
Default
  #4
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Yep you are right. That was the problem.
Thx the feedback.
simrego is offline   Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Gmsh] Extrude on gmsh Pedro Felix OpenFOAM Meshing & Mesh Conversion 0 October 30, 2019 13:33
Need help setting up chtMultiRegion OskarT OpenFOAM Pre-Processing 1 September 25, 2019 16:51
Error message Bruno_Jorge Main CFD Forum 1 February 5, 2019 12:12
writing execFlowFunctionObjects immortality OpenFOAM Post-Processing 30 September 15, 2013 07:16
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 16:57


All times are GMT -4. The time now is 04:51.