Binary file

Moderator: GiD Team

waseda
Posts: 3
Joined: Thu Dec 24, 2015 4:31 am

Binary file

Postby waseda » Thu Dec 24, 2015 4:48 am

Hi,

I have a problem writing results in the binary format.
Platform: Windows 7, Visual Studio 2013, Intel Visual Fortran, GiD 12.1.9d (library files: Gidpost ver 2.4)

The following code works just fine when writing results in ASCII format.

CALL GiD_PostInit
fdm=GiD_fOpenPostMeshFile('BEM2D.post.msh',GiD_PostAscii)
fdr=GiD_fOpenPostResultFile('BEM2D.post.res',GiD_PostAscii)
! fdr=GiD_fOpenPostResultFile('BEM2D.post.bin',GiD_PostBinary)
! fdm=fdr
CALL GiD_fBeginMesh(fdm,'Mesh',GiD_2D,GiD_Point,1)
CALL GiD_fBeginCoordinates(fdm)
DO i=1,npoint
CALL GiD_fWriteCoordinates2D(fdm,i,xyi(1,i),xyi(2,i))
ENDDO
DO i=1,numbe
j=npoint+i
CALL GiD_fWriteCoordinates2D(fdm,j,xm(i),ym(i))
ENDDO
CALL GiD_fEndCoordinates(fdm)
CALL GiD_fBeginElements(fdm)
DO i=1,npoint
idummy = i
CALL GiD_fWriteElement(fdm,i,idummy)
ENDDO
CALL GiD_fEndElements(fdm)
CALL GiD_fBeginElements(fdm)
DO i=1,numbe
j=i+npoint
idummy=j
CALL GiD_fWriteElement(fdm,j,idummy)
ENDDO
CALL GiD_fEndElements(fdm)
CALL GiD_fEndMesh(fdm)

CALL GiD_fBeginResultHeader(fdr,'Displacements','Analysis',999.9_iwp,GiD_Vector,GiD_OnNodes,GiD_NULL)
CALL GiD_fResultValues(fdr)
DO i=1,npoint
CALL GiD_fWrite2DVector(fdr,i,ui(1,i),ui(2,i))

ENDDO
CALL GiD_fEndResult(fdr)
CALL GiD_fBeginResultHeader(fdr,'Stresses','Analysis',999.9_iwp,GiD_Matrix,GiD_OnNodes,GiD_NULL)
CALL GiD_fResultValues(fdr)
DO i=1,npoint
CALL GiD_fWrite2DMatrix(fdr,i,sigi(1,i),sigi(2,i),sigi(3,i))
ENDDO
CALL GiD_fEndResult(fdr)

CALL GiD_fClosePostResultFile(fdr)
CALL GiD_PostDone


Then I changed the first five lines to use the binary format;

CALL GiD_PostInit
!fdm=GiD_fOpenPostMeshFile('BEM2D.post.msh',GiD_PostAscii)
!fdr=GiD_fOpenPostResultFile('BEM2D.post.res',GiD_PostAscii)
fdr=GiD_fOpenPostResultFile('BEM2D.post.bin',GiD_PostBinary)
fdm=fdr

keeping the remaing code the same.

When I tried to open the binary file in GiD, the following error message appears:
"Error reading file 'C:...': binary results, error reading line.. "
I don't know what I am missing here.

Could you please help me solve the problem?

Kenji Furui
User avatar
escolano
Posts: 1628
Joined: Thu Sep 18, 2014 3:31 pm

Re: Binary file

Postby escolano » Thu Jan 07, 2016 7:49 pm

I think that it is not valid to have more than one BeginElements/EndElements in a mesh.

Maybe GiD is tolerant to this bug in the ASCII version but not in the binary version?

CALL GiD_fBeginElements(fdm)
DO i=1,npoint
idummy = i
CALL GiD_fWriteElement(fdm,i,idummy)
ENDDO

CALL GiD_fEndElements(fdm)
CALL GiD_fBeginElements(fdm)

DO i=1,numbe
j=i+npoint
idummy=j
CALL GiD_fWriteElement(fdm,j,idummy)
ENDDO
CALL GiD_fEndElements(fdm)



Try removing the two lines in red.

If this doesn't fix your problem, upload the mesh and results files in both, ASCII and binary format.
waseda
Posts: 3
Joined: Thu Dec 24, 2015 4:31 am

Re: Binary file

Postby waseda » Mon Jan 11, 2016 2:05 am

Escolano.

Thanks for your help on this. After removing the two lines, I successfully created a binary file.

Regards,

Kenji

Return to “Postprocess”

Who is online

Users browsing this forum: No registered users and 1 guest