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

Reading forces from previous time step within solver

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 14, 2010, 07:58
Default Reading forces from previous time step within solver
  #1
Member
 
Stefan
Join Date: Jan 2010
Location: Kiel, Germany
Posts: 77
Rep Power: 8
SD@TUB is on a distinguished road
Hello FOAMers,

what would be the best way of reading forces from previous time step within solver code? I'm calculating some cases with OF 1.6 via simpleFoam.
I noticed the function objects where pressure and viscous forces/moments are integrated over given walls (using "libforces.so"). In forces.C the
data of interest accessed by:
Code:
...
fm.first().first() (pressure forces) or fm.first().second() (viscous forces)
fm.second().first() (moment of pressure forces) or fm.second().second() (moment of viscous forces)
...
return fm;
...
fm.write();
Now i tried to catch the values within solver code. I added my own header in simpleFoam.C where i calculate some additional stuff. Within this header i want to initialize variables with the summarized forces (under consideration of the listed headers in forces.C), but it doesn't work. I did something like:
Code:
scalar Fp = fm.first().first();
scalar Fv = fm.first().second();
According to the OF programmers guide, field data from previous time step are associated with geometricField<type>. In my understanding this isn't applicable for calculated forces, because they applied to pressure and shear stress on walls.
I'm not familiar with the code conventions of OF and new to object oriented programming in C++! Any advice is much appreciated...


/Stefan
SD@TUB is offline   Reply With Quote

Old   May 25, 2016, 03:00
Default
  #2
Member
 
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 36
Rep Power: 2
federicabi is on a distinguished road
Quote:
Originally Posted by SD@TUB View Post
Hello FOAMers,

what would be the best way of reading forces from previous time step within solver code? I'm calculating some cases with OF 1.6 via simpleFoam.
I noticed the function objects where pressure and viscous forces/moments are integrated over given walls (using "libforces.so"). In forces.C the
data of interest accessed by:
Code:
...
fm.first().first() (pressure forces) or fm.first().second() (viscous forces)
fm.second().first() (moment of pressure forces) or fm.second().second() (moment of viscous forces)
...
return fm;
...
fm.write();
Now i tried to catch the values within solver code. I added my own header in simpleFoam.C where i calculate some additional stuff. Within this header i want to initialize variables with the summarized forces (under consideration of the listed headers in forces.C), but it doesn't work. I did something like:
Code:
scalar Fp = fm.first().first();
scalar Fv = fm.first().second();
According to the OF programmers guide, field data from previous time step are associated with geometricField<type>. In my understanding this isn't applicable for calculated forces, because they applied to pressure and shear stress on walls.
I'm not familiar with the code conventions of OF and new to object oriented programming in C++! Any advice is much appreciated...


/Stefan
Hi!
I know that this is an old post but I'm very interested in it. Have you found a solution to that problem? I need to customize a restraint library inserting pressure and viscous forces calculated in the previous time step.
Do you have any suggestion?

Best regards

Federica
federicabi is offline   Reply With Quote

Reply

Tags
forces, header, solver

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic moving mesh Pei-Ying Hsieh (Hsieh) OpenFOAM Running, Solving & CFD 64 June 7, 2012 10:04
Reading old time step markc OpenFOAM Running, Solving & CFD 8 July 22, 2008 15:11
Doubt on Implicit Methods analyse In India Main CFD Forum 10 March 9, 2007 04:01
AMG versus ICCG msrinath80 OpenFOAM Running, Solving & CFD 2 November 7, 2006 16:15
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


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