|
[Sponsors] |
How to solve for components of Center of mass? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 17, 2015, 11:53 |
How to solve for components of Center of mass?
|
#1 |
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0 |
Hye Foamers, i calculated center of mass by writing following formula in interFoam.C
CoM = sum(rho*mesh.V()*mesh.C().dimensionedInternalField ())/sum(rho*mesh.V()); now i want to calculate acceleration of center of mass in each dimension. So first i tried to calculate x y and z components of CoM using following formula. CoMx = CoM.x(); CoMy = CoM.y(); CoMz = CoM.z(); then i tried volScalarField CoMx = CoM.component(vector::X); volScalarField CoMy = CoM.component(vector::Y); volScalarField CoMz = CoM.component(vector::Z); there was still error which was this myInterFoamDDT.C: In function ‘int main(int, char**)’: myInterFoamDDT.C:111:46: error: conversion from ‘Foam::dimensioned<double>’ to non-scalar type ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ requested volScalarField CoMx = CoM.component(vector::X); myInterFoamDDT.C:112:46: error: conversion from ‘Foam::dimensioned<double>’ to non-scalar type ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ requested volScalarField CoMy = CoM.component(vector::Y); myInterFoamDDT.C:113:46: error: conversion from ‘Foam::dimensioned<double>’ to non-scalar type ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ requested volScalarField CoMz = CoM.component(vector::Z); After that i tried volScalarField CoMx = CoM.component(0); Error was myInterFoamDDT.C: In function ‘int main(int, char**)’: myInterFoamDDT.C:111:38: error: conversion from ‘Foam::dimensioned<double>’ to non-scalar type ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ requested volScalarField CoMx = CoM.component(0); i Got following error please help me myInterFoamDDT.C: In function ‘int main(int, char**)’: myInterFoamDDT.C:111:1: error: ‘CoMx’ was not declared in this scope CoMx = CoM.x(); ^ myInterFoamDDT.C:111:12: error: ‘Foam::dimensionedVector’ has no member named ‘x’ CoMx = CoM.x(); ^ |
|
March 17, 2015, 12:26 |
|
#2 |
Senior Member
|
Hi,
Centre of mass is vector (in your particular case it is dimensionedVector due to the definition), so Code:
volScalarField CoMx = CoM.component(vector::X); volScalarField CoMy = CoM.component(vector::Y); volScalarField CoMz = CoM.component(vector::Z); Code:
volScalarField CoMx = CoM.component(0); Compiler tries to help you, gives you hints like this Code:
myInterFoamDDT.C:111:12: error: ‘Foam::dimensionedVector’ has no member named ‘x’ CoMx = CoM.x(); If you would like to get components of dimensionedVector, you should use something like Code:
scalar CoMx = CoM.value().x() Code:
dimensionedScalar CoMx ( "CoMx", CoM.dimensions(), CoM.value().x() ); |
|
March 17, 2015, 12:43 |
|
#3 |
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0 |
Thank you sir i got the point...... sorry i am new in openFoam
|
|
March 17, 2015, 12:46 |
|
#4 |
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0 |
Thank you sir i got the point...... sorry i am new in openFoam
Please tell me how to define it in creatFields.H as for center of mass i did CoM = sum(rho*mesh.V()*mesh.C().dimensionedInternalField ())/sum(rho*mesh.V()); in interFoam.C and specified dimensionedVector CoM("CoM", dimLength, vector::zero); in creatFields.H with the help of teachers like you :-) |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Target Mass Flow Rate | Nitin | FLUENT | 9 | June 17, 2017 11:30 |
moving position for DFBI center of mass | vince60270 | STAR-CCM+ | 11 | June 25, 2014 06:45 |
Verifying Mass Balance in Fluent | Noblek330 | FLUENT | 0 | March 27, 2014 19:18 |
total mass loss/gain--simulating taylor couette flow | nwpukaka | OpenFOAM Programming & Development | 0 | February 12, 2014 19:57 |
is it possible to solve mass transfer problems in FLUENT | travikiran | FLUENT | 2 | August 11, 2010 05:46 |