Solver for Mystran

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Solver for Mystran

Post by bernd »

I am investigating Mystran and pyNastran ... I have started to play with this in FreeCAD. Do you know how to write the pyNastran Python code to create bdf for this example https://github.com/SteveDoyle2/pyNastra ... enmdao.bdf ?

cheers bernd
aerospaceweeb
Posts: 118
Joined: Fri Apr 09, 2021 3:26 am

Re: hfcMYSTRAN - a test case

Post by aerospaceweeb »

I bothered Steve on Discord and he said this

```
I don't really understand his question...it's a square plate with quads. He's working on a preprocessor? If so then he just needs to take that mesh and write GRID and CQUAD4s using some data structure. If it's a post-processor, than you need a reader for that format.

There's varioius methods like add_grid, and_cquad4, add_force, etc. that you can use if you want to skip the whole formatting thing
then call the write_bdf at the end

totally depends on what your data structures are though
```

Personally I don't think that model was "made" in pynastran. It's just a flat plate, really, and it seems like the built in tools in freeCAD.FEM already have most of these
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: hfcMYSTRAN - a test case

Post by bernd »

I choose this for my first example to play with. Having the pyNastran code for it would just have save me some time. There are no really any examples of a whole modell created by pyNastran around, only snippets. At least I did not found some.

Eventually I have been lazy reading the documentation. I wanted wo play with an example. I do neither know bdf nor pyNastran code. ATM I do not know how big the load is. Is it a edge or node load. How thick is the plate? All easy to find if you would know the code. For Z88, Elmer, Calculix and OOFEM I would have known it in seconds. For Nastran ATM it will take some time ...

Sorry for the noise ...

BTW:
I am not working on a preprocessor. I have started to play with Mystran and pyNastran for an hour or two. That is all I have done ATM. I am not even a beginner. I am a nobody, nothing in the regard of Mystran.
aerospaceweeb
Posts: 118
Joined: Fri Apr 09, 2021 3:26 am

Re: hfcMYSTRAN - a test case

Post by aerospaceweeb »

OHHH I absolutely understand. Keep on asking questions we love to explain this stuff!

Well in that case I'll start off where I was taught.

Nastran, unlike nearly all other codes like it, was designed to be used long before the ability to visualize a mesh. Its bulk data format, the ascii based file used to create the runs of the data, is more readable than others like abaqus or ansys. This is not actually always a good thing. Abaqus can have input files that are split up into sets by default, and are smaller, making them easier for computers to read. Nastran can have sets too, but it's a bit more complicated, because each card can sometimes be two lines long rather than one, because you can't have lines longer than 72 characters in the original versions of fortran, which nastran was developed alongside.

Mystran is a clone of Nastrans most commonly used solutions, but written in far more modern and easy to understand fortran code. Nastrans syntax is the easiest that still exists. It's the first proper finite element software, used for aerospace applications, in many ways. It dates back all the way to the early 70s.

Comments in the mystran/nastran input start with a $
The default format for input data is a fixed width 8 character input, but you can switch it to 16 character fields with an asterisk after the first word on a line, or you could just delimit it with commas. This is too complicated for now.

Lines that start with "C" are elements
Lines that start with "P" are properties

There are two primitive shell elements. CTRIA3 and CQUAD4. Cards are always defined by the first 8 characters on a line.
In this case, it could be this.

Code: Select all

$ MAT1 is a material card that is isotropic.
$ The material, with an ID of 201, has a youngs modulus of 29.0E6, poisson=0.29 and density=0.29
MAT1     201     29.E6           0.29    0.29
$----------------------------------------------------------------------------------------
$234567><234567><234567><234567><234567><234567><234567><234567><234567><234567>
$----------------------------------------------------------------------------------------
$ PSHELL is a property card for a shell element
$ The property, with an ID of 301, is made of material #201, and is 0.1 units thick.
PSHELL   301     201     0.1
$234567><234567><234567><234567><234567><234567><234567><234567><234567><234567>
$ This is the grid entry. This is how nodes are defined in nastran and mystran
$ Node number 101 is defined in coordinate system 0, which is the global, default coordinate system. Its location is at (0.0, 0.0, 0.0)
GRID     101     0       0.0     0.0     0.0
GRID     102     0       1.0     0.0     0.0
GRID     103     0       1.0     1.0     0.0
GRID     103     0       0.0     1.0     0.0
$234567><234567><234567><234567><234567><234567><234567><234567><234567><234567>
$ Element number 401 is a CQUAD4 element. It uses property #301, and is made of nodes 101, 102, 103, and 104.
$ The normal vector for this shell element 
CQUAD4   401     301     101     102     103     104
$ The normal vector for the shell element comes from the right hand rule of the node order.
$ if V1 goes from node 101 to node 102, and
$ if V2 goes from node 102 to node 103,
$ Then the normal vector of the quad element is V1 X V2
Mystrans documentation is very similar to nastrans, much like how Calculix'es is very similar to abaqus.
Here's a pretty good online NX nastran documentation.
http://www2.me.rochester.edu/courses/ME ... 6:id507676

