VUAMP subroutine
VUAMP subroutine
(OP)
Dear users!
I have made interface for coupled simulations using VUAMP subroutine. I import value of loads with VUAMP subroutine to prescribe node forces of model in every increment...It's working fine, but when I tried to simulate bigger problem (Number of nodes>5000) there is a problem with computational time. I think that the main problem is that the VUAMP subroutine is called for every user amplitude (5000nodesx3directions=15000 amplitudes) in every increment. I have values of loads in .txt file...and subroutine also read these data in every increment 15000 times.
Now I'm wondering if there is any possibility to reduce number of calls for suboutine and import multiple amplitudes at one time?
Thank you for your answers!
Regards
I have made interface for coupled simulations using VUAMP subroutine. I import value of loads with VUAMP subroutine to prescribe node forces of model in every increment...It's working fine, but when I tried to simulate bigger problem (Number of nodes>5000) there is a problem with computational time. I think that the main problem is that the VUAMP subroutine is called for every user amplitude (5000nodesx3directions=15000 amplitudes) in every increment. I have values of loads in .txt file...and subroutine also read these data in every increment 15000 times.
Now I'm wondering if there is any possibility to reduce number of calls for suboutine and import multiple amplitudes at one time?
Thank you for your answers!
Regards





RE: VUAMP subroutine
You can read all amplitudes from *.txt files at once at the beginning and save it in memory.
It will not change total number of VUAMP calls but maybe it will cut down time of one call.
Regards,
Bartosz
VIM filetype plugin for Abaqus
https://github.com/gradzikb/vim-abaqus
RE: VUAMP subroutine
Thank you for your answer. I alredy tried to read all amplitudes only at first call, but it looks like fortran subroutine doesn't remember array...what you mean with "saving in memory" ?
Regards,
Nejc
RE: VUAMP subroutine
You are right by default FORTRAN does not preserve values of local variables between a subroutine calls.
This is why VUAMP subroutine has "svars" array where you can store real values and the values will be keep between VUAMP calls.
Each user amplitude has his own "svars" array and the size is from 1 to "nSvars". "nsvars" is set in inputdeck with keyword *AMPLITUDE, VARIABLE=nsvras.
Just store your data into "svars" array and then the values will be always available for you in each call.
By the way, you import amplitude values from external file, it means all values are explicitly known to you before you start analysis, am I right?
What is a reason to use VUAMP in this case? Do you use sensors and the load is not time dependent?
Regards,
Bartosz
VIM filetype plugin for Abaqus
https://github.com/gradzikb/vim-abaqus
RE: VUAMP subroutine
Thank you for your information. I suppose that you have solved my problem!
Yes, you are almost right all values are explicitly known before each time increment (explicit simulation). I developed interface for coupled simulations based on geometry and load transfer. In "outer code" contact forces are computed (discrete particle method) and then I use VUAMP to prescribe nodal forces to every node in Abaqus...after that I export nodal coordinates with VUFIELD to "outer code" and again compute contact forces...
We will use this interface to simulate behaviour of porous spheres in sandwich structures and there are also many other possibilities to use this interface.
If you are interested in additional information about interface and its ability, do not hesitate to contact me.
Thank you again!
Best regards,
Nejc
RE: VUAMP subroutine
I used your suggestion in my code, but when I checked amplitudes and svars values I noticed that values are non-zero only in first call-therefore for first amplitude.
Below is my subroutine (this is only simple case of VUAMP) - I use one additional file (unreaded.txt) for checking if I have already read values in svars (my "outer code" will later generate this file before every new time increment). But in second call there are no values in svars array...interesting is that in second time increment (unreaded.txt stay deleted from previous increment) I also get right amplitudes from svars for first call...
Is there maybe any command to save svars array for all calls?
CODE --> F77
c user amplitude subroutine Subroutine vuamp( C passed in for information and state variables * ampName, time, ampValueOld, dt, nprops, props, nSvars, svars, * lFlagsInfo, nSensor, sensorValues, sensorNames, * jSensorLookUpTable, C to be defined * ampValueNew, * lFlagsDefine, * AmpDerivative, AmpSecDerivative, AmpIncIntegral) include 'vaba_param.inc' C svars - additional state variables, similar to (V)UEL dimension sensorValues(nSensor), svars(nSvars) dimension props(nprops) character*80 sensorNames(nSensor) character*80 ampName c reason in vektor definition integer reason,i,J real array(2,2) LOGICAL, SAVE :: notFirstTime logical OK character direction character node parameter(zero=0.e0, one = 1.e0, two = 2.e0, ome5=1.e-5, * half = 0.5d0) double precision oned, zerod, twod, tim, tStart, tEnd, S c double precision ampValueNew, ampDerivative, ampSecDerivative C time indices parameter (iStepTime = 1, * iTotalTime = 2, * nTime = 2) C flags passed in for information parameter (iInitialization = 1, * iRegularInc = 2, * nFlagsInfo = 2) C optional flags to be defined parameter (iComputeDeriv = 1, * iComputeSecDeriv = 2, * iComputeInteg = 3, * iStopAnalysis = 4, * nFlagsDefine = 4) dimension time(nTime), lFlagsInfo(nFlagsInfo), * lFlagsDefine(nFlagsDefine) dimension jSensorLookUpTable(*) C User code to compute ampValueNew zerod = dble(zero) oned = dble(one) twod = dble(two) c if (lFlagsInfo(iInitialization).eq.1) then AmpValueNew=0.0 ELSE if (lFlagsInfo(iRegularInc).eq.1) then INQUIRE(FILE='D:/unreaded.txt',EXIST=OK) IF (OK) THEN c Reading Array from file OPEN(UNIT=101,FILE='D:/amplitude.txt') DO READ(101,*, iostat=reason) svars IF (reason /= 0) exit END DO CLOSE(101) OPEN(UNIT=105,FILE='D:/unreaded.txt') CLOSE(105,STATUS='DELETE') END IF c Loop for nodes DO 30 i=0,1 c Loop for x,y,z directions DO 20 j=1,2 c Integer to character WRITE(node,'(I1)') i+1 WRITE(direction,'(I1)') j c Value definition IF (ampName(1:7) .eq. 'N000'//node//'_'//direction) THEN AmpValueNew=svars(i+j) WRITE (6, *) ampName WRITE (6, *) AmpValueNew c Time step definition tim = dble(time(iStepTime)) tStart = dble(tim) - dble(dt) tEnd = tim END IF 20 CONTINUE c 30 CONTINUE c END IF return endBest regards,
Nejc
RE: VUAMP subroutine
Just for my understanding. File "amplitude.txt" has value of load for current increment for one amplitude or for all amplitudes?
In other words you have one file with amplitude values or each amplitude has each own file?
As I see you want to open "amplitude.txt" file once in first VUAMP call and read all values into svars array.
Next use the array for other calls, am I right?
Svars array works in different way. Each amplitude has his own svars array.
Lets assume you have two user amplitude: userAmp-1 & userAmp-2.
Abaqus calls VUAMP for each amplitude, for one increment we have two calls.
In first call (for ampUser-1) you read "amplitude.txt" store svars array and remove "unreaded.txt" file.
In the same increment we have second call (for ampUser-2), since there is no "unreaded.txt" abauqs does not read "amplitude.txt" and svars for ampUser-2 is never save with your amplitude values.
Svars array for ampUser-1 is completely different variable as svars for userAmp-2.
It means ampUser-1 has values inside svars but ampUser-2 has empty svars.
If you have one variable which has to be access able for all subroutines you can always use COOMMON block.
Please keep in mind in abaqus all COMMON block names must start with k letter and it work fine as long you use only 1CPU.
Can you share you test model (abaqus model, VUAMP subroutine, amplitude.txt)?
Regards,
Bartosz
VIM filetype plugin for Abaqus
https://github.com/gradzikb/vim-abaqus
RE: VUAMP subroutine
I have one file (amplitude.txt) with all amplitudes-data in file looks like this:
Fx1 Fy1 Fz1
Fx2 Fy2 Fz2
Fx3 Fy3 Fz3
...etc..
Yes I want to read all values from file to array at first call, and for later calls only prescribe values from array to amplitudes. I think that this will be faster because subroutine don't need to read values so many times in one time increment.
OK I will try with common block...Thank you for your suggestion!
Yes, of course I can share my model...this is very simple (only for testing cubroutine VUAMP) model with 4 2D elements and 4 concentrated forces which values are prescribed with amplitudes.
Regards,
Nejc
RE: VUAMP subroutine
Thank you for the files. I made my own example which I think is doing what you need.
Testing of "unreaded.txt" is the only thing missing.
Force values from "amplitude.txt" is read one time per increment. The file has following structure:
CODE
All values are stored in two arrays, one with nodes ids and the second one with force values.
Next base on amplitude name the subroutine apply force value for specific node in specific direction.
To save data between calls I am using SAVE statement.
Be careful when you use more than domain, there is a change it will not work in this case.
By the way please take a look here: Abaqus Analysis User's Manual, 3.7 FORTRAN unit numbers
You are using file units reserved for Abaqus in you example.
Regards,
Bartosz
VIM filetype plugin for Abaqus
https://github.com/gradzikb/vim-abaqus
RE: VUAMP subroutine
Thank you very much for your help! I will use your method in my interface...
Thanks for the warning, but I know that I'm using file units reserved for Abaqus-for testing I write to .log file with (6,*)!
Thank you again!
Regards,
Nejc
RE: VUAMP subroutine
I was thinking about unit 101. According to documentation unit 101 is reserved for "Local state (.abq.4) file for CPU #4"
And you can use units 16–18 or unit numbers greater than 100 ending in 5 to 9
Regards,
Bartosz
VIM filetype plugin for Abaqus
https://github.com/gradzikb/vim-abaqus
RE: VUAMP subroutine
thank you for this information. I mixed up values with Abaqus/Standard...
Regards,
Nejc