Fortran中的Abaqus DFLUX子例程 [英] Abaqus DFLUX subroutine in Fortran

查看:207
本文介绍了Fortran中的Abaqus DFLUX子例程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在这里的第一篇文章,希望我能清楚地描述 Abaqus子例程所遇到的问题.我是使用 Fortran 的新手.基本上,我的目标是在横截面开口的管子上定义不均匀的表面热通量,而我正在使用 DFLUX子例程.通量为开放横截面,受结构的自阴影影响,必须相应地定义.显然,在每个积分点都调用了子例程,因此不存储这些点的坐标,并且我每次只有一个点的X,Y,Z值.我想做的是将所有坐标存储在一个数组中,以便我可以比较不同的点以应用热通量的条件.我已经阅读了有关COMMON块或SAVE命令的信息,但是在子例程中找不到如何使用此类选项的信息.我希望我已经足够清楚了.这是我正在使用的子例程:

this is my first post here and I hope I will be clear describing the issues I'm having with Abaqus subroutine. I'm quite a newbie using Fortran. Basically, my goal is to define a non-uniform surface heat flux over an open cross-section tube and I'm using the DFLUX subroutine. Being open cross-section, the flux is influenced by the self-shadowing of the structure and has to be defined accordingly. Apparently the subroutine is called at each integration point, so that the coordinates of these points are not stored and I have each time just X,Y,Z values for a single point. What I'd like to do is to store all the coordinates in one array so that I can compare the different points to apply the conditions for the heat flux. I've read around about COMMON blocks or SAVE command, but I can't find how to use such options in my subroutine. I hope I've been clear enough. This is the subroutine I'm using:

     SUBROUTINE DFLUX(FLUX,SOL,JSTEP,JINC,TIME,NOEL,NPT,COORDS,JLTYP,
 1 TEMP,PRESS,SNAME)

  INCLUDE 'ABA_PARAM.INC'

   REAL X,Y,Z,t,pi,theta
   parameter(pi=3.1415)
   DIMENSION COORDS(3),FLUX(2),TIME(2)

   CHARACTER*80 SNAME

  X=COORDS(1)-0.1 ! X coordinate of the center in global ref
  Y=COORDS(2)+0.1732 ! Y coord of the center in global ref
  Z=COORDS(3)
  t=TIME(2)
  theta=atan2(X,Y)
  if (JSTEP.eq.1) then !Step with heat flux impinging on structure
  !flux dependant on the angle of incidence
      if (theta.ge.0 .and.theta.le.pi/2 .or. theta.le.-pi/2) then
       flux(1)=1400*abs(cos(theta))
       flux(2)=0
    else !shadowed portion of the structure
       flux(1)=0
       flux(2)=0
    endif
  else
     STOP
  endif
  RETURN

  END

推荐答案

背景:Abaqus提供了许多Fortran子例程模板"(固定格式/F77样式),允许用户获取特定信息或在分析过程中(即用户子例程)影响解决方案的某些方面.Abaqus控制何时调用用户子例程,传入/传出什么信息等.用户无法更改其中的任何内容,并且无法访问主程序或其专有源代码.但是,在用户子例程中,用户可以自由编写他们认为必要的任何有效代码.

background: Abaqus provides a number of Fortran subroutine "templates" (in fixed-format/F77 style) that allow users to get specific info or influence certain aspects of the solution during an analysis, aka user-subroutines. Abaqus controls when the user-subroutines are called, what info is passed in/out, etc. Users cannot change any of that, and have no access to the main program or its proprietary source code. However, within a user-subroutine, the user is free to write any valid code they feel is necessary.

在此问题中,OP希望存储每次调用 dflux 用户子例程的信息,以便其他子例程或对 dflux 子例程.注意:此功能不是 dflux 提供的,因此OP需要解决方法.

In this question, the OP wants to store information from each call to the dflux user-subroutine so that it is available to other subroutines or to other calls to the dflux subroutine. Note: this capability is not provided by dflux, so the OP needs a work-around.

