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:

Re: Solver for Mystran

Post by bernd »

johnwang wrote: Sun Aug 01, 2021 11:31 am I never worked out how the starterkit functioning.
took me some time too, but once you undersood it it is great, since FreeCAD code is seaparted from none FreeCAD code and it can be installed with pip :D Best to have a look at the examples like trails, gears or glider wb.
User avatar
johnwang
Veteran
Posts: 1345
Joined: Sun Jan 27, 2019 12:41 am

Re: Solver for Mystran

Post by johnwang »

bernd wrote: Sun Aug 01, 2021 12:18 pm Without any FreeCAD related code?
one neu2femResult.
Probably will not make neu python viewer. Too much work.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
aerospaceweeb
Posts: 118
Joined: Fri Apr 09, 2021 3:26 am

Re: Solver for Mystran

Post by aerospaceweeb »

@Bernd
@JohnWang

There's a chance that our neutral file format is a bit out of date, according to one of our devs.
Is there any chance I could help you parse one of the other textual file formats, @JohnWang, in the meantime?

I'm sure that our Neutral files are consistent, but we may want to modernize it soon.

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

Re: Solver for Mystran

Post by bernd »

aerospaceweeb wrote: Tue Aug 03, 2021 3:59 am @Bernd
@JohnWang

There's a chance that our neutral file format is a bit out of date, according to one of our devs.
Is there any chance I could help you parse one of the other textual file formats, @JohnWang, in the meantime?

I'm sure that our Neutral files are consistent, but we may want to modernize it soon.

- Aero
my idea is either have a internal reader or use pyNastran ... only than we could set up unit tests. History has shown without unit tests code will break on one day ...

https://github.com/SteveDoyle2/pyNastran/issues/651 ... but I just did not have the time to test so far ... later we could even use pyNastran to create a real FreeCAD FEM result object.
mesheb82
Posts: 9
Joined: Tue Jul 27, 2021 4:18 am

Re: Solver for Mystran

Post by mesheb82 »

bernd wrote: Sat Jul 31, 2021 4:14 pm The initial version of Mystran solver in in FreeCAD master. https://github.com/FreeCAD/FreeCAD/comp ... 01ec949525 It needs pyNastran to write the solver input. The pyNastran code used to create the bdf file is written too.

Start FreeCAD switch to FEM use Utilities Gui. Mystran hast a few examples already. They give correct results for me. Would be cool if some of you would give it a try and give some feedback about the generated pyNastran code. As you know I am still a newbie to pyNastran.
I'm not setup for building FreeCAD on Windows (I'm getting a cmake error that it can't find vtk despite setting FREECAD_LIBPACK_DIR). Is there a way to download your updates and be able to load models/modify the python code without building?

I assume I also need to run

Code: Select all

FreeCAD-asm3-Daily-Win64-Py3-Qt5-20210717/bin python -m pip install pyNastran 
. Is that right?
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Solver for Mystran

Post by bernd »

mesheb82 wrote: Tue Aug 03, 2021 6:27 pm I assume I also need to run

Code: Select all

FreeCAD-asm3-Daily-Win64-Py3-Qt5-20210717/bin python -m pip install pyNastran 
. Is that right?
ATM yes, hopefully this will be included soon.


bernd wrote: Sat Jul 31, 2021 4:14 pm Is there a way to download your updates and be able to load models/modify the python code without building?
sure the way I do it on windows ... I am not able to build FreeCAD on Windwos either. :o I only build on Linux.

Get latest dev version from here: https://github.com/FreeCAD/FreeCAD-Bund ... kly-builds get the latest master FreeCAD source and replace the Fem or your sources. https://github.com/FreeCAD/FreeCAD/tree ... rc/Mod/Fem Do not copy Gui or App it contains cpp code. Cmake and dox files are not needed either. You can delete all files before your Fem exept the resources. Your need to keep the resources directory.

The only missing thing is the tool to add a new solver and the preferences page. Use preferences editor to create a new preference for mystran. Look at gmsh how does it look like.

The simplest way to get a solve is to use FEM examples gui and set up some mystran examples and copy the solver from there. If you encounter problems keep asking.

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

Re: Solver for Mystran

Post by bernd »

I have Mystran solver errors on beam analysis just because I changed cross section geometry ... Could some of the Mystran cracks around help. https://www.mystran.com/forums/showthre ... 268#pid268
aerospaceweeb
Posts: 118
Joined: Fri Apr 09, 2021 3:26 am

