volScalarField to power of constant
Hello (my first post)
I want to calculate: rS=a0*P^rbn in OpenFOAM, for a modified version of rhoCentralFoam. Where: rS (0 1 -1 0 0 0 0) speed (m/s) volScalarField created by createFields a0 (-1 2 1 0 0 0 0) read from thermophysicalProperties in test case as dimensionedScalar P (1 -1 -2 0 0 0 0) pressure (kg/(ms^2)) created by createFields rbn read from thermophysicalProperties in test case as dimensionedScalar, but is dimensionless and is some constant. If I multiply a0 with P, then the dimensions change to (0 1 -1 0 0 0 0), which is correct for rS (0 1 -1 0 0 0 0) speed (m/s) volScalarField. My problem is when I do P^rbn by using pow(P,rbn). Then the dimensions are altered. My question: Is there a way to take a volScalarField such as P, to the power of a dimensionless scalar such as rbn without changing the dimensions?? Kind regards |
I got a way to do this:
Store the dimensions of "p" as arDims dimensionSet arDims(p.dimensions()); Make "p" dimensionless p.dimensions().reset(dimless); Perform calculation (resulting in desired dimension) (0 1 -1 0 0 0 0) ar = a0*pow(p,rbn); Restore the dimensions of "p". p.dimensions().reset(arDims); Hope this will help someone. Vrede |
Have you tried to use: p.value()
This should give you the dimensionless values of the pressure field. |
Hi jherb
Yes, I have tried "p.value()" (result below) and "p.val()", just to make sure. Code:
srmFoamLam.C: In function ‘int main(int, char**)’: Vrede |
Hallo,
One approach would be to do the following: Code:
scalar exponent = 1.5; Niels |
Ok, googling I found: http://www.cfd-online.com/Forums/ope...tml#post476693
The correct method seems to be field() |
All times are GMT -4. The time now is 06:28. |