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

Center of Mass / volume

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 14, 2013, 10:26
Default Center of Mass / volume
  #1
Senior Member
 
Aurelien Thinat
Join Date: Jul 2010
Posts: 165
Rep Power: 15
Aurelien Thinat is on a distinguished road
Hi everyone,

I'm trying to add the calculation of the center of mass in the solver InterFoam. I wrote in interFoam.C :

Code:
vector CoM = sum(mesh.V()*(alpha1*rho1 + (1-alpha1)*rho2)*mesh.C().internalField())/sum(mesh.V()*(alpha1*rho1+(1-alpha1)*rho2));
So far it compiles correctly but the results are wrong. So I added another vector relative to the center of volume :

Code:
vector CoV = sum(mesh.V()*mesh.C().internalField())/sum(mesh.V());
And now it doesn't compile anymore.

I can't see the probleme. If the first line compile, the second should too. Does anyone of you have any idea ?


EDIT :

After some tests it seems the problem is coming from "mesh.C().internalField()". As soon as I use this in the "sum" operator, the dimensions are deleted.
Exemple :
- sum(rho*mesh.V()) -> dimension is kg.
- sum(rho*mesh.V()*mesh.C().internalField() -> dimmensionless.

Is there a way to fix that ?
Aurelien Thinat is offline   Reply With Quote

Old   November 14, 2013, 13:50
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
marupio is on a distinguished road
Try .dimensionedInternalField()
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   November 15, 2013, 03:36
Default
  #3
Senior Member
 
Aurelien Thinat
Join Date: Jul 2010
Posts: 165
Rep Power: 15
Aurelien Thinat is on a distinguished road
Wonderfull, it works ! Thank you very much.
Aurelien Thinat 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
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 05:21
Water subcooled boiling Attesz CFX 7 January 5, 2013 03:32
Closed Volume: Mass increases, pressure and temperature decrease... vainilreb OpenFOAM Running, Solving & CFD 1 December 4, 2012 07:57
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 09:56
volume fraction, Mass fraction and Bulk Mass flow Dr.jones CFX 1 January 25, 2006 04:32


All times are GMT -4. The time now is 17:11.