OOFem

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
bernd
Posts: 8211
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: OOFem

Postby bernd » Thu Oct 11, 2018 5:18 pm

not at all. you may undestood me wrong. My words where more in the direction of helping you coding than taking some pressure.
User avatar
HarryvL
Posts: 1042
Joined: Sat Jan 06, 2018 7:38 pm

Re: OOFem

Postby HarryvL » Thu Oct 11, 2018 7:24 pm

I wasn't serious Bernd ;)
User avatar
bernd
Posts: 8211
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: OOFem

Postby bernd » Thu Oct 11, 2018 8:42 pm

HarryvL wrote:
Thu Oct 11, 2018 7:24 pm
I wasn't serious Bernd ;)
8-)
User avatar
HarryvL
Posts: 1042
Joined: Sat Jan 06, 2018 7:38 pm

Re: OOFem

Postby HarryvL » Thu Oct 11, 2018 9:13 pm

A preview of where I am heading with the input file

Code: Select all

    def write_OOFEM_input_file(self):
        
        timestart = time.clock()
        
        inpfile = open(self.file_name, 'a')        
        
        self.write_output_file_record(inpfile)
        ''' Filename String '''
        
        self.write_job_description_record(inpfile)
        ''' Job description string '''
        
        self.write_analysis_record(inpfile)
        '''*AnalysisType     nsteps # (in)
                            [renumber # (in) ]
                            [profileopt # (in) ]
                            attributes # (string)
                            [ninitmodules # (in) ]
                            [nmodules # (in) ]
                            [nxfemman # (in) ]
        
                            *StaticStructural
                            nsteps # (in)
                            [deltat # (...) ]
                            [prescribedtimes # (...) ]
                            [stiffmode # (...) ]
                            [nonlocalext # (...) ]
                            [sparselinsolverparams # (...) ]
                            
                            *LinearStability
                             nroot # (in)
                             rtolv # (rn)
                             [eigensolverparams # (...) ]
                             
                            *NonLinearStatic
                             [nmsteps # (in) ]
                             nsteps # (in)
                             [contextOutputStep # (in) ]
                             [sparselinsolverparams # (string) ]
                             [nonlinform # (in) ]
                             [nonlocstiff # (in) ]
                             [nonlocalext]
                             [loadbalancing]'''

        self.write_domain_record(inpfile)

        '''domain *domainType
                              *2dPlaneStress
                              *2d-Truss
                              *3d
                              *2dMindlinPlate
                              *3dShell
                              *2dBeam
        
        '''
        
        self.write_output_manager_record(inpfile)
        
        '''OutputManager
           [tstep all]
           [tstep step # (in) ]
           [tsteps out # (rl) ]
           [dofman all]
           [dofman output # (rl) ]
           [dofman except # (rl) ]
           [element all]
           [element output # (rl) ]
           [element except # (rl) ]
           ndofman # (in)
           nelem # (in)
           ncrosssect # (in)
           nmat # (in)
           nbc # (in)
           nic # (in)
           nltf # (in)
           [nbarrier # (in) ]'''
           
        self.write_dof_manager_record(inpfile)
           
        '''*DofManagerType
            (num#) (in)
            [load # (ra) ]
            [DofIDMask # (ia) ]
            [bc # (ia) ]
            [ic # (ia) ]
            [doftype # (ia) masterMask # (ia) ]
            [shared]i | h[remote]i | h[null]
            [partitions # (ia) ]
                                                 *Node coords # (ra)
                                                  [lcs # (ra) ]'''
                                                  
        self.write_element_record(inpfile)
           
        '''*ElementType
            (num#) (in)
            mat # (in) crossSect # (in) nodes # (ia)
            [bodyLoads # (ia) ] [boundaryLoads # (ia) ]
            [activityltf # (in) ] [lcs # (ra) ]
            [partitions # (ia) ] [remote]
                                                 *beam2d
                                                  2D beam element
                                                  [dofstocondense # (ia) ]
                                                 *beam3d
                                                  3D beam element
                                                  refnode # (in) [dofstocondense # (ia) ]
                                                 *planestress2d
                                                  4-noded 2D quadrilateral element for plane stress analysis
                                                  [NIP # (in) ]
                                                 *qplanestress2d
                                                  8-noded 2D quadrilateral element for plane stress analysis
                                                  [NIP # (in) ]
                                                 *trplanestress2d
                                                  3-noded 2D triangular element for plane stress analysis                                                 
                                                 *qtrplstr
                                                  6-noded 2D triangular element for plane stress analysis [NIP # (in) ]
                                                 *quad1planestrain
                                                  4-noded 2D quadrilateral element for plane strain analysis
                                                  [NIP # (in) ]
                                                 *trplanestrain
                                                  3-noded 2D triangular element for plane strain analysis
                                                 *lspace
                                                  Linear 8-node isoparametric brick element
                                                  [NIP # (in) ]
                                                 *qspace
                                                  Quadratic 20-node isoparametric brick element
                                                  [NIP # (in) ]
                                                 *LTRSpace
                                                  Linear 4-node tetrahedra element
                                                 *QTRSpace
                                                  Quadratic 10-node tetrahedra element
                                                  [NIP # (in) ] '''

        self.write_set_record(inpfile)
        
        '''Set (num#) (in)
           [elements # (ia) ] [elementranges # (rl) ] [allElements]
           [nodes # (ia) ] [noderanges # (rl) ] [allNodes]
           [elementboundaries # (ia) ] [elementedges # (ia) ] '''
           
        self.write_cross_section_record(inpfile)
        
        '''*CrossSectType (num#) (in)
                                        *SimpleCS [thick # (rn) ] [width # (rn) ] [area # (rn) ]
                                         [iy # (rn) ] [iz # (rn) ] [ik # (rn) ]
                                         [shearareay # (rn) ] [shearareaz # (rn) ] beamshearcoeff # (rn)
                                         
                                        *VariableCS [thick # (expr) ] [width # (expr) ] [area # (expr) ]
                                        [iy # (expr) ] [iz # (expr) ] [ik # (expr) ]
                                        [shearareay # (expr) ] [shearareaz # (expr) ]
                                        
                                        *LayeredCS nLayers # (in)
                                        LayerMaterials # (ia)
                                        Thicks # (ra) Widths # (ra)
                                        midSurf # (rn) '''

        self.write_material_type_record(inpfile)
        
        '''*MaterialType (num#) (in) d # (rn)
                                         Linear isotropic elastic material
                                        *IsoLE num (in) # d (rn) # E (rn) # n (rn) # tAlpha (rn) #
                                         Mooney-Rivlin
                                        *MooneyRivlin (in) # d (rn) # K (rn) # C1 (rn) # C2 (rn) #
                                         Large-strain master material material
                                        *LSmasterMat (in) # m (rn) # slavemat (in) #
                                         DP material
                                        *DruckerPrager num (in) # d (rn) # tAlpha (rn) # E (rn) # n (rn) # alpha (rn) # alphaPsi (rn) # ht (in) # iys (rn) # lys (rn) # hm (rn) # kc (rn) # [ yieldtol (rn) #]
                                         Mises plasticity model with isotropic hardening
                                        *MisesMat (in) # d (rn) # E (rn) # n (rn) # sig0 (rn) # H (rn) # omega crit (rn) #a (rn) #
                                         Rotating crack model for concrete
                                        *Concrete3 d (rn) # E (rn) # n (rn) # Gf (rn) # Ft (rn) # exp soft (in) # tAlpha (rn) #
                                         EC2CreepMat model for concrete creep and shrinkage
                                        *EC2CreepMat n (rn) # [ begOfTimeOfInterest (rn) #] [ end-OfTimeOfInterest (rn) #] relMatAge (rn) # [ timeFactor (rn) #] stiffnessFactor (rn) # [ tAlpha (rn) #] fcm28 (rn) # t0 (rn) # cem- Type (in) # [ henv (rn) #] h0 (rn) # shType (in) # [ spectrum ][ temperatureDependent ]'''
           
                   
        # footer
        self.write_footer(inpfile)
        inpfile.close()
        FreeCAD.Console.PrintMessage("Writing time input file: " + str(time.clock() - timestart) + ' \n\n')
        return self.file_name

