@@ -119,6 +119,20 @@ def default_parameters(
119119 "p_y00" : 2500 * ureg ("MPa" ), # final yield stress
120120 "p_w" : 200 * ureg ("" ), # saturation parameter
121121 }
122+
123+ elif material == "mohr_coulomb_smoothed_3D_analytical" :
124+ model_parameters = {
125+ "E" : 78000 * ureg ("Pa" ),
126+ "nu" : 0.3 * ureg ("" ), # poisson ratio
127+ "c_0" : 1050 * ureg ("Pa" ),
128+ "c_00" : 2280 * ureg ("Pa" ),
129+ "p_w" : 10 * ureg ("" ),
130+ "psi" : 20 * np .pi / 180 * ureg ("" ),
131+ "phi" : 20 * np .pi / 180 * ureg ("" ),
132+ "theta_T" : 26 * np .pi / 180 * ureg ("" ),
133+ "a" : 0.25 * 1.05 / np .tan (20 ) * ureg ("" )
134+ }
135+
122136 else :
123137 raise ValueError ("material law not known" )
124138
@@ -194,6 +208,7 @@ def setup(self) -> None:
194208 # additional stuff/output field for activation or specific output
195209 self .modulus = self .mechanics_problem .modulus
196210 self .density_time = self .mechanics_problem .density_time
211+ self .von_mises = self .mechanics_problem .von_mises
197212 # array describing path time per quadrature point
198213 self .q_array_path_time = np .zeros_like (self .density_time .x .array [:]) # zero as default
199214
@@ -277,12 +292,14 @@ def update_material_parameters(self) -> None:
277292
278293 elif self .material_law .__name__ == "VonMises3D" :
279294 # changing parameters
280- time_params = ["p_ka" , "p_mu" , "p_y0" ]
295+ time_params = ["p_ka" , "p_mu" , "p_y0" , "p_y00" , "p_w" ]
281296 p_values = self .get_params_gp (time_params )
282297 #
283298 self .mechanics_problem .laws [0 ][0 ].p_ka = p_values ["p_ka" ]
284299 self .mechanics_problem .laws [0 ][0 ].p_mu = p_values ["p_mu" ]
285300 self .mechanics_problem .laws [0 ][0 ].p_y0 = p_values ["p_y0" ]
301+ self .mechanics_problem .laws [0 ][0 ].p_y00 = p_values ["p_y00" ]
302+ self .mechanics_problem .laws [0 ][0 ].p_w = p_values ["p_w" ]
286303
287304 # # store bulk modulus just for access since material law dependent do it here and not in ProblemAM
288305 self .mechanics_problem .modulus .x .array [:] = self .mechanics_problem .laws [0 ][0 ].p_ka
@@ -383,6 +400,10 @@ def pv_plot(self) -> None:
383400 # project(self.density_time, self.plot_space_alpha, ufl.dx, density_plot)
384401 # density_plot.x.scatter_forward()
385402
403+ Q0 = df .fem .functionspace (self .mesh , ("DG" , 0 ))
404+ VM_plot = project (self .von_mises , Q0 , self .rule .dx )
405+ VM_plot .name = "Von-Mises_DG0"
406+
386407 if self .a_plot :
387408 alpha_plot = project (self .q_fields .history_scalar , self .plot_space_alpha , self .rule .dx )
388409 alpha_plot .name = "Alpha"
@@ -395,6 +416,7 @@ def pv_plot(self) -> None:
395416 f .write_function (disp_plot , self .time )
396417 f .write_function (sigma_plot , self .time )
397418 f .write_function (density_plot , self .time )
419+ f .write_function (VM_plot , self .time )
398420 if self .a_plot :
399421 f .write_function (alpha_plot , self .time )
400422
@@ -539,6 +561,7 @@ def __init__(
539561 s_space = df .fem .functionspace (mesh , QSe )
540562 self .modulus = df .fem .Function (s_space , name = "modulus" ) # one material parameter
541563 self .density_time = df .fem .Function (s_space , name = "density" )
564+ self .von_mises = df .fem .Function (s_space , name = "von_mises" )
542565 ###
543566
544567 # define forms
@@ -672,6 +695,8 @@ def form(self, x: PETSc.Vec) -> None:
672695
673696 self .stress_1 .x .scatter_forward ()
674697 self .tangent .x .scatter_forward ()
698+ self .von_mises .x .array [:] = self .von_mises_from_mandel (self .stress_1 .x .array )
699+ self .von_mises .x .scatter_forward ()
675700
676701 def update (self ) -> None :
677702 """
@@ -769,3 +794,41 @@ def stress_rotate(self, del_grad_u, mandel_stress):
769794 # print('mandel stress rotated ################',rotated_stress_mandel)
770795 # mandel_stress = mandel_stress.flatten()
771796 mandel_stress [:, :] = rotated_stress_mandel
797+
798+ def von_mises_from_mandel (self , mandel_stress ):
799+ """
800+ Compute von Mises stress from stress tensor in Mandel notation.
801+
802+ Args:
803+ mandel_stress: ndarray of shape (n_points, 6), in Mandel notation
804+
805+ Returns:
806+ von_mises: ndarray of shape (n_points,)
807+ """
808+
809+ I2 = np .eye (3 , 3 )
810+ # shape = int(np.shape(self.mechanics_problem._del_grad_u)[0] / 9)
811+
812+ mandel_stress = mandel_stress .reshape (- 1 , 6 )
813+
814+ s = mandel_stress .copy ()
815+
816+ # Compute trace of stress tensor
817+ trace = s [:, 0 ] + s [:, 1 ] + s [:, 2 ]
818+
819+ # Deviatoric part: s_ij = sigma_ij - (1/3) * trace * delta_ij
820+ s [:, 0 ] -= trace / 3
821+ s [:, 1 ] -= trace / 3
822+ s [:, 2 ] -= trace / 3
823+
824+ # Compute von Mises stress
825+ vm_squared = (
826+ s [:, 0 ] ** 2
827+ + s [:, 1 ] ** 2
828+ + s [:, 2 ] ** 2
829+ + s [:, 3 ] ** 2 + s [:, 4 ] ** 2 + s [:, 5 ] ** 2
830+ )
831+
832+ ans = np .sqrt (1.5 * vm_squared )
833+
834+ return ans
0 commit comments