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

Export/Load file.txt in OpenFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 2, 2020, 17:40
Default Export/Load file.txt in OpenFoam
  #1
New Member
 
Mehrshad Amini
Join Date: Sep 2017
Posts: 10
Rep Power: 8
mxa261 is on a distinguished road
Hello,

I am writing a new BC for time varying inlet velocity.
I could write a vectorfield as a text file by following command in the .C file:

#incude <OFstream.H>
.
.
.
Ofstream myfile ("ux.txt.");
myfile << ux << endl;

However, I do not know how to load a text file! is there any way to do it? btw I am new in the OpenFoam programing. Thank you in advance.

Best,
Mehrshad
mxa261 is offline   Reply With Quote

Old   November 3, 2020, 11:47
Default
  #2
New Member
 
Mehrshad Amini
Join Date: Sep 2017
Posts: 10
Rep Power: 8
mxa261 is on a distinguished road
I found the answers. See below:

#inlcude <IFstream.H>
.
.
.
.
IFstream dataStream("ux.tx")
dataStream >> ux;
mxa261 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
Frequently Asked Questions about Installing OpenFOAM wyldckat OpenFOAM Installation 3 November 14, 2023 11:58
OpenFOAM Training Jan-Jul 2017, Virtual, London, Houston, Berlin CFDFoundation OpenFOAM Announcements from Other Sources 0 January 4, 2017 06:15
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 13:36
OpenFOAM Foundation releases OpenFOAM 2.2.2 opencfd OpenFOAM Announcements from ESI-OpenCFD 0 October 14, 2013 07:18
[Gmsh] 2D Mesh Generation Tutorial for GMSH aeroslacker OpenFOAM Meshing & Mesh Conversion 12 January 19, 2012 03:52


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