Welcome to the forums. Please post in English or French.

You are not logged in.

#1 2018-06-17 12:38:31

ingladisa
Member
Registered: 2017-12-31
Posts: 50

[solved] Beam orientation vectors

Hello,
I followed training instructions described in page 32 of .../DOC/Formations/01-overviewce.pdf for a beam frame model, so i defined CONCEPT string as described, after the run I obtained REPLO data in the output file and ParaVIS provide a plotting of that but NOT vectors. I applied cell center filter but it doesn't work (no vectors), glyph filter does not recognize data (the input menu is empty).

What I missed?

Last edited by ingladisa (2018-06-18 14:40:20)

Offline

#2 2018-06-18 11:49:03

JGWagenfeld
Member
Registered: 2016-04-01
Posts: 27

Re: [solved] Beam orientation vectors

You first have to apply an ELNOfieldToSurface filter. I attached a python-script which automatically plots the local coordinate system. With the tkinter dialog you select your desired result-file.


# ======== Select a file for opening:
import Tkinter,tkFileDialog

root = Tkinter.Tk()
file = tkFileDialog.askopenfilename(parent=root,
                                    initialdir='/',
                                    filetypes=[("Result Files","*.rmed")])
root.destroy()

import pvsimple
pvsimple.ShowParaviewView()
#### import the simple module from the paraview
from pvsimple import *

#Modules to create ParaVis-representation
#from smeca_utils import macro_post
#import presentations

#### disable automatic camera reset on 'Show'
pvsimple._DisableFirstRenderCameraReset()


#------------------------------------------------------------------------------
# Visualize Local Base   X,Y,Z  (red, yellow, green)
#------------------------------------------------------------------------------
print("Create Visualization of local coordinates: X,Y,Z  (red, yellow, green) ")

LocalCoordinates = MEDReader(FileName=file)
RenameSource('LocalCoordinates',LocalCoordinates)



keys=LocalCoordinates.GetProperty("FieldsTreeInfo")[::2]
#Get all the fields contained in the ResultFile
arr_name_with_dis=[elt.split("/") for elt in keys]


for arr in arr_name_with_dis:
    if 'RepLocal' in arr[3]:
        comfield=arr[2]
        timestep=arr[0]

print(timestep,comfield)
newlist=[]
for arr in arr_name_with_dis:
	if arr[0]==timestep and arr[2]==comfield :
		newlist.append("/".join(arr))

print(newlist)
LocalCoordinates.AllArrays = newlist
LocalCoordinates.GenerateVectors = 1


renderView1 = GetActiveViewOrCreate('RenderView')

#Script by cbourcier
# Scale factor for glyphs, factor of the bounding box dimensions
scale_factor = 1./10

source = GetActiveSource()

# Pass cell data to cell centers, since glyphs can only be applyed on points

ELNOMesh1 = ELNOfieldToSurface(Input=LocalCoordinates)

# Guess an absolute scale factor form the bounding box dimensions
bounds = source.GetDataInformation().DataInformation.GetBounds()
side = [bounds[1] - bounds[0], bounds[3] - bounds[2], bounds[5] - bounds[4]]
length = min(side)
scale = length*scale_factor


# Colors of each glyph, same colors as the global base in Paraview 3D viewer
d_colors = {1: [1.0, 0.0, 0.0], # X: red
            2: [1.0, 1.0, 0.0], # Y: yellow
            3: [0.0, 1.0, 0.0]} # Z: green

