CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Initialize a uniform 0 volVectorField

Register Blogs Community New Posts Updated Threads Search

Like Tree16Likes
  • 16 Post By l_r_mcglashan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 26, 2009, 07:05
Default Initialize a uniform 0 volVectorField
  #1
Member
 
Julien Schaguene
Join Date: Apr 2009
Location: France
Posts: 55
Rep Power: 17
Schag is on a distinguished road
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
Schag is offline   Reply With Quote

Old   August 26, 2009, 07:56
Default
  #2
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
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...
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   August 26, 2009, 07:57
Default
  #3
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
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.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   August 26, 2009, 11:08
Default
  #4
Member
 
Julien Schaguene
Join Date: Apr 2009
Location: France
Posts: 55
Rep Power: 17
Schag is on a distinguished road
Thank you both,

Laurence, you anticipated my next problem with dimensionedVector!

Best Regards
Schag is offline   Reply With Quote

Old   July 24, 2024, 03:18
Talking For anyone may concerned
  #5
New Member
 
Yanjun Tong
Join Date: Jul 2020
Posts: 17
Rep Power: 6
Hughtong is on a distinguished road
symmTensor:

Code:
    volSymmTensorField Rsymm
    (
        IOobject
        (
            "Rsymm",
            location_phase_average,
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedSymmTensor("R", dimVelocity * dimVelocity, symmTensor(0.0 ,0.0, 0.0, 0.0, 0.0, 0.0))
    );
Tensor:
Code:
    volTensorField R 
    (
        IOobject
        (
            "R",
            location_phase_average,
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedTensor("R", dimVelocity * dimVelocity, tensor(0.0 ,0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0))
    );
Hughtong is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convection discretization schemes for LES sek OpenFOAM Running, Solving & CFD 38 July 31, 2017 15:30
Pressure instability with rhoSimpleFoam daniel_mills OpenFOAM Running, Solving & CFD 44 February 17, 2011 18:08
FOAM FATAL IO ERRORsimpleFoam hariya03 OpenFOAM Running, Solving & CFD 6 July 16, 2008 09:03
RasInterFoam STRANGE RESULTS AT BOUNDARY kumar2 OpenFOAM Running, Solving & CFD 8 March 24, 2008 19:38
uniform grid and beta clustering rvndr Main CFD Forum 0 February 22, 2004 00:19


All times are GMT -4. The time now is 01:38.