# MBDyn (C) is a multibody analysis code. 
# http://www.mbdyn.org
# 
# Copyright (C) 1996-2017
# 
# Pierangelo Masarati	<masarati@aero.polimi.it>
# Paolo Mantegazza	<mantegazza@aero.polimi.it>
# 
# Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
# via La Masa, 34 - 20156 Milano, Italy
# http://www.aero.polimi.it
# 
# Changing this copyright notice is forbidden.
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation (version 2 of the License).
# 
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

begin: data;
	problem: initial value;
end: data;

begin: initial value;
	initial time: 0.;
	final time: 10.;
	time step: 1e-2;

	method: ms, 0.6;

	tolerance: 1e-6;
	max iterations: 10;

	linear solver: naive, colamd;

	output: iterations;
end: initial value;

begin: control data;
	structural nodes: 2;
	joints: 3;
end: control data;

set: real L0 = 200.e-3;	# m
set: real F0 = 63.;	# N

module load: "libmodule-muscles.la";

begin: nodes;
	structural: 0, static, null, eye, null, null;
	structural: 1, static, 0., 0., L0, eye, null, null;
end: nodes;

begin: elements;
	joint: 0, clamp, 0, node, node;
	joint: 1, total pin joint,
		1,
			position, reference, node, null,
		position, reference, global, null,
		position constraint, 1, 1, 1, 0., 0., 1.,
			const, L0,
			# cosine, 2., pi/2., 1.e-2*L0, forever, L0,
		orientation constraint, 1, 1, 1, null;
	joint: 2, rod,
		0,
		1,
		from nodes,
		muscle Pennestri, help,
			# ergonomy, yes,
			initial length, L0,
			reference length, L0,
			reference velocity, 2.5,
			reference force, F0,
			activation,
				# cosine, 0., pi/2., .5, half, 0.,
				const, 1.,
			activation check, yes,
		prestress, 0.,
		prestrain, cosine, 0., pi/2., -.1, half, 0.;
end: elements;