# For each 3 directions
direction=["X","Y","Z"]
for i in xrange(1, 4):
    # Find the field for the i-th direction
    for name, array in ELNOMesh1.PointData.items():
        if name.endswith("RepLocal_"+direction[i-1]):
            # Create glyphs (that are vectors) and set their scale factor
            Glyph1 = Glyph(Input=ELNOMesh1, Vectors = ['POINTS', name], ScaleMode = 'off')
            SetActiveSource(Glyph1)
            Glyph1.Scalars = ['POINTS', 'None']
            Glyph1.GlyphMode = 'All Points'
            # Show the glyphs with the right colors
            color = d_colors[i]
            GlyphRepresentation = Show(DiffuseColor = color)
            RenameSource("LocalAxis_"+direction[i-1], Glyph1)

            localAxis = FindSource('LocalAxis_"+direction[i-1]+"')
            # hide data in view
            Hide(localAxis, renderView1)




import SalomePyQt
sg = SalomePyQt.SalomePyQt()
sg.activateModule("ParaViS")

Offline

#3 2018-06-18 13:34:25

ingladisa
Member
Registered: 2017-12-31
Posts: 50

Re: [solved] Beam orientation vectors

I loaded the py script. It gives a NameError: name "timestep" is not defined.
The rmed file loaded, it provides results as before.

Offline

#4 2018-06-18 13:57:22

JGWagenfeld
Member
Registered: 2016-04-01
Posts: 27

Re: [solved] Beam orientation vectors

Sorry i didnt mention, this script only works with the newest SalomeMeca version.   
If timestep is not defined, it means it didn't find the RepLocal field in your *.rmed file.

So either, you didn't write the CONCEPT or it has a different name (other SalomeMeca version). If you load your *.rmed file check how your REPLO field is named.

Offline

#5 2018-06-18 14:09:28

ingladisa
Member
Registered: 2017-12-31
Posts: 50

Re: [solved] Beam orientation vectors

I installed Salome meca 2017.0.2.
Concept string in .comm:
CONCEPT= _F(CARA_ELEM=elemprop, MODELE=model, REPERE_LOCAL='ELEM')...

Ok I understood. I changed in REPERE_LOCAL="ELNO". It works! Thank you!

Last edited by ingladisa (2018-06-18 14:15:26)

Offline

#6 2018-06-18 18:37:53

ingladisa
Member
Registered: 2017-12-31
Posts: 50

Re: [solved] Beam orientation vectors

I have seen in the same training file, that it is possible to visualize also the section, but not describing how. Is it necessary a pyton script too?

Offline

#7 2018-06-18 20:42:31

JGWagenfeld
Member
Registered: 2016-04-01
Posts: 27

Re: [solved] Beam orientation vectors

Do you mean multifibre elements with subpoints  (which i assume is what youre refering to from the training-material) or simple 2D beam-elements?

The beam visualization-functionality was beforehand included in Eficas (which doesn't exisit anymore), but is currently not part of the Aster-Module. So you would need to do it manually depending on what your goal is.

For the beam-Elements you might wanne have a look at the TUBA-script i'm working on (http://tuba-v2.readthedocs.io/en/sm2017 and   https://github.com/jgwagenfeld/TUBA_V2). It does the crosssection visualization and also the plotting of the local coordinate system.

The python-function to visualize the cross-section is part of the salome - geom module and is not directly available in paravis. In TUBA the geometry in the geom module is exported and then included in the Postprocessing as an overlay).

ExampleTUBA2.png

Last edited by JGWagenfeld (2018-06-18 20:45:52)


Attachments:
ExampleTUBA3.png, Size: 34.85 KiB, Downloads: 107

Offline

#8 2018-06-18 20:58:30

ingladisa
Member
Registered: 2017-12-31
Posts: 50

Re: [solved] Beam orientation vectors

So I suppose next SM version will have these features...
I tried to use the multifibre beam string simply to define a H shaped section steel beam (that I meshed apart), I don't know if it is right, but I tried.
Thank you very much for the clarification and good luck for your challenging work.

Last edited by ingladisa (2018-06-18 21:12:54)

Offline

#9 2018-06-19 06:39:26

jeanpierreaubry
Guru
From: nantes (france)
Registered: 2009-03-12
Posts: 3,535

Re: [solved] Beam orientation vectors

hello

