|
[Sponsors] |
Reading forces from previous time step within solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 14, 2010, 07:58 |
Reading forces from previous time step within solver
|
#1 |
Member
Stefan
Join Date: Jan 2010
Location: Kiel, Germany
Posts: 81
Rep Power: 16 |
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(); Code:
scalar Fp = fm.first().first(); scalar Fv = fm.first().second(); I'm not familiar with the code conventions of OF and new to object oriented programming in C++! Any advice is much appreciated... /Stefan |
|
May 25, 2016, 04:00 |
|
#2 | |
Member
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 39
Rep Power: 10 |
Quote:
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 |
||
August 19, 2020, 20:35 |
Any updates?
|
#3 |
New Member
Bernardo Ribeiro
Join Date: Aug 2016
Posts: 13
Rep Power: 10 |
Hi all,
I'm also very interested in this problem. Has anyone managed to figure it out? Thanks much! Bernardo |
|
March 4, 2022, 02:42 |
|
#4 |
Senior Member
TWB
Join Date: Mar 2009
Posts: 414
Rep Power: 19 |
Hi,
I also need to read the forces from the prev time step but I do not know how to do it. Currently, what I did is: 1. I filter the forces output file to something simpler 2. read in that file to get the forces req It works but it's slower. |
|
March 5, 2022, 07:29 |
|
#5 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
I don't know if it is useful but geometric fields have the member function oldTime() and prevIter() which gives back the value of the field at the previous time step and iterations, respectly.
Best Michael |
|
April 24, 2023, 12:51 |
|
#6 |
Senior Member
TWB
Join Date: Mar 2009
Posts: 414
Rep Power: 19 |
Hi all,
I have managed to get the forces and moments by directly calling from within OF. I have attached the code, but some parts of my calculation are removed. So anyone interested can just modify a bit to get it working for them. This is for OF v2206. Some ver may require removal of "s". |
|
Tags |
forces, header, solver |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic moving mesh | Pei-Ying Hsieh (Hsieh) | OpenFOAM Running, Solving & CFD | 64 | June 7, 2012 11:04 |
Reading old time step | markc | OpenFOAM Running, Solving & CFD | 8 | July 22, 2008 16: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 |