Meshing question

General discussion about TexGen.

Moderators: Martin, Developers

anndee108
Posts: 3
Joined: Thu Jul 05, 2007 2:43 pm

Meshing question

Post by anndee108 »

Hi Martin and other,
I am trying to visulize the mesh generated by texgen. Looks like it is a vtk file. What version of vtk should I use to visualize that mesh? I could not see the mesh clearly even with paraview. Are there any tricks?

My second and more important question is: Are you able to generate quadratic elements or are they going to be only linear elements?

Thanks
Deepak
Texas A&M University
Martin
Project Leader
Posts: 70
Joined: Wed Mar 28, 2007 9:05 am
Location: Nottingham
Contact:

Post by Martin »

You should be able to see the mesh with paraview, if you just open it up initially you will see a box shape. You can apply various filters to examine the mesh, for example the shrink elements filter allows you to see the elements clearly. Or extract edges filter is also good to get a wireframe representation of the mesh. You just need to experiment with different filters.

It would not be difficult to support quadratic elements, the simplest approach is just to create mid-side nodes that are half way between corner nodes. However this may be somewhat defeating the point of using quadratic elements. The mid-side nodes of elements lying on a yarn-matrix boundary should ideally be projected to the boundary. If this is a feature which is useful I will consider implementing it.

I would assume the most important part for you is to first be able to get the mesh into whatever analysis tool you are using so you can get some simulations running. I have already written some code to export to ABAQUS's file format, its will be in the next release however I have a few other things to do before releasing a new version. What analysis software are you using or intend to use?
Ross
Regular
Posts: 12
Joined: Wed Oct 31, 2007 4:57 pm
Location: College Station, TX

Mesh Issues

Post by Ross »

Hi Martin. I work with the same group as Deepak at Texas A&M and am working on this as well. Quadratic elements are essential to us as we deal almost exclusively with this sort of element due to concerns about accuracy. While we could simply calculate the mid-points of the linear element edges, this would eliminate one of the key advantages of quadratic elements – accurately representing curved surfaces (a point you alluded to in your response to Deepak). We would be extremely pleased with the ability to output curved-edge quadratic elements from a future version of TexGen.

As for the tools we use, right now we run analyses on ABAQUS as well as an in-house FEM code we have developed.

A few other questions about TexGen mesh generation:

1. Would it be possible to define the sort of element that is generated in the model. In our solid analyses we use predominantly 20 node hexahedron elements, although we could adapt the code to utilize quadratic tetrahedron elements if necessary. I don’t know anything about your algorithm for mesh generation so I wouldn’t have the foggiest idea how much harder it would be to implement different types of elements.

2. What sort of algorithm did you use for generating the mesh. I am beginning to look into some of the issues of mesh generation and would be interested to learn how TexGen goes about dealing with the difficulties in generating a valid mesh for a textile composite.
Ross McLendon
Graduate Researcher
Texas A&M University
anndee108
Posts: 3
Joined: Thu Jul 05, 2007 2:43 pm

Post by anndee108 »

To add on to Ross's list:
This is something about the current capability of Texgen V3.2:
How can we export a refine mesh of models generated by Texgen?
From Texgen interface when we click: File->Export->VolumeMesh
There is an option to specify seed size, but I am getting the same mesh even if I change seed size.
Thanks
Deepak, PhD candidate
Tecas A&M
Martin
Project Leader
Posts: 70
Joined: Wed Mar 28, 2007 9:05 am
Location: Nottingham
Contact:

Post by Martin »

Ok for quadratic elements, I will add support for that when I get round to it. I've submitted it as a feature request on sourceforge so I don't forget, in the future feel free to add feature requests directly:

http://sourceforge.net/tracker/?group_i ... tid=895443

1. Yes I know that hex elements are considered to yield more accurate results in FE analyses but I am not aware of any meshing algorithm capable of creating conforming hex-only meshes for general cases. The technique I used for meshing will only work with either tetrahedrons only or a hybrid of tetrahedron, wedge and pyramid elements. Basically I'd need to scrap the existing algorithm and start again if I wanted to generate a hex-only mesh. And I can't think of any way to generate hex-only meshes which work for geometries other than woven fabrics.

