CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Data Transfer (http://www.cfd-online.com/Forums/openfoam/96224-data-transfer.html)

Argen January 16, 2012 16:58

Data Transfer
 
I passed a multi-dimension matrix kk(N,M) from Fortran side to a volScalarField, ks, defined at OpenFoam side as,

PtrList<volScalarField> ks(Nq);
const int Nq=10;
for (int i=0;i<Nq;i++)
{
ks.set(i,new volScalarField
(
IOobject
(
"ks",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
km
)
);
};

volScalarField km
(
IOobject
(
"km",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimless/dimLength, 0.0)
);

The outputs of data exhibit that the values for ks are the same as those for kk. But min(ks[i]) is always ZERO, even max(ks[i]) is fine.

What's wrong with this problem and how to fix it?

Argen January 16, 2012 18:04

Quote:

Originally Posted by Argen (Post 339592)
I passed a multi-dimension matrix kk(N,M) from Fortran side to a volScalarField, ks, defined at OpenFoam side as,

volScalarField km
(
IOobject
(
"km",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimless/dimLength, 0.0)
);

The outputs of data exhibit that the values for ks are the same as those for kk. But min(ks[i]) is always ZERO, even max(ks[i]) is fine.

I found that min(ks[i])is always zero since "dimensionedScalar("zero", dimless/dimLength, 0.0)" is declared for km. I tested other values for it and correspondingly min(ks[i]) is changing no matter what values are actually specified.

How can solve this problem?


All times are GMT -4. The time now is 04:51.