Author Topic: Efficient method to read data into material model  (Read 10178 times)

ekbon

  • Jr. Member
  • **
  • Posts: 13
Efficient method to read data into material model
« on: November 01, 2023, 10:21:45 AM »
Dear all,

I have a material model that reads data from a file that denotes a respective Youngs Modulus to each element in the model.
I am currently doing this within the umatl routine, where I write the values to the history variable as follows:
Code: [Select]
if(isw.eq.14) then
!   Initialise history variable values in hn(*)
   
    ! Read element densities   
    open (unit=io, file=file_name)
        do i = 1,numel
                read(io,*) temp            ! decimal [0:1]
                if (i.eq.n_el) then
                    hn(i) = temp*ud(1)  ! multiply by Youngs Modulus constant
                    exit
                endif
        enddo
    close(io)
   
else
!   Compute and output stress (sig) and tangent moduli (dd)
    ... ! calculation using hn(n_el)
endif

However, this method requires opening the file and reading the contents for every element up until the current element number (n_el). Additionally, this occurs for every node of the element.

I would like to be able to read the file the whole way through just once and assign the values to the history variables.

From what I've seen in other forum posts this should be done in isw=1. However, I assign the size of history variable arrays in the umati routine (which is isw=1), therefore it wouldn't be possible to do this there.

Any advice on this matter would be greatly appreciated. I have attached the umatl file for context.
Thank you,
Elliot

Prof. R.L. Taylor

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 2649
Re: Efficient method to read data into material model
« Reply #1 on: November 01, 2023, 10:39:55 AM »
You could write a user mesh input routine to read the data into a history array in element number order.  Then in your element you access the 'n_el' (ver8.6) entry as this is the element being processed.  Earlier versions of the variable was 'n'.  These are in: include 'eldata.h'.

You should use a ualloc.f and assign the "up(i)" value you want to use then in your element you can access from "hr(up(i)+n_el-1)".

ekbon

  • Jr. Member
  • **
  • Posts: 13
Re: Efficient method to read data into material model
« Reply #2 on: November 03, 2023, 08:29:21 AM »
Dear Prof. Taylor,

Thank you for this advice. It has achieved exactly what I was aiming for.

Best,
Elliot