Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

feLoadMesh.addarray pressure direction

[ Edited ]

When using the feLoadMesh.addarray pressure method in my VBA code, I’m able to apply pressures normal to the element face.

However I would like to give them a direction as is possible for the Nastran solver (see Help) and for single element pressure application with feLoadMesh.add this is also possible. Manually this is also possible. But I can't get it working when loading the elements with arrays using the .addarray method.

 

How do I need to set / use this function in order to get a directional pressure component, not normal tot the element?

For example as a vector of (1, 1, 1 | X, Y, Z).

 

AddArray

( count, doDOF, doValues, doFunctions, NodeElemID, DOF, Values, FunctionID )

 

Femap version 11.1

3 REPLIES
Solution
Solution
Accepted by topic author CRensen
‎03-04-2016 03:15 AM

Re: feLoadMesh.addarray pressure direction

Dear CRensen,

 

 

You can set direction directly in LoadMesh object, see example:

    Dim pressureMesh As femap.LoadMesh
    Set pressureMesh = App.feLoadMesh
    pressureMesh.fluxdir(0) = 1; 'x
    pressureMesh.fluxdir(1) = 1; 'y
    pressureMesh.fluxdir(2) = 1; 'z

And then use AddArray Function. 

 

Yarko

Solution
Solution
Accepted by topic author CRensen
‎03-04-2016 03:15 AM

Re: feLoadMesh.addarray pressure direction

Added to that, you should also set

 

pressureMesh.flag(1) = True

 

Below a simple example thanks to Andy Haines:

 

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

    Dim eload As femap.LoadMesh
    Set eload = App.feLoadMesh

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

    Dim elIDs As Variant
    Dim DOFs As Variant
    Dim Vals As Variant
    Dim Funcs As Variant

    eset.AddAll (FT_ELEM)

    elcount = eset.Count
    elarray = elcount-1
    DOFarray = (elcount*3)-1
    ValArray = (elcount*5)-1
    FuncArray = (elcount*5)-1

    ReDim elIDs (elarray) As Long
    ReDim DOFs (DOFarray) As Boolean
    ReDim Vals (ValArray) As Double
    ReDim Funcs (FuncArray) As Long

    'Specify Load Set ID
    eload.setID = 1
    'Specify Load Type (Pressure)
    eload.type = FLT_EPRESSURE

    'Specify the directional vector using fluxdir
    'Specify dX value
    eload.fluxdir(0) = 1.0
    'Specify dY value
    eload.fluxdir(1) = 2.0
    'Specify dZ value
    eload.fluxdir(2) = 3.0

    'eload.Pressure = 12.0
    'Specify Face ID
    eload.FaceNumber = 1

    'Set Falg(1) to True to designate "Specify Direction" option for pressures
    eload.flag(1) = True

    i = 0
    While eset.Next
        elIDs(i) = eset.CurrentID
        Vals(i*5) = (i*0.1)+0.1
        Vals(i*5+1) = 0.0
        Vals(i*5+2) = 0.0
        Vals(i*5+3) = 0.0
        Vals(i*5+4) = 0.0
        i=i+1
    Wend

    rc = eload.AddArray (elcount, False, True, False, elIDs, DOFs, Vals, Funcs)

End Sub

 

 

Re: feLoadMesh.addarray pressure direction

Dear CRensen,

 

 

You are right. I've checked the function where I copied the code and there flag(1) is set to true. 

 

Yarko