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

Input data from Fortran into OpenFOAM

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 9, 2012, 19:15
Default Input data from Fortran into OpenFOAM
  #1
New Member
 
Ryan Sanders
Join Date: Jun 2012
Posts: 2
Rep Power: 0
rsanders20 is on a distinguished road
Hey,

I have an initial turbulence condition that I generated in FORTRAN, and I want to make it the initial condition for a run of boxTurb16. I have already made sure that the mesh in Fortran and the mesh in OpenFoam are the same, but I can't figure out how to get OpenFoam to read the Fortran binary, and replace the initial conditions in /0/u and /0/p. Does OpenFoam have a built in function to read data from Fortran?

Thank you for your time.
rsanders20 is offline   Reply With Quote

Old   June 10, 2012, 13:51
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings Ryan and welcome to the forum!

Quote:
Originally Posted by rsanders20 View Post
Hey,

I have an initial turbulence condition that I generated in FORTRAN, and I want to make it the initial condition for a run of boxTurb16. I have already made sure that the mesh in Fortran and the mesh in OpenFoam are the same, but I can't figure out how to get OpenFoam to read the Fortran binary, and replace the initial conditions in /0/u and /0/p. Does OpenFoam have a built in function to read data from Fortran?

Thank you for your time.
Your description is a bit vague... so here are a few questions:
  1. What exactly are you trying to accomplish by using OpenFOAM to "read the Fortran binary"?
  2. And what's the level of initial condition you're trying to set? More specifically, is it just for the boundary walls and patches or for the internal field as well?
Best regards,
Bruno

PS: I renamed the title of this thread, since MATLAB isn't anywhere mentioned on the first post...
wyldckat is offline   Reply With Quote

Old   June 10, 2012, 16:41
Default
  #3
New Member
 
Ryan Sanders
Join Date: Jun 2012
Posts: 2
Rep Power: 0
rsanders20 is on a distinguished road
Answering your questions in order:

1) The reason I need to input data taken from a FORTRAN program into OpenFOAM is because I have a program in FORTRAN that models in-compressible turbulent flow using large eddy simulation, and i want to test it against a DNS to make sure that it is working correctly. I did not originally write this code, but whoever did built it so that it reads a FORTRAN binary file in order to set the initial conditions.

2) I already set the boundary conditions to be the same, I need now to input the data taken from FORTRAN into the files found at ~/0/u and ~/0/p, where currently a different turbulent initial condition is specified.

Thank you for your quick reply, and for renaming the thread.

Ryan.
rsanders20 is offline   Reply With Quote

Old   June 11, 2012, 03:01
Default
  #4
Senior Member
 
Christian Lucas
Join Date: Aug 2009
Location: Braunschweig, Germany
Posts: 198
Rep Power: 7
Chris Lucas is on a distinguished road
Hi,

you can compile the FORTRAN code as a dynamic library and link this library into your OpenFOAM solver

Best Regards,
Christian
Chris Lucas is offline   Reply With Quote

Old   June 12, 2012, 17:36
Default
  #5
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings to all!

Ryan: This is a bit ambiguous at first, so here's an attempt at making it more explicit - correct me if I'm wrong:
  1. You have a FORTRAN application that generates the initial turbulence data.
  2. The same FORTRAN application then writes this data into a binary file.
  3. Then another or the same FORTRAN application can read the data back from the binary file.
  4. You want to convert/import/export this data to OpenFOAM formatted data, more specifically put the respective data to the U and p fields, saving those fields in their respective files.
Like Chris wrote, and if this is the case, you can build FORTRAN code as a library, then link the library to a customized OpenFOAM utility for loading the data from your binary file. Basically the OpenFOAM based utility would call a function or group of functions coded in FORTRAN, to do the tasks at hand.

The other possibility is to write the customized OpenFOAM utility to directly load the data from the binary file onto the OpenFOAM formatted fields in memory and then save them to their files.

Either way, I vaguely remember an application that might partially fit the description - fluentDataToFoam: http://openfoam-extend.git.sourcefor...ToFoam;hb=HEAD

For more, you can try using the search function on this forum and search for what people have been able to do with FORTRAN and OpenFOAM

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Reply

Tags
boxturb16, data, fortran, initial condition, openfoam

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
how to convert Openfoam data to fluent .cas and .msh files sachinlb FLUENT 3 October 25, 2011 05:03
Comparison between C/C++ and Fortran? rick Main CFD Forum 45 September 6, 2011 00:52
Coupling OpenFoam with Fortran codes anfho OpenFOAM Programming & Development 1 January 17, 2011 13:26
Velocity vector data in OpenFOAM and ParaView mismatch tekky OpenFOAM 9 December 21, 2009 12:26
input vertex data file format Rick FLUENT 3 March 6, 2006 03:39


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