The meta code in the comments is (a selection) from the OOFEM input manual. It gives an impression of the capability of OOFEM, but also indicates that there is still a bit of work required on the FC material object and solver object (data tab) to collect some of that information from the user.

I will first start with what is currently readily available from material, mesh and solver objects and (if time permits) later try to extend those objects to capture the information/parameters for the more exotic capabilities of OOFEM.
User avatar
Kunda1
Posts: 5135
Joined: Thu Jan 05, 2017 9:03 pm

Re: OOFem

Postby Kunda1 » Mon Oct 29, 2018 7:40 pm

HarryvL wrote:
Thu Oct 11, 2018 9:13 pm
How is the progress going with this ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
HarryvL
Posts: 1042
Joined: Sat Jan 06, 2018 7:38 pm

Re: OOFem

Postby HarryvL » Mon Oct 29, 2018 8:32 pm

I have made 0% progress since my last post.
User avatar
bernd
Posts: 8211
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: OOFem

Postby bernd » Mon Oct 29, 2018 8:39 pm

HarryvL wrote:
Mon Oct 29, 2018 8:32 pm
I have made 0% progress since my last post.
Do you need any help or it just a matter of time and mood ?
User avatar
HarryvL
Posts: 1042
Joined: Sat Jan 06, 2018 7:38 pm

Re: OOFem

Postby HarryvL » Tue Oct 30, 2018 3:12 am

bernd wrote:
Mon Oct 29, 2018 8:39 pm
HarryvL wrote:
Mon Oct 29, 2018 8:32 pm
I have made 0% progress since my last post.
Do you need any help or it just a matter of time and mood ?
Thanks. It's just a matter of time and focus.
User avatar
bernd
Posts: 8211
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: OOFem

Postby bernd » Tue Oct 30, 2018 5:53 am

FreeCAD motto is: It's done when it's done! :D
User avatar
HarryvL
Posts: 1042
Joined: Sat Jan 06, 2018 7:38 pm

Re: OOFem

Postby HarryvL » Thu Nov 01, 2018 1:54 pm

Bernd,

I am able to write the OOFEM input file to disk (replicating Z88 logic), but the mesh is empty.

I make the following call to importOOFEMMesh.write_OOFEM_mesh_to_file () in writer.py:

https://github.com/HarryvL/FreeCAD/blob ... er.py#L286

after which the following shows zero nodes and elements:

https://github.com/HarryvL/FreeCAD/blob ... #L322-L340

I have not been able to trace back where self.femnodes_mesh and self.femelement_table get assigned ... apart from the initiation here:

https://github.com/HarryvL/FreeCAD/blob ... py#L86-L87

and the assignment in the unrelated(?) method get_constraints_pressure_faces() here:

https://github.com/HarryvL/FreeCAD/blob ... #L187-L201

In summary, I am lost on how to access node and element data for writing to file.