Page 5 - Demo
P. 5
Planar Truss Examplefor ComrelAdd-onRCPConsult, 2023-2025Page 5doi=1,nbdNN(n)=NN(n)+keT(i)*de(i)enddoenddo!!* Visualizationif(StrurelPlot)thenif(StrurelMode.eq.0.or.StrurelMode.eq.2)then! Local variables: width, heigth, ouput window number, etc.wo=-2.d0;we=26.d0;ho=-2.d0;he=10.d0title=\if(StrurelMode.eq.0)then! 0 -initial deterministic statestate=\else! 2 final stochastic solutionstate=\endif! Set of 3 plotsdonp=1,3! Number of figureif(StrurelMode.eq.0)n=1nf=np*2-n! Initialize an Gnuplot environmentInit=GnuplotInit()if(Init)then! Create an output windowcallGnuplotWindowRelative(nf,40,40,.TRUE.)! Set a titlecallGnuplotWindowTitle(nf,trim(title)//c_)write(buffer,\',a,'''')\*trim(title),trim(state)callGnuplotPut(nf,trim(buffer)//c_)! Define range for axeswrite(buffer,\wo,wecallGnuplotPut(nf,trim(buffer)//c_)write(buffer,\ho,hecallGnuplotPut(nf,trim(buffer)//c_)callGnuplotPut(nf,\_)callGnuplotPut(nf,\_)! Plot a main subtitle of plotwrite(buffer,\*\ at 1,5.5 font ''Arial,14''')\*trim(StrurelName),trim(StrurelModule),trim(StrurelVersion)callGnuplotPut(nf,trim(buffer)//c_)if(StrurelMode.eq.0)then! Input data at state of mean valuescallGnuplotPut(nf,\*\ at -1.,5.0 font 'Arial,12'\_)else! Final data of stochastic solutionwrite(buffer,\*\ at -1.,5.0 font ''Arial,12''')\*trim(StrurelIMET),trim(StrurelIOPT)callGnuplotPut(nf,trim(buffer)//c_)write(buffer,\*\', Pf=',f9.5,'''\*\ at -1.,4.5 font ''Arial,10''')\*StrurelBeta,StrurelPfcallGnuplotPut(nf,trim(buffer)//c_)endifselectcase(np)case(1)!! plot set #1! Set a main subtitle of plotcallGnuplotPut(nf,\*\ states' at 12.,8. center font 'Arial,16'\_)! Plot initial state of trusssc=2.d0don=1,nfev(1,1)=XY(1,IEN(1,n));v(2,1)=XY(2,IEN(1,n))v(1,2)=XY(1,IEN(2,n));v(2,2)=XY(2,IEN(2,n))! Blue color for initial statecallGnuplotPlotData(nf,*\ lines linecolor rgb 'blue' lw 1 notitle\_,*v,2,2)! Rod number in the middle of rod lengthwrite(buffer,\*\,f5.1,',',f5.1,' font ''Arial,8''')\*n,(v(1,1)+v(1,2))/2,(v(2,1)+v(2,2))/2callGnuplotPut(nf,trim(buffer)//c_)! Red color for deformed statev(1,1)=v(1,1)+ac(IEN(1,n)*ned-1)*scv(2,1)=v(2,1)+ac(IEN(1,n)*ned )*scv(1,2)=v(1,2)+ac(IEN(2,n)*ned1)*scv(2,2)=v(2,2)+ac(IEN(2,n)*ned )*sccallGnuplotPlotData(nf,*\ lines linecolor rgb 'red' lw 2 notitle\_,*v,2,2)enddo! Nodal numbersdoi=1,nnpwrite(buffer,\*\,f5.1,',',f5.1,' font ''Arial,8''')\*i,XY(1,i),XY(2,i)callGnuplotPut(nf,trim(buffer)//c_)enddo! Forces with scale factor 0.000025callMATNUL(fp,ned,nnp)doi=8,nnpfp(2,i)=P(i7)*0.000025v(1,1)=XY(1,i);v(2,1)=XY(2,i)+fp(2,i)v(1,2)=0.d0;v(2,2)=fp(2,i)! Single vectorcallGnuplotPlotData(nf,*\ vectors filled head linecolor rgb 'black' lw 3 \*\_,v,4,1)! Force valuewrite(buffer,\*\'' at ',f5.1,',',f5.1,' font ''Arial,8''')\*i-7,fp(2,i)*40000.d0,XY(1,i)+0.1d0,XY(2,i)+fp(2,i)callGnuplotPut(nf,trim(buffer)//c_)enddo