2.3. MaterialPointSimulator¶
Overview¶
A model in Matmodlab is defined by a MaterialPointSimulator object. The
MaterialPointSimulator object manages and allocates memory for materials and
analysis steps. In this section, the MaterialPointSimulator object is
described.
The MaterialPointSimulator Constructor¶
-
class
MaterialPointSimulator(job, verbosity=1, d=None, inital_temperature=DEFAULT_TEMP, output=DBX)¶ Create a MaterialPointSimulator object and set up the simulation.
The
jobstring is the simulation ID. Generated files are namedjob.ext, where ext is the file extension.The following arguments are optional.
The
verbosityinteger set the simulation verbosity. Generally, 0=quiet, 2=noisy. Thedstring is the simulation directory, the default is the working directory.initial_temperatureis the initial temperature, the default is298K. Theoutputsymbolic constant specifies the output type, it defaults toDBXif not specified. See Matmodlab File Formats for a description of supported output formats.Examples:
>>> mps = MaterialPointSimulator('model') >>> mps = MaterialPointSimulator('model', verbosity=2, d='/home/user/sim')
Defining a Material Model¶
-
MaterialPointSimulator.Material(model, parameters, name=None, switch=None, rebuild=False, source_files=None, depvar=None, fiber_dirs=None, user_ics=False, order=None, response=None, libname=None, param_names=None)¶ Create and assign a material model
The required arguments are a model name and material parameters. The model name must be a recognized material model (see Materials).
parametersis either a dictionary ofkey:value(keybeing the parameter name,valueits numeric value) or ndarray.The following arguments are optional and applicable to all materials.
rebuildis a boolean that, whenTrue, forces the material model to be rebuilt before the simulation.switchis a tuple containing the material name and the name of another material to be switched in to its place.The following arguments are applicable to user materials:
A user material is invoked by setting
modelto one ofUSER,UMAT,UHYPER,UANISOHYPER_INV(see User Defined Materials for details).source_filesis a list of model source files. Each file must exist and be readable on the file system.depvaris either the integer number of state dependent variables or a list of state dependent variable names.fiber_dirsis an array of fiber directions (applicable only to uanisohyper_inv models).param_namesis a list of parameter names. Ifuser_icsisTrue, Matmodlab calls the user suppliedSDVINIsubroutine to initialize state dependent variables - otherwise they are set to0.orderis a list of strings specifying the component ordering of second order tensors.responseis one ofMECHANICAL,HYPERELASTIC, orANISOHYPERand is used to determine which type of response the model will describe.Examples:
>>> mps.Material('elastic', {'K': 123e9, 'G': 53e9}) >>> mps.Material(UMAT, (10e6, .333, 42e3), source_files=('umat.f', 'umat.pyf'), param_names=('E', 'nu', 'Y'), user_ics=True, depvar=('EQPS',))
Optional Material Addons¶
Thermal Expansion¶
A Thermal Expansion object, enabling the computation of thermal strains associated with thermal expansion.
Viscoelasticity¶
A Viscoelasticity object defining the linear relaxation response of the material. When given, the elastic moduli are treated as the instantaneous values.
Time-Temperature Shift¶
Used in conjuction with a Viscoelasticity to compute a reduced time.
Defining Simulation Steps¶
The recommended way to create simulation steps is to use the following convenience functions.
-
MaterialPointSimulator.StrainStep(*)¶ All step components are interpreted as components of the strain tensor.
The arguments represented by the * are common to all other step methods and are described in Common Step Arguments.
-
MaterialPointSimulator.StrainRateStep(*)¶ All step components are interpreted as components of the strain rate tensor.
The arguments represented by the * are common to all other step methods and are described in Common Step Arguments.
-
MaterialPointSimulator.StressStep(*)¶ All step components are interpreted as components of the stress tensor.
The arguments represented by the * are common to all other step methods and are described in Common Step Arguments.
Note
kappais set to0for stress steps
-
MaterialPointSimulator.StressRateStep(*)¶ All step components are interpreted as components of the stress rate tensor.
The arguments represented by the * are common to all other step methods and are described in Common Step Arguments.
Note
kappais set to0for stress rate steps
-
MaterialPointSimulator.DisplacementStep(*)¶ All step components are interpreted as components of the displacement vector, applied only to the “+” faces of a unit cube centered at the coordinate origin.
The arguments represented by the * are common to all other step methods and are described in Common Step Arguments.
-
MaterialPointSimulator.DefGradStep(*)¶ All step components are interpreted as components of the deformation gradient tensor.
-
MaterialPointSimulator.DataSteps(filename, tc=0, columns=None, descriptors=None, skiprows=0, comments='#', sheet=None, *)¶ Generate steps from a data file.
filenameis the name of a file containing the data.tcis the integer index of the column containing time.columnsare the indices of the columns containing data. If not given,columnsis taken to be the first six columns of the file, that are nottc.skiprowsis the integer number of rows to skip before reading data,commentsis the comment delimiter.sheetis the sheet from which to read data, iffilenameis an excel file.The ith
descriptordesignates the physical interpretation of the ith.descriptorsmust be one of'E'(strain),'D'(strain rate),'S'(stress),'R'(stress rate),'P'(electric field),'T'(temperature).The arguments represented by the * are common to all other step methods and are described in Common Step Arguments.
-
MaterialPointSimulator.MixedStep(descriptors=None, *)¶ All step components are interpreted as components of stress and/or strain.
The ith
descriptordesignates the physical interpretation of the ith.descriptorsmust be one of'E'or'S'with'E'representing strain and'S'representing stress.The arguments represented by the * are common to all other step methods and are described in Common Step Arguments.
Common Step Arguments¶
The arguments common to all step functions are:
componentsare the components of the tensor defining the step. Tensor ordering is described in Conventions. For all tensors, the components are assumed to be the “tensor values”, as opposed to the “engineering values”. For symmetric tensors, specifying only the three diagonal components implicitly assigns the off-diagonal components a value of zero. For strain type tensors, if only a single component is given, it is assumed to be a volumetric deformation. For stress type tensors, if only a single component is given, it is assumed to be a pressure.
scaleis a multiplier applied to all components. It can be a float or a numpy ndarray (so that a different scale could be applied to each component separately).
framesis the integer number of increments that the step is subdivided in to.
kappathe Seth-Hill strain parameter. See The Strain Tensor for details.
temperatureis the temperature. If not specified, the step is assigned the same temperature as the previous step.
elec_fieldis the electric field vector. If none is given, it is set to(0, 0, 0).
num_dumpsis the integer number of times to write the output database. If not specified, all step increments are written.
Running the Simulation¶
-
MaterialPointSimulator.run(termination_time=None)¶ Run the simulation
termination_timeis the termination time. If not given, the final time from the last step is used.
Extracting Results from the Output Database¶
-
MaterialPointSimulator.get(*variables, model=None, disp=0)¶ Get variables from output database.
variablesis a list of variables to extract. Ifdispis1, the variables are returned, in addition to a header describing the variables.
Viewing Simulation Results¶
-
MaterialPointSimulator.view(model=None)¶ Display simulation results in visualizer.
Exporting Results to Other Formats¶
-
MaterialPointSimulator.dump(variables, model=None, format='ascii', ffmt='%.18f')¶ Writes simulation results for the requested
variablesto the requestedformat.variablesis a list of variables to extract from the database and are written theMaterialPointSimulator.job.ext, whereextis a file extension that depends on the requested outputformat.