Cancel
Showing results for 
Search instead for 
Did you mean: 

FEMAP POST-PROCESSING

Creator
Creator

Hello community, i want to explain a problem regarding the post processing. 

I need to study a symmetric object, as shown in the attached picture, to simplify and use a fine mesh, i divided it in 4 parts and i run the simulation. 

Now the question, is possible to "mirror" the results of the analysis to have a complete view of the entire figure? 

 

Thanks in Advance

 

3 REPLIES

Re: FEMAP POST-PROCESSING

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hello!,

No, not possible to see results in the whole model, if you want to have a view of the entire figure you need to mirror the geometry & mesh (do not forget to associate mesh to geometry), merge nodes in the interfaces, apply the correct BCs to avoid rigid body movements and rerun the analysis.

Well, in the past I requested to FEMAP developers to have the option to render & postprocess results in the whole model when performing a linear static axisymmetric analysis as a virtual solid model, giving the option to choose the axis of rotation, the start & revolving angle (if the user choose 360 degrees, the full 3D part will be rendered), and specify the number of radial sections to sweep through for the rendering (the more sections, the finer the display). This is a real task of a FEA pre&postpreocessor!!.

Please FEMAP developers, hear our needs, thanks!.

Best regards,
Blas.

Blas Molero Hidalgo, Ingeniero Industrial, Director
IBERISA • 48004 BILBAO (SPAIN)
WEB: http://www.iberisa.com
Blog Femap-NX Nastran: http://iberisa.wordpress.com/

Re: FEMAP POST-PROCESSING

Creator
Creator
Hello,

Thanks for the reply. This is a very sad information, hope in a future improvement of the feature.

Best Regards,
PieFierro

Re: FEMAP POST-PROCESSING

Experimenter
Experimenter

Hi,

I looked into this problem a couple of months ago.

I worte an API that do mirror some result.

Use it with causion, I havent touched it in a while but i think it works alright.

/ Henrik

 

'Henrik Johansson
'All Rights Reserved, 2017
'Henrik Johansson Assumes No Responsibility For Results Obtained From API
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'API Written by Henrik Johansson, Rev-1 (Tested on Femap v11.3.0)

Option Explicit
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'                                                                   M A I N   F U N C T I O N
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub Main
	    Dim App As femap.model
	    Set App = feFemap()

	    Dim rc As zReturnCode

		Dim fOut As femap.Output
		Set fOut = App.feOutput

		Dim fOutNew As femap.Output
		Set fOutNew = App.feOutput
		Dim fOutSetNew As femap.OutputSet
		Set fOutSetNew = App.feOutputSet

		Dim sOutVec As femap.Set
		Dim sOutSet As femap.Set
		Dim ResID As Long

		Dim SetName As Results
        Set SetName = App.feResults

        Dim sTitle As String
        Dim nDataType As zDataType
        Dim nOutputType As zOutputType
        Dim bCentroidTotal As Boolean, bCalcWarn As Boolean
        Dim nCompDir As Long

		App.feAppMessage(FCM_COMMAND,"Running API")

				' Mirror body and mesh
		rc = App.feAppMessageBox(2,"Mirror mesh and body?")
		If rc = FE_OK Then
				Mirror_Body_Mesh()
		Else
				App.feAppMessage(FCM_NORMAL,"No mesh or body mirrored")
		End If

		If App.feSelectOutput( "Select Output Vectors",0,FOT_ANY, FOC_ANY,0,False,sOutSet, sOutVec ) = FE_OK  Then
				sOutSet.Next()

						' Create a new Output Set
				fOutSetNew.title = "Mirrored Result"
				fOutSetNew.analysis = FAT_STATIC
				fOutSetNew.Put(App.feOutputSet.NextEmptyID)

				While sOutVec.Next
								' Get the selected output ID
						ResID = sOutVec.CurrentID
						fOut.Get(ResID)
						SetName.VectorTitle(sOutSet.CurrentID, sOutVec.CurrentID, sTitle)
						SetName.VectorInfo(sOutSet.CurrentID, sOutVec.CurrentID, nDataType, _
							nOutputType, bCentroidTotal, bCalcWarn, nCompDir)

						' Set the old output information to the new
						fOutNew.location = nDataType
						fOutNew.category = nOutputType
						fOutNew.centroidtotal = bCentroidTotal
						fOutNew.nonlinear = bCalcWarn
						fOutNew.hascomponent = nCompDir

						App.feAppMessage(FCM_COMMAND, "Mirroring : " + Str$(ResID) + " - " + sTitle)

						App.feAppMessage(FCM_COMMAND, "Location = " + Str$(nDataType) + ";   Category = " + Str$(nOutputType)+ _
							";   Centroidtotal = " + Str$(bCentroidTotal) + ";   Nonlinear = " + Str$(bCalcWarn) + ";   Hascomponent = " + Str$(nCompDir))

						If nDataType = FT_ELEM Then
									' Mirror tetrahedral element result
								MirrorTetElementResult(fOut, fOutNew, ResID, fOutSetNew.ID, sTitle)
						ElseIf nDataType = FT_NODE Then
									' Mirror tetrahedral node result
								If fOutNew.hascomponent = 1 And fOutNew.nonlinear = True Then
										MirrorTetVecNodeResult(fOut,fOutNew,ResID,fOutSetNew.ID, sTitle)
								ElseIf fOutNew.nonlinear = True Then
										MirrorTetScaNodeResult(fOut,fOutNew,ResID,fOutSetNew.ID, sTitle)
								Else
										App.feAppMessage(FCM_COMMAND, "Skipped : " + Str$(ResID) + " - " + sTitle + " since the values will be copied through another output")
								End If
						Else
								App.feAppMessage(FCM_ERROR, "Not element or node output selected")
						End If
				Wend
		End If
		ShowStatus(False,1)
		App.feViewRegenerate(0)
		App.feAppMessage(FCM_COMMAND,"All Done!")
