|
[Sponsors] |
February 26, 2014, 11:38 |
How to read .dat files into OpenFOAM
|
#1 |
Member
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 12 |
Hiiii,
I want to read data file like .dat into solver and interpolate for example SGAS KRG PCOG 0 0 0 0.02 0 0 0.05 0.005 0 0.12 0.025 0 0.2 0.075 0 0.25 0.125 0 0.3 0.19 0 0.4 0.41 0 On searching i found In interFOAM solver reading of data file is there but it is commented that is interpolationTable<vector> timeSeriesAcceleration ( runTime.path()/runTime.caseConstant()/"acceleration.dat" ); i want to know what is the format of "acceleration.dat". Thanks & Regards N.Manjunath, M-Tech, IIT Guwahati |
|
March 1, 2014, 08:56 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Greetings Manjunath,
It really depends on the objective on what to do with the loaded data. Is it for:
Bruno
__________________
|
|
March 1, 2014, 10:46 |
Hiiii wyldckat
|
#3 |
Member
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 12 |
Thank you for your reply.
Where KRG = f(SGAS) . I want to interpolate the KRG & SGAS and then use it in my equation. That is coefficient of 'sw' volScalarField KRG = f(SGAS) ; - fvm::ddt(KRG,sw) == fvc::laplacian(phik*phiM_o,p) - fvc::laplacian(KRG*phik*rho_o,gh) - fvc::Sp(J*n*KRG,p) + fvc::Sp(J*n*KRG,pbh) Thanks & Regards N.Manjunath Reddy |
|
March 1, 2014, 11:16 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
If I'm not mistaken, for the file extension ".dat", OpenFOAM will use it's own data formatting convention. Therefore, for a vector, it should be:
Code:
#SGAS KRG PCOG (0 0 0) (0.02 0 0) (0.05 0.005 0) (0.12 0.025 0) (0.2 0.075 0) (0.25 0.125 0) (0.3 0.19 0) (0.4 0.41 0) Code:
#SGAS KRG PCOG (0 (0 0)) (0.02 (0 0)) (0.05 (0.005 0)) (0.12 (0.025 0)) (0.2 (0.075 0)) (0.25 ( 0.125 0)) (0.3 (0.19 0)) (0.4 (0.41 0)) Code:
#SGAS KRG PCOG 0 (0 0) 0.02 (0 0) 0.05 (0.005 0) 0.12 (0.025 0) 0.2 (0.075 0) 0.25 ( 0.125 0) 0.3 (0.19 0) 0.4 (0.41 0) |
|
March 4, 2014, 05:11 |
Hiiii wyldckat
|
#5 |
Member
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 12 |
Thank you so much for your reply.
As you told i wrote the .dat file in vector form while reading OpenFOAM shown this error --> FOAM FATAL IO ERROR: incorrect first token, expected <int> or '(', found on line 1 the word '#SGAS' file: /home/manjunath/OpenFOAM/manjunath-2.2.2/run/tutorials/basic/laplacianFoam/flange/constant/acceleration.dat at line 1. From function operator>>(Istream&, List<T>&) in file /opt/openfoam222/src/OpenFOAM/lnInclude/ListIO.C at line 149. i used laplacianFoam as sample code too run this Thanks &Regards N.Manjunath |
|
March 4, 2014, 05:37 |
|
#6 |
Senior Member
|
||
March 4, 2014, 06:09 |
|
#7 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Mmm... Try this:
Code:
//SGAS KRG PCOG ( (0 0 0) (0.02 0 0) (0.05 0.005 0) (0.12 0.025 0) (0.2 0.075 0) (0.25 0.125 0) (0.3 0.19 0) (0.4 0.41 0) ) |
|
April 9, 2014, 21:07 |
|
#8 | |
Member
Ripudaman Manchanda
Join Date: May 2013
Posts: 55
Rep Power: 12 |
I have a similar issue where I am trying to import a set of X-Y values. I want to run some explicit calculation in my solver using this field of values. One such implementation is going to be calculating the minimum distance of the XY vaues imported to a chosen point in the Openfoam mesh.
I am stuck at the first step though. I am unable to import the file in my code. Here is the data I am trying to import: Quote:
Code:
--> FOAM FATAL ERROR: out-of-order value: -152.4 at index 1 From function Foam::interpolationTable<Type>::checkOrder() const in file /opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/interpolationTable.C at line 226. FOAM exiting Code:
interpolationTable<scalar> previousFracTraj(previousFrac); Thanks. Ripu |
||
April 10, 2014, 01:59 |
Hi Ripudaman
|
#9 |
Member
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 12 |
I overcome d the problem by reading individual X and Y data like given below....
If you want to read the scalarField create a data file which has a scalarFields Ex: file name PVTdata which has a scalarField X /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object transportProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // X ( 9.342894e-02 4.567101e-02 3.013131e-02 2.219316e-02 1.746954e-02 1.427184e-02 1.205589e-02 1.041777e-02 9.144300e-03 8.184990e-03 7.393980e-03 6.737610e-03 6.221490e-03 5.789520e-03 5.452920e-03 5.172420e-03 4.925580e-03 4.712400e-03 4.532880e-03 4.370190e-03 ); and you can read this Field in create fields using a IOdict IOdictionary PVTdata ( IOobject ( "PVTdata", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); scalarField X ( PVTdata.lookup("X") ); similarly for Y Regards Manjunath |
|
April 10, 2014, 02:19 |
|
#10 |
Member
Ripudaman Manchanda
Join Date: May 2013
Posts: 55
Rep Power: 12 |
Thanks this is very helpful.
|
|
April 10, 2014, 04:30 |
|
#11 |
Member
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 12 |
If you have Swak4foam in that " wobbler " case consist similar type of file importing as you mentioned in the previous post....
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[CAD formats] Importing mesh files to OpenFOAM: is obj format viable? | sudo | OpenFOAM Meshing & Mesh Conversion | 3 | March 5, 2014 06:14 |
999999 (../../src/mpsystem.c@1123):mpt_read: failed:errno = 11 | UDS_rambler | FLUENT | 2 | November 22, 2011 10:46 |
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 | wyldckat | OpenFOAM Announcements from Other Sources | 3 | September 8, 2010 07:25 |
Modified OpenFOAM Forum Structure and New Mailing-List | pete | Site News & Announcements | 0 | June 29, 2009 06:56 |
Results saving in CFD | hawk | Main CFD Forum | 16 | July 21, 2005 21:51 |