Author Topic: Accommodating different size of array s for stress, node  (Read 16940 times)

sg

  • New Member
  • *
  • Posts: 7
Accommodating different size of array s for stress, node
« on: July 25, 2024, 10:57:53 AM »
I have a question regarding the use of STRE, NODE command in FEAP v8.6

In my parent user element, subroutines for isw = 3 and isw = 8 are called. Each isw returns array s and p. However, sizes of these arrays differ for both the cases. In isw = 3,  s = (nst,*), while for isw=8, s = (nen,*).
 
Since array s is declared once at the start of parent element, how can it be declared again with a different size before calling either of the subroutines (isw=3 or isw=8) to accommodate size difference in each one of them? Fortran does not allow 2D assumed-size arrays.
 
Attached here is the user element for reference.

Prof. R.L. Taylor

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 2649
Re: Accommodating different size of array s for stress, node
« Reply #1 on: July 27, 2024, 01:22:43 PM »
The pointer is changed between calls 3 & 8

sg

  • New Member
  • *
  • Posts: 7
Re: Accommodating different size of array s for stress, node
« Reply #2 on: July 28, 2024, 09:12:03 PM »
I have a user subroutine that computes quantities for nodal projections. In ver 8.4, I write projected values using hr(np(58)+(i-1) + j*numnp) array where i is the counter over number of nodal points and j is the counter over projected quantities. It is giving me correct values.

In ver 8.6, I change the array to hr(npnp+numnm+(i-1)*istv+j) where i goes from 1 to numnm. But it is writing all zeros. Am I pointing to correct position in the history variable?

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1164
Re: Accommodating different size of array s for stress, node
« Reply #3 on: July 29, 2024, 08:08:11 AM »
This looks incorrect.

The base location is correct hr(npnp+numnm).  But from a look at program/p_paraview.f it looks like the layout is that the stresses are to be thought of as being in a NUMNM by ISTV two dimensional array.  Which I think says you should think of i=1:numnm and j=1:istv and then you can use hr(npnp+numnm + (j-1)*numnm + i).

Hopefully I got this correct.  I find it helpful to use the version of comblk.h that has the target attribute
Code: [Select]
!-----[--+---------+---------+---------+---------+---------+---------+-]
!     Modification log                                  Date(dd/mm/year)
!     1. Increase dimension to 1024 to force loops on        03/10/2011
!        long arrays

      real (kind=8), target:: hr
      integer ,      target::           mr
      common /comblk/ hr(1024),mr(1024)
Then you can more convieniently index into hr( ) with code like
Code: [Select]
real (kind=8), pointer :: sig(:,:)
sig(1:numnm,1:istv) => hr(npnp+numnm : npnp+numnm+numnum*istv-1)
If you do this then the indexing is just sig(node , projected_component).

sg

  • New Member
  • *
  • Posts: 7
Re: Accommodating different size of array s for stress, node
« Reply #4 on: July 29, 2024, 02:30:29 PM »
Thank you, Prof Govindjee.

I checked my output file and I see that STREss,node,#,# command is giving 'All values zero'. This is strange since the code and user subroutine for nodal projections are the same that give correct values for v8.4. Could you please help me identify what might be going wrong here? Attached here are my input and output files.

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1164
Re: Accommodating different size of array s for stress, node
« Reply #5 on: July 29, 2024, 04:13:58 PM »
There is not nearly enough information given to be able to help you.  I suggest you follow the model used by the example element given in the programmer's manual or other posted elements on the internet.  Attached is a simple element for ver8.6 that solves the elastic torsion problem.
« Last Edit: July 29, 2024, 04:16:53 PM by Prof. S. Govindjee »

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1164
Re: Accommodating different size of array s for stress, node
« Reply #6 on: July 29, 2024, 04:17:44 PM »
Attachment is here.

Prof. R.L. Taylor

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 2649
Re: Accommodating different size of array s for stress, node
« Reply #7 on: July 29, 2024, 04:38:26 PM »
Starting in ver 8.6 the stresses are not projected across element interfaces, thus. you should do the projections into the local arrays in the elements (usually passed as P & S).  Otherwise you will have problems with what you were doing before.

sg

  • New Member
  • *
  • Posts: 7
Re: Accommodating different size of array s for stress, node
« Reply #8 on: July 30, 2024, 12:18:04 AM »
I made the following changes to make the stress nodal projections of ver 8.4 to work in ver 8.6:

1. Defined 'pstyp = ndm' under isw=1. Without this variable, element projection arrays are not assembled into global array in 'passble.f' and projection command returns zero values.
2. The projected values are written using hr(npnp+numnm+(i-1)*numnm+j-1) where i is the counter from 1 to istv and j is the counter from 1 to numnm.

Thank you Prof. Govindjee and Prof. Taylor for your help.

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1164
Re: Accommodating different size of array s for stress, node
« Reply #9 on: July 30, 2024, 06:37:38 AM »
Good.

Sometimes it is useful to look at the user stubs given in user/  for example user/elmt01.f even if you are experienced with FEAP.  The element stubs, for example, have the following lines
Code: [Select]
      elseif(isw.eq.1) then                ! Input material set data
!       pstyp = ???                        ! Sets plot dimension (1,2,3)
                                           ! If set to zero not plotted