-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.m
94 lines (71 loc) · 2.89 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
%=========================================================================%
% IGAFrac is a MATLAB software package for PHT spline-based adaptive
% Iso-Geometric Analysis (IGA) of fractures.
%
% Release: 10.05.2022
% Authors: Ritukesh Bharali (Chalmers University of Technology, Sweden)
% Somdatta Goswami (Brown University, USA)
%=========================================================================%
function globdat = main(casename)
% If no casename is provided, ask for one
if nargin ~= 1
casename = input('Enter problem to simulate: ','s');
end
% Clear workspace
close all; clc
format long;
warning('off')
tic
%-------------------------------------------------------------------------%
% ADD PATH TO DIRECTORIES
%-------------------------------------------------------------------------%
disp(' - Adding path to directories')
% Path to external libraries and source folders
addpath(genpath('./ext'));
addpath(genpath('./src/io'));
addpath(genpath('./src/materials'));
addpath(genpath('./src/solver'));
addpath(genpath('./src/utils'));
% Remove path to femodel and inputData to avoid function clashes
rmpath(genpath('./src/igamodel'))
rmpath(genpath('./inputData'))
% Path to input files
addpath(fullfile('./inputData/',casename));
% Create an output directory
dir_output = sprintf('./output/%s', casename);
if ~exist(dir_output, 'dir')
mkdir(dir_output)
end
% Remove path to output, and add only case specific directory
rmpath(genpath(dir_output))
addpath(fullfile(dir_output,casename))
%-------------------------------------------------------------------------%
% SETUP RUNTIME PARAMETERS, MESH
%-------------------------------------------------------------------------%
disp(' - Reading user input and setting up runtime parameters and mesh')
props = inputData;
% Add path to the right femodel
addpath(fullfile('src/igamodel/',props.femodel.type))
% Initialise the global database
globdat = setupProblem(props);
%-------------------------------------------------------------------------%
% TIME-STEPPING
%-------------------------------------------------------------------------%
while globdat.active
% Solve a step
globdat = solveStep(props,globdat);
% Check for exit
globdat = checkExit(props,globdat);
% Post-process
globdat = postProcessStep(dir_output,props,globdat);
end
%-------------------------------------------------------------------------%
% SHUTDOWN
%-------------------------------------------------------------------------%
shutdownProblem(dir_output,props,globdat);
disp(' ')
disp([' - *** TIME ELAPSED = ',num2str(toc),' seconds.'])
%=========================================================================%
% End of main function
%=========================================================================%
end