文稿说明案例user_第1页
文稿说明案例user_第2页
文稿说明案例user_第3页
文稿说明案例user_第4页
文稿说明案例user_第5页
免费预览已结束,剩余28页可下载查看

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Lesson content:Overview of Some User Subroutines Where User Subroutines Fit into Abaqus/Standard Including User Subroutines in a Model Writing Output from User Subroutines Compiling and Linking User Subroutines Debugging Techniques and Proper Programming HabitsC/C+ interfaceSupport for User Subrouti

2、nes Lesson 1: Introduction1 hourOverview of Some User Subroutines (1/6)Abaqus provides users with an extensive array of user subroutines that allow them to adapt Abaqus to their particular analysis requirements.User subroutines are written as C, C+, or Fortran code; the primary focus of this course,

3、 however, is on using Fortran code to develop user subroutines. The C/C+ interface is briefly introduced at the end of this lecture.The Abaqus User Subroutines Reference Guide details all 40+ user subroutines available in Abaqus. Some popular Abaqus user subroutines include:CREEP:Use this subroutine

4、 to define time-dependent, viscoplastic deformation in a material. The deformation is divided into deviatoric behavior (creep) and volumetric behavior (swelling).(V)DLOAD*: Use this subroutine to define nonuniform, distributed mechanical loads (pressures and body forces).*In this course, the use of

5、(V) at the start of a subroutine name is used as shorthand notation to indicate that the subroutine is available in two forms: one for Abaqus/Standard and one for Abaqus/Explicit. For example, (V)DLOAD refers to subroutines DLOAD (Abaqus/Standard) and VDLOAD (Abaqus/Explicit). If the prefix is omitt

6、ed, the subroutine is only available in Abaqus/Standard (e.g., the CREEP subroutine is only available in Abaqus/Standard). Overview of Some User Subroutines (2/6)FILM: Use this subroutine to describe complex film coefficient behavior (temperature and field variable dependence) and complex sink tempe

7、rature behavior.(V)FRIC: Use this subroutine when more complex models than those provided with the friction option are needed to describe the transmission of shear forces between surfaces. The models defined in this subroutine must be local models (information is provided only at the node making con

8、tact).Note: VFRIC may only be used with contact pairs in Abaqus/Explicit; for general contact in Abaqus/Explicit, use VFRICTION instead.(V)FRIC_COEF: Use this subroutine to define the isotropic friction coefficient. The definition of frictional forces is not required (as it is with (V)FRIC and VFRIC

9、TION). Overview of Some User Subroutines (3/6)HETVAL:Use this subroutine to define complex models for internal heat generation in a material, such as might occur when the material undergoes a phase change.(V)UEL:Use this subroutine when it is necessary to create elements with an element formulation

10、that is not available in Abaqus. UELMAT:This routine is similar to a UEL; however, it provides access to selected mechanical and thermal material libraries built into Abaqus. Overview of Some User Subroutines (4/6)UEXPAN: Use this subroutine to define incremental thermal strains when the materials t

11、hermal expansion is too complex to model with the built in expansion option.UEXTERNALDB: Use this subroutine to help manage external databases that may be used by other user subroutine or other software programs that are providing Abaqus/Standard data and/or using data generated by Abaqus/Standard.U

12、GENS: Use this subroutine to define complex, nonlinear mechanical behavior for shell elements directly in terms of the shell elements section stiffness.(V)UMAT: Use this subroutine to define any complex, constitutive models for materials that cannot be modeled with the available Abaqus material mode

13、ls.Overview of Some User Subroutines (5/6)UMESHMOTION: Use this subroutine to specify mesh motion constraints during adaptive meshing for wear analysis.UPOREP: Use this subroutine to define the initial pore fluid pressures in a coupled pore fluid diffusion and stress analysis as a function of node l

14、ocation.URDFIL: Use this subroutine to read the data from the results (.fil) file at the end of an increment. The information can be used to make decisions such as when to terminate the analysis or whether to overwrite the results of the previous increment.(V)USDFLD: Use this subroutine to define th