Mystran is way, way, way simpler than Calculix, Abaqus, and Nastran, though.
Mystran has maybe 2 dozen elements, a dozen properties, half a dozen material cards, half a dozen ways to apply loads, and two or three solutions.
Its power comes from its simplicity.

PS: I think I can make a few simple preprocessors with the freeCAD tools you've already created. I'm playing with it now, and if I have any luck I'll let you know.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: hfcMYSTRAN - a test case

Post by bernd »

ATM I only need to understand the plate one. It is the one I have started with. https://github.com/SteveDoyle2/pyNastra ... dels/plate

- the grid is no problem. I already understood this one.
- thickness is 0.3 mm
- material: Poisons Ratio is 0.3, Young's Modulus is 70'000'000.0 ??? which leads to the question Which unit has the file
- lengths is in mm, how about force and young's modulus?

- For the load ... there is "load", "force" and "pload" ... I have not read these yet ...
- IMHO it is not an edge load because the end points are moving more. I assume it is the same node load on each mesh node on the edge, thus the outer nodes moves more. OK I need to read the card docu ...

bernd
aerospaceweeb
Posts: 118
Joined: Fri Apr 09, 2021 3:26 am

Re: hfcMYSTRAN - a test case

Post by aerospaceweeb »

Let me give one of the simplest explanations I can think of.
A nastran deck is split up into many sections.
... know what gimme a sec

Okay forgot to hit submit here you go lol

Code: Select all

$ Problem Illustration
$---------------------
$ Four Fasteners bolt a plate down
$ Get Assume a load if applied, parralel to the plane, but offset from it.
$ Get the reaction loads on the fasteners, assuming a rigid load distribution.
$
$   -------------
$   | X       X |   ^ Y
$   |           |   |
$   |           |   |
$   |           |    ---> X
$   | X       X |
$   -------------
$          
$             Rigid Element             
$               |-------|  
$                         | <-- Load applied
$         |>X--X----\     |
$        /     |     --\  V    ^ Y    
$   fixed      |        --x    |     
$   nodes      |     --/       |    Z
$        \|>X--X----/           --->
$             \
$              -- Springs representing the fasteners
$
$
$ Or, in more clear terms, with node IDs,
$ for two of the fasteners,
$
$                          |
$         |>31--3----\     |
$        /      |     --\  V    ^ Y    
$   fixed       |        --5    |     
$   nodes       |     --/       |    Z
$        \|>11--1----/           --->
$
$
$          -------------
$          | 3       4 |        ^ Y    
$          |           |        |     
$          |     5     |        |    X
$          |           |         --->
$          | 1       2 |
$          -------------
$------------------------------------------------
$------- Executive Control Section --------------
$------------------------------------------------
ID Rbody Test
SOL 1
$ CEND == This is the end of the executive control section
CEND

$------------------------------------------------
$---------- Case Control Section ----------------
$------------------------------------------------
TITLE = Rbody Test
SUBTITLE = Rbody Test
$ Nastran allows for infinite subcases to be run per model,
$ unlike abaqus or calculix which more easily interpret "steps" of
$ a nonlinear analysis than "subcases" or "loadcases" of many different linear
$ combinations of loads.
SUBCASE 1
    LOAD  = 17
    SPC = 2
    GPFORCE(PRINT)  = ALL
$ For subcase 1,
$ run load in loadset #17,
$ run the single point constrains in single point constraint set #2
$ print out all of the gridpoint force data

BEGIN BULK
$------------------------------------------------
$------------ Bulk Data Section -----------------
$------------------------------------------------
GRID    1                0.0     0.0     0.0             
GRID    11               0.0     0.0    -0.01
GRID    2                1.0     0.0     0.0
GRID    21               1.0     0.0    -0.01
GRID    3                0.0     1.0     0.0             
GRID    31               0.0     1.0    -0.01
GRID    4                1.0     1.0     0.0             
GRID    41               1.0     1.0    -0.01
GRID    5                0.5     0.5     1.0

