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

Dynamic Arrays in OF 1.6

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 27, 2010, 14:49
Default Dynamic Arrays in OF 1.6 [SOLVED]
  #1
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
Hello everyone,

I am having trouble with a custom post-processor. I want to be able to read in a tab separated file from memory and refer to its values (look-up table essentially). Since the size of the file may change, I was thinking of using dynamic arrays, and was able to write the code for it to work in a program on its own.

The problem I run into is when I try run the program in FOAM. I've included all the necessary header files, and the program compiles just fine. When I run it and I need to allocate space, I get the following errors:

new cannot satisfy memory request.
This does not necessarily mean you have run out of virtual memory.
It could be due to a stack violation caused by e.g. bad use of pointers or an out of date shared library

My table isn't very big, which is why I'm going the array route. Has anyone run into this before. Barring that, how could I implement this type of functionality with the built in foam libraries?

Last edited by mturcios777; September 28, 2010 at 14:13. Reason: Found solution to problem
mturcios777 is offline   Reply With Quote

Old   September 28, 2010, 14:09
Default
  #2
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
Ok, figured it out. Easiest way to do this is with the interpolationTable library.


Code:
fileName myFile = someDict.lookup("file.ext");

interpolationTable<scalar> myTab(myFile);
file.ext has the usual structure:

Code:
N
(
  (x1 y1)
  (x2 y2)
  ...
  (xN yN)
)
Now whenever I want to interpolate:

Code:
scalar yiVar = myTab(xi);
returns the corresponding y value interpolated from the entries of myTab.
For future reference, I'm going to see if I can do something similar for multidimensional interpolation. Out of curiosity, what is the best way to indicate that I've solved my problem so people browsing the forum for this answer can find it faster?

Last edited by mturcios777; September 28, 2010 at 14:15. Reason: Question for forum tools
mturcios777 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Mesh Problem. Tom Clark FLUENT 10 June 21, 2021 05:27
k-omega-SST model (OF 1.6) - turbulent flat plate cboss OpenFOAM Running, Solving & CFD 25 August 9, 2016 10:53
Regarding Negative volume detected in Dynamic mesh Vinay Morabad FLUENT 10 December 16, 2015 01:31
Dynamic Mesh moving interface help akash.iitb FLUENT 0 August 24, 2010 00:53
Dynamic mesh + grid adapt = Crash! (Files included BillH FLUENT 4 July 24, 2007 16:31


All times are GMT -4. The time now is 02:03.