Re: Solver for Mystran

Post by aerospaceweeb »

Yes it does support PBARLs.

I'll look in a moment.
aerospaceweeb
Posts: 118
Joined: Fri Apr 09, 2021 3:26 am

Re: Solver for Mystran

Post by aerospaceweeb »

Okay. Here's what I know right now. I know that the best test case for this isn't that shape.

Here's a simple test case.
We_See_Bars.PNG
We_See_Bars.PNG (70.27 KiB) Viewed 2201 times
Cantilever beam, hand calculation, nothing too complicated.
20 inches long. 1 inch tall. 1 inch wide. Made of steel, that has a youngs modulus of 29.0E6, with a poisson ratio of 0.29.

I predict it should deflect by 1.1 inches, and have a stress of 120,000 psi.
Here's the spreadsheet.
See_____Bars.xlsx
(35.13 KiB) Downloaded 39 times
Thankfully, we appear to be right. Linear beam bending still works! Hooray!
Phew.PNG
Phew.PNG (21.64 KiB) Viewed 2201 times
Nothing appears to be "wrong" with mystran... I think... but let's see what's going on with that solver deck.

Give us another moment.
Here's the bdf file I ran, but without the comments.

Code: Select all

SOL 101
CEND
ECHO = NONE
SUBCASE 1
  DISPLACEMENT = ALL
  LOAD = 1
  SPC = 2
  STRESS = ALL
  SUBTITLE = HAND_CALC_CHECK
PARAM,DELBAN,1
BEGIN BULK
$GRID,ID,CoordSys,X,Y,Z,,,
GRID,1,0,0.0,0.0,0.0,,,
GRID,2,0,20.0,0.0,0.0,,,
CBAR,1,1,1,2,0.0,1.0,0.0,
PBARL,1,1,,BAR,,,,
,1.0,1.0,,,,,,
MAT1,1,29.0E6,,0.29,0.29,,,
SPCADD,2,1,,,,,,
SPC1,1,123456,1,,,,,
LOAD,1,1.0,1.0,2,,,,
FORCE,2,2,0,1000.0,0.0,1.0,0.0,
ENDDATA
And here's the full F06 output file.

Code: Select all

   803212924

 MYSTRAN Version 12.2a    Apr 26 2021 MYSTRAN developed by Dr Bill Case
*** Please report any problems to the author at dbcase29@gmail.com ***                                                                                                                                                                                          

 >> MYSTRAN BEGIN  :  8/ 3/2021 at 21:29:24.971 The input file is Rundeck.bdf                                                                                                                                                                                                                                                     


 >> LINK  0 BEGIN


SOL 101                                                                                                                                                                                                                                                         
CEND                                                                                                                                                                                                                                                            
ECHO = NONE                                                                                                                                                                                                                                                     
SUBCASE 1                                                                                                                                                                                                                                                       
  DISPLACEMENT = ALL                                                                                                                                                                                                                                            
  LOAD = 1                                                                                                                                                                                                                                                      
  SPC = 2                                                                                                                                                                                                                                                       
  STRESS = ALL                                                                                                                                                                                                                                                  
  SUBTITLE = HAND_CALC_CHECK                                                                                                                                                                                                                                    