15、e values of field variables directly at the integration points of elements. The field variable values can be functions of element variables such as stress or strain.Overview of Some User Subroutines (6/6)UTRACLOAD: Use this subroutine to define nonuniform distributed surface tractions, edge traction

16、s, and edge moments .UWAVE: Use this user subroutine to define complex wave kinematics in an Abaqus/Aqua simulation or to determine when the configuration of the model should be updated in a stochastic wave analysis.(V)UAMP: Use this user subroutine to define an amplitude curve; use with sensors and

17、 actuators for logical modeling applications.Where User Subroutines Fit into Abaqus/Standard (1/5)While a complete understanding of the structure of Abaqus is not required to develop a user subroutine, it helps if the developer has an understanding of at least the overall structure.The following fig

18、ures show the basic flow of data and actions from the start of an Abaqus/Standard analysis to the end of a step. These figures also show a much more detailed accounting of how Abaqus/Standard calculates the element stiffness during an iteration.In these figures a signifies a decision point in the co

19、de or a specific state (i.e., beginning of increment) during the analysis.A signifies an action that is taken during the analysis.Where User Subroutines Fit into Abaqus/Standard (2/5)Beginning of analysisDefine initial conditionsStart of stepStart of incrementStart of iterationDefine KelDefine loads

20、 RaUEXTERNALDBUEXTERNALDBDLOAD, FILM, UTRACLOAD, HETVAL, UWAVECREEP, FRIC, FRIC_COEF, UEL, UELMAT, UEXPAN, UGENS, UMAT, USDFLDUPOREPWhere User Subroutines Fit into Abaqus/Standard (3/5)Write outputSolve Kelc = RaConverged?End of step?UEXTERNALDBURDFILTo start of incrementTo start of iterationTo star

21、t of next stepNoNoYesGlobal flow in Abaqus/StandardWhere User Subroutines Fit into Abaqus/Standard (4/5)Start of incrementCalculate integration point field variable from nodal valuesStart of iterationCalculate DeDefine loads P, P/xCalculate s, FILM, dh/dq, HETVAL r/qUMAT, USDFLDUEL,UELMATDLOAD, UTRA

22、CLOAD, UWAVEFRIC: Dt/Dg UGENS: N/ECREEP: Decr, Desw UEXPAN: DethA more detailed flow of Abaqus/StandardWhere User Subroutines Fit into Abaqus/Standard (5/5)User subroutine calls in the first iterationThe flow chart is idealized. In the first iteration of an increment all of the user subroutines show

23、n in the figure are called twice. During the first call the initial stiffness matrix is being formed using the configuration of the model at the start of the increment.During the second call a new stiffness, based on the updated configuration of the model, is created.In subsequent iterations the sub

24、routines are called only once.In these subsequent iterations the corrections to the models configuration are calculated using the stiffness from the end of the previous iteration.Including User Subroutines in a Model (1/3)To include user subroutines in an analysis, specify the name of a file with th

25、e user parameter on the Abaqus execution command.abaqus job=my_analysis user=my_subroutineThe file should be either source code (my_subroutine.f on Unix or my_subroutine.for on Windows) or an object file (my_analysis.o on Unix or my_subroutine.obj on Windows). The file extension can be included (my_

26、subroutine.f on Unix or my_subroutine.for on Windows); otherwise, Abaqus will determine automatically which type of file is specified.Including User Subroutines in a Model (2/3)In Abaqus/CAE, edit the job attributes to specify the file containing the user subroutine.Including User Subroutines in a M

27、odel (3/3)Using multiple user subroutines in a modelWhen multiple user subroutines are needed in the analysis, the individual routines can be combined into a single file.A given user subroutine (such as UMAT or FILM) should appear only once in the specified user subroutine source or object code.Rest

28、art analysesWhen an analysis that includes a user subroutine is restarted, the user subroutine must be specified again because the subroutine object or source code is not stored on the restart (.res) file.Writing Output from User Subroutines (1/2)The following unit numbers can be used within a user

