Cancel
Showing results for
Did you mean:

# Is there a way to apply a stress factor to only a certain group of elements?

Experimenter

I need to apply different stress concentration factors to different regions of a structure - these factors are calculated based upon principal stresses. I have hundreds of load cases, so doing this manually by exporting stress vectors to excel or similar is simply unfeasible.

Is there a way to do this via the FEMAP menus? Or will I have to write an API program to do this?

10 REPLIES 10

# Re: Is there a way to apply a stress factor to only a certain group of elements?

Siemens Phenom

An API is definitely the way to go, what does the equation look like?

Mark.

# Re: Is there a way to apply a stress factor to only a certain group of elements?

Experimenter

There are 6 different stress concentration factors to be applied to the maximum elemental stresses. Here is one example:

Kt = 1.2*S1 - 0.4*S3

where S1 and S3 are the first and third principal stresses. They are simple equations, and once I have each element's principal stresses in hand it's easy enough to compute. The difficulty lies in 1) applying different equations to different sets of elements and 2) automating the process. As mentioned I have hundreds of load cases for each analysis. Also worth noting is that the final product needs to be in the form of nodal stresses (easily exported once the stress concentration factors have been applied to the elemental stresses).

I have virtually no experience with Visual Basic, but reading over the API manual perhaps I can experiment. Are there some particular methods you would suggest I take a look at?

# Re: Is there a way to apply a stress factor to only a certain group of elements?

Siemens Phenom

What type of elements are in your model?  Beams?  Plates?  Solids?

Mark.

Experimenter
100% plates.

# Re: Is there a way to apply a stress factor to only a certain group of elements?

Siemens Phenom

The following API should be a good starting point.  It asks you to choose elements, it removes anything that is not a plate.  It then prompts you for K1, and K2 and uses these in your equation.  It also asks you for which output sets you want to process.  It uses the equation at the centroid, and the corners of the plates selected and creates new output vectors 9,000,000 and 9,000,001 plus the associated corner data.

You can certainly add some logic to change the equation based on property type, location, or just about anything.  The Output Vector IDs are hard coded, if you run it again, they will be overwritten, this could also be modified.  I hope it helps.

Mark.

The HTML Clipboard