End Sub

'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'                                                                   M I R R O R   T E T R A H E D R A L   E L E M E N T   R E S U L T
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function MirrorTetElementResult(fOut As femap.Output, fOutNew As femap.Output, ResID As Long, fOutSetNewID As Long, sTitle As String)
		Dim App As femap.model
	    Set App = feFemap()

		Dim Ne As Long, MaxCorner As Long, i As Long, ID_Last As Long
				' To store non mirrored result in
		Dim ce, ID As Variant
		Dim c1 As Variant, c2 As Variant, c3 As Variant, c4 As Variant
		Dim c5 As Variant, c6 As Variant, c7 As Variant, c8 As Variant
			' To stor mirrored result in
		Dim Newce(10000000) As Variant, NewID(10000000) As Variant
		Dim Newc1(10000000) As Variant, Newc2(10000000) As Variant, Newc3(10000000) As Variant, Newc4(10000000) As Variant
		Dim Newc5(10000000) As Variant, Newc6(10000000) As Variant, Newc7(10000000) As Variant, Newc8(10000000) As Variant

		Dim bigstatus As Long

			' Get the output vectors
		fOut.GetElemWithCorner(Ne,MaxCorner,ID,ce,c1,c2,c3,c4,c5,c6,c7,c8)

			' Number of elements
		Ne = UBound(ID)+1
			' Last element id of the old mesh
		ID_Last = ID(Ne-1)

		bigstatus = Ne/100
		ShowStatus(True,Ne)
		UpdateStatus(i)

		App.feAppMessage(FCM_NORMAL, "Number of result elements read:     " + Str$(Ne))
		App.feAppMessage(FCM_NORMAL, "New elements are starting from ID: " + Str$(ID_Last))

		For i = 0 To Ne - 1
					' Copy all old result to new set
				NewID(i) = ID(i)
				Newce(i) = ce(i)
				Newc1(i) = c1(i)
				Newc2(i) = c2(i)
				Newc3(i) = c3(i)
'				Newc4(i) = c4(i)
				Newc5(i) = c5(i)
'				Newc6(i) = c6(i)
'				Newc7(i) = c7(i)
'				Newc8(i) = c8(i)

					' Mirror all old result to the new set
				NewID(Ne+i) = ID_Last + 1 + i
				Newce(Ne+i) = ce(i)
				Newc1(Ne+i) = c2(i)
				Newc2(Ne+i) = c1(i)
				Newc3(Ne+i) = c3(i)
'				Newc4(Ne+i) = c4(i)
				Newc5(Ne+i) = c5(i)
