CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

extractData script for centre of mass

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

Like Tree1Likes
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 28, 2014, 23:39
Default extractData script for centre of mass
  #1
New Member
 
Prasad
Join Date: Oct 2013
Posts: 11
Rep Power: 9
mprasad is on a distinguished road
Hi all,

I am looking at the extractData script for the simple harmonic motion tutorial.

Does anyone know how I can modify the script to extract centre of mass in 3 coordiantes?

Right now it only extracts for the z axis.

Thank you.

Regards,
Prasad
mprasad is offline   Reply With Quote

Old   March 1, 2014, 08:28
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,959
Blog Entries: 45
Rep Power: 122
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Prasad,

I assume you're referring to the tutorial "mesh/moveDynamicMesh/simpleHarmonicMotion".

Let's see...
  1. The Allrun script provides the log file "log.moveDynamicMesh" to the script extractData.
  2. The log file provides the centre of mass like this:
    Code:
    Centre of mass: (0.5 0.5 0.5)
  3. The script extractData gets the Z value with this line:
    Code:
    grep "Centre of mass" $1 | cut -d ":" -f 2 | cut -d " " -f 4 | tr -d ")" > cM
  4. cut is the application that does the extraction of the necessary data, along with tr. We can test and play with this, with the following command:
    Code:
    echo "Centre of mass: (0.5 0.5 0.5)"  | cut -d ":" -f 2 | cut -d " " -f 4 | tr -d ")"
  5. This seems to do the trick:
    Code:
    echo "Centre of mass: (0.5 0.5 0.5)"  | cut -d ":" -f 2 | tr -d "()"
  6. Therefore, change the line mentioned above in the script extractData to this:
    Code:
    grep "Centre of mass" $1   | cut -d ":" -f 2 | tr -d "()" > cM
Best regards,
Bruno
gautami likes this.
__________________
wyldckat is offline   Reply With Quote

Old   March 1, 2014, 22:04
Default
  #3
New Member
 
Prasad
Join Date: Oct 2013
Posts: 11
Rep Power: 9
mprasad is on a distinguished road
Greetings Bruno,

The script you suggested worked and i can extract the data in 3 coordinates now.

Thank you.

Regards,
Prasad
mprasad is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 06:21
total mass loss/gain--simulating taylor couette flow nwpukaka OpenFOAM Programming & Development 0 February 12, 2014 19:57
Low Mixing time Problem Mavier CFX 5 April 29, 2013 01:00
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32
Problem setting with chtmultiregionFoam Antonin OpenFOAM 10 April 24, 2012 10:50


All times are GMT -4. The time now is 09:32.