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

Problems adding volScalarField to rhoCentralFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 16, 2013, 21:06
Default Problems adding volScalarField to rhoCentralFoam
  #1
New Member
 
Daniel
Join Date: Nov 2012
Posts: 5
Rep Power: 14
cryple is on a distinguished road
Dear all,

I thought I would be standing in front of just a little problem, when I wanted to add some run-tim-calculated fields to the rhoCentralFoam solver.

I would like to calculate e.g. mach number on-the-fly for some easier sampling and so added following to the createFields.H (testet on wedge15Ma5 tutorial):

Code:
volScalarField Ma
(
    IOobject
    (
        "Ma",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mag(U)/sqrt(1.4/psi)
);
The result is a file "Ma" in the run time folders, which has a uniform dimensionless internal field of 5.000001 in it, whereas the boundary "obstacle" is comprising of a nonuniform list of 80 scalars.

I want that nonuniform list of scalars for my internal field. What am I doing wrong?

Thanks in advance!
Best
Daniel
cryple is offline   Reply With Quote

Old   January 17, 2013, 05:12
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by cryple View Post
Dear all,

I thought I would be standing in front of just a little problem, when I wanted to add some run-tim-calculated fields to the rhoCentralFoam solver.

I would like to calculate e.g. mach number on-the-fly for some easier sampling and so added following to the createFields.H (testet on wedge15Ma5 tutorial):

Code:
volScalarField Ma
(
    IOobject
    (
        "Ma",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mag(U)/sqrt(1.4/psi)
);
The result is a file "Ma" in the run time folders, which has a uniform dimensionless internal field of 5.000001 in it, whereas the boundary "obstacle" is comprising of a nonuniform list of 80 scalars.

I want that nonuniform list of scalars for my internal field. What am I doing wrong?

Thanks in advance!
Best
Daniel
You've calculated the field for the initial conditions. To have the current state written out you've got to update it at the end of the timestep (something like "Ma=mag(U)/sqrt(1.4/psi);"

More elegant (without the modification of the solver) would be a functionObject
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   January 17, 2013, 06:18
Default
  #3
New Member
 
Daniel
Join Date: Nov 2012
Posts: 5
Rep Power: 14
cryple is on a distinguished road
Thanks a lot for your fast reply, gschaider.

I realised that actualy what I did, was just create an IOobject at the beginning of the solver run, without taking care of performing any calculation for Ma !inside! the time loop at all...

I also thought about using functionObjects, which would be much better, I think but I can't find any documentation on the possibilities and options I have there.

I will post the solution when I got more into it.

Thanks again!
Daniel
cryple 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
[openSmoke] libOpenSMOKE Tobi OpenFOAM Community Contributions 562 January 25, 2023 10:21
dimensionedScalar + volScalarField is evaluated elementwisely ? tianyikillua OpenFOAM Programming & Development 1 March 30, 2012 04:12
Needed Benchmark Problems for FSI Mechstud Main CFD Forum 4 July 26, 2011 13:13
Adding a user application class Rasmus Gjesing (Gjesing) OpenFOAM Pre-Processing 57 February 3, 2010 04:45
Problems with volScalarField niklas OpenFOAM Running, Solving & CFD 2 November 28, 2005 17:05


All times are GMT -4. The time now is 17:09.