CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Meshing Format & General Technical

Points

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 28, 2004, 17:00
Default Hi I want to read the points
  #1
Satish Undapalli (Satish)
Guest
 
Posts: n/a
Hi
I want to read the points file using a code. I have multi blocks in my FOAM grid. I would like to know how these points are written in the file. I want to read these points using a FORTRAN code. Is this possible?
  Reply With Quote

Old   January 28, 2004, 18:27
Default Do you want to read the point
  #2
Mattijs Janssens (Mattijs)
Guest
 
Posts: n/a
Do you want to read the points from the blockMeshDict only (i.e. the block points) or the points from the generated mesh?

If the latter you can write a simple application to read the mesh and dump the points into a file with one coordinate per line so Fortran can easily read it.

Something like (starting from an application which read a mesh)
..
OFstream pointStream("points.txt");
forAll(mesh.points(), pointI)
{
const point& pt = mesh.points()[pointI];
pointStream << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
}
..


(if you want to read the block points that will be a bit harder. You'll have to read the blockMeshDict dictionary and dump the points as above)
  Reply With Quote

Old   May 5, 2008, 12:57
Default Hi Mattijs, is there a chan
  #3
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 10
braennstroem is on a distinguished road
Hi Mattijs,

is there a chance to do it vice versa, i.e. read two different point text files and create a points file for the polymesh?

I would read a file like:


fileName fileC= runTime.path()/runTime.constant()/"points2.txt";
IFstream CFile(fileC);
double T1;
double T2;
double T3;

while(0==CFile.eof() )
{
if (0==CFile.eof())
{
CFile >> T1 >> T2>> T3;
Info << CFile.eof() << endl;

}
}
but I get this:

--> FOAM FATAL IO ERROR : Attempt to get back from bad stream

file: /Software/OpenFOAM-1.4.1/tutorials_1.4.1/tutorials/simpleFoam/pitzDaily/constant /points2.txt at line 25014.

From function void Istream::getBack(token& t)
in file db/IOstreams/IOstreams/Istream.C at line 44.


Once this would work, I would read a different points-file and assign newT1, newT2 and newT3. Afterwards the difference should be added to the existings points:

diff1=T1-newT1
diff2=T2-newT2
diff3=T3-newT3



The difference could be added to the existing points by:


pointField zeroPoints(mesh.points());

pointField newPoints = zeroPoints + scaleFactor*pInterp.interpolate(diff)().internalFi eld();

mesh.polyMesh::movePoints(newPoints);
mesh.write();


where 'diff' is a somehow created vector.

Would be nice, if you have (or anyone) some good hints :-)

Thanks!
Fabian
braennstroem is offline   Reply With Quote

Old   May 6, 2008, 16:15
Default You are probably trying to rea
  #4
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 16
mattijs is on a distinguished road
You are probably trying to read 3 scalars from a last empty line.

Fix file or loop instead mesh.nPoints() times is my advice.
mattijs is offline   Reply With Quote

Old   May 7, 2008, 01:09
Default Oh, pretty simple with the loo
  #5
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 10
braennstroem is on a distinguished road
Oh, pretty simple with the loop over mesh.nPoints. Fixing the file my way did not help though. Thanks a lot!

Fabian
braennstroem is offline   Reply With Quote

Old   May 7, 2008, 02:42
Default me again... actually I use thi
  #6
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 10
braennstroem is on a distinguished road
me again... actually I use this for reading the points2.txt file and the orig mesh. It works fine, but now the trouble is to combine the vector to a vectorField, which can be passed to the morphing:


fileName fileC= runTime.path()/runTime.constant()/"points2.txt";
IFstream CFile(fileC);
scalar diff;
vector diffv;
vector T;
double scale=1.0;

forAll(mesh.points(), pointI)
{
CFile >> T; //read shape vectors
const point& pt = mesh.points()[pointI]; //orig mesh
pointStream << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl; //read orig mesh
diff = pt.y()-T.component(1);
diffv = pt - scale* T; // create diff between orig mesh and shape
}

Info << "Vektor T: "<< T << endl;
Info << "Vektor T1: "<< T.component(1) << endl;
Info << "Diff: "<< diff << endl;
Info << "Diff-Vektor: "<< diffv << endl;


Do you have a hint, how to append the vectors to a vectorField?

Fabian
braennstroem is offline   Reply With Quote

Old   May 7, 2008, 03:09
Default Read your new position into a
  #7
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 16
mattijs is on a distinguished road
Read your new position into a pointField first, then do your manipulation.

pointField newPoints(mesh.nPoints());
forAll(newPoints, pointI)
{
point& pt = newPoints[pointI];
CFile >> pt.x() >> pt.y() >>> pt.z();
}

vectorField diffv = scale*(mesh.points()-newPoints);
mattijs is offline   Reply With Quote

Old   May 8, 2008, 15:19
Default Thanks a lot! Works nice :-)
  #8
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 10
braennstroem is on a distinguished road
Thanks a lot! Works nice :-)
Fabian
braennstroem is offline   Reply With Quote

Reply

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 get the value of points by TECPLOT?? Jason FLUENT 4 March 31, 2015 06:18
Points on Rake suvash FLUENT 0 October 26, 2006 23:20
Mointor points Tim CFX 2 March 7, 2006 14:23
monitor points mike abelado CFX 5 October 15, 2004 03:30
surface and points no. -1 Pascael Fonteijn CFX 1 July 15, 2003 09:50


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