'				Newc6(Ne+i) = c6(i)
'				Newc7(Ne+i) = c7(i)
'				Newc8(Ne+i) = c8(i)

					' Update Status Bar
				If i > bigstatus Then
		   				UpdateStatus(i)
						bigstatus += Ne/100
				End If
		Next i
		ShowStatus(False,1)
		App.feAppMessage(FCM_NORMAL,"Copied and Mirrored result to new set")

		ShowStatus(True,4)
		UpdateStatus(1)
		App.feAppMessage(FCM_NORMAL,"Initializing the new output")
			' Initialize the new output
		fOutNew.InitElemWithCorner(fOutSetNewID,ResID, ResID+10000,ResID+10200,ResID+10400,ResID+10600, _
				ResID+10800,ResID+11000,ResID+11200,ResID+11400, sTitle,FOT_ANY,False)

		UpdateStatus(2)
		App.feAppMessage(FCM_NORMAL,"Saving the result to the new output")
		'	 Put the mirrored result into the new output set
		fOutNew.PutElemWithCorner(UBound(NewID)+1,MaxCorner,NewID,Newce,Newc1,Newc2, _
			Newc3,Newc4,Newc5,Newc6,Newc7,Newc8)

		UpdateStatus(3)
		App.feAppMessage(FCM_NORMAL,"Creating the new output")
			' Create the new output
		fOutNew.Put(ResID)
		UpdateStatus(4)
End Function

'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'                                                                   M I R R O R   T E T R A H E D R A L   V E C T O R   N O D A L   R E S U L T
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function MirrorTetVecNodeResult(fOut As femap.Output, fOutNew As femap.Output, ResID As Long, fOutSetNewID As Long, sTitle As String)
		Dim App As femap.model
	    Set App = feFemap()

		Dim Nn As Long, i As Long, ID_Last As Long
				' To store non mirrored result in
		Dim ID As Variant, X As Variant, Y As Variant, Z As Variant
			' To stor mirrored result in
		Dim NewID(10000000) As Variant, NewX(10000000) As Variant, NewY(10000000) As Variant, NewZ(10000000) As Variant

		Dim bigstatus As Long

			' Get the output vectors
		fOut.GetVectorAtNode(Nn,ID,X,Y,Z)


			' Number of elements
		Nn = UBound(ID)+1
			' Last element id of the old mesh
		ID_Last = ID(Nn-1)

		bigstatus = Nn/100
		ShowStatus(True,Nn)
		UpdateStatus(0)

		App.feAppMessage(FCM_NORMAL, "Number of result nodes read:     " + Str$(Nn))
		App.feAppMessage(FCM_NORMAL, "New nodes are starting from ID: " + Str$(ID_Last))

		For i = 0 To Nn - 1
					' Copy all old result to new set
				NewID(i) = ID(i)
				NewX(i) = X(i)
				NewY(i) = Y(i)
				NewZ(i) = Z(i)

					' Mirror all old result to the new set
				NewID(Nn+i) = ID_Last + 1 + i
				NewX(Nn+i) = X(i)
				NewY(Nn+i) = Y(i)
				NewZ(Nn+i) = Z(i)

					' Update Status Bar
				If i > bigstatus Then
		   				UpdateStatus(i)
						bigstatus += Nn/100
				End If
		Next i
		ShowStatus(False,1)
		App.feAppMessage(FCM_NORMAL,"Copied and Mirrored result to new set")

		ShowStatus(True,4)
		UpdateStatus(1)
		App.feAppMessage(FCM_NORMAL,"Initializing the new output")
			' Initialize the new output

		fOutNew.InitVectorAtNode(fOutSetNewID,ResID, ResID+1,ResID+2,ResID+3,sTitle,fOutNew.category,fOutNew.nonlinear)

		UpdateStatus(2)
		App.feAppMessage(FCM_NORMAL,"Saving the result to the new output")
		'	 Put the mirrored result into the new output set
		fOutNew.PutVectorAtNode(UBound(NewID), NewID, NewX, NewY, NewZ)

		UpdateStatus(3)
		App.feAppMessage(FCM_NORMAL,"Creating the new output")
			' Create the new output
		fOutNew.Put(ResID)
		UpdateStatus(4)
End Function