可能的解决方法:幸运的是, dflux 用户子例程提供了当前调用的元素编号,积分点编号和空间坐标.此信息可能可以用于存储(和访问)您需要的任何数据.数据存储/传输方法可以通过COMMON块,Fortran模块或什至文本文件或其他外部数据库"来实现.

possible work-arounds: Luckily, the dflux user-subroutine provides the element number, the integration point number, and the spatial coords for the current call. This info can probably be used to store (and access) any data you need. The data storage/transfer method might be accomplished through a COMMON block, a Fortran module, or even a text file or some other external "database".

> 我推荐基于模块的方法.但是,请参见此答案,以获取有关如何同时使用公共块和模块的良好解释.

> I recommend the module-based approach. However, see this answer for a good explanation of how to use both COMMON blocks and modules.

(EDIT)为完整起见,可以将一个带有模块和abaqus子例程的非常简单的示例构建为:

(EDIT) For completeness, a very simple example with a module and an abaqus subroutine could be structured something like:

module data_mod
  ! Any routine may access this module with the statement: "USE data_mod".
  ! Any variable within the module is then shared by those routines.

  implicit none

  ! You can use an allocatable array, but for this example I will assume
  ! there are 1000 or fewer points, and up to 10 values for each.
  real, dimension(1000,10) :: point_data

end module data_mod


subroutine dflux(....all the args...)
  ! Note: you must "USE" modules before any other statements in the routine.

  use data_mod

  ! Now you may carry on with the rest of your code. 
  ! Be sure to have the required "INCLUDE 'ABA_PARAM.INC" statement,
  ! which defines how abaqus implements "IMPLICIT REAL" for your machine,
  ! and all of the boilerplate variable declarations included with the 
  ! DFLUX subroutine template.

  include 'aba_param.inc'
  (...etc...)

  ! For simplicity, I am assuming you have a unique ID for each point, and
  ! each ID is numerically equal to one of the row indices in 'point_data'.
  ! When ready to read/write data in the 'point_data' array:

  ! Read data:
  neighbor_vals(:) = point_data(NEIGHBOR_ID, 2:)
  old_data_at_current_point(:) = point_data(ID, 2:)

  (...etc...)

  ! Write data:
  point_data(ID,2:4) = coords(:)
  point_data(ID,5) = result1
  point_data(ID,6) = result2

end subroutine dflux

> 您将需要选择一种数据容器和一些巧妙的组织概念-也许使用元素编号,积分点编号或(x,y,z)坐标唯一地标识您要存储的数据.例如,一个简单的二维(MxN)数组可能就足够了:每一行代表第M 个积分点,第一列包含唯一的点标识符,其余列则包含任何您希望从每个点存储的值.注意:确定哪些点是邻居"是您需要一个聪明的解决方案的另一个主题.完成此操作后,也许也可以将相邻点存储在数组中,以加快访问速度.

> You will need to choose a type of data container and some clever organizational concept - perhaps using the element number, integration point number, or the (x,y,z) coordinates to uniquely identify the data you want to store. For instance, a simple 2-dimensional (MxN) array might be sufficient: each row represents the Mth integration point, the first column contains the unique point identifier(s), and the remaining columns contain any values you want to store from each point. Note: Determining which points are "neighbors" is another topic you will need a clever solution for. Once you've done this, perhaps neighboring points can be stored in the array as well, for faster access.

> 您可以从存储在数据容器中的其他集成点安全地读取数据,但不要写入/更改存储在数据容器中的值(无论是在COMMON块中还是在模块中)),除非用于当前正在调用 dflux 的当前集成点.

> You are safe reading data from other integration points stored in the data container, but do not write/change the values stored in the data container (whether it is within a COMMON block or a module) unless it is for the current integration point where dflux is currently being called.

旁注:

  1. 新用户经常认为他们被困在Abaqus用户子例程中编写FORTRAN 77.不是.
  2. 将模块与abaqus用户子例程一起使用的最简单方法是将它们放在文件的顶部.然后,Abaqus将在您运行分析时自动编译并链接它们.

这篇关于Fortran中的Abaqus DFLUX子例程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