PARAM,DELBAN,1                                                                                                                                                                                                                                                  
BEGIN BULK                                                                                                                                                                                                                                                      
 *INFORMATION: MAT1 ENTRY        1 HAD FIELD FOR G  BLANK. MYSTRAN CALCULATED G  =  1.124031E+07



 *WARNING    : BANDIT DID NOT RUN SUCCESSFULLY. IT QUIT WITH ERROR =        6
               CHECK FILE BANDIT.OUT IN THE DIRECTORY WHERE MYSTRAN.EXE RESIDES
               SINCE FIELD 4 OF PARAM GRIDSEQ = N, MYSTRAN WILL DEFAULT TO GRID SEQUENCING BASED ON GRID NUMERICAL ORDER.
               (THIS WAS EITHER ENTERED ON A BULK DATA PARAM GRIDSEQ ENTRY OR IS THE DEFAULT. SEE MYSTRAN DOCUMENTATION)



       O U T P U T   F R O M   T H E   G R I D   P O I N T   W E I G H T   G E N E R A T O R   F O R   O V E R A L L   M O D E L
                                             (reference point is basic coord system origin)

                                                      Total mass =  5.800000E+00

                                                             X             Y             Z
                                       C.G. location :  1.000000E+01  0.000000E+00  0.000000E+00
                                        (relative to reference point in basic coordinate system)


                             6x6 Rigid body mass matrix - about reference point in basic coordinate system
                      ***                                                                                     ***
                      *  5.800000E+00  0.000000E+00  0.000000E+00  *  0.000000E+00  0.000000E+00 -0.000000E+00  *
                      *  0.000000E+00  5.800000E+00  0.000000E+00  * -0.000000E+00  0.000000E+00  5.800000E+01  *
                      *  0.000000E+00  0.000000E+00  5.800000E+00  *  0.000000E+00 -5.800000E+01  0.000000E+00  *
                      *  ************  ************  ************  *  ************  ************  ************  *
                      *  0.000000E+00  0.000000E+00  0.000000E+00  *  0.000000E+00  0.000000E+00  0.000000E+00  *
                      *  0.000000E+00  0.000000E+00  0.000000E+00  *  0.000000E+00  1.160000E+03  0.000000E+00  *
                      *  0.000000E+00  0.000000E+00  0.000000E+00  *  0.000000E+00  0.000000E+00  1.160000E+03  *
                      ***                                                                                     ***


                                    M.O.I. matrix - about reference point in basic coordinate system
                                             ***                                        ***
                                             *  0.000000E+00  0.000000E+00  0.000000E+00  *
                                             *  0.000000E+00  1.160000E+03  0.000000E+00  *
                                             *  0.000000E+00  0.000000E+00  1.160000E+03  *
                                             ***                                        ***


                                  M.O.I. matrix - about above c.g. location in basic coordinate system
                                             ***                                        ***
                                             *  0.000000E+00  0.000000E+00  0.000000E+00  *
                                             *  0.000000E+00  5.800000E+02  0.000000E+00  *
                                             *  0.000000E+00  0.000000E+00  5.800000E+02  *
                                             ***                                        ***


                                     M.O.I. matrix - about above c.g. location in principal directions
                                             ***                                        ***
                                             *  0.000000E+00  0.000000E+00  0.000000E+00  *
                                             *  0.000000E+00  5.800000E+02  0.000000E+00  *
                                             *  0.000000E+00  0.000000E+00  5.800000E+02  *
                                             ***                                        ***


                                     Transformation from basic coordinates to principal directions
                                             ***                                        ***
                                             *  1.000000E+00  0.000000E+00  0.000000E+00  *
                                             * -0.000000E+00  1.000000E+00  0.000000E+00  *
                                             *  0.000000E+00  0.000000E+00  1.000000E+00  *
                                             ***                                        ***



 >> LINK  0 END


 >> LINK  1 BEGIN

               DEALLOCATED  2.30E-03 MB MEMORY FROM ARRAY STF3

               DEALLOCATED  4.80E-05 MB MEMORY FROM ARRAY STFKEY
               DEALLOCATED  2.30E-03 MB MEMORY FROM ARRAY STF3

 >> LINK  1 END


 >> LINK  2 BEGIN




 *INFORMATION: AUTOSPC Summary, Overall: after identification of all AUTOSPC's                                                               

                                     AUTOSPC_RAT = 1.000000E-06

                       Number of DOF's identified for AUTOSPC in component  1         =            0
                       Number of DOF's identified for AUTOSPC in component  2         =            0
                       Number of DOF's identified for AUTOSPC in component  3         =            0
                       Number of DOF's identified for AUTOSPC in component  4         =            0
                       Number of DOF's identified for AUTOSPC in component  5         =            0
                       Number of DOF's identified for AUTOSPC in component  6         =            0
                                                                                        ------------
                       Total number of DOF's identified overall                       =            0


 >> LINK  2 END


 >> LINK  3 BEGIN

 SUPERLU FACTORIZATION OF MATRIX KLL SUCCEEDED IN SUBR SYM_MAT_DECOMP_SUPRLU          

 SUPERLU SPARSE SOLVER SUCCESSFUL FOR CASE        1 IN SUBR FBS_SUPRLU
 *INFORMATION: FOR INTERNAL SUBCASE NUMBER        1 EPSILON ERROR ESTIMATE            =  0.000000E+00 Based on U'*(K*U - P)/(U'*P)


 >> LINK  3 END


 >> LINK  5 BEGIN


 >> LINK  5 END


 >> LINK  9 BEGIN



 OUTPUT FOR SUBCASE        1
 HAND_CALC_CHECK                                                                                                                                                                                                                                                 

                                                       D I S P L A C E M E N T S
                                              (in global coordinate system at each grid)
           GRID     COORD      T1            T2            T3            R1            R2            R3
                     SYS
              1        0  0.0           0.0           0.0           0.0           0.0           0.0         
              2        0  0.0           1.105583E+00  0.0           0.0           0.0           8.275862E-02


 OUTPUT FOR SUBCASE        1
 HAND_CALC_CHECK                                                                                                                                                                                                                                                 

             E L E M E N T   S T R E S S E S   I N   L O C A L   E L E M E N T   C O O R D I N A T E   S Y S T E M
                                          F O R   E L E M E N T   T Y P E   B A R      
  Element      SA1           SA2           SA3           SA4          Axial         SA-Max        SA-Min      M.S.-T
     ID        SB1           SB2           SB3           SB4          Stress        SB-Max        SB-Min      M.S.-C

        1 -1.200000E+05  1.200000E+05  1.200000E+05 -1.200000E+05  0.0           1.200000E+05 -1.200000E+05                          
           2.910383E-11 -2.910383E-11 -2.910383E-11  2.910383E-11                2.910383E-11 -2.910383E-11                          
          ------------- ------------- ------------- ------------- ------------- ------------- ------------- ---------
 MAX* :   -1.200000E+05  1.200000E+05  1.200000E+05 -1.200000E+05  0.0           1.200000E+05 -1.200000E+05 -1.00E+00
 MAX* :    2.910383E-11 -2.910383E-11 -2.910383E-11  2.910383E-11  0.0           2.910383E-11 -2.910383E-11 -1.00E+00

 MIN* :   -1.200000E+05  1.200000E+05  1.200000E+05 -1.200000E+05  0.0           1.200000E+05 -1.200000E+05 -1.00E+00
 MIN* :    2.910383E-11 -2.910383E-11 -2.910383E-11  2.910383E-11  0.0           2.910383E-11 -2.910383E-11 -1.00E+00

 ABS* :    1.200000E+05  1.200000E+05  1.200000E+05  1.200000E+05  0.0           1.200000E+05  1.200000E+05  1.00E+00
 ABS* :    2.910383E-11  2.910383E-11  2.910383E-11  2.910383E-11  0.0           2.910383E-11  2.910383E-11  1.00E+00
 *for output set

 >> LINK  9 END

    Total CPU time =  1.25E-01 seconds

 >> MYSTRAN END    :  8/ 3/2021 at 21:29:25.565
