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 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(*) parameter(timeStarSecStep = 1.0) C User code to compute ampValue = F(sensors) c get sensor values first; note that iR_U1 = ivGetSensorID('RIGHTNODESENSOR_U1', jSensorLookUpTable) valueR_U1 = sensorValues(iR_U1) if (ampName(1:8) .eq. 'LOADAMP2' ) then c lFlagsDefine(iComputeDeriv) = 1 c lFlagsDefine(iComputeSecDeriv) = 1 c lFlagsDefine(iComputeInteg) = 1 if (time(iTotalTime).lt.timeStarSecStep) then c these sensors are defined only in the first step c print them out iR_CU1 = ivGetSensorID('ELEM1_SENSOR_CU1', * jSensorLookUpTable) valueR_CU1 = vGetSensorValue('ELEM1_SENSOR_CU1', * jSensorLookUpTable, * sensorValues) c call xplb_abqerr(1, 'Sensor %S value: %R',0,valueR_CU1, c * sensorNames(iR_CU1)) iR_CRF2 = ivGetSensorID('ELEM1_SENSOR_CRF2', * jSensorLookUpTable) valueR_CRF2 = vGetSensorValue('ELEM1_SENSOR_CRF2', * jSensorLookUpTable, * sensorValues) c call xplb_abqerr(1, 'Sensor %S value: %R',0,valueR_CRF2, c * sensorNames(iR_CRF2)) end if if (lFlagsInfo(iInitialization).eq.1) then ampValueNew = ampValueOld c ampDerivative = 0.0 c ampSecDerivative = 0.0 c ampIncIntegral = 0.0 if (time(iTotalTime).ge.timeStarSecStep) then c store the initial value of the sensor in the initialization c phase of the second step svars(1) = valueR_U1 end if else c Example: f(t) = t tim = time(iStepTime) tStart = tim - dt tEnd = tim if (time(iTotalTime).lt.timeStarSecStep) then ampValueNew = valueR_U1 else ampValueNew = valueR_U1 - svars(1) end if c ampDerivative = 1.0 c ampSecDerivative = 0.0 c ampIncInteg = (tStart*tStart-tEnd*tEnd)/2.0 C stop the analysis, if desired if (ampValueNew.gt.1000) lFlagsDefine(iStopAnalysis)=1 end if c else if (ampName(1:7) .eq. 'LOADAMP' ) then c if (lFlagsInfo(iInitialization).eq.1) then c ampDerivative = 0.0 c ampSecDerivative = 0.0 c ampIncIntegral = 0.0 c ampValueNew = ampValueOld c else c Example: f(t) = t c tim = time(iStepTime) c tStart = tim - dt c tEnd = tim c ampValueNew = tim c ampDerivative = 1.0 c ampSecDerivative = 0.0 c ampIncInteg = (tStart*tStart-tEnd*tEnd)/2.0 c end if end if return end