CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   the problem about dimension (http://www.cfd-online.com/Forums/openfoam/93426-problem-about-dimension.html)

 bojiezhang October 15, 2011 03:58

the problem about dimension

hello everyFoamer:
I have two problems, and hope someone can help me,
1：when I use the function below:
Foam::cos( -omega*runTime.value())
the dimension of omega is[0,0,-1,0,0,0,0]，
It can compile pretty well, but when caculating, the error comes as below:
ds not dimensionless
From function cos(const dimensionedScalar& ds)
2：when I assign the value as below:
mass[cellI] =A*omega*Foam::cos(-omega*runTime.value());
mass is volScalarField , and intialized as dimensionedScalar("zero", dimensionSet(0,1,-1,0,0,0,0), 0.0)
the dimension of A is [0,1,0,0,0,0,0]，the dimension of omega is[0,0,-1,0,0,0,0]，
when compiled , it shows "error"：can not convert dimensioned<double> to double ;

what can I do , I really hope someone can give me some advice, thank you in advance!

bojiezhang

 nimasam October 15, 2011 09:00

1) define omega as dimless , because when u use the value() function, it only returns the value of run time not its dimension!

2) its not important whats the dimension of volScalarField is, when you use just on array of it! its a scalar with out dimension so the left side should be dimensionless too, but ur left side is not dimension less, its an strange combination of [0 0 1 0 0 0 0]* cos [0 0 -1 0 0 0 0] for compiler, so define A as dimless too then
congratulation ;) both ur problem get solved

 bojiezhang October 16, 2011 00:22

Quote:
 Originally Posted by nimasam (Post 328022) 1) define omega as dimless , because when u use the value() function, it only returns the value of run time not its dimension! 2) its not important whats the dimension of volScalarField is, when you use just on array of it! its a scalar with out dimension so the left side should be dimensionless too, but ur left side is not dimension less, its an strange combination of [0 0 1 0 0 0 0]* cos [0 0 -1 0 0 0 0] for compiler, so define A as dimless too then congratulation ;) both ur problem get solved
Thank you for your reply, the problem is solved successfully by your idea!

 All times are GMT -4. The time now is 10:15.