anaiortega / XCmodels

XC test bench: projects, models, tests, ... in Python for XC
3 stars 3 forks source link

create block geometry with ijkrange #4

Open berndhahnebach opened 6 years ago

berndhahnebach commented 6 years ago

https://github.com/berndhahnebach/XCmodels/blob/master/workingModel/model_gen.py#L89-L151

I have never created such block geometry. I am missing something. I have tried to understand and what is happening, but I do not understand the whole thing. Could you bring some light in the darkness. It is some simple geometry. It should not be to difficult.

Is it possible to print the contents of columnZ_rg ? What is inside this list ?

bernd

lcpt commented 6 years ago

Hi.

I imagine you're trying to create the lines and surfaces in XC, from your IFC data, to mesh them later. I wonder if the use of a grid in the same way that Ana does in the example is the best way to do it. Can't you create the "key points" and then the lines and the surfaces directly from your data?

The grid that Ana uses in this example allows you to refer different parts of the model using ((i,j,k) indexes but, do you need that?

Anyway, the grid works in some way like Blender meshes: first you create a rectilinear grid with vertices on the intersections of the planes defined by the initial set of coordinates an the you apply trnsformations to different subsets of these points to obtain the final geometry. But I think you already have the "final geometry" stored in your model.

@Ana, can you add a more detailed explanation please?

Cheers Luis.

lcpt commented 6 years ago

Hi again.

As for the underliying block topology (the grid is only an interface that allows you to create it), you can see it as a "macro" mesh defined by pseudo-nodes (points), "macro" linear elements and "macro" shell elementas that connect on those points and then are used to generate the real finite element mesh.

anaiortega commented 6 years ago

Hi, Sorry for my delayed answer. As Luis says, the usual way to create the geometry is, first, to define points by their coordinates to then generate lines, surfaces or volumes by passing the tags of the linked points as parameters to the respective functions. This is the way it works also in this model, except that to save myself from keeping track of the point numbering, I resort to the artifice of ranges. A range (or list of ranges) does not represent an entity, it is only a list of indexes. I attach a clarifying drawing. ijkranges

In any case, it is quite possible, especially taking into account the simplicity of the model, to make a more direct generation of geometry. Maybe we can rewrite the script to make it more readable.

Cheers, Ana

lcpt commented 6 years ago

Thanks Ana, nice!

@Bernd maybe if you explain us what are the source data (in what form the structure is stored in your model) we can help to design the process of exporting that to XC.

Cheers Luis.

berndhahnebach commented 6 years ago

thanks for your help. I still do not know which way to go to get geometry into xc. Thus I would like to play with xc and create some own geometry. Thus I wanted to understand how it works in workingModel.

I went a step back and used anas tutorial. See https://github.com/berndhahnebach/XCmodels/blob/655748bd487c8740c23f9b81f7185d76bcd873bc/xctutorial01/tut.py which runs great.

Will see if I am able to make the CalculiX cantilever example with one beam element out of it. See FreeCAD 3D FEM example on start wb for a model with 250 tet10.

berndhahnebach commented 6 years ago

I tried to display the mesh of the tutorial 1 but failed due to an error ... https://github.com/berndhahnebach/XCmodels/blob/bernd2/xctutorial01/tut01-comments.py#L78-L80

I got an error:

` $ python tut01-comments.py ('N = ', -10079.998306560286) Traceback (most recent call last): File "tut01-comments.py", line 80, in defDisplay.displayMesh(truss, fName= None, caption='Mesh', nodeSize=0.020, scaleConstr=0.30) File "/usr/local/lib/python2.7/dist-packages/postprocess/xcVtk/FE_model/vtk_FE_graphic.py", line 214, in displayMesh self.defineMeshActorsSet(xcSets,field,defFScale,nodeSize) File "/usr/local/lib/python2.7/dist-packages/postprocess/xcVtk/FE_model/vtk_FE_graphic.py", line 181, in defineMeshActorsSet if elemSet.color.Norm()==0: AttributeError: 'Truss' object has no attribute 'color' $

`

berndhahnebach commented 6 years ago

It will take some (a lot) of time until i will know some of the Python to create my own models ... But I will keep going

lcpt commented 6 years ago

thanks for your help. I still do not know which way to go to get geometry into xc. Thus I would like to play with xc and create some own geometry. Thus I wanted to understand how it works in workingModel.

I went a step back and used anas tutorial. See https://github.com/berndhahnebach/XCmodels/blob/655748bd487c8740c23f9b81f7185d76bcd873bc/xctutorial01/tut.py which runs great.

Will see if I am able to make the CalculiX cantilever example with one beam element out of it. See FreeCAD 3D FEM example on start wb for a model with 250 tet10.

Do you plan to use solid elements?

lcpt commented 6 years ago

I tried to display the mesh of the tutorial 1 but failed due to an error ... https://github.com/berndhahnebach/XCmodels/blob/bernd2/xctutorial01/tut01-comments.py#L78-L80

I got an error:

` $ python tut01-comments.py ('N = ', -10079.998306560286) Traceback (most recent call last): File "tut01-comments.py", line 80, in defDisplay.displayMesh(truss, fName= None, caption='Mesh', nodeSize=0.020, scaleConstr=0.30) File "/usr/local/lib/python2.7/dist-packages/postprocess/xcVtk/FE_model/vtk_FE_graphic.py", line 214, in displayMesh self.defineMeshActorsSet(xcSets,field,defFScale,nodeSize) File "/usr/local/lib/python2.7/dist-packages/postprocess/xcVtk/FE_model/vtk_FE_graphic.py", line 181, in defineMeshActorsSet if elemSet.color.Norm()==0: AttributeError: 'Truss' object has no attribute 'color' $

`

@Ana can you take a look?

lcpt commented 6 years ago

It will take some (a lot) of time until i will know some of the Python to create my own models ... But I will keep going

Is not so hard (IMHO), it's basically the "connect the dots game". Do you have a simple example with 1D and/or 2D elements?

anaiortega commented 6 years ago

Hi, The first argument to displayMesh must be a list of sets. You can create a set (even if it has only one element) by adding these lines:

trussSet=preprocessor.getSets.defSet('trussSet') trussSet.elements.append(truss) trussSet.fillDownwards() #add nodes to set

and after that display the mesh:

from postprocess.xcVtk.FE_model import vtk_FE_graphic defDisplay= vtk_FE_graphic.RecordDefDisplayEF() defDisplay.displayMesh(xcSets=[trussSet],fName= None,caption='Mesh',nodeSize=0.020,scaleConstr=0.10)

Cheers, Ana

berndhahnebach commented 6 years ago

thanks, yeah it just setting togethet all the bits and pieces ...

this is what I would like as 1d model ... http://feacluster.com/CalculiX/ccx_2.13/doc/ccx/node7.html

berndhahnebach commented 6 years ago

The above example of CalculiX and FreeCAD FEM with all elements ... one example with 1D beams, one with 2D shells and one with 3D solids. Just because it the model I do start any FEM software with. Check FEM examples of FreeCAD at Startworkbench

lcpt commented 6 years ago

Hi.

I've created a xc_examples repository and I've written the Calculix example as a 1D model.

I hope that will help to explain the "normal" workflow when creating the mesh.

Cheers Luis.

lcpt commented 6 years ago

By the way I've grouped the parameters that define the camera position, orientation, etc. in a class named CameraParameters (there is a lot of simplification work to do :-( ). I've updated the routines in this repository so, normally there's no harm done ;-)