'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'                                                                   M I R R O R   T E T R A H E D R A L   S C A L A R   N O D A L   R E S U L T
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function MirrorTetScaNodeResult(fOut As femap.Output, fOutNew As femap.Output, ResID As Long, fOutSetNewID As Long, sTitle As String)
		Dim App As femap.model
	    Set App = feFemap()

		Dim Nn , i , ID_Last As Long
				' To store non mirrored result in
		Dim ID  As Variant, Cen As Variant
			' To stor mirrored result in
		Dim NewID(10000000) As Variant, NewCen(10000000) As Variant

		Dim bigstatus As Long

			' Get the output vectors
		fOut.GetScalarAtNode(Nn,ID,Cen)

			' Number of elements
		Nn = UBound(ID)+1
			' Last element id of the old mesh
		ID_Last = ID(Nn-1)

		bigstatus = Nn/100
		ShowStatus(True,Nn)
		UpdateStatus(0)

		App.feAppMessage(FCM_NORMAL, "Number of result nodes read:     " + Str$(Nn))
		App.feAppMessage(FCM_NORMAL, "New nodes are starting from ID: " + Str$(ID_Last))

		For i = 0 To Nn - 1
					' Copy all old result to new set
				NewID(i) = ID(i)
				NewCen(i) = Cen(i)

					' Mirror all old result to the new set
				NewID(Nn+i) = ID_Last + 1 + i
				NewCen(Nn+i) = Cen(i)

					' Update Status Bar
				If i > bigstatus Then
		   				UpdateStatus(i)
						bigstatus += Nn/100
				End If
		Next i
		ShowStatus(False,1)
		App.feAppMessage(FCM_NORMAL,"Copied and Mirrored result to new set")

		ShowStatus(True,4)
		UpdateStatus(1)
		App.feAppMessage(FCM_NORMAL,"Initializing the new output")
			' Initialize the new output
		fOutNew.InitScalarAtNode(fOutSetNewID,ResID,sTitle,fOutNew.category,fOutNew.nonlinear)

		UpdateStatus(2)
		App.feAppMessage(FCM_NORMAL,"Saving the result to the new output")
		'	 Put the mirrored result into the new output set
		fOutNew.PutScalarAtNode(UBound(NewID),NewID,NewCen)

		UpdateStatus(3)
		App.feAppMessage(FCM_NORMAL,"Creating the new output")
			' Create the new output
		fOutNew.Put(ResID)
		UpdateStatus(4)
End Function

'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'                                                                   M I R R O R   B O D Y   A N D   M E S H
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function Mirror_Body_Mesh()

    Dim App As femap.model
    Set App = feFemap()

    Dim fSet As femap.Set
    Set fSet = App.feSet

    Dim rc As zReturnCode
	Dim VecLength As Double
	Dim VecBase As Variant
	Dim VecDir As Variant

    	' Get the vector to project the symmetry
    rc = App.feVectorPick("Select symmetry surface normal",False,VecLength,VecBase,VecDir)
	If rc = FE_CANCEL Then Exit Function

	ShowStatus(True,4)

		' Get the solid to mirror
	fSet.Reset
    fSet.AddAll(FT_SOLID)
	UpdateStatus(1)

		' Mirror the solid
    rc = App.feGenerateReflect(FT_SOLID,fSet.ID,VecBase,VecDir,0,True)
	If rc = FE_FAIL Then Exit Function
	UpdateStatus(2)

	App.feAppMessage(FCM_NORMAL,"Solid Mirrored")

    	' Get elements to mirror
    fSet.AddAll(FT_ELEM)
	UpdateStatus(3)

    	' Mirror the elements
    rc = App.feGenerateReflect(FT_ELEM,fSet.ID,VecBase,VecDir,0,True)
    If rc = FE_FAIL Then Exit Function
    UpdateStatus(4)

    App.feAppMessage(FCM_NORMAL,"Mesh Mirrored")
    ShowStatus(False,1)
End Function

'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'                                                                    U P D A T E   S T A T U S   B A R
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function UpdateStatus(status As Long)
    Dim App As femap.model
    Set App = feFemap()

	App.feAppStatusUpdate(status)
	App.feAppStatusRedraw()
End Function

'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'                                                                    S H O W / H I D E   S T A T U S   B A R
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function ShowStatus(Show As Boolean, Size As Long)
    Dim App As femap.model
    Set App = feFemap()

	App.feAppStatusShow(Show, Size)
	App.feAppStatusRedraw()
End Function