I tried to use the multifibre beam string simply to define a H shaped section steel beam (that I meshed apart), I don't know if it is right, but I tried.

there is a much simpler way to do that
the macro command MACR_CARA_POUTRE allows you to calculate the properties on a given section directly within the .comm file
it is described in U4.42.02 and in chapter  16.2 of my book

jean pierre aubry

Offline

#10 2018-06-19 07:24:55

ingladisa
Member
Registered: 2017-12-31
Posts: 50

Re: [solved] Beam orientation vectors

Thank you, I will practice it.

A question: TUBA will manage also user-defined sections?

Offline

#11 2018-06-19 09:33:47

JGWagenfeld
Member
Registered: 2016-04-01
Posts: 27

Re: [solved] Beam orientation vectors

No, for now it doesn't work with custom profiles - (only rectangular and circular). The visualization is based on the salome struct-elem library docs.salome-platform dot org/7/gui/GEOM/struct_elem_visualisation dot html which doesn't create custom crosssections.

As jeanpierreaubry wrote, for custom profiles you would need to first use MACR_CARA_POUTRE in CodeAster to calculate the characteristics of the cross section. Though this wouldn't include a proper visualization but only the mechanical behavior.

Core-Engineering (https://github.com/core-engineering/aster-calc-section) has some interesting code for the automated calculation of custom profiles (e.g I and H-Beams) with a list of standard IPE and HE profiles. I'm looking currently into how to include this code in TUBA (coupled with a visualization) but i'm still not far.

Offline

#12 2018-06-28 11:01:56

JGWagenfeld
Member
Registered: 2016-04-01
Posts: 27

Re: [solved] Beam orientation vectors

I updated the TUBA-code to include I- and H-Beams. You now have access to the list of IPE and HE-Profiles from Core-Engineerings' aster-calc-section code.
github dot com/jgwagenfeld/TUBA_V2/blob/SM2017/external/Section/IBeam.input

I attached a short example of the functionality.

Besides a 1D-Mesh, you can plot it as well as a meshed 3D-Element (V_3D() ) - though the calculation becomes very expensive very fast. I mainly included it to verify to correct orientation of the elements.

P(0,0,0)  
FixPoint()
SectionIBeam("IPEAA80")		
SectionOrientation(45)
V(500,0,0)
Force(z=-1000)

P(0,300,0)  
FixPoint()
SectionIBeam("IPEAA80")		
SectionOrientation(45)
V_3D(500,0,0)
Force(z=-1000)

Screenshot_2018-06-28_11-11-32.png

I will add more standard profiles. User-defined profiles (with a Sketcher-String) should be possible soon as well.

Last edited by JGWagenfeld (2018-06-28 11:05:00)


Attachments:
Screenshot_2018-06-28_11-11-32.png, Size: 246.4 KiB, Downloads: 93

Offline

#13 2018-06-28 13:07:05

ingladisa
Member
Registered: 2017-12-31
Posts: 50

Re: [solved] Beam orientation vectors

Great...
I have no skill in pyton and adding features like this in Salome. Could you describe a "step-by-step" way to install TUBA inside Salome-meca 2017?
Thank you...

Offline

#14 2018-06-28 13:49:19

JGWagenfeld
Member
Registered: 2016-04-01
Posts: 27

Re: [solved] Beam orientation vectors

I have written a short documentation on how to install and how to use TUBA
http://tuba-v2 dot readthedocs.io/en/sm2017/Installation.html#

You basically download the TUBA-directory and add the TUBA-script to your .bashrc (and make it executable) .  Then you can start it from your terminal like this (where examplescript.py is your list of function as e.g. the example i posted above)

TUBA.py examplescript.py -all

The above line will
-create your geometry and mesh(Background)
-runs the Code Aster Simulation(Background)
-launches ParaView with your results (some standard plotting)

In the tutorials folder, you have plenty of examples how to use the code.

Offline

Board footer