Fortran Coder

在AQWA中添加Fortran subroutine user_force

查看数: 2601 | 评论数: 4 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2023-2-15 10:12

正文摘要:

这个代码是我在ansys help里找到的例子,标红部分是自己写的,FORCE 函数是POSITION函数前后差值取绝对值的累加,但是在AQWA中计算出来的结果数据不对,正确的应该相邻前后两次的FORCE和POSITION的差值相等才对。 很 ...

回复

AQWA!!!! 发表于 2023-2-15 10:17:16
[img][/img]
AQWA!!!! 发表于 2023-2-15 10:14:57
IF (MODE.EQ.0) THEN
        CONTINUE
       
ELSEIF (MODE.EQ.1) THEN
   
        dx = abs(POSITION(3,1) - x)
    a1 = a1 + dx
        x = POSITION(3,1)
        FORCE(3,1) = a1
       
       
        ADDMASS = 0
        ERRORFLAG = 0
       
       
ENDIF
RETURN

END SUBROUTINE USER_FORCE
       

!
! Input Parameter Description:
!
! MODE(Int)     - 0 = Initialisation. This routine is called once with mode 0
!                     before the simulation. All parameters are as described
!                     below except for STAGE, which is undefined. FORCES and
!                     ADDMASS are assumed undefined on exit.
!                     IERR if set to > 0 on exit will cause
!                     the simulation to stop.
!
!                 1 = Called during the simulation. FORCE/ADDMASS output expected.
!
!                99 = Termination. This routine is called once with mode 99
!                     at the end of the simulation.
!
! I_CONTROL(100)- User-defined integer control parameters input in .DAT file.
! R_CONTROL(100)- User-defined real control parameters input in .DAT file.
!
! NSTRUC(Int)   - Number of structures in the simulation
!
! TIME          - The current time (see STAGE below)
!
! TIMESTEP      - The timestep size (DT, see STAGE below)
!
! STAGE(Int)    - The stage of the integration scheme. AQWA time integration is
!                 based on a 2-stage predictor corrector method. This routine is
!                 therefore called twice at each timestep, once with STAGE=1 and
!                 once with STAGE=2. On stage 2 the position and velocity are
!                 predictions of the position and velocity at TIME+DT.
!                 e.g. if the initial time is 0.0 and the step 1.0 seconds then
!                 calls are as follows for the 1st 3 integration steps:
!
!                 CALL USER_FORCE(.....,TIME=0.0,TIMESTEP=1.0,STAGE=1 ...)
!                 CALL USER_FORCE(.....,TIME=0.0,TIMESTEP=1.0,STAGE=2 ...)
!                 CALL USER_FORCE(.....,TIME=1.0,TIMESTEP=1.0,STAGE=1 ...)
!                 CALL USER_FORCE(.....,TIME=1.0,TIMESTEP=1.0,STAGE=2 ...)
!                 CALL USER_FORCE(.....,TIME=2.0,TIMESTEP=1.0,STAGE=1 ...)
!                 CALL USER_FORCE(.....,TIME=2.0,TIMESTEP=1.0,STAGE=2 ...)
!
! COG(3,NSTRUC) - Position of the Centre of Gravity in the Definition axes.
!
! POSITION(6,NSTRUC) - Position of the structure in the FRA - angles in radians
!
! VELOCITY(6,NSTRUC) - Velocity of the structure in the FRA
!                      angular velocity in rad/s
!
!
! Output Parameter Description:
!
! FORCE(6,NSTRUC) - Force on the Centre of gravity of the structure. NB: these
!                   forces are applied in the Fixed Reference axis e.g.
!                   the surge(X) force is ALWAYS IN THE SAME DIRECTION i.e. in
!                   the direction of the X fixed reference axis.
!
! ADDMASS(6,6,NSTRUC)
!                 - Added mass matrix for each structure. As the value of the
!                   acceleration is dependent on FORCES, this matrix may be used
!                   to apply inertia type forces to the structure. This mass
!                   will be added to the total added mass of the structure at
!                   each timestep at each stage.
!
! ERRORFLAG       - Error flag. The program will abort at any time if this
!                   error flag is non-zero. The values of the error flag will
!                   be output in the abort message.

!------------------------------------------------------------------------
! MODE=0 - Initialise any summing variables/open/create files.
!          This mode is executed once before the simulation begins.
!------------------------------------------------------------------------


!------------------------------------------------------------------------
! MODE=1 - On-going - calculation of forces/mass
!------------------------------------------------------------------------


!------------------------------------------------------------------------
! MODE=99 - Termination - Output/print any summaries required/Close Files
!           This mode is executed once at the end of the simulation
!------------------------------------------------------------------------

      !ELSEIF (MODE.EQ.99) THEN
         
         
         
         


!------------------------------------------------------------------------
! MODE# ERROR - OUTPUT ERROR MESSAGE
!------------------------------------------------------------------------
AQWA!!!! 发表于 2023-2-15 10:14:14
咋没显示全,我把剩余代码和仿真截图放这里

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-12-26 05:08

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表