2. It's too complicated to explain in this forum, but I plan to write a paper on the technique in the future.

Just a note about TexGen 3.2.0, after releasing it I realised that the mesh generator doesn't always generate conforming meshes. I.e. although all of the nodes are shared between elements, some elements do not share the same faces. This results in discontinuities which may cause errors or poor results when used in an FE analysis. I have already fixed the problem, but as I haven't released a new version yet the only way to access the fix is by downloading the latest source code from SVN and compiling it yourself. Just thought you should know in case you are planning to run any simulations in the near future. In any case the fix will be in the new version which I hope to release within the next month.

Deepak,

Perhaps you have specified a seed size which is too large. The seed size represents the average element edge length. However the edge length will never be lower than that required to conform to the yarn-matrix boundaries. If you have a unit cell of say 2 x 2 then you might try a seed size of 0.2 for example, this should give you a fairly fine mesh. The more you reduce the seed size the finer your mesh gets. Don't overdo it though or the meshing may take a long time. Let me know if you still have trouble with it.
Ross
Regular
Posts: 12
Joined: Wed Oct 31, 2007 4:57 pm
Location: College Station, TX

Compiling TexGen

Post by Ross »

I am working on compiling the most recent code as Dr. Whitcomb (my professor) thinks he is noticing some of the face matching issues you mentioned.

I got Subversion to obtain all the sourcecode, ran C-Make on the Trunk directory, and after installing SWIG and wxWidgets (I already had Python 2.5 and VTK), I put together the VS Solution to build. On building, I run into two errors.

1st Error

fatal error LNK1104: cannot open file 'python25_d.lib'

2nd Error (repeats a number of times)

fatal error C1083: Cannot open include file: 'wx/wxprec.h': No such file or directory

As far as the 1st error goes, I just have the Python 2.5 release installed, so I don't have the debug library. I noticed some commented out code in PrecompiledHeaders.h in the TexGenGUI project that supposedly eliminates the need for this library. I assume that I can just uncomment that code to deal with this error because the debug library isn't actually required for TexGen to work.

With regards to the second error, I do have wxprec.h on my system. It is located at:
C:\wxWidgets-2.8.6\include\wx
With regards to my C-Make configuration settings, my wxWidgets directories are the following:
wxWidgets_LIB_DIR=C:/wxWidgets-2.8.6/lib
wxWidgets_ROOT_DIR=C:/wxWidgets-2.8.6
My gut tells me that anywhere I see a "wx\<filename.h>" in the code, it should actually be looking for "\include\wx\<filename.h>".

Any ideas on what I should adjust so that wxprec.h can be found? I apologize that my skill level in compiling larger-scale codes like this is lacking, to say the least, but it is making more sense with each program that I build from source.

Thanks

*EDIT* If there aren't easy solutions to these issues, don't worry about it. I don't want to take up too much of your time with questions on how to build TexGen from source.
Ross McLendon
Graduate Researcher
Texas A&M University
Martin
Project Leader
Posts: 70
Joined: Wed Mar 28, 2007 9:05 am
Location: Nottingham
Contact:

Post by Martin »

I'm glad you are taking the time to try and compile TexGen, as far as I know you are the first to do it from outside of our research group. I've been meaning to update the website with instructions on how to do it for some time. You seem to be making good progress without it though.
fatal error LNK1104: cannot open file 'python25_d.lib'
Yes, this is a bit of an odd one. If you download the python windows installer which I assume you have it doesn't contain the debug library (that's what the _d stands for). It only comes with the release library (python25.lib), so if you try to compile it in debug mode it won't work as you have found out. There are several options:

- Download the python source code and compile that yourself so that you have both the debug and release libraries (which is in fact what I ended up doing). This is the best solution but will take some time to do.

- If you don't want to do that you can link the release version of the python library into your debug build. Normally its not a good idea to mix debug and release builds together but I think in this case it was working ok for me. So you can uncomment the hack that you saw in the PrecompiledHeaders.h file.