$ Element 101 is a rigid boundary element of type 2
$ Place your central node at node 5, and constrain nodes
$ 1, 2, 3, and 4 to node 5, by all six degrees of freedom.
RBE2     101     5       123456  1       2       3       4      

$ Element 102 is a general purpose spring element
$ It has property #201, and attaches node 11 to node 1
$ The plane perpendicular to the axial stiffness is defined by a vector
$ <0.0, 1,0, 0.0>
CBUSH    102     201     11      1       0.0     1.0     0.0
CBUSH    103     201     21      2       0.0     1.0     0.0
CBUSH    104     201     31      3       0.0     1.0     0.0
CBUSH    105     201     41      4       0.0     1.0     0.0

$ Property 201 is a general purpose spring element property
$ Give stiffness of 1.0E9 in all directions: 3 translations and 3 rotations.
PBUSH    201     K       1.0E9   1.0E9   1.0E9   1.0E9   1.0E9   1.0E9  

$ Create a constraint set of ID 1
$ in constaint set of ID 1, constrian nodes 11, 21, 31, and 41 in 
$ the three translational degrees of freedom
SPC1     1       123     11      21      31      41

$ Create a constraint set of ID 2
$ Add constraint set of ID 1 to the constraint set of ID 2
SPCADD   2       1

$ Apply a force to loadset number 17
$ Apply this force to node ID 5
$ Defined this force in coordinate system 0, which is the default, 
$ global coordinate system
$ Give Scale the force vector by a factor of 1.0
$ Make the force vector be <0.0, 0.0, -1.0>
$ This should apply a force of 0.25 in compression to every bar element
FORCE    17      5       0        1.0     0.0    0.0     -1.0

ENDDATA
aerospaceweeb
Posts: 118
Joined: Fri Apr 09, 2021 3:26 am

Re: hfcMYSTRAN - a test case

Post by aerospaceweeb »

bernd wrote: Sun Jul 18, 2021 8:34 pm ATM I only need to understand the plate one. It is the one I have started with. https://github.com/SteveDoyle2/pyNastra ... dels/plate

- the grid is no problem. I already understood this one.
- thickness is 0.3 mm
- material: Poisons Ratio is 0.3, Young's Modulus is 70'000'000.0 ??? which leads to the question Which unit has the file
- lengths is in mm, how about force and young's modulus?

- For the load ... there is "load", "force" and "pload" ... I have not read these yet ...
- IMHO it is not an edge load because the end points are moving more. I assume it is the same node load on each mesh node on the edge, thus the outer nodes moves more. OK I need to read the card docu ...

bernd
The units of nastran are actually dimensionless. For example, if your material has E defined in N/m^2, then your forces would be in N and your distances in m.

Nastran, Steve, and I are all American, so the units you'll see in our bdfs is usually inches and pounds, except for modal solutions, then american units REALLY start to get annoying.
User avatar
johnwang
Veteran
Posts: 1345
Joined: Sun Jan 27, 2019 12:41 am

Re: hfcMYSTRAN - a test case

Post by johnwang »

bernd wrote: Sun Jul 18, 2021 5:37 pm I am investigating Mystran and pyNastran ...
You can call pyNastran within FreeCAD.
When I started, I played with pyNastran to read case file. A few models from it which I read are posted in this thread.But the bdf is a little different from Nastran95's inp and Mystran's dat. Instead of learning pyNastran, I started to write my own for hfcMystran and hfcNastran.
Only recently, I began to play with writing case file. I haven't tested pyNastran's writing functions. I am using Fortran. The Hinge. dat and Bridge. dat are two examples.Direct coding, no CAD. But I have an OpenGL program which I can read a case file and show the model. I will add simple sketch tools to connect these two.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: hfcMYSTRAN - a test case

Post by bernd »

aerospaceweeb wrote: Sun Jul 18, 2021 8:42 pm The units of nastran are actually dimensionless. For example, if your material has E defined in N/m^2, then your forces would be in N and your distances in m.
Great, same as all other FEM solver I know off are ...
aerospaceweeb
Posts: 118
Joined: Fri Apr 09, 2021 3:26 am

Re: hfcMYSTRAN - a test case

Post by aerospaceweeb »

bernd wrote: Sun Jul 18, 2021 8:47 pm
Great, same as all other FEM solver I know off are ...
[/quote]

Indeed.
Post Reply