Running the solver directly in Octave
This mode continues the original MKE-F workflow: open the project in an installed GNU Octave, read an input file and call the numerical core directly. Docker and a browser GUI are unnecessary. Most automated solver checks use the same entry points.
1. Requirements
- GNU Octave 8.4 or later; the project is locally verified on Octave 11.3.0;
- a complete MKE-F directory containing files
setup.m,src,scripts,examplesandtests; - read access to source files and write access only to the result directory chosen by the student.
GNU Octave is the only supported runtime. MATLAB compatibility is neither tested nor guaranteed.
No extra Octave packages, Python, npm or network connection are needed for calculations. Use the Octave graphical window as a terminal, or a fully headless octave-cli.
All commands below start at the repository root, the directory containing setup.m. If Octave is open elsewhere, first run cd with your own absolute MKE-F path.
2. Adding the core to the Octave path
In the GNU Octave command window:
cd('C:/path/to/MKE-F');
addpath(pwd);
setup;
On Linux and macOS the path might be /home/student/MKE-F. The function setup adds only the model, common operations, three solvers, results and scripts directories. It neither runs an analysis nor changes input data.
Check the path without performing calculations:
which StructFEProblem
which solveStatic
which solveModal
which solveTransient
Each command should show a file inside this project rather than another MKE-F copy.
3. First analysis with RunSelected
Files CasePreprocessorStatic.txt, CasePreprocessorModal.txt and CasePreprocessorTransient.txt already contain section analysis. The same call therefore selects the appropriate solver from the input file:
addpath(pwd);
setup;
casePath = fullfile('examples', 'cases', ...
'CasePreprocessorStatic.txt');
options = struct('verbose', true, 'plotting', false);
problem = StructFEProblem(casePath, options);
result = problem.RunSelected();
result.analysisType
result.displacements
result.reactions
StructFEProblem reads TXT, builds the mesh, numbers DOFs, creates elements and assembles sparse matrices K and M. RunSelected() reads only the configuration analysis and calls RunStatic, RunModal or RunTransient.
Replace the name with CasePreprocessorModal.txt or CasePreprocessorTransient.txt. For modal results inspect result.frequenciesHz and result.modeShapes; for transient results inspect result.time, result.displacements, result.velocities and result.accelerations.
4. Older files and explicit methods
Files created before section analysis remain valid. Select the analysis through a method, as in the original program interface:
staticProblem = StructFEProblem(fullfile( ...
'examples', 'cases', 'Case1ElementBeam.txt'));
staticResult = staticProblem.RunStatic();
modalProblem = StructFEProblem(fullfile( ...
'examples', 'cases', 'CaseBeam.txt'));
modalResult = modalProblem.RunModal();
transientProblem = StructFEProblem(fullfile( ...
'examples', 'cases', 'CaseBeamDyn.txt'));
transientResult = transientProblem.RunTransient( ...
1e-4, 1e-2, 3, 2);
Transient-method arguments are time step, duration, monitoring node number and local DOF. The last two are validated even with plotting=false, although headless mode creates no chart.
5. Pure numerical-core functions
To study the algorithm, separate reading and assembly from solving. GetAnalysisModel() creates a plain value structure that solvers do not modify:
addpath(pwd);
setup;
problem = StructFEProblem(fullfile( ...
'examples', 'cases', 'Case1ElementBeam.txt'));
model = problem.GetAnalysisModel();
staticResult = solveStatic(model);
modalProblem = StructFEProblem(fullfile( ...
'examples', 'cases', 'CaseBeam.txt'));
modalModel = modalProblem.GetAnalysisModel();
modalResult = solveModal(modalModel);
transientProblem = StructFEProblem(fullfile( ...
'examples', 'cases', 'CaseBeamDyn.txt'));
transientModel = transientProblem.GetAnalysisModel();
transientOptions = struct('timeStep', 1e-4, ...
'duration', 1e-2);
transientResult = solveTransient( ...
transientModel, transientOptions);
These are the exact core functions referenced by the analysis chapters:
solveStatic.m— reduction, solution, reactions, equilibrium and element results;solveModal.m— generalized eigenvalue problem and full modes;solveTransient.m— Newmark average acceleration and full histories;createAnalysisModel.m— immutable model-structure contract.
Repeated calls with the same structure should give identical results: solvers retain no state between runs.
6. Matrices and intermediate data
Matrices are stored sparsely. In a laboratory, first inspect size, nonzero count and symmetry; convert to dense only for small examples:
size(problem.K)
nnz(problem.K)
norm(problem.K - problem.K.', inf)
K = full(problem.K); % small models only
M = full(problem.M);
dofMap = problem.mesh.iMnod
In the pure model, the same data are named model.stiffness, model.mass, model.dofMap and model.nodeCoordinates. This lets you match each formula to an executable array.
7. Fully headless execution
Run the same code from a system terminal. On Windows, the official distribution usually provides octave-cli; Linux often provides the command octave:
octave-cli --no-gui --quiet --no-history --eval "addpath(pwd); setup; problem = StructFEProblem(fullfile('examples','cases','CasePreprocessorStatic.txt')); result = problem.RunSelected(); disp(result.displacements);"
Equivalent command using the executable octave:
octave --no-gui --quiet --no-history --eval "addpath(pwd); setup; run_octave_smoke_tests;"
The flag --no-gui disables the Octave window, --quiet suppresses the startup banner, --no-history disables command-history recording. The model option plotting=false prevents the project itself from creating graphics windows.
8. The checks used to maintain the solver
The quick integration check reads ten input files, checks sparse assembly and runs static, modal, pulse and harmonic transient problems:
addpath(pwd);
setup;
run_octave_smoke_tests;
The full local check then adds independent numerical invariants, result recovery, export and offline HTML integrity:
addpath(pwd);
setup;
run_octave_tests;
scripts/run_octave_smoke_tests.mshows the actual assembly and execution sequence for all analysis types;scripts/run_octave_tests.mis the common local entry point;tests/run_verification_tests.mlists the physical and numerical properties being checked.
The smoke suite checks that all supplied cases assemble and run. The verification suite separately checks formulas, dimensions, symmetry, equilibrium, the Mario Paz modal reference, Newmark integration and force recovery. Core changes require both levels.
9. Saving and further analysis
Save Octave structures to continue the laboratory later:
save('-mat7-binary', fullfile('output', ...
'local-static.mat'), 'model', 'staticResult');
An offline browser view of the result still does not require Docker:
exportPostprocessorData(model, staticResult, ...
fullfile('output', 'local-static.json'), ...
struct('title', 'Local static analysis', ...
'prettyPrint', true));
Then open postprocessor/index.html directly from disk and select the JSON. This does not run Octave from the browser: local computation is already complete, and HTML only validates and visualizes the data.
10. Common difficulties
| Message or symptom | What to check |
|---|---|
StructFEProblem undefined | Octave is not at the project root, or these commands were not run: addpath(pwd); setup;. |
MKEF:MissingAnalysisConfiguration | The old file has no analysis. Use explicit RunStatic, RunModal or RunTransient. |
| File not found | Check pwd and build paths with fullfile, rather than assuming one operating system’s separator. |
| Mechanism or singular system | Check supports, zero lengths, element properties and mass on free DOFs. |
| A graphics window appears | Create the problem with struct('verbose', false, 'plotting', false) and start Octave with --no-gui. |
Source-code reading route
StructFEProblem.m— compatible reading, assembly and execution facade;FEMesh.m— TXT parsing and input validation;createStructuralElement.m— element matrices;assembleGlobalMatrices.m— global sparse assembly;partitionDOFs.m— free and constrained DOFs;- one of the three
solve*.m, listed above; recoverElementResults.m— local displacements and forces.
The container backend and browser GUI wrap this sequence. Local execution calls the same core files directly.