- Finally if you are not interested in debugging TexGen then you can just stick to compiling the release build and you shouldn't have any trouble with that.
fatal error C1083: Cannot open include file: 'wx/wxprec.h': No such file or directory
That is strange, my CMake is set up like this:

wxWidgets_LIB_DIR=C:/wxWidgets-2.8.3/lib/vc_lib
wxWidgets_ROOT_DIR=C:/wxWidgets-2.8.3

Note: the lib director is different, but that can't be the problem because you are having trouble at the compiling stage not the linking stage.

Could you check what directories are set up in MSVC? From the solution explorer if you right click on TexGenGUI -> Properties, then on the left go to Configuration Properties -> C/C++ -> General and look for "Additional Include Directories" on the right you should look to see if you see something like this "C:\wxWidgets-2.8.3\include" in the list.

If it's not there, then that means there was some problem with the way CMake set up project. What version of CMake do you have? I am using CMake version 2.4 patch 6. You may well have trouble if you are using an older version than this. Newer versions shouldn't be a problem.
Martin
Project Leader
Posts: 70
Joined: Wed Mar 28, 2007 9:05 am
Location: Nottingham
Contact:

Post by Martin »

Ok well it seems Jon has been having the same exact problems. Jon has been updating the website yesterday and today with the information on how to compile TexGen using MSVC++ as he goes through the process himself. I'm not sure if you have been following these instructions or not. I assumed you hadn't because he was literally in the middle of doing it as I read your message.

I think we've sorted out the problems though and the website is being updated to reflect this. I'll get back to you once he's finished.
joncrookston
Expert User
Posts: 27
Joined: Wed Apr 11, 2007 4:03 pm
Location: Nottingham, UK

Post by joncrookston »

Hi Ross,

As Martin says, I have been writing up the Windows install procedure. It's now live on the wiki. Hopefully if anyone has problems with it they can post back to let me know. Your problem with 'wx/wxprec.h' may be caused by not compiling wxWidgets from source, or perhaps because of the need to update the file 'findwxWidgets.cmake'. Both of these are now explained in the compilation instructions.

Please let us know how you get on.

Thanks,
Jon.
Martin
Project Leader
Posts: 70
Joined: Wed Mar 28, 2007 9:05 am
Location: Nottingham
Contact:

Post by Martin »

anndee108 wrote:There is an option to specify seed size, but I am getting the same mesh even if I change seed size.
I just discovered a bug which causes seed sizes below 0.0447 to be ignored. I'm not sure if this is the issue you were/are having but it will be fixed in the next version.
Martin
Project Leader
Posts: 70
Joined: Wed Mar 28, 2007 9:05 am
Location: Nottingham
Contact:

Post by Martin »

I have just release a new version of TexGen which now has Quadratic element support, ABAQUS export, fixes the bug with the seed size and problems with mismatching faces.

As a bit of an oversight, there is no GUI option to select quadratic elements when you export. However you can still use this feature with the python console by typing the following:

Code: Select all

mesher = CMesher()
mesher.SetSeed(1)
mesher.SetMergeTolerance(0.001)
mesher.SetQuadratic(True)
mesher.CreateMesh(r'2DWeave(W:2,H:2)')
mesher.SaveVolumeMeshToVTK(r'C:\test.vtu')
and to save to ABAQUS replace the last line with:

Code: Select all

mesher.SaveVolumeMeshToABAQUS(r'C:\test')
Alternatively you can put the code into a python script and run it by clicking on Python -> Run script...

However I should warn that in my preliminary tests, exporting quadratic meshes to ABAQUS resulted in some errors saying that some elements have close to zero volume. These elements occur on the boundary between the yarn and matrix, having viewed the elements that gave errors/warnings in ABAQUS I can see that the elements are indeed of quite bad quality. This issue will need some more time to resolve, perhaps the best course of action is to attempt to improve the quality of the mesh using mesh optimisation techniques such as described in the following paper:

http://www.math.ualberta.ca/ijnam/Volum ... ial/08.pdf

