Package: cubrium
cubriumAcube in equilibriumCubrium is a toolbox for the definition, solution and post-processing of homogenous loadcases in continuum mechanics of solids (statics). It usescontiquefor the numeric continuation of the nonlinear equilibrium equations. If you usecubriumorcontiquein your scientific publications, please cite my work. I'll provide a citable template with a DOI in the future.Official DocumentationExample 101 a.k.ahello cubrium😎This is an example which solves a cube with a Saint Venant-Kirchhoff (SVK) material for the case of uniaxial loading. In the first step, weinita model.importcubriumMDL=cubrium.init()ConstitutionIn the second part, we have to define the constitutive law. We can either use one ofcubrium's models or use our ownumat(user material). This time we're using our ownumatfunction for a simple SVK material.importnumpyasnpdefumat_svk(F,parameters):"""(U)ser (MAT)erial Function.Returns First Piola-Kirchhoff stress tensor for a givendeformation gradient tensor with a list of material parameters."""# expand list of material parametersmu,K=parameters[:2]gamma=K-2/3*muC=F.T@FE=1/2*(C-np.eye(3))S=2*mu*E+gamma*np.trace(E)*np.eye(3)returnF@SNow we have to link ourumatto thecubriummodel definition and specify material parameters.MDL.GLO.constitution.umat=umat_svkMDL.GLO.constitution.parameters=[1.0,5000.0]Loadcase (Kinematics and Kinetics)A loadcase is defined with exactly9equations for the unsymmetric or6equations for the full-symmetric case. This contains either kinematic or kinetic types of equations. For the case of uniaxial loading we are building this loadcase for ourselfes. We apply an external normal force 1 and set all external shear forces and normal forces 2 and 3 to zero. A symmetric solution is enforced (no rigid body rotation is allowed). The load-proportionaly-factor is applied to the normal forces (lpftype=0). Finally we specify atitlefor the loadcase. This will later effect the output filenames.defuniaxial(MDL):MDL.EXT.force.normal[0]=1MDL.EXT.force.normal[1]=0MDL.EXT.force.normal[2]=0MDL.EXT.force.shear[0,1]=0MDL.EXT.force.shear[1,2]=0MDL.EXT.force.shear[0,2]=0MDL.EXT.gridvec.symmetry=[1,1,1]MDL.GLO.lpftype=0MDL.GLO.title="Uniaxial"returnMDLAgain, we have to link our loadcase to thecubriummodel and update the model with the new loadcase settings.MDL=uniaxial(MDL)MDL=cubrium.update(MDL)SolverStarting from a valid initial solution everything is ready to solve the model.Hint:x0are the flattened components of the displacement gradient w.r.t. the undeformed coordinates (=primary unknows of the problem).Res=cubrium.solve(MDL)(x0=np.zeros(9),lpf0=0.0,)The results contain the extended unknownsy = (x, lpf)but no information about the internal quantities of the model. Therefore we extract the extended unknows from the Result object (Res) and recover these internal quantities (e.g. reaction forces) for all steps.Y=np.array([res.xforresinRes])history=cubrium.recover(Y,MDL)Plots and Post-processingWe plot the axial stretch vs. load-proportionality-factor in direction 1.importmatplotlib.pyplotaspltplt.plot([0],[0],"C0o",label="origin")plt.plot(Y[:,0],Y[:,-1],"C0.-")plt.xlabel("$\lambda_1 - 1$")plt.ylabel("load-proportionality-factor LPF")Usingmeshiowe are able to export our solution in thexdmffile format which may be further post-processed by ParaView.cubrium.writer.xdmf(history,filename=MDL.GLO.title,)An exemplary scene for ParaView 5.9.0 is available todownload. Import it in ParaView (File - Load state) and choose "Choose File Names" as shown below. Voilà, a nice cube scene in 3D with a cube colored in "Cauchy Stress XX" and reaction forces scaled and colored in "Reaction Force Magnitude" is ready to animate. The whole script of this example may bedownloaded here.Finally you can watch the animated cube during the deformation.Have fun usingcubrium! If you find any bugs please submit an issue.