29、subroutine to read and write data from files:1518100+In Abaqus/Standard user subroutines can write debug output to the message (.msg) file (unit 7) or to the printed output (.dat) file (unit6).These units do not have to be opened within the user subroutine they are opened by Abaqus.Unit 6 can also b

30、e used to write to the status (.sta) file in Abaqus/Explicit.Writing Output from User Subroutines (2/2)Path names for external filesWhen a file is opened in a user subroutine, Abaqus assumes that it is located in the scratch directory created for the simulation. Therefore, full path names must be us

31、ed in the OPEN statements in the subroutine to specify the location of the files.The following example opens, reads and closes an external file: open(unit=15, file=/nfs_scratch/wdir/ndw/TempHist.inp) read(15,*) (timehist(j), j=1,25) i = 1 do while ( .true. ) read(15,*,end=100) index(i),(temphist(i,j

32、), j=1,25) i = i + 1 end do100 close(15)Compiling and Linking User Subroutines (1/2)When a model that contains user subroutines is submitted to Abaqus, the correct compile and link commands should be used automatically.Abaqus includes the correct compile and link commands for every platform on which

33、 Abaqus is supported in the default environment file (abaqus_v6.env) located in the abaqus_dirsite directory.Here abaqus_dir is the directory in which Abaqus was installed.For example, on the Windows release, the following commands are defined in the abaqus_dirsiteabaqus_v6.env file:compile_fortran=

34、ifort /c /Gm /recursive /nologo /include:%Ilink_sl=LINK /nologo /INCREMENTAL:NO /subsystem:console /machine:X86 /NODEFAULTLIB:LIBC.LIB /NODEFAULTLIB:LIBCMT.LIB /DEFAULTLIB:OLDNAMES.LIB /DEFAULTLIB:LIBIFCOREMD.LIB /DEFAULTLIB:LIBIFPORTMD.LIB /DEFAULTLIB:LIBMMD.LIB /DEFAULTLIB:MSVCRT.LIB /DEFAULTLIB:k

35、ernel32.lib /DEFAULTLIB:user32.lib /DEFAULTLIB:advapi32.lib /FIXED:NO /dll /def:%E /out:%U %F %A %BIf you encounter compile or link errors, check that the abaqus_dirsiteabaqus_v6.env file defines the compile and link commands. If it does not, please contact SIMULIA. We will provide you with the corr

36、ect commands for your system.Compiling and Linking User Subroutines (2/2)Fortran compiler levelsThe Fortran compiler levels used to create Abaqus are shown at .For example, Intel Fortran must be installed to run user subroutines on computers running Windows.If the version of your Fortran compiler do

37、es not correspond to that specified on the Abaqus web site, patibilities may occur.Debugging Techniques and Proper Programming Habits (1/12)Some programming habits and suggested debugging techniques are discussed in this section.Required Fortran statementsEvery user subroutine in Abaqus/Standard mus

38、t include the statementinclude aba_param.incas the first statement after the argument list. The file aba_param.inc is installed on the computer system by the Abaqus installation procedure. The file specifies implicit real*8 (a-h, o-z) for double precision machines. The Abaqus execution procedure, wh

39、ich compiles and links the user subroutine with the rest of Abaqus, will include the aba_param.inc file automatically. It is not necessary to find this file and copy it to any particular directory: Abaqus will know where to find it.Every user subroutine in Abaqus/ Explicit must include the statement

40、include vaba_param.incDebugging Techniques and Proper Programming Habits (2/12)Naming conventionsIf user subroutines call other subroutines or use COMMON blocks to pass information, the names of such subroutines or COMMON blocks should begin with the letter K since this letter is never used to start

41、 the name of any subroutine or COMMON block in Abaqus.Subroutine argument listsThe variables passed into a user subroutine via the argument list are classified as either variables to be defined, variables that can be updated, or variables passed in for information.The user must not alter the values

42、of the “variables passed in for information.”Doing so will yield unpredictable results.Debugging Techniques and Proper Programming Habits (3/12)Solution-dependent state variablesSolution-dependent state variables (SDVs) are values that can be defined to evolve with the solution.An example of a solut