I was however unable to find any libraries capable of doing these kinds of optimisations, if anybody knows of any please let me know.
Ross
Regular
Posts: 12
Joined: Wed Oct 31, 2007 4:57 pm
Location: College Station, TX

Post by Ross »

Glad to have the new release. I will spend some time over the next few days shaking things out some and will definitely post back here if I notice any issues with mesh generation. I'm also very excited to see that quad elements are implemented!

-Ross
Ross McLendon
Graduate Researcher
Texas A&M University
Ross
Regular
Posts: 12
Joined: Wed Oct 31, 2007 4:57 pm
Location: College Station, TX

A Few Questions regarding Mesh File Output

Post by Ross »

I have TexGen generating Mesh files (.vtu files) just fine, and the matching faces issues seem to be resolved as well as the quadratic tetrahedral elements issue. I have a few questions about some of the data contained in the output file.

What is the significance of the following CellData members:
RegionIndex
Layer (I would not expect values 0-4 for a plain weave)
Location
VolumeFraction (Does this mean that this data can be input into the model at the TexGen level)
SurfaceDistance

Also, how well can the mesh generator handle the situation where you have a tow interfacing another tow over a large surface? In other words - does the algorithm depend on the presence of matrix between the tows in order to work?

I am going to make another post in a different thread as it would be off-topic here. We are pretty excited about the potential uses of TexGen now that it seems to be outputting valid meshes.

Regards,
Ross
Ross McLendon
Graduate Researcher
Texas A&M University
Ross
Regular
Posts: 12
Joined: Wed Oct 31, 2007 4:57 pm
Location: College Station, TX

Post by Ross »

One other question I had with regard to YarnTangent.

What tangent does this signify? Is it a value at the center of the element?
When we deal with orientation data for a textile tow, we consider the orientation at all of the nodes of the element (each node has an x,y,and z rotation, meaning that a 10 node element would have 30 pieces of orientation data). I can probably interpolate this data for each node, but I need to know what the data contained in YarnTangent represents.


Thanks for the help.
Ross McLendon
Graduate Researcher
Texas A&M University
Martin
Project Leader
Posts: 70
Joined: Wed Mar 28, 2007 9:05 am
Location: Nottingham
Contact:

Post by Martin »

Again sorry for my slow reply...

RegionIndex and Layer aren't really of much physical significance. They are just artefacts of the way the mesh was created. I am writing a paper at the moment which will probably make it more clear as to where they came form. But if you just look at the contours in VTK you might get an idea of what they correspond to.

Location is the coordinates of the element relative to the center-line of the element. I.e. elements at the center of the yarn have coordinates (0,0). Elements at the side edges will have coordinates (width/2, 0), (-width/2, 0) and elements at the top and bottom edges (0, height/2), (0, -height/2). I'm not sure why this might be useful, but the information is obtained again as an artefact of some of the routines in TexGen so why not make it available for people to use. You may find that you want to assign different material properties at the edges of the yarns than in the centre.

Surface distance is similar to location, it gives an idea of how far the element is below the surface of the yarn. Only relevant for elements within the yarns.

As you guessed it, yes you can specify Volume fraction within TexGen. Volume fraction of elements within a yarn will vary with cross-section area changes.

>>Also, how well can the mesh generator handle the situation where you have a tow interfacing another tow over a large surface? In other words - does the algorithm depend on the presence of matrix between the tows in order to work?

It doesn't really matter. If the gap between yarns is very small (below a given tolerance) the gap will be removed and you will no longer have resin elements between these two surfaces. The tolerance can be specified manually.

>>What tangent does this signify? Is it a value at the center of the element?

Yes it is the value at the centre of the element. For details on how this is calculated please have a look at my thesis:

http://etheses.nottingham.ac.uk/archive ... -final.pdf

Section "2.11.2 Yarn intersections"

If you need tangents at the nodes rather than at the centre of the element I can do that too. The only trouble comes when the same node is shared by two elements in different yarns. For example where they are crossing. Then the node should in fact have two different tangents, this is why I thought it best to attach that data to the element rather than the node.
Post Reply