Skip to content

Commit

Permalink
last minor changes for publication
Browse files Browse the repository at this point in the history
  • Loading branch information
plkinon committed Jun 17, 2024
1 parent 7019e3c commit f3237b1
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 108 deletions.
2 changes: 1 addition & 1 deletion classes/Integrator/EML_noCons.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

end

function [resi, tang] = compute_resi_tang(self, zn1, zn, this_system)
function [resi, tang] = compute_resi_tang(self, zn1, zn, this_system, time_n)

%% Abbreviations
h = self.DT;
Expand Down
2 changes: 1 addition & 1 deletion classes/Integrator/EML_null.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
z0 = [this_simulation.Q_0',p0', this_simulation.V_0'];
end

function [resi, tang] = compute_resi_tang(self, xn1, zn, this_system)
function [resi, tang] = compute_resi_tang(self, xn1, zn, this_system, time_n)

%% Abbreviations
h = self.DT;
Expand Down
2 changes: 1 addition & 1 deletion classes/Integrator/EML_reduced.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
z0 = [this_simulation.Q_0',p0', this_simulation.V_0', self.LM0'];
end

function [resi, tang] = compute_resi_tang(self, xn1, zn, this_system)
function [resi, tang] = compute_resi_tang(self, xn1, zn, this_system, time_n)

%% Abbreviations
h = self.DT;
Expand Down
32 changes: 16 additions & 16 deletions classes/Integrator/EMS_std.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

end

function [resi, tang] = compute_resi_tang(self, zn1, zn, this_system)
function [resi, tang] = compute_resi_tang(self, zn1, zn, this_system, time_n)

%% Abbreviations
h = self.DT;
Expand All @@ -55,37 +55,37 @@
lambda_n1 = zn1(2*nDOF+1:2*nDOF+m);
Vext_n1 = this_system.external_potential(qn1);
g_n1 = this_system.constraint(qn1);
%if ismethod(this_system,'get_inverse_mass_matrix')
if ismethod(this_system,'get_inverse_mass_matrix')
IMn1 = this_system.get_inverse_mass_matrix(qn1);
%else
% Mn1 = this_system.get_mass_matrix(qn1);
% IMn1 = eye(size(Mn1)) / Mn1;
%end
else
Mn1 = this_system.get_mass_matrix(qn1);
IMn1 = eye(size(Mn1)) / Mn1;
end

%% Known quantities from last time-step
qn = zn(1:nDOF);
pn = zn(nDOF+1:2*nDOF);
Vext_n = this_system.external_potential(qn);

%if ismethod(this_system,'get_inverse_mass_matrix')
if ismethod(this_system,'get_inverse_mass_matrix')
IMn = this_system.get_inverse_mass_matrix(qn);
%else
% Mn = this_system.get_mass_matrix(qn);
% IMn = eye(size(Mn)) / Mn;
%end
else
Mn = this_system.get_mass_matrix(qn);
IMn = eye(size(Mn)) / Mn;
end

%% MP evaluated quantities
q_n05 = 0.5 * (qn + qn1);
p_n05 = 0.5 * (pn + pn1);
DVext_n05 = this_system.external_potential_gradient(q_n05);
D_1_T_n05 = this_system.kinetic_energy_gradient_from_momentum(q_n05, p_n05);

%if ismethod(this_system,'get_inverse_mass_matrix')
if ismethod(this_system,'get_inverse_mass_matrix')
IMn05 = this_system.get_inverse_mass_matrix(q_n05);
%else
% Mn05 = this_system.get_mass_matrix(q_n05);
% IMn05 = eye(size(Mn05)) / Mn05;
%end
else
Mn05 = this_system.get_mass_matrix(q_n05);
IMn05 = eye(size(Mn05)) / Mn05;
end

% kinetic energy with mixed evaluations
T_qn1pn = 0.5 * pn' * IMn1 * pn;
Expand Down
2 changes: 1 addition & 1 deletion classes/Integrator/MP_std.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

end

function [resi, tang] = compute_resi_tang(self, zn1, zn, this_system)
function [resi, tang] = compute_resi_tang(self, zn1, zn, this_system, time_n)

%% Abbreviations
M = this_system.MASS_MAT;
Expand Down
1 change: 1 addition & 0 deletions classes/Metis/Metis.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
NUM_ITER
MEAN_ITER
ALPHA_0
ADVANCED_INIT = false;

%% Postprocessing parameters
% Can be given in an input-file (not necessary for computing)
Expand Down
6 changes: 5 additions & 1 deletion classes/Solver/Solver.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
properties
MAX_ITERATIONS
TOLERANCE
ADVANCED_INIT
end

methods
Expand All @@ -15,6 +16,7 @@
% Set Newton tolerance and max. iterations from simulation
self.TOLERANCE = this_simulation.TOLERANCE;
self.MAX_ITERATIONS = this_simulation.MAX_ITERATIONS;
self.ADVANCED_INIT = this_simulation.ADVANCED_INIT;

end

Expand Down Expand Up @@ -50,7 +52,9 @@
zn = zn1;

% Initial Guess
%zn1 = self.newton_initial_guess(zn1,this_system,this_simulation, this_integrator.DT);
if self.ADVANCED_INIT
zn1 = self.newton_initial_guess(zn1,this_system,this_simulation, this_integrator.DT);
end

% Print current time-step
fprintf(this_simulation.log_file_ID, '%s: %s\n', datestr(now, 0),'----------------------------------------------------');
Expand Down
Binary file not shown.
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
%% System Parameters
% Name of system in /classes/System
%SYSTEM = 'HeavyTopQuaternions';
SYSTEM = 'HeavyTopQuaternionsRegularMassMatrix';
SYSTEM = 'HeavyTopQuaternions'; %for EML,MPL
%SYSTEM = 'HeavyTopQuaternionsRegularMassMatrix'; % for EMH,MPH

% External acceleration
g = 9.81;
EXT_ACC = [0; 0; -g];
Expand Down Expand Up @@ -46,11 +47,10 @@

%% Integrator
% Name of routines in /classes/Integrator to be analyzed
%INTEGRATOR = {'EML'}; %EMS_std
%INTEGRATOR = {'MP_Livens'};
INTEGRATOR = {'MP_std'};
INTEGRATOR = {'EML','MP_Livens'};
%INTEGRATOR = {'EMS_std','MP_std'};
% Parameters of the method
INT_PARA = [NaN, NaN];
INT_PARA = [NaN, NaN; NaN, NaN];
% time step sizes to be analyzed
DT = [0.01, 0.005, 0.001, 0.0005];
% quantity which is to be analyzed
Expand All @@ -65,6 +65,8 @@
MAX_ITERATIONS = 40;
% tolerance of Newton Rhapson method
TOLERANCE = 1E-09;
% advanced initial guess
ADVANCED_INIT = true; %true required for EMH and MPH

%% Postprocessing
% Animation of trajectory [true/false]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%% System Parameters
% Name of system in /classes/System
SYSTEM = 'HeavyTopQuaternions';
%SYSTEM = 'HeavyTopQuaternionsRegularMassMatrix';
%SYSTEM = 'HeavyTopQuaternionsRegularMassMatrix'; %required for EMH, MPH

% External acceleration
g = 9.81;
Expand Down Expand Up @@ -48,9 +48,9 @@
%% Integrator
% Name of routine in /classes/Integrator
INTEGRATOR = 'EML';
%INTEGRATOR = 'EMS_std';
%INTEGRATOR = 'EMS_std'; %is EMH
%INTEGRATOR = 'MP_Livens';
%INTEGRATOR = 'MP_std';
%INTEGRATOR = 'MP_std'; %is MPH
% Parameters of the method
INT_PARA = [NaN, NaN];
% time step size
Expand All @@ -65,6 +65,8 @@
MAX_ITERATIONS = 40;
% tolerance of Newton Rhapson method
TOLERANCE = 1E-09;
% advanced initial guess
ADVANCED_INIT = false; %true required for EMH and MPH

%% Postprocessing
% Animation of trajectory [true/false]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
% Parameters of the method
INT_PARA = [NaN, NaN];
% time step size
DT = 0.01;
DT = 0.05;
% starting time
T_0 = 0;
% end time
T_END = 10; %2
T_END = 2; %10;

%% Solver Method
% maximum number of iterations of Newton Rhapson method
Expand Down
2 changes: 0 additions & 2 deletions start_metis_error_analysis.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

% Metis creates a dummy simulation object, the system and solver from input-file
[dummy_simulation, system, dummy_integrator, solver] = Metis('input/published/MUBO_kinon_betsch_2024/quat_heavytop/error_analysis_HeavyTopQuat', 1, 1);
%[dummy_simulation, system, dummy_integrator, solver] = Metis('input/published/MUBO_kinon_betsch_2024/quat_freeRB/error_analysis_rigidBodyRotatingQuat', 1, 1);
% Check how many different timestepsizes and integrators are analyzed
n_DT = numel(dummy_simulation.ALL_DT);
n_INT = numel(dummy_simulation.ALL_INTEGRATOR);
Expand All @@ -39,7 +38,6 @@

% Metis creates objects for current timestepsize and integrator
[current_simulation, ~, current_integrator, ~] = Metis('input/published/MUBO_kinon_betsch_2024/quat_heavytop/error_analysis_HeavyTopQuat', i, j);
%[current_simulation, ~, current_integrator, ~] = Metis('input/published/MUBO_kinon_betsch_2024/quat_freeRB/error_analysis_rigidBodyRotatingQuat', i, j);

%% METIS solver
% Solve system with solver and current integrator
Expand Down
7 changes: 4 additions & 3 deletions start_metis_single_analysis.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
% Add all subdirectories and to the current path
addpath(genpath(fileparts(which(mfilename))));
% Metis creates objects from input-file
%[simulation, system, integrator, solver] = Metis('input/published/MUBO_kinon_betsch_2024/single_analysis_RedundantMassSpring', 1, 1);
[simulation, system, integrator, solver] = Metis('input/published/MUBO_kinon_betsch_2024/single_analysis_RedundantMassSpring', 1, 1);
%[simulation, system, integrator, solver] = Metis('input/published/MUBO_kinon_betsch_2024/single_analysis_SpringPendulumPolar', 1, 1);
%[simulation, system, integrator, solver] = Metis('input/published/MUBO_kinon_betsch_2024/quat_freeRB/single_analysis_rigidBodyRotatingQuat', 1, 1);
[simulation, system, integrator, solver] = Metis('input/published/MUBO_kinon_betsch_2024/single_analysis_ClosedLoopMBS', 1, 1);
%[simulation, system, integrator, solver] = Metis('input/published/MUBO_kinon_betsch_2024/single_analysis_rigidBodyRotatingQuat', 1, 1);
%[simulation, system, integrator, solver] = Metis('input/published/MUBO_kinon_betsch_2024/quat_heavytop/single_analysis_HeavyTopQuat', 1, 1);
%[simulation, system, integrator, solver] = Metis('input/published/MUBO_kinon_betsch_2024/single_analysis_ClosedLoopMBS', 1, 1);

%% METIS solver
% Solve system with chosen solver and integration scheme
Expand Down

0 comments on commit f3237b1

Please sign in to comment.