43、ion-dependent state variable for the UEL subroutine is strain.Several user subroutines allow the user to define SDVs. Within these user subroutines the SDVs can be defined as functions of any variables passed into the user subroutine.It is the users responsibility to calculate the evolution of the S

44、DVs within the subroutine; Abaqus just stores the variables for the user subroutine.Debugging Techniques and Proper Programming Habits (4/12)Solution-dependent state variables (contd)Space must be allocated to store each of the solution-dependent state variables defined in a user subroutine. For mos

45、t subroutines the number of such variables required at the integration points or nodes is entered as the only value on the data line of the *DEPVAR option.*USER MATERIAL*DEPVAR8Debugging Techniques and Proper Programming Habits (5/12)Solution-dependent state variables (contd)For subroutines (V)UEL,

46、UELMAT, and UGENS the VARIABLES parameter must be used on the *USER ELEMENT and *SHELL GENERAL SECTION options, as appropriate. *USER ELEMENT, VARIABLES=8For subroutine FRIC the number of variables is defined with the DEPVAR parameter on the *FRICTION option.*FRICTION, USER, DEPVAR=8Debugging Techni

47、ques and Proper Programming Habits (6/12)Solution-dependent state variables (contd)There are two methods available for defining the initial values of solution-dependent variables. The *INITIAL CONDITIONS, TYPE=SOLUTION option can be used to define the variable field in a tabular formatFor complicate

48、d cases user subroutine SDVINI can be used to define the initial values of the SDVs (Abaqus/Standard only). Invoke this subroutine by adding the USER parameter to the *INITIAL CONDITIONS, TYPE=SOLUTION option.Debugging Techniques and Proper Programming Habits (7/12)Testing suggestionsAlways develop

49、and test user subroutines on the smallest possible model.Do not include other complicated features, such as contact, unless they are absolutely necessary when testing the subroutine.Test the most basic variant of the user subroutine before adding any new features to it. When appropriate, try to test

50、 the user subroutine with models where only values of the nodal degrees of freedom (displacement, rotations, temperature) are specified. Then test the subroutine with models where fluxes and nodal degrees of freedom are specified.Ensure that arrays passed into a user subroutine with a given dimensio

51、n are not used as if they had a larger dimension.For example, if a user subroutine is written such that the number of SDVs is 10 but only 8 SDVs are specified on the *DEPVAR option, the user subroutine will overwrite data stored by Abaqus with unpredictable consequences.Debugging Techniques and Prop

52、er Programming Habits (8/12)You can interactively debug your user subroutine if you have a debugger installed on your systemFirst you will need to change the compiler options such that the object file includes debug symbolsabaqus info=env | grep compile_fortranFor example, on Windows remove the /On

53、option (optimization) and add the /debug option. On Windows do the same for the link_sl environment variableCopy the variables compile_fortran and link_sl (if necessary) to your abaqus_v6.env file The specific change you will need to make will depend on the platform you are using (see Knowledge Base

54、 Article QA for details)Debugging Techniques and Proper Programming Habits (9/12)Run the job in the following way: abaqus -j jobName user userSub debug exec Here is the name of the debugger you will use (e.g., Totalview, MSDev, etc.).When the debugger appears, open the source of the user subroutine,

55、 add breakpoints, etc. and start the run.The debugger will allow you to probe values of variables and arrays to confirm that the code is working the way it was intended.Debugging Techniques and Proper Programming Habits (10/12)If the analysis aborts with signal 11 (UNIX) or error code 5 (Windows), t

56、he steps to be taken by the user before contacting Abaqus Technical Support areRemove the user subroutine and check if the analysis runs without it.If possible, replace your subroutine with a user subroutine from the Abaqus Verification Guide and check if the analysis runs with this subroutine.Conta

57、ct SIMULIA Technical Support if you determine that any of the variables passed into the user subroutine has an unexpected valueDebugging Techniques and Proper Programming Habits (11/12)An illegal floating point operation (signal 8) error that occurs when a user subroutine is used indicates a bug in the user codingSome com

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论