-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.m
102 lines (73 loc) · 2.66 KB
/
main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
%=========================================================================%
% falcon-MATLAB is a finite element analysis program from the falcon
% numerical analyses suite. It is developed primarily for prototyping.
% The coding style is similar to the original falcon package, which is
% based on the Jem-Jive library (https://dynaflow.com/software/jive/).
%
% Author : Ritukesh Bharali (Chalmers University of Technology)
%
%=========================================================================%
function globdat = main(problem)
% User prompt if no problem is provided
if nargin ~= 1
problem = input('Enter problem to run: ','s');
end
% Clear the workspace
close all; clc
format long;
warning('off')
%=========================================================================%
% ADD PATH TO RELEVANT DIRECTORIES
%=========================================================================%
disp(' - Adding path to directories')
% Remove path
rmpath(genpath('./src/fem'))
rmpath(genpath('./src/solvers'));
rmpath(genpath('./inputData'))
% Path to source folders
addpath(genpath('./ext'));
addpath(genpath('./src/constraints'));
addpath(genpath('./src/io'));
addpath(genpath('./src/solvers/linear'));
addpath(genpath('./src/utils'));
% Path to input files
addpath(fullfile('./inputData/',problem));
% Create an output directory
dir_output = sprintf('./output/%s', problem);
if ~exist(dir_output, 'dir')
mkdir(dir_output)
end
addpath(dir_output)
%=========================================================================%
% INITIALIZATION
%=========================================================================%
disp(' - Reading user input and setting up runtime parameters')
props = inputData;
% Add path to the FE Model and solver
addpath(fullfile('./src/fem/',props.feModel.type))
addpath(fullfile('./src/solvers/implicit/',props.nlSolver.type))
% Initialise the global database
globdat = initProblem(props);
% Create PVD file
globdat = postProcessStep(dir_output,props,globdat);
%=========================================================================%
% RUN
%=========================================================================%
tic
% Startup time-stepping
globdat.active = true;
while globdat.active
% Solve a step
globdat = solveStep(props,globdat);
% Post-process
globdat = postProcessStep(dir_output,props,globdat);
% Check for exit
globdat = checkExit(props,globdat);
end
%=========================================================================%
% SHUTDOWN
%=========================================================================%
% Shutdown problem
globdat = shutdownProblem(dir_output,props,globdat);
toc
end