2626# ---------------------------------------------------------------------
2727
2828import argparse
29- #import gstools
3029
3130import edelweissfe .utils .performancetiming as performancetiming
3231import numpy as np
3332import pytest
3433from edelweissfe .journal .journal import Journal
3534from edelweissfe .linsolve .pardiso .pardiso import pardisoSolve
3635from edelweissfe .timesteppers .adaptivetimestepper import AdaptiveTimeStepper
37- from edelweissfe .utils .exceptions import StepFailed
3836
3937from edelweissmpm .constraints .particlelagrangianweakdirichlet import (
4038 ParticleLagrangianWeakDirichletOnParticleSetFactory ,
4139)
4240from edelweissmpm .fieldoutput .fieldoutput import MPMFieldOutputController
43-
4441from edelweissmpm .generators .abqinpfilegenerator import (
4542 generateKernelFunctionGridFromInputFile ,
4643)
4744from edelweissmpm .meshfree .approximations .marmot .marmotmeshfreeapproximation import (
4845 MarmotMeshfreeApproximationWrapper ,
4946)
50- from edelweissmpm .meshfree .kernelfunctions .marmot .marmotmeshfreekernelfunction import (
51- MarmotMeshfreeKernelFunctionWrapper ,
52- )
5347from edelweissmpm .meshfree .particlekerneldomain import ParticleKernelDomain
5448from edelweissmpm .models .mpmmodel import MPMModel
5549from edelweissmpm .outputmanagers .ensight import OutputManager as EnsightOutputManager
5852)
5953from edelweissmpm .particles .marmot .marmotparticlewrapper import MarmotParticleWrapper
6054from edelweissmpm .solvers .nqs import NonlinearQuasistaticSolver
61- #from edelweissmpm.solvers.nqsmparclength import NonlinearQuasistaticMarmotArcLengthSolver
62-
6355from edelweissmpm .stepactions .particledistributedload import ParticleDistributedLoad
64- from edelweissmpm .stepactions .particleindirectcontrol import IndirectControl
6556
66- def run_sim (inputFilePath = "test_potato.inp" ,
67- name = "potato" ,
68- supportRadiusFactor = 1.1 ,
69- outputName = "_potato" ,
70- particleType = "GradientEnhancedMicropolarSQCNIxSDI/PlaneStrain/Quad" ):
57+ # import gstools
58+
59+
60+ # from edelweissmpm.solvers.nqsmparclength import NonlinearQuasistaticMarmotArcLengthSolver
61+
62+
63+ def run_sim (
64+ inputFilePath = "test_potato.inp" ,
65+ name = "potato" ,
66+ supportRadiusFactor = 1.1 ,
67+ outputName = "_potato" ,
68+ particleType = "GradientEnhancedMicropolarSQCNIxSDI/PlaneStrain/Quad" ,
69+ ):
7170 dimension = 2
7271
7372 # set nump linewidth to 200:
@@ -81,24 +80,28 @@ def run_sim(inputFilePath = "test_potato.inp",
8180
8281 theModel = MPMModel (dimension )
8382
84- kernelFunctionSpecifier = {"kernelFunction" : "BSplineBoxed" , "continuityOrder" : 3 , "supportRadiusFactor" : supportRadiusFactor }
83+ kernelFunctionSpecifier = {
84+ "kernelFunction" : "BSplineBoxed" ,
85+ "continuityOrder" : 3 ,
86+ "supportRadiusFactor" : supportRadiusFactor ,
87+ }
8588
8689 theApproximation = MarmotMeshfreeApproximationWrapper (
8790 "ReproducingKernelImplicitGradient" , dimension , completenessOrder = 1
8891 )
8992
90- #=====================================================================
93+ # =====================================================================
9194 # MATERIAL
92- #=====================================================================
95+ # =====================================================================
9396 theMaterial = {
9497 "material" : "GMDamagedShearNeoHooke" ,
9598 # E, nu, GcToG, lb, lt, polarRatio
9699 "properties" : np .array ([4.5e3 , 0.2 , 1 , 1 , 1 , 1.4999 , 1.0 ]),
97100 }
98-
99- #=====================================================================
101+
102+ # =====================================================================
100103 # PARTICLE FACTORY & MODEL
101- #=====================================================================
104+ # =====================================================================
102105
103106 def TheParticleFactory (number , vertexCoordinates , volume ):
104107 return MarmotParticleWrapper (
@@ -110,26 +113,28 @@ def TheParticleFactory(number, vertexCoordinates, volume):
110113 theMaterial ,
111114 )
112115
113- theModel = generateKernelFunctionGridFromInputFile (inputFilePath = inputFilePath ,
114- journal = theJournal ,
115- model = theModel ,
116- kernelFunctionSpecifier = kernelFunctionSpecifier ,
117- particleFactoryCallback = TheParticleFactory ,
118- firstKernelFunctionNumber = 1 ,
119- firstParticleNumber = 1 ,
120- name = name )
116+ theModel = generateKernelFunctionGridFromInputFile (
117+ inputFilePath = inputFilePath ,
118+ journal = theJournal ,
119+ model = theModel ,
120+ kernelFunctionSpecifier = kernelFunctionSpecifier ,
121+ particleFactoryCallback = TheParticleFactory ,
122+ firstKernelFunctionNumber = 1 ,
123+ firstParticleNumber = 1 ,
124+ name = name ,
125+ )
121126
122- #=====================================================================
127+ # =====================================================================
123128 # SET PARTICLE PROPERTIES
124- #=====================================================================
129+ # =====================================================================
125130
126131 for particle in theModel .particles .values ():
127- particle .setProperty ("newmark-beta beta" , 0.0 )
128- particle .setProperty ("newmark-beta gamma" , 0.0 )
129- particle .setProperty ("VCI order" , 0 )
132+ particle .setProperty ("newmark-beta beta" , 0.0 )
133+ particle .setProperty ("newmark-beta gamma" , 0.0 )
134+ particle .setProperty ("VCI order" , 0 )
130135
131136 if "NSNI" in particleType :
132- particle .setProperty ("stabilize angular momentum" , 1.0 )
137+ particle .setProperty ("stabilize angular momentum" , 1.0 )
133138
134139 # let's create the particle kernel domain
135140 theParticleKernelDomain = ParticleKernelDomain (
@@ -148,31 +153,35 @@ def TheParticleFactory(number, vertexCoordinates, volume):
148153 # We need this model to create the dof manager
149154 theModel .particleKernelDomains ["my_all_with_all" ] = theParticleKernelDomain
150155
151- #=====================================================================
156+ # =====================================================================
152157 # SET DIRICHLET BCs
153- #=====================================================================
154-
155- dirichletLeftBottom = ParticleLagrangianWeakDirichletOnParticleSetFactory ("leftBottom" ,
156- theModel .particleSets [f"{ name } _b_leftBottom" ],
157- "displacement" ,
158- {0 : 0 , 1 : 0 },
159- theModel ,
160- location = "center" )
161- dirichletRightBottom = ParticleLagrangianWeakDirichletOnParticleSetFactory ("rightBottom" ,
162- theModel .particleSets [f"{ name } _b_rightBottom" ],
163- "displacement" ,
164- {0 : 0 , 1 : 0 },
165- theModel ,
166- location = "center" )
158+ # =====================================================================
159+
160+ dirichletLeftBottom = ParticleLagrangianWeakDirichletOnParticleSetFactory (
161+ "leftBottom" ,
162+ theModel .particleSets [f"{ name } _b_leftBottom" ],
163+ "displacement" ,
164+ {0 : 0 , 1 : 0 },
165+ theModel ,
166+ location = "center" ,
167+ )
168+ dirichletRightBottom = ParticleLagrangianWeakDirichletOnParticleSetFactory (
169+ "rightBottom" ,
170+ theModel .particleSets [f"{ name } _b_rightBottom" ],
171+ "displacement" ,
172+ {0 : 0 , 1 : 0 },
173+ theModel ,
174+ location = "center" ,
175+ )
167176 theModel .constraints .update (dirichletLeftBottom )
168177 theModel .constraints .update (dirichletRightBottom )
169178 theModel .prepareYourself (theJournal )
170179
171180 theJournal .printPrettyTable (theModel .makePrettyTableSummary (), "summary" )
172181
173- #=====================================================================
182+ # =====================================================================
174183 # SET FIELD OUTPUT
175- #=====================================================================
184+ # =====================================================================
176185
177186 fieldOutputController = MPMFieldOutputController (theModel , theJournal )
178187
@@ -202,12 +211,12 @@ def TheParticleFactory(number, vertexCoordinates, volume):
202211 theModel .particleSets ["all" ],
203212 "microrotation" ,
204213 )
205-
214+
206215 fieldOutputController .initializeJob ()
207216
208- #=====================================================================
217+ # =====================================================================
209218 # ENSIGHT OUTPUT
210- #=====================================================================
219+ # =====================================================================
211220
212221 ensightOutput = EnsightOutputManager (outputName , theModel , fieldOutputController , theJournal , None )
213222 ensightOutput .updateDefinition (fieldOutput = fieldOutputController .fieldOutputs ["displacement" ], create = "perElement" )
@@ -218,26 +227,24 @@ def TheParticleFactory(number, vertexCoordinates, volume):
218227 ensightOutput .updateDefinition (
219228 fieldOutput = fieldOutputController .fieldOutputs ["deformation gradient" ], create = "perElement"
220229 )
221- ensightOutput .updateDefinition (
222- fieldOutput = fieldOutputController .fieldOutputs ["stress" ], create = "perElement"
223- )
224- ensightOutput .updateDefinition (
225- fieldOutput = fieldOutputController .fieldOutputs ["microrotation" ], create = "perElement"
226- )
230+ ensightOutput .updateDefinition (fieldOutput = fieldOutputController .fieldOutputs ["stress" ], create = "perElement" )
231+ ensightOutput .updateDefinition (fieldOutput = fieldOutputController .fieldOutputs ["microrotation" ], create = "perElement" )
227232 ensightOutput .initializeJob ()
228233
229- #=====================================================================
234+ # =====================================================================
230235 # SOLVER SETUP
231- #=====================================================================
236+ # =====================================================================
232237
233238 incSize = 1
234- adaptiveTimeStepper = AdaptiveTimeStepper (currentTime = theModel .time ,
235- stepLength = 1 ,
236- startIncrement = incSize ,
237- maxIncrement = incSize ,
238- minIncrement = incSize / 1 ,
239- maxNumberIncrements = 5000 ,
240- journal = theJournal )
239+ adaptiveTimeStepper = AdaptiveTimeStepper (
240+ currentTime = theModel .time ,
241+ stepLength = 1 ,
242+ startIncrement = incSize ,
243+ maxIncrement = incSize ,
244+ minIncrement = incSize / 1 ,
245+ maxNumberIncrements = 5000 ,
246+ journal = theJournal ,
247+ )
241248
242249 nonlinearSolver = NonlinearQuasistaticSolver (theJournal )
243250 iterationOptions = nonlinearSolver .validOptions .copy ()
@@ -259,18 +266,16 @@ def TheParticleFactory(number, vertexCoordinates, volume):
259266 iterationOptions ["spec. relative field correction tolerances" ]["micro rotation" ] = 1e10
260267 iterationOptions ["spec. absolute field correction tolerances" ]["micro rotation" ] = 1e10
261268
262-
263-
264269 linearSolver = pardisoSolve
265270
266271 from edelweissmpm .meshfree .vci import (
267272 BoundaryParticleDefinition ,
268273 VariationallyConsistentIntegrationManager ,
269274 )
270275
271- #=====================================================================
276+ # =====================================================================
272277 # VCI SETUP
273- #=====================================================================
278+ # =====================================================================
274279
275280 theBoundary = [
276281 BoundaryParticleDefinition (theModel .particleSets [f"{ name } __s_wholeBoundary_S1" ], np .empty (2 ), 1 ),
@@ -283,34 +288,34 @@ def TheParticleFactory(number, vertexCoordinates, volume):
283288 list (theModel .particles .values ()), list (theModel .meshfreeKernelFunctions .values ()), theBoundary
284289 )
285290
286- #=====================================================================
291+ # =====================================================================
287292 # DISTRIBUTED LOADS
288- #=====================================================================
293+ # =====================================================================
289294
290295 pressure_S1 = ParticleDistributedLoad (
291- name = "pressure_S1" ,
292- model = theModel ,
293- journal = theJournal ,
294- particles = theModel .particleSets [f"{ name } __s_top_S1" ],
295- distributedLoadType = "pressure" ,
296- loadVector = np .array ([- 10 ]),
296+ name = "pressure_S1" ,
297+ model = theModel ,
298+ journal = theJournal ,
299+ particles = theModel .particleSets [f"{ name } __s_top_S1" ],
300+ distributedLoadType = "pressure" ,
301+ loadVector = np .array ([- 10 ]),
297302 surfaceID = 1 ,
298- f_t = lambda t : t
303+ f_t = lambda t : t ,
299304 )
300305 pressure_S3 = ParticleDistributedLoad (
301- name = "pressure_S3" ,
302- model = theModel ,
303- journal = theJournal ,
304- particles = theModel .particleSets [f"{ name } __s_top_S3" ],
305- distributedLoadType = "pressure" ,
306- loadVector = np .array ([- 10 ]),
306+ name = "pressure_S3" ,
307+ model = theModel ,
308+ journal = theJournal ,
309+ particles = theModel .particleSets [f"{ name } __s_top_S3" ],
310+ distributedLoadType = "pressure" ,
311+ loadVector = np .array ([- 10 ]),
307312 surfaceID = 3 ,
308- f_t = lambda t : t
313+ f_t = lambda t : t ,
309314 )
310-
311- #=====================================================================
315+
316+ # =====================================================================
312317 # SOLVE STEPS
313- #=====================================================================
318+ # =====================================================================
314319
315320 try :
316321 theJournal .printSeperationLine ()
0 commit comments