```Sub Main
Dim App As femap.model
Set App = feFemap()

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

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

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

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

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

Dim k1 As Double
Dim k2 As Double

Dim resultsTop As femap.Results
Set resultsTop = App.feResults

Dim resultsBottom As femap.Results
Set resultsBottom = App.feResults

Dim outSetID As Long
Dim topMaxPrinCol As Long
Dim topMinPrinCol As Long
Dim colIDs As Variant

Dim elIDs As Variant
Dim topMaxPrinCenter As Variant
Dim topMaxPrinC1 As Variant
Dim topMaxPrinC2 As Variant
Dim topMaxPrinC3 As Variant
Dim topMaxMinC4 As Variant

Dim topMinPrinCenter As Variant
Dim topMinPrinC1 As Variant
Dim topMinPrinC2 As Variant
Dim topMinPrinC3 As Variant
Dim topMinMinC4 As Variant
Dim botMinPrinCenter As Variant
Dim botMinPrinC1 As Variant
Dim botMinPrinC2 As Variant
Dim botMinPrinC3 As Variant
Dim botMinMinC4 As Variant

Dim topSICenter() As Double
Dim topSIC1() As Double
Dim topSIC2() As Double
Dim topSIC3() As Double
Dim topSIC4() As Double
Dim topSIC5() As Double
Dim topSIC6() As Double
Dim topSIC7() As Double
Dim topSIC8() As Double
Dim botSICenter() As Double
Dim botSIC1() As Double
Dim botSIC2() As Double
Dim botSIC3() As Double
Dim botSIC4() As Double
Dim botSIC5() As Double
Dim botSIC6() As Double
Dim botSIC7() As Double
Dim botSIC8() As Double

Dim Dummy As Variant

Dim ouVec As femap.Output

Dim nElems As Long

If selSet.Select( FT_ELEM, True, "Pick Elements to Process" ) = FE_OK Then
If workSet.Count > 0 Then
If App.feGetReal( "Factor K1", 0.00001, 10.0, k1 ) = FE_OK Then
If App.feGetReal("Factor K2", 0.00001, 10.0, k2 ) = FE_OK Then
If outSets.SelectMultiID( FT_OUT_CASE, allOutSets.ID, "Select Output Sets To Process") = FE_OK Then
outSetID = outSets.First()
While outSetID > 0
resultsTop.Clear
resultsBottom.Clear
resultsTop.DataNeeded( FT_ELEM, workSet.ID )
resultsBottom.DataNeeded(FT_ELEM,workSet.ID)
topMaxPrinCol = colIDs(0)
End If
topMinPrinCol = colIDs(0)
End If
botMaxPrinCol = colIDs(0)
End If
botMinPrinCol = colIDs(0)
End If
resultsTop.Populate()
resultsBottom.Populate()
resultsTop.GetColumn( topMaxPrinCol, elIDs, topMaxPrinCenter )
resultsTop.GetColumn( topMaxPrinCol+1, elIDs, topMaxPrinC1 )
resultsTop.GetColumn( topMaxPrinCol+2, elIDs, topMaxPrinC2 )
resultsTop.GetColumn( topMaxPrinCol+3, elIDs, topMaxPrinC3 )
resultsTop.GetColumn( topMaxPrinCol+4, elIDs, topMaxPrinC4 )
resultsTop.GetColumn( topMinPrinCol, elIDs, topMinPrinCenter )
resultsTop.GetColumn( topMinPrinCol+1, elIDs, topMinPrinC1 )
resultsTop.GetColumn( topMinPrinCol+2, elIDs, topMinPrinC2 )
resultsTop.GetColumn( topMinPrinCol+3, elIDs, topMinPrinC3 )
resultsTop.GetColumn( topMinPrinCol+4, elIDs, topMinPrinC4 )

resultsBottom.GetColumn( botMaxPrinCol, elIDs, botMaxPrinCenter )
resultsBottom.GetColumn( botMaxPrinCol+1, elIDs, botMaxPrinC1 )
resultsBottom.GetColumn( botMaxPrinCol+2, elIDs, botMaxPrinC2 )
resultsBottom.GetColumn( botMaxPrinCol+3, elIDs, botMaxPrinC3 )
resultsBottom.GetColumn( botMaxPrinCol+4, elIDs, botMaxPrinC4 )
resultsBottom.GetColumn( botMinPrinCol, elIDs, botMinPrinCenter )
resultsBottom.GetColumn( botMinPrinCol+1, elIDs, botMinPrinC1 )
resultsBottom.GetColumn( botMinPrinCol+2, elIDs, botMinPrinC2 )
resultsBottom.GetColumn( botMinPrinCol+3, elIDs, botMinPrinC3 )
resultsBottom.GetColumn( botMinPrinCol+4, elIDs, botMinPrinC4 )

nElems = resultsTop.NumberOfRows
ReDim topSICenter(nElems) As Double
ReDim topSIC1(nElems) As Double
ReDim topSIC2(nElems) As Double
ReDim topSIC3(nElems) As Double
ReDim topSIC4(nElems) As Double
ReDim topSIC5(nElems) As Double
ReDim topSIC6(nElems) As Double
ReDim topSIC7(nElems) As Double
ReDim topSIC8(nElems) As Double
ReDim botSICenter(nElems) As Double
ReDim botSIC1(nElems) As Double
ReDim botSIC2(nElems) As Double
ReDim botSIC3(nElems) As Double
ReDim botSIC4(nElems) As Double
ReDim botSIC5(nElems) As Double
ReDim botSIC6(nElems) As Double
ReDim botSIC7(nElems) As Double
ReDim botSIC8(nElems) As Double

For j=0 To nElems - 1
topSICenter(j) = k1*topMaxPrinCenter(j) - k2*topMinPrinCenter(j)
topSIC1(j) = k1*topMaxPrinC1(j) - k2*topMinPrinC1(j)
topSIC2(j) = k1*topMaxPrinC2(j) - k2*topMinPrinC2(j)
topSIC3(j) = k1*topMaxPrinC3(j) - k2*topMinPrinC3(j)
topSIC4(j) = k1*topMaxPrinC4(j) - k2*topMinPrinC4(j)
topSIC5(j) = 0.0
topSIC6(j) = 0.0
topSIC7(j) = 0.0
topSIC8(j) = 0.0
botSICenter(j) = k1*botMaxPrinCenter(j) - k2*botMinPrinCenter(j)
botSIC1(j) = k1*botMaxPrinC1(j) - k2*botMinPrinC1(j)
botSIC2(j) = k1*botMaxPrinC2(j) - k2*botMinPrinC2(j)
botSIC3(j) = k1*botMaxPrinC3(j) - k2*botMinPrinC3(j)
botSIC4(j) = k1*botMaxPrinC4(j) - k2*botMinPrinC4(j)
botSIC5(j) = 0.0
botSIC6(j) = 0.0
botSIC7(j) = 0.0
botSIC8(j) = 0.0
Next

Msg = "K1 = " + Str\$(k1) + " K2 = " + Str\$(k2) + " Plate Top"

Set ouVec = App.feOutput
rc = ouVec.InitElemWithCorner( outSetID, 9000000, 9000002, 9000003,9000004,9000005, 0, 0, 0, 0, Msg, FOT_STRESS, True )
rc = ouVec.PutElemWithCorner( nElems, 4, elIDs, topSICenter, topSIC1, topSIC2, topSIC3, topSIC4, 0, 0, 0, 0)
rc = ouVec.Put( 9000000 )

Msg = "K1 = " + Str\$(k1) + " K2 = " + Str\$(k2) + " Plate Bottom"

Set ouVec = App.feOutput
rc = ouVec.InitElemWithCorner( outSetID, 9000001, 9000006, 9000007,9000008,9000009, 0, 0, 0, 0, Msg, FOT_STRESS, True )
rc = ouVec.PutElemWithCorner( nElems, 4, elIDs, botSICenter, botSIC1, botSIC2, botSIC3, botSIC4, 0, 0, 0, 0)
rc = ouVec.Put( 9000001 )

outSetID = outSets.Next()
Wend
End If
End If
End If
End If
End If
End Sub
```

