MATLAB: Does the Partial Differential Equation Toolbox provide the functionality of “assembleFEMatrices” for the new “modal-solid” workflow introduced in R2018a

Partial Differential Equation Toolbox

I am using the Partial Differential Equation Toolbox to perform modal structural analysis. Therein, I want to perform the calculation of the Frequency Response Function. Therefore, I need to have access to the mass and stiffness matrices of the system. For the general approach using "createpde", the Partial Differential Equation Toolbox offers the functionality of "assembleFEMatrices" in order to get access to the processed matrices.
Does the Partial Differential Equation Toolbox provide a similar functionality for "modal-solid" analysis in MATLAB R2018a?
My code is as follows:
% modal structural analysis
modalStructuralModel = createpde('structural','modal-solid');
% just some test geometry
modalStructuralModel.importGeometry('Torus.stl');
% just a small visualization
pdegplot(modalStructuralModel,'FaceLabels','on')
% generate the mesh
modalStructuralModel.generateMesh('GeometricOrder','linear')
% set structural properties
modalStructuralModel.structuralProperties('YoungsModulus',210e9, ...
'PoissonsRatio',0.3, ...
'MassDensity',7800)
% set some frequencies
minFrequency = 0;
maxFrequency = 100;
% solve the problem
modalStructuralResults = solve(modalStructuralModel, ...
    'FrequencyRange',[minFrequency maxFrequency]); 

Best Answer

For the vertical workflow using "createpde('structural','modal-solid')", the Partial Differential Equation (PDE) Toolbox does not provide the functionality of "assembleFEMatrices". As an alternative, you could solve the 'modal-solid' problem by setting up a PDE model with "createpde()", where you can get access to the matrices with all the checks and internal validatation in place. You can think of PDE model workflow as a super workflow which can also solve ‘modal-solid’ systems. However, the setup is different because of the generality of the approach.
This example shows you how to compute the modes of a cantilever beam using the PDEModel workflow. In the end, you get access to the matrices and can you use them for further calculations, e.g. finding the Frequency Response Function.
% Create PDEModel to solve for 3 PDEs of equilibrium for a solid body
PDEmodel = createpde(3);
% Create a cantilever beam geometry
PDEmodel.Geometry = multicuboid(0.45, 0.02, 0.003);
% Plot geometry
figure(1)
pdegplot(PDEmodel, 'FaceLabels', 'on');
title('Geometry');
% NOTE: the beam will be fixed on the left face ([5])
% Generate mesh
PDEmodel.generateMesh;
% Plot mesh
figure(2)
pdemesh(PDEmodel);
title('Mesh');
% Set material properties (steel)
E = 210E9;
nu = 0.3;
rho = 7800;
% Compute c-coefficients in the required form using material properties
c = elasticityC3D(E,nu);
PDEmodel.specifyCoefficients('m', rho, 'd', 0, 'c', c, 'a', 0, 'f', [0;0;0]);
% Apply boundary conditions:
% % B.C. 1: fix beam on left face
PDEmodel.applyBoundaryCondition('dirichlet', 'Face', 5, 'u', [0;0;0]);
% % B.C. 2: one face is applied with a traction
%applyBoundaryCondition(model,'neumann','Face',3,'g',[0;0;1000]);
% NOTE: line is commented out, as this BC is ineffective as loads are not
% accounted for in modal analysis.
% Solve for modes and frequency
modalSol = PDEmodel.solvepdeeig([0,3E5]);
% Plot mode shapes
figure(3)
subplot(2,1,1)
pdeplot3D(PDEmodel, 'ColorMapData', modalSol.Eigenvectors(:,3,1))
title(['Z-Disp, Mode = 1, frequency = ' num2str(sqrt(modalSol.Eigenvalues(1))/2/pi) ' Hz'])
subplot(2,1,2)
pdeplot3D(PDEmodel, 'ColorMapData', modalSol.Eigenvectors(:,3,2))
title(['Z-Disp, Mode = 2, frequency = ' num2str(sqrt(modalSol.Eigenvalues(2))/2/pi) ' Hz'])
% Get access to the matrices used in modal solution
FEmodel = assembleFEMatrices(PDEmodel)