aerospaceweeb
Posts: 118
Joined: Fri Apr 09, 2021 3:26 am

Re: Solver for Mystran

Post by aerospaceweeb »

I now know that you can duplicate your error with a far smaller model.
Here's your original model Bernd reduced to only one element, but it produces the same error.

Code: Select all

$ does uncommenting non-structural mass work? No.
$ What about getting rid of all the bars?
SOL 101
CEND
ECHO = NONE
SUBCASE 1
    DISPLACEMENT = ALL
    LOAD = 1
    SPC = 1
    SPCFORCES = ALL
    STRESS = ALL
    SUBTITLE = Default
BEGIN BULK
GRID           1              0.    500.    500.
GRID           2           8000.    500.    500.
CBAR     1       1       1       2       0.0     0.0     1.0
PBARL          1       1             BAR
            400.   1400.      0.
MAT1           1 210000.              .3
$LOADS
LOAD           1      1.      1.       2
FORCE          2       2        9000000.      0.      0.     1.
$SPCs
SPCADD         1       2
SPC1           2  123456       1
ENDDATA
From this I conclude that this model is impossibly flimsy.
In my familiar unit system, you're applying nine million pounds, on an 8000 inch long beam, that's 400 inches tall, and made of something with a youngs modulus of 210,000 pounds per square inch.

That is a bridge, two soccer fields long, made of something five times softer than Acrylic plastic, with SEVEN Airbus A-380s pushing down on the end of it.

The stiffnesses are so low compared to the forces, that it's overflowing the matrix inversion subroutine.
We can override this, by setting MACH_SFMIN even lower, with a relatively simple parameter which I can't remember off the top of my head right now, but it would suffice to say that this is why it doesn't give the correct solution.
Post Reply