# Re: Is there a way to apply a stress factor to only a certain group of elements?

Experimenter

Wow, thanks so much!! Thank you for taking the time to put this together, it's much appreciated.

Highlighted

# Re: Is there a way to apply a stress factor to only a certain group of elements?

Legend

Hello Mark,

Do you need this for this project only? Or you use these calculations quite often?

Yarko

# Re: Is there a way to apply a stress factor to only a certain group of elements?

Legend

Hello Mark,

My company has developed an extension to Femap which has advanced formula editor. I think It can help you in this project.

This product is a commercial program but I would like to suggest you a cooperation: I will assist you with formulas and arrange the trial for 30 days (and you can use our program for this project for free). And I will use the created check as an example in the article.

The benefits are that calculation for all 6 types will be on one plot. And also it is possible to make an envelope for all your cases. (check all cases with one plot).

Let me know if have time and interested in such cooperation.

I've started already with the check. I've created custom characteristic which defines 6 different types (groups) of elements which will use different formulas for calculations. I equally divided my model into 6 groups and set them types 1-6:

And the formulas look like this. For the first type, I've used your formula and for rest just numbers 2-6.:

SCF - define what formula should be used for which elements:

Yarko

# Re: Is there a way to apply a stress factor to only a certain group of elements?

Experimenter

Hi, thanks Yarko. Your solution looks very useful, but this is a one-time situation and the project moves too quickly for a cooperation with an outside entity. We have already moved beyond this problem by using in-house resources (IMAT with MATLAB).

But thank you again!