CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Syntax question relating volScalarField

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   March 24, 2011, 13:04
Lightbulb Syntax question relating volScalarField
  #1
Member
 
Sabin Ceuca
Join Date: Mar 2010
Location: Munich
Posts: 42
Rep Power: 7
sabin.ceuca is on a distinguished road
Hi Foamers,
I have the following question is it possible to "force" a volScalarField in this way?

volScalarField somethingSomething
(
IOobject
(
"somethingSomething",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero",dimensionSet(1,0-1,0,0,0,0),A*B)
);
with the product of A*B having a different dimension, i.e. to overwrite the dimension?
sabin.ceuca is offline   Reply With Quote

Old   March 24, 2011, 14:46
Default
  #2
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 19
niklas will become famous soon enough
So basically this

Code:
volScalarField somethingSomething
(
    IOobject
    (
        "somethingSomething",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mesh,
    A*B,
    ...boundary conditions...
);
If A and B are dimensionedScalars

if they form a volScalarField, you just remove mesh, like this
Code:
volScalarField somethingSomething
(
    IOobject
    (
        "somethingSomething",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    A*B
);
niklas is offline   Reply With Quote

Old   March 24, 2011, 15:24
Default
  #3
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
l_r_mcglashan will become famous soon enough
Quote:
Originally Posted by sabin.ceuca View Post
with the product of A*B having a different dimension, i.e. to overwrite the dimension?
I found the best thing to do is define another dimensionedScalar with value 1.0 (call it, say, dimensionConversionAB) that has the dimensions required to convert from the dimensions of A*B to the dimensions you require. That way you don't forget that you're doing something a bit dodgy when you come to look back at your code.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   April 2, 2015, 04:05
Default
  #4
New Member
 
Panagiotis Giannatselis
Join Date: Jan 2015
Location: Athens, Greece
Posts: 5
Rep Power: 2
pgiannatselis is on a distinguished road
Quote:
Originally Posted by sabin.ceuca View Post
Hi Foamers,
I have the following question is it possible to "force" a volScalarField in this way?

volScalarField somethingSomething
(
IOobject
(
"somethingSomething",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero",dimensionSet(1,0-1,0,0,0,0),A*B)
);
with the product of A*B having a different dimension, i.e. to overwrite the dimension?

dimensionSet(1,0,-1,0,0,0,0) is the correct.... a "," was misssing
pgiannatselis is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate volume average of volScalarField tangd OpenFOAM Running, Solving & CFD 3 May 1, 2013 13:37
syntax error on config.h ehooi Fluent UDF and Scheme Programming 3 November 9, 2011 11:05
A question about the source code of realizableKE.C yuhai OpenFOAM Programming & Development 1 June 26, 2009 08:05
Nonuniform boundary syntax juho OpenFOAM Running, Solving & CFD 1 December 11, 2008 17:13
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 16:16


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