CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Initialize a uniform 0 volVectorField (https://www.cfd-online.com/Forums/openfoam/67777-initialize-uniform-0-volvectorfield.html)

Schag August 26, 2009 06:05

Initialize a uniform 0 volVectorField
 
Hi,

I'm trying to create a new volVectorField, but I want it uniform 0 when creating it.

I think it's something like

volVectorField myField
(
IOobject
(
"myField",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
)

uniform 0
);


I know it is made for p in interFOAM v1.5 (I work on v1.6 if it can help), but p is initialize with other existing volVectorFields.

If anyone has an idea, it would be great, it's the last thing that doesn't work in my program and it's driving me crazy...

I could also create and read an existing volVectorField and then multiply it by 0, but I think there must be a cleaner way to do it.

Regards,

Julien

sega August 26, 2009 06:56

Maybe you can try to use mesh,scalar(0) instead of uniform 0 ?
But I think this is for a scalar field ... I don't know how this may work for a vector...

l_r_mcglashan August 26, 2009 06:57

To start with, you have a volVectorField, so it won't take scalars.

Substitute uniform 0 for:

mesh,
Foam::vector(0,0,0)

or

mesh,
dimenstionedVector("variableName", dimensionSet(0,0,0,0,0,0,0), Foam::vector(0,0,0))

substituting the for the relevant values in dimensionSet obviously.

Schag August 26, 2009 10:08

Thank you both,

Laurence, you anticipated my next problem with dimensionedVector!

Best Regards


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