Author Topic: enabling d(*) in user material  (Read 6214 times)

Schandra

  • Full Member
  • ***
  • Posts: 82
enabling d(*) in user material
« on: March 21, 2017, 03:55:26 AM »
Dear Feap community,

Task: Read material parameters from input file for a user material.

I have downloaded and modified example files for microsphere model provided by Prof. Govindjee.
When I change the argument  from ud(*) to d(*), I get an error that residual norm is NAN or Inf.
I guess I am doing something fundamentally wrong. I am attaching the modified files.
Can you please help me in rectifying the issue.

Warm Regards,
Chandra

Prof. R.L. Taylor

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 2649
Re: enabling d(*) in user material
« Reply #1 on: March 21, 2017, 01:58:31 PM »
You should have access to both d(*) and ud(*) in user material model, however, you should never change values in the d(*) array as the elements are using some of them to get shape functions and other parameters needed for each element.  For user material models always use the array ud(*) for the things belonging to that material.  The meaning of each ud(*) is controled by what you assign in the umati* module.

Schandra

  • Full Member
  • ***
  • Posts: 82
Re: enabling d(*) in user material
« Reply #2 on: March 22, 2017, 12:46:33 AM »
Dear Prof.Taylor,

Thanks for taking time to reply me. I realize the mistake that I was doing.
To clarify again, my input file arguments are as follows:

0.0d0 1.d0 1.d0 300.d0 1.0d0 2.d0 1.d5 1.d0 3.d0 9.d0
29800.d0 19800.d0
1.06d-5 37.25d0 2.944d0 0.d0 0.0d0 0.d0
2.d7 3.d0
2.d0 38.d0
1400.d0 100.d0 -79.2d0 -0.3d0 5.d1 5.d-2 5.d1 5.d-2 5.d0 5.d0 1.d0

Hence, I have modified umati file to look like this:
 
if(pcomp(type,'mat2',4)) then     ! Default form: DO NOT CHANGE
   type = 'micro2'                ! Specify new 'name'
c
c Input user data and save in ud(*) array
c
else 
   text(1) = 'micro2'
   do while (.not.pcomp(text(1),'    ',4))
      errck  = pinput(td,11)
c
      call pinput(td,10)
        do i = 1,10
          ud(i) = td(i)
        end do
c       
      call pinput(td(11),2)
        do i = 1,2
          ud(i+10) = td(i+10)
        end do
c
      call pinput(td(13),6) 
        do i=1,6
          ud(i+12) = td(i+12)
        end do
c
      call pinput(td(19),2)
        do i =1,2
          ud(i+18) = td(i+18)
        end do
c
      call pinput(td(21),2)
        do i=1,2
          ud(i+20) = td(i+20)
        end do
c
      call pinput(td(23),11) 
        do i=1,11
          ud(i+22) = td(i+22)
        end do
c
   end do     
end if

Can you please let me know if this is the ideal way of doing it.

Regards,
Chandra

Prof. R.L. Taylor

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 2649
Re: enabling d(*) in user material
« Reply #3 on: March 22, 2017, 08:27:38 AM »
You can use this, but there are two things I would change.  First always read into td(1:n) where n is the size you want, then move to ud(*) in the position you need.

Second, there does not seem to be an exit from your while loop, you need to set the character array to an exit value.

Personally, I like to use tinput(tx,n1,td,n2) where tx is a character array with a name that defines the data you are to input.  We do this for things like ELAStic ISOTropic  e  nu
You can use the character compare PCOMP to check what data you are getting in tx.
The while loop allows for data to be in any order.

Schandra

  • Full Member
  • ***
  • Posts: 82
Re: enabling d(*) in user material
« Reply #4 on: March 22, 2017, 08:32:45 AM »
Thanks for your suggestions Prof.Taylor. I shall modify accordingly.

Schandra

  • Full Member
  • ***
  • Posts: 82
Re: enabling d(*) in user material
« Reply #5 on: May 03, 2017, 03:03:45 AM »
Dear all,

As I wanted the data to be this way in the input file:
0.0d0 1.d0 1.d0 300.d0 1.0d0 2.d0 1.d5 1.d0 3.d0 9.d0
29800.d0 19800.d0
1.06d-5 37.25d0 2.944d0 0.d0 0.0d0 0.d0
2.d7 3.d0
2.d0 38.d0
1400.d0 100.d0 -79.2d0 -0.3d0 5.d1 5.d-2 5.d1 5.d-2 5.d0 5.d0 2.d0

I have modified the umati file to look like this:
Code: [Select]
     implicit  none
c
      logical   pcomp
      character type*15
      integer   n1,n3,i
      real*8    vv(6),d(*),ud(32),td(16)
      include   'errchk.h'
      include   'iofile.h'
c
1   continue
      type = 'fglfin'
      do while (pcomp(type,'fglfin',6))
c
           call pinput(td,10)
             do i = 1,10
               ud(i) = td(i)
             end do
c
            call pinput(td,2)
             do i = 1,2
               ud(i+10) = td(i+10)
             end do
c
            call pinput(td,6)
             do i = 1,6
               ud(i+12) = td(i+12)
             end do
c
            call pinput(td,2)
             do i = 1,2
               ud(i+18) = td(i+18)
             end do
c
            call pinput(td,2)
             do i = 1,2
               ud(i+20) = td(i+20)
             end do
c
            call pinput(td,11)
             do i = 1,11
               ud(i+22) = td(i+22)
             end do
c
        if(errck) write(*,*) 'error'
        goto 1
       end do
       end

I am still doubtful if I am doing it correctly. Can someone please correct me in case I am wrong..

Warm Regards,
Chandra
« Last Edit: May 03, 2017, 03:08:01 AM by schandra »

Schandra

  • Full Member
  • ***
  • Posts: 82
Re: enabling d(*) in user material
« Reply #6 on: May 03, 2017, 06:32:36 AM »
Dear all,

I have the following code for my umati.
Code: [Select]
      implicit  none
c
      logical   pcomp,tinput
      character type*15,text(1)
      integer   n1,n3,i
      real*8    vv(6),d(*),ud(33),td(11)
      include   'errchk.h'
      include   'iofile.h'
c
      if(pcomp(type,'mat2',4)) then     ! Default form: DO NOT CHANGE
        type = 'mysma'
      else
        text(1) = 'xxxx'
        do while (.not.pcomp(text(1),'    ',4))
          errck  = tinput(text,1,td,3)
c
          if (pcomp(text(1),'gene',4)) then
              ud(1) = td(1)
              ud(2) = td(2)
              ud(3) = td(3)
              ud(4) = td(4)
              ud(5) = td(5)
              ud(6) = td(6)
              ud(7) = td(7)
              ud(8) = td(8)
              ud(9) = td(9)
              ud(10) = td(10)
          elseif (pcomp(text(1),'elas',4)) then
              ud(11) = td(1)
              ud(12) = td(2)
          elseif (pcomp(text(1),'ther',4)) then
              ud(13) = td(1)
              ud(14) = td(2)
              ud(15) = td(3)
              ud(16) = td(4)
              ud(17) = td(5)
              ud(18) = td(6)
          elseif (pcomp(text(1),'visc',4)) then
              ud(19) = td(1)
              ud(20) = td(2)
          elseif (pcomp(text(1),'prin',4)) then
              ud(21) = td(1)
              ud(22) = td(2)
          elseif (pcomp(text(1),'fglf',4)) then
              ud(23) = td(1)
              ud(24) = td(2)
              ud(25) = td(3)
              ud(26) = td(4)
              ud(27) = td(5)
              ud(28) = td(6)
              ud(29) = td(7)
              ud(30) = td(8)
              ud(31) = td(9)
              ud(32) = td(10)
              ud(33) = td(11)
          endif
         end do
       end if
      end

and I have included this in my input file.

Code: [Select]
mate 1
user 10
ucon mysma
gene 2.0d0 1.d0 1.d0 300.d0 1.0d0 2.d0 1.d5 1.d0 3.d0 9.d0
elas 29190.d0 15037.d0
ther 1.06d-5 37.25d0 2.944d0 0.d0 0.0d0 0.d0
visc 2.d7 3.d0
prin 2.d0 44.d0
fglf 1400.d0 0.d0 253.d0 273.d0 50.d0 0.046d0 0.d0 0.d0 5.d0 5.d0 2.d0


can you please let me know if this is the correct way of definition in umati file.

Warm Regards,
Chandra

Prof. R.L. Taylor

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 2649
Re: enabling d(*) in user material
« Reply #7 on: May 03, 2017, 07:56:52 AM »
all looks good except the "tinput" record.  You tell it "1" character variable and "3" data variables  but you are reading 10 on some lines.   so it should be tinput(text,1,td,10)
Also the character variable should be 15,
   character  text(1)*15

Schandra

  • Full Member
  • ***
  • Posts: 82
Re: enabling d(*) in user material
« Reply #8 on: May 03, 2017, 08:03:43 AM »
Thank you Prof. Taylor.

Schandra

  • Full Member
  • ***
  • Posts: 82
Re: enabling d(*) in user material
« Reply #9 on: May 03, 2017, 08:28:42 AM »
Dear Prof. Taylor,

I am still unclear on the following code:
Code: [Select]

........
      text(1) = 'xxxx'
        do while (.not.pcomp(text(1),'    ',4))
          errck  = tinput(text,1,td,11)
........

Can you please briefly explain the above three lines of the code.

Warm Regards,
Chandra