2D Linear Elastic Eigenmodes

Read data

SetDirectory[NotebookDirectory[]]

qfiles=FileNames["./out/q*.hdf"];
tfiles=FileNames["./out/t*.hdf"];
nFrames=Length[qfiles]-1;

gDataSets=Import["./out/global.hdf"];
{GlobalInfo,qmin,qmax}=Map[Import["./out/global.hdf",{"Datasets",#}]&,gDataSets];

nFrames=Floor[GlobalInfo[[1]]]

{λ,μ,ρ,nMode,iDir,aMode}=Map[#[[1]]&,ReadList["setprob.data",{Number,String}]]

{qmin[[1;;6]],qmax[[1;;6]]}

qmin[[3]]=qmin[[3]]-1; qmin[[6]]=qmin[[6]]-1; qmax[[3]]=qmax[[3]]-1; qmax[[6]]=qmax[[6]]-1;

Define utility functions

GetData[n_]:=Module[{u,v,F1,F2,F3,F4,dsets},
dsets=Import[qfiles[[n+1]]];
{u,v,F1,F2,F3,F4}=Map[Import[qfiles[[n+1]],{"Datasets",#}]&,dsets[[1;;6]]];
Return[{u,v,F1-1,F2,F3,F4-1}] ];

PlotData[n_,iDir_]:=Module[{u,v,F1,F2,F3,F4,uplt,vplt,F1plt,F2plt,F3plt,F4plt,plts,mx,my,ir,jr,fl},
{u,v,F1,F2,F3,F4}=Map[Transpose[#]&,GetData[n]];
{mx,my}=Dimensions[u];
If[iDir==1, ir=1;;mx; jr=my/2; fl="x", ir=mx/2; jr=1;;my; fl="y"];
uplt=ListPlot[u[[ir,jr]],Joined->True,Axes->False,Frame->True,FrameLabel->{fl,"u"},PlotMarkers->Automatic,GridLines->Automatic,PlotLabel->"Velocity (v1)",PlotRange->{All,{Min[qmin[[1;;2]]],Max[qmax[[1;;2]]]}}];
vplt=ListPlot[v[[ir,jr]],Joined->True,Axes->False,Frame->True,FrameLabel->{fl,"v"},PlotMarkers->Automatic,GridLines->Automatic,PlotLabel->"Velocity (v2)",PlotRange->{All,{Min[qmin[[1;;2]]],Max[qmax[[1;;2]]]}}];
F1plt=ListPlot[F1[[ir,jr]],Joined->True,Axes->False,Frame->True,FrameLabel->{fl,"F1"},PlotMarkers->Automatic,GridLines->Automatic,PlotLabel->"Deformation gradient (v1,1)",PlotRange->{All,{Min[qmin[[3;;6]]],Max[qmax[[3;;6]]]}}];
F2plt=ListPlot[F2[[ir,jr]],Joined->True,Axes->False,Frame->True,FrameLabel->{fl,"F2"},PlotMarkers->Automatic,GridLines->Automatic,PlotLabel->"Deformation gradient (v1,2)",PlotRange->{All,{Min[qmin[[3;;6]]],Max[qmax[[3;;6]]]}}];
F3plt=ListPlot[F3[[ir,jr]],Joined->True,Axes->False,Frame->True,FrameLabel->{fl,"F3"},PlotMarkers->Automatic,GridLines->Automatic,PlotLabel->"Deformation gradient (v2,1)",PlotRange->{All,{Min[qmin[[3;;6]]],Max[qmax[[3;;6]]]}}];
F4plt=ListPlot[F4[[ir,jr]],Joined->True,Axes->False,Frame->True,FrameLabel->{fl,"F4"},PlotMarkers->Automatic,GridLines->Automatic,PlotLabel->"Deformation gradient (v2,2)",PlotRange->{All,{Min[qmin[[3;;6]]],Max[qmax[[3;;6]]]}}];
plts={{uplt,vplt},{F1plt,F2plt},{F3plt,F4plt}};
GraphicsGrid[plts,ImageSize->Full]
]

Plot results

Manipulate[PlotData[n,iDir],{n,0,nFrames,1}]