Fluids

Fluids

how are line elements split in ansys aqwa

Tagged: 

    • pc
      Subscriber

      line elements cannot be split in design modeler, so my question is how will aqwa find only the submerged portion of a brace which I made using line elements to calculate morison force

    • Mike Pettit
      Ansys Employee

      Hello,

      For Morison elements, the Aqwa solver automatically determines the waterline location from the instantaneous element position, and the water level (in a frequency domain analysis) or the wave surface elevation (in a time domain analysis). In other words, the 'split' is performed internally by the Aqwa solver, so you do not need to worry about splitting the line element in the geometry editor.

      I hope this helps; please let me know if you have any other questions.

      Cheers, Mike

      • pc
        Subscriber

        Thanks Mike, It's a relief to find out that the split is performed internally

        I have another question regarding using DLL to include external load
        Is there any limit to the no.of times the DLL will be called in Hydrodynamic Response module, because I ran the simulation for 60 sec with 0.2 sec as time step, the external force is caluclated for only 50.8 sec and after that it is zero. I have tried several time steps and total simulation time and found that the DLL is being called for only 254 times and after that it is zero every time

        Could you explain what is happening?

        Thanks, PC

        • Mike Pettit
          Ansys Employee

          Hello,

          There's no limit that I'm aware of. How are you creating the DLL?

          For applying user-defined force functions, it might be easier to connect to a Python server - then you do not need to compile a DLL, and the force function can be written in Python. There's an example of this included in the installation, in e.g. C:\Program Files\ANSYS Inc\v222\aqwa\utils\ExternalForceCalculation.

          Mike

    • pc
      Subscriber

      I am compiling a C program to create a DLL using Dev C++. I am not really familiar with python
      Do you have any troubleshooting tips, where I could have done a mistake

      • Mike Pettit
        Ansys Employee

        Are you able to paste the C code here? I am not allowed to download any files from this forum, but I can look at text/screenshots.

        Mike

        • pc
          Subscriber

          /* Replace "dll.h" with the name of your header */
          #include "user_force.h"
          #include
          #include
          #include

          DLLIMPORT void USER_FORCE(int* Mode , int I_Control[100] , float R_Control[100] ,
                                     int* Nstruc , float* Time , float* TimeStep , int* Stage ,
                                     float Position[][6] , float Velocity[][6] , float Cog[][3] ,
                                     float Force[][6] , float Addmass[][6][6] , int* ErrorFlag)
           
          //
          // *** Visual C++ Template
          // -----------------------
          //
          // 1. Uses stdcall calling convention
          // 2. Routine name MUST be in upper case
          // 3. All parameters are passed as pointers
          //
          // 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
          //                        ADDMAS are assumed undefined on exit.
          //                        IERR if set to > 0 on exit will cause
          //                        the simulation to stop.
          //
          //                   1  = Called during the simulation. FORCE/ADDMAS 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.
          // (int*)
          //
          // R_Control[100]  - User-defined real control parameters input in .DAT file.
          // (float*)
          //
          // Nstruc int*     - Number of structures in the the simulation
          //
          // Time float*     - The current time (see Stage below)
          //
          // Timestep float* - The current timestep
          //
          // 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. e.g. if the
          //                   initial time is 0.0 and the step 1.0 seconds then calls are as
          //                   follows for the 1st 2 integration steps:
          //
          //                   CALL USER_FORCE(.....,TIME=0.0,TIMESTEP=1,STAGE=1 ...)
          //                   CALL USER_FORCE(.....,TIME=1.0,TIMESTEP=1,STAGE=2 ...)
          //                   CALL USER_FORCE(.....,TIME=1.0,TIMESTEP=2,STAGE=1 ...)
          //                   CALL USER_FORCE(.....,TIME=2.0,TIMESTEP=2,STAGE=2 ...)
          //
          // Cog[Nstruc][3]  - Position of the Centre of Gravity in the Definition axes.
          //
          // Position[Nstruc][6] - Position of the structure in the FRA - angles in radians
          // (float*)
          //
          // Velocity[Nstruc][6] - Velocity of the structure in the FRA
          // (float*)              angular velocity in rad/s
          //
          //
          // Output Parameter Description:
          //
          // Force[Nstruc,6] - Force on the Centre of gravity of the structure. NB: these
          // (float)           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[Nstruc,6,6]
          // (float)         - 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 int*  - 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.
                         
          {
              // DECLARATION SECTION
              /*indices*/
              int i, j;                // indices for controlling loops
              /* External additional forces*/
              float F_ext[6];
              float F_gyro[6];                          // Gyroscopic Moments (forces will be zero)
              
              for (i = 0; i<6; i++){
                  F_ext[i] = 0;
                  F_gyro[i] = 0;
              }

              int struc = 0;                // Only one structure
              
              /* Inputs from AQUA*/
              float Ir = 12 , omega=50 ;            // Rotor inertia
              float I_rOmega_r[3];    // Rotor second mass moment of inertia in kg m^2
             

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

              if ( *Mode == 0 )
              {
              }

          //------------------------------------------------------------------------
          // MODE#1 - On-going - calculation of forces/mass
          //------------------------------------------------------------------------

              else if ( *Mode == 1 )
              {
                  for ( struc = 0 ; struc < *Nstruc ; struc++ )
                  {                        
                       // Gyroscopic effect calculations
                      
                          I_rOmega_r[0] = 0;
                          I_rOmega_r[1] = 0; 
                          I_rOmega_r[2] = Ir*omega;
                      
                      // Gyroscopic effect module
                      for (j = 0; j <3; j++){
                          F_gyro[j] = 0;
                          F_gyro[j+3] = 0;
                      }
                                                              
                      // dot product of Velocity with I_rOmega_r
                      F_gyro[3] = Velocity[struc][4] * I_rOmega_r[2] - Velocity[struc][5] * I_rOmega_r[1]; 
                      F_gyro[4] = Velocity[struc][5] * I_rOmega_r[0] - Velocity[struc][3] * I_rOmega_r[2]; 
                      F_gyro[5] = Velocity[struc][3] * I_rOmega_r[1] - Velocity[struc][4] * I_rOmega_r[0];
                      
                      
                      
                      //  Sum of all external force
                      for ( i =0 ; i < 6 ; i++ )
                      {
                          F_ext[i] = F_gyro[i]    
                      }

                      
                      for ( i = 0 ; i < 6 ; i++ )
                      {
                          Force[struc][i] += F_ext[i]; 
                          
                          for ( j = 0 ; j < 6 ; j++ )
                          {
                              Addmass[struc][i][j] += 0.0;
                          }
                      }
                  }
                  *ErrorFlag = 0;
              }

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

              else if ( *Mode == 99 )
              {
              }

          //------------------------------------------------------------------------
          // MODE# ERROR - OUTPUT ERROR MESSAGE
          //------------------------------------------------------------------------

              else
              {
              }
              return;

          }
          BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
          {
              switch(fdwReason)
              {
                  case DLL_PROCESS_ATTACH:
                  {
                      break;
                  }
                  case DLL_PROCESS_DETACH:
                  {
                      break;
                  }
                  case DLL_THREAD_ATTACH:
                  {
                      break;
                  }
                  case DLL_THREAD_DETACH:
                  {
                      break;
                  }
              }
              
              /* Return TRUE on success, FALSE on failure */
              return TRUE;
          }

Viewing 2 reply threads
  • You must be logged in to reply to this topic.