Selecting surfaces in a set for cgx


I have recently discovered the great software that is CalculiX and have been following rsmith’s excellent tutorial series on using CalculiX for FE analysis on a composite sandwich using solid elements.

I regularly need to analyze composite sandwich structures, so the series is really directly related to what I aim to do. It also helped me a lot understanding the workflow of using CalculixX, the interaction between cgx and ccx, etc.

I have been trying to build a sandwich in a slightly different manner, however, as that is more convenient for the type of things I want to do: create a cross section for the sandwich first, sweep it over a certain length and apply a load on one of the skins of the sandwich.

Most things seem to work, but I somehow cannot get a set created with the surfaces that form the appropriate skin. The issue seems to be somewhere here:

# topface
seta faces f all
rep faces
enq faces topface rec _ _ z3 0.1 a

I created an .fbd file and an .inp that directly reflects my approach for a simple example. I would appreciate any pointers to what I’m doing wrong here! Sorry if the answer is obvious, still learning…

Thanks, Ronald

The .FBD file:

valu L 500
valu W 500
valu H 100
valu t 10
valu z0 0
valu z1 t
valu z2 - H t
valu z3 H

# btm skin
pnt p0 0 0 z0
pnt p1 0 W z0
pnt p2 0 W z1
pnt p3 0 0 z1
line l0 p0 p1 20
line l1 p1 p2 4
line l2 p2 p3 20
line l3 p3 p0 4

seto surfbtm
  surf surfbtm l0 l1 l2 l3

seto swpbtm
 swep surfbtm swpbtm tra L 0 0 20

# core
pnt p4 0 0 z1
pnt p5 0 W z1
pnt p6 0 W z2
pnt p7 0 0 z2
line l4 p4 p5 20
line l5 p5 p6 10
line l6 p6 p7 20
line l7 p7 p4 10

seto surfcore
  surf surfcore l4 l5 l6 l7

seto swpcore
  swep surfcore swpcore tra L 0 0 20

# top skin
pnt p8 0 0 z2
pnt p9 0 W z2
pnt p10 0 W z3
pnt p11 0 0 z3

line l8 p8 p9 20
line l9 p9 p10 4
line l10 p10 p11 20
line l11 p11 p8 4

seto surftop
  surf surftop l8 l9 l10 l11

seto swptop
 swep surftop swptop tra L 0 0 20

# elements
elty all he20r
mesh all
neigh all 1e-5 abq tie

# supported nodes
seta nodes n all
enq nodes sup1 rec 0 _ z0 0.1 a
enq nodes sup2 rec L _ z0 0.1 a

# topface
seta faces f all
rep faces
enq faces topface rec _ _ z3 0.1 a

send all abq
send swpbtm abq nam
send swpcore abq nam
send swptop abq nam
send sup1 abq nam
send sup2 abq nam
send topface abq nam

And the .INP file:



*INCLUDE, INPUT=ties.sur

*INCLUDE, INPUT=neigh.con

*INCLUDE, INPUT=swptop.nam

*INCLUDE, INPUT=swpcore.nam

*INCLUDE, INPUT=swpbtm.nam

*INCLUDE, INPUT=sup1.nam

*INCLUDE, INPUT=sup2.nam

*INCLUDE, INPUT=topface.nam









** Loading 5kN/m2





According to the cgx manual, enq handles surfaces, but not faces.
And when using surfaces, it also captures the sides of the laminate, which is probably not wanted. :slight_smile:

I could make the selection work like this:

plot sa all

That showed me that the top surface is A00E. So:

seta topface s A00E
comp topface do
comp topface do

# To check:
plot f topface

alternatively, can be simplified by using neigh commands.

@rsmith Thanks a lot, I will have a look once I’m able to (away from computer now). I am unsure if this will scale well, however, since a typical cross section I am working with is more complex and is intended to be more parametric. The example I provided is quite simplified to demonstrate the issue.

Maybe I can filter nodes and construct a surface using a Python script or something. I will investigate.

@xyont, not sure if I follow. How can the neigh command be used for this?


Sorry i miss interpreting, it’s actually related to boundary conditions. So, a face ID’s better in use. Try eliminates using extrusion since it will lead unpredictable sometimes, i mean all entity (point,line, face and body) are explicitly predefined in part constructor.

I think @xyont’s point is that if you construct the surfaces from lines, you can assign them a name, so you don’t have to look up the automatically assigned names.

What I would say is;

  1. If you only want to be able to e.g. change the thickness but not generate new geometry before the faces you are interested in, then looking up the names with plot sa all is fine.
  2. However if you want to do things that might change the name of a surface (e.g. by generating new surfaces before it) then generating the surfaces from points and lines is a good strategy.

Writing a Python script for the second option would be a good idea.
It is possible to do calculations in cgx with valu, but it is kind of cumbersome. For anything more than a single binary operation Python (or another scripting language) would be preferable.

As an aside, the fact that both the preprocessor and the solver use domain specific languages is (in my opinion) actually a strength in this regard.
For example, my auto-orient program examines a generated all.msh and given set names and then generates new sets, orientations and solid sections based on the normal vectors of the elements in the named sets. I wrote it to correctly assign material properties to composite laminates that are not flat.

Personally though, I’m rather fond of extruding “sketches” and copying sets. It’s pretty similar to the workflow in most 3D CAD programs these days. So (1) is probably the workflow I use most.

If (in that case) I have to look up the name of a surface or body, then so be it. Unless I have to generate dozens of variants. Then I would probably script it.

thanks @rsmith for reporting the consistency of extrusion based on entity, specifically i’m working on mesh based and the problem still unsolved.

The goal would be to analyze a large range of designs automatically, so a manual step to obtain the correct surface name would be cumbersome.

I will try to construct the surface from lines and construct part of the geometry (the top skin) in another way. Not ideal probably, but I think I can make it work.

If that doesnt resolve it, I can try the scripting option (similar to the approach taken by @rsmith in huis Orient script) but that is somewhat more involved and would add another step in the whole model generation, which I find less elegant :slight_smile:

Sorry, can’t help you much with that. I’ve never worked with extruded unstructured meshes.

For a flat skin, swep ... tra will do the trick to make a laminate from the surface. If the surface is flat-ish (not flat but close) you can try to swep ... nor the surface set. Otherwise, copy points in the right directions and create new lines, surfaces and bodies.

Given the examples of the jet engine centrifugal compressor and turbine, I would say that almost any geometry can be generated and meshed with cgx. It might take some time though. :slight_smile:

Thanks for al the feedback. I made it work eventually by applying the load on the element surfaces. Not ideal (little bit tricky with the element face numbering), but results seem to be consistent and what I expected.