CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > 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 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: 4
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
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,502
Blog Entries: 36
Rep Power: 96
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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.
__________________
___
I'll be at OFW11 in Portugal
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: 4
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
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
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 00:00
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32
Problem setting with chtmultiregionFoam Antonin OpenFOAM 10 April 24, 2012 09:50
mass flow in is not equal to mass flow out saii CFX 2 September 18, 2009 08:07


All times are GMT -4. The time now is 05:22.