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

Reading a volScalarField from File

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By hjasak
  • 1 Post By hjasak

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 28, 2005, 12:49
Default Is it possible to read in a vo
  #1
New Member
 
Klaus Schnitzlein
Join Date: Mar 2009
Posts: 7
Rep Power: 17
schnitzlein is on a distinguished road
Is it possible to read in a volScalarfield from a
data file (in the constant directory) during the run and if yes, how can this be achieved?

Thanks in advance.
schnitzlein is offline   Reply With Quote

Old   June 28, 2005, 12:55
Default Yes, instead of say vol
  #2
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 22
henry is on a distinguished road
Yes, instead of say

volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

use

volScalarField p
(
IOobject
(
"p",
"constant",
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);
henry is offline   Reply With Quote

Old   June 29, 2005, 05:56
Default Thank you very much for your h
  #3
New Member
 
Klaus Schnitzlein
Join Date: Mar 2009
Posts: 7
Rep Power: 17
schnitzlein is on a distinguished road
Thank you very much for your help. Originally I replaced runTime.timeName() by runTime.constant(). The results are identical.

I set up the file defining the field beginning with:

dimensions [...];

internalField
nonuniform (
.. here the values are inserted
)

What I know is that I have to insert the values for the interior cells. But, in what order? And how do they relate to the cells and their indices, respectively.

I would like to specify the values in the same ordering as for the cells (polyMesh/cells). Is it possible? Is there a chance to define the values for the entire mesh, not only for the internal and boundary fields, e.g. by using a different keyword, e.g. Field ...?
schnitzlein is offline   Reply With Quote

Old   June 29, 2005, 06:01
Default Come on, this is trivial: the
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Come on, this is trivial: the list of values is in the same order as the list of cells: first value into first cell, second value into a second cell etc. Anything else would be madness.

Hrv

P.S. For future reference, think about your problems: if it is logical, it is probably right!
kk415 likes this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   June 29, 2005, 06:03
Default BTW, before you ask, the same
  #5
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
BTW, before you ask, the same applies for points, edges, faces, faces in patch etc.

Hrv
kk415 likes this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   November 23, 2022, 13:40
Default
  #6
New Member
 
Raphael Santos
Join Date: Oct 2013
Posts: 20
Rep Power: 13
Raphael_Santos is on a distinguished road
Hello,

I've asked about how to create and use a new volScalarField on a drag model.

But now, I solved. I did it creating the variable on createFields.H, and later, calling it on the drag model file using lookup, command.

Last edited by Raphael_Santos; November 27, 2022 at 20:53. Reason: solved
Raphael_Santos 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
How to create initiate a volScalarField p without reading from disk NO_READ does not seem to work dbxmcf OpenFOAM Running, Solving & CFD 14 March 25, 2022 07:08
Error reading trn file OliH CFX 3 March 4, 2010 09:24
Error reading msh file ANIL FLUENT 1 January 22, 2009 01:45
error reading file limingtiger Siemens 3 September 21, 2005 21:31
prob reading in .neu file jemteo FLUENT 0 June 15, 2004 14:00


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