Time-dependent contact mechanics

Contact geometry allows to describe some thermodynamic and dissipative systems. In this paper we introduce a new geometric structure in order to describe time-dependent contact systems: cocontact manifolds. Within this setting we develop the Hamiltonian and Lagrangian formalisms, both in the regular and singular cases. In the singular case, we present a constraint algorithm aiming to find a submanifold where solutions exist. As a particular case we study contact systems with holonomic time-dependent constraints. Some regular and singular examples are analyzed, along with numerical simulations.


Introduction
In the last decades, the interest in the formalism and applications of differential geometric structures to the study of mathematical physics and dynamical systems has risen drastically [1,3,39,29]. The natural geometric framework for autonomous conservative mechanical systems, both Hamiltonian and Lagrangian, is symplectic geometry and the variational approach is based on Hamilton's variational principle. For non-autonomous systems [11,21,24,38,43] the same variational principle is valid, but the underlying geometry is cosymplectic geometry [2,10,13]. Time-dependent systems can also be geometrically formulated as the Reeb dynamics of a contact system. Both symplectic and cosymplectic structures are particular instances of Poisson geometry [22,39,50].
Recently, the application of contact geometry to the study of dynamical systems has grown significantly [4,18,26]. This is due to the fact that contact geometry is not only a way to geometrically model the time-dependency in mechanical systems [23], which can also be done by means of cosymplectic geometry, but it also allows us to describe mechanical systems with certain types of damping, quantum mechanics [14], circuit theory [31], control theory [45] and thermodynamics [5,48], among many others [41]. In recent papers [7,8], the authors consider time-dependent systems, although a rigorous geometric description of time-dependent contact mechanics is in order. These systems include mechanical systems with time-dependent external forces and, in particular, controlled systems whose controls can be used to compensate the damping.
Let us recall that the variational approach to contact systems is based on Herglotz's principle [36] (see for instance [15,16,17]). This variational principle generalizes the Hamilton principle and it is appropriate to deal with action-dependent Lagrangians. From the geometric perspective, it is important to point out that contact structures are not Poisson, but Jacobi. This is due to the fact that the Leibniz rule is not fulfilled [18].
In the present paper, we develop a formalism in order to geometrically describe contact mechanical systems with explicit time-dependence. We begin by introducing a new geometric structure: cocontact manifolds. These manifolds extend the notion of both contact and cosymplectic structures. We study the properties of these manifolds, exhibit some examples, prove a Darboux-type theorem for these structures, and show that cocontact manifolds are Jacobi manifolds. In addition, we introduce the notion of cocontact orthogonal complement of a submanifold and define and characterize the coisotropic and Legendrian submanifolds of a cocontact manifold. This geometric framework is later used to develop both Hamiltonian and Lagrangian formulations of time-dependent mechanical systems with dissipation.
The introduction of time-dependence makes us consider systems subjected to constraints that can vary with time. Such systems can be described by introducing the constraints in the Lagrangian via Lagrange multipliers. These Lagrangians are obviously singular, since the velocity associated to the Lagrange multipliers do not appear in the expression of the Lagrangian. In order to study such systems, we introduce the notion of precocontact structure as a weakened version of a cocontact structure, and describe a suitable constraint algorithm.
The structure of the paper is as follows. In Section 2, we describe the geometrical setting that will be used throughout the paper. We present the notion of cocontact manifold and some examples. In particular, we see that cocontact manifolds are Jacobi manifolds, and thus all the theory about Jacobi structures is applicable to cocontact structures. Section 3 is devoted to develop a Hamiltonian formulation for dissipative time-dependent systems, while Section 4 dedicated to develop the Lagrangian formulation for cocontact systems and state the associated generalized Herglotz-Euler-Lagrange equations. In Section 5 we study the case of mechanical systems described by singular time-dependent contact Lagrangians and give a description of the constraint algorithm to obtain the dynamics in both the Hamiltonian and Lagrangian formulations. Section 6 is devoted to analyze the case of damped mechanical systems with holonomic constraints which can depend on time. Finally, in Section 7, three examples are presented and worked out: the damped forced harmonic oscillator, a system with timedependent mass subjected to a central force with friction, and the damped pendulum with variable length. We also show and discuss some simulations of these systems.
Throughout the paper all the manifolds and mappings are assumed to be smooth and secondcountable. Sum over crossed repeated indices is understood.
2 Geometrical setting 2.1 Cocontact manifolds Definition 2.1. Let M be a manifold of dimension 2n + 2. A cocontact structure on M is a couple (τ, η) of 1-forms on M such that τ is closed and such that τ ∧ η ∧ (dη) ∧n is a volume form on M . Under these hypotheses, (M, τ, η) is called a cocontact manifold.
We can see from this definition that every cocontact manifold has two tangent distributions. The first one is generated by ker τ , is integrable, and gives a foliation made of contact leaves. The other one is ker η and it is not integrable. This structure will be very useful when proving the Darboux theorem.
Example 2.2. Let (P, η 0 ) be a contact manifold and consider the product manifold M = R × P . Denoting by dt the pullback to M of the volume form in R and denoting by η the pullback of η 0 to M , we have that (dt, η) is a cocontact structure on M . Example 2.3. Let (P, τ, −dθ) be an exact cosymplectic manifold and consider the product manifold M = P × R. Denoting by s the coordinate in R we define the 1-form η = ds − θ. Then, (τ, η) is a cocontact structure on M = P × R.
Example 2.4 (Canonical cocontact manifold). Let Q be an n-dimensional smooth manifold with local coordinates (q i ) and its cotangent bundle T * Q with induced natural coordinates (q i , p i ). Consider the product manifolds R × T * Q with coordinates (t, q i , p i ), T * Q × R with coordinates (q i , p i , s) and R × T * Q × R with coordinates (t, q i , p i , s) and the canonical projections Let θ 0 ∈ Ω 1 (T * Q) be the canonical 1-form of the cotangent bundle, which has local expression θ 0 = p i dq i . Denoting by θ 2 = π * 2 θ, we have that (dt, θ 2 ) is a cosymplectic structure in R × T * Q. On the other hand, denoting by θ 1 = π * 1 θ 0 , we have that Proposition 2.5. Let (M, τ, η) be a cocontact manifold. We have the following isomorphism of vector bundles: : Proof. It is clear that ker = 0, since M is a cocontact manifold. Hence, it follows that has to be an isomorphism.
This isomorphism can be extended to an isomorphism of C ∞ (M )-modules: Proposition 2.6. Given a cocontact manifold (M, τ, η), there exist two vector fields R t , R s ∈ X(M ), called Reeb vector fields, satisfying the conditions R t is the time Reeb vector field and R s is the contact Reeb vector field.
Taking into account the isomorphism introduced above, we can give an alternative definition of the Reeb vector fields: Theorem 2.7 (Darboux theorem for cocontact manifolds). Let (M, τ, η) be a cocontact manifold. Then, for every point p ∈ M , there exists a local chart (U ; t, q i , p i , s) around p such that These coordinates are called canonical or Darboux coordinates. Moreover, in Darboux coordinates, the Reeb vector fields are Proof. The idea of the proof is the following: in every cocontact manifold there is a contact foliation made of leaves of the distribution generated by ker τ (which are (2n + 1)-submanifolds) and, on each of them, the restriction of η is a contact form. Now, we can take local coordinates adapted to the foliation and, on each leaf, use the Darboux theorem for contact manifolds. Hence, we have local coordinates (t, q i , p i , s) such that η = ds − p i dq i . Finally, we can write τ as a combination of all these coordinates, τ = f (t, q i , p i , s)dt, where f is a non-vanishing function, and then we can redefine the coordinate t.

Cocontact manifolds as Jacobi manifolds
It is known that symplectic, cosymplectic and contact manifolds are particular instances of a more general geometric structure: Jacobi manifolds. Then, it is reasonable to think that cocontact manifolds should also be Jacobi manifolds.
Jacobi manifolds Definition 2.9. A Jacobi manifold is a triple (M, Λ, E), where Λ is a bivector field on M , i.e. a skew-symmetric 2-contravariant tensor field, and E is a vector field on M , such that where [·, ·] denotes the Schouten-Nijenhuis bracket [44,47].
Given a Jacobi manifold (M, Λ, E), we can define a bilinear map on the space of smooth functions on M , called the Jacobi bracket, given by The Jacobi bracket is bilinear, skew-symmetric, satisfies the Jacobi identity and fulfills the weak Leibniz rule Hence, the set of smooth maps C ∞ (M ) equipped with the Jacobi bracket {·, ·} is a local Lie algebra in the sense of Kirillov. The converse is also true: given a local Lie algebra structure on C ∞ (M ), one can define a Jacobi structure (Λ, E) on M such that its Jacobi bracket coincides with the bracket of the local Lie algebra bracket [37,40]. Given a smooth function f ∈ C ∞ (M ), we define the Hamiltonian vector field associated with f as The characteristic distribution C of (M, Λ, E) is spanned by these vector fields X f . It is integrable, and it can be defined in terms of the bivector Λ and the vector field E as In general, the morphismΛ is not an isomorphism, as can be seen in the following example. and we denote its inverse by = −1 . The Reeb vector field is R = η.
Then we can define a Jacobi structure (Λ, E) on M given by In this case, the morphismΛ is given bŷ and it is clear thatΛ is not an isomorphism, since kerΛ = η and ImΛ = ker η. We know that both symplectic and cosymplectic manifolds are Poisson. Hence, they are also Jacobi manifolds with where ω is the 2-form of the symplectic or cosymplectic manifold and is the inverse of the flat morphism of the symplectic or cosymplectic manifold.

Jacobi structure of cocontact manifolds
Consider now a cocontact manifold (M, τ, η). In Darboux coordinates, the flat isomorphism reads Its inverse is the isomorphism : Ω 1 (M ) → X(M ), which is given by We can define a 2-contravariant skew-symmetric tensor Λ: which in Darboux coordinates reads Proposition 2.13. Let (M, τ, η) be a cocontact manifold. Then, (Λ, E), where E = −R s , is a Jacobi structure on M .
The previous proposition can be proved using Darboux coordinates. Using Darboux coordinates, the Jacobi bracket reads In particular, one has

Legendrian submanifolds
In the previous section we have seen that every cocontact manifold (M, τ, η) is a Jacobi manifold taking Λ(α, β) = −dη( α, β) and E = −R s . We will study a special kind of submanifolds associated to this structure.
In first place, we find a new expression for the morphismΛ which is easier to manipulate. We have and contracting with the Reeb vector fields R s , R t , we get Hence, we have that kerΛ = τ, η .
Definition 2.14. Let (M, τ, η) be a cocontact manifold and consider a submanifold N ⊂ M . We define the cocontact orthogonal complement of N as Notice that v ∈ T p N ⊥ if, and only if, there exists α ∈ T * p N such thatΛ(α) = v and α(u) = 0 for every u ∈ T p N . Definition 2.15. Let (M, τ, η) be a cocontact manifold and consider a submanifold N → M .
The following theorem characterizes isotropic and Legendrian submanifolds.
Since j * η = 0, we have j * dη = dj * η = 0 and thus i u i v dη = α(u) = 0 for every u ∈ T p N . Now, Since is an isomorphism, this is the same as checking that (v) = α, which is obvious taking into account that j * η = 0 and j * τ = 0. Finally, we have already proved that α(T p N ) = 0.
(ii) Suppose that TN = TN ⊥ and let k = dim N . Thus, at any point p ⊂ N , which implies that k = n.
Conversely, we have that 2n

Cocontact Hamiltonian systems
We can use the cocontact geometric framework developed in the previous section to deal with Hamiltonian systems with dissipation and with explicit time dependence.
The cocontact Hamilton equations for a curve ψ : where ψ : I ⊂ R → TM is the canonical lift of the curve ψ to the tangent bundle TM .
Let us express these equations using Darboux coordinates (see Theorem 2.7). Consider the curve ψ(r) = (f (r), q i (r), p i (r), s(r)). The third equation in (2) imposes that f (r) = r, thus we will denote r ≡ t. The other equations become: We can give another interpretation of these equations using vector fields.
Equations (3) can be rewritten using the isomorphism as Therefore, it is clear that the cocontact Hamilton equations (3) have a unique solution. The solution to these equations is called the cocontact Hamiltonian vector field, and will be denoted by X H . Its local expression is Remark 3.3. It can be seen that the vector field X H − R t coincides with the one for the associated Jacobi manifold given in the preceding section. Proof. This is a direct consequence of equations (2) and (3), and the fact that any point of M is in the image of an integral curve of X.

Cocontact Lagrangian systems 4.1 Lagrangian phase space and geometric structures
Let Q be a smooth n-dimensional manifold. Consider the product manifold R × TQ × R endowed with natural coordinates (t, q i , v i , s). We have the canonical projections Notice that τ 2 and τ 0 are the projection maps of two vector bundle structures. Usually, we will have in mind the projection τ 0 . In fact, the vector bundle Our goal is to develop a time-dependent contact Lagrangian formalism on the manifold R×TQ×R. The usual geometric structures of the tangent bundle can be naturally extended to the cocontact Lagrangian phase space R × TQ × R. In particular, the vertical endomorphism of T(TQ) yields a τ 0 -vertical endomorphism J : In the same way, the Liouville vector field on the fibre bundle TQ gives a Liouville vector field ∆ ∈ X(R × TQ × R). Actually, this Liouville vector field coincides with the Liouville vector field of the vector bundle τ 0 . The local expressions of these objects in Darboux coordinates are where c 2 is the velocity curve of c 2 . Every pathc which is the prolongation of a path c : R → R×Q×R is said to be holonomic. A vector field Γ ∈ X(R × TQ × R) is said to satisfy the second-order condition (for short: it is a sode) when all of its integral curves are holonomic.
This definition can be equivalently expressed in terms of the canonical structures defined above: In natural coordinates, if c(r) = (t(r), c i (r), s(r)), theñ The local expression of a sode is So, in coordinates a sode defines a system of differential equations of the form

Cocontact Lagrangian systems
The Cartan forms associated to L are defined as The contact Lagrangian form is and consequently Notice that, in general, given a cocontact Lagrangian system (R×TQ×R, L), the family (R×TQ× R, τ = dt, η L , E L ) is not a cocontact Hamiltonian system because condition τ ∧ η ∧ (dη L ) n = 0 is not fulfilled. The Legendre map characterizes which Lagrangian functions will give cocontact Hamiltonian systems.
where FL(t, ·, s) is the usual Legendre map associated to the Lagrangian L(t, ·, s) : TQ → R with t and s freezed.
Notice that the Cartan forms can also be defined as where θ 0 and ω 0 = −dθ 0 are the canonical 1-and 2-forms of the cotangent bundle and π is the natural projection π : R × T * Q × R → T * Q (see Example 2.4).
Proposition 4.5. For a Lagrangian function L the following conditions are equivalent: The proof of this result can be easily done using natural coordinates, where and And the three conditions in the above proposition are equivalent to say that the matrix W = (W ij ) is everywhere regular, hence they are equivalent. Definition 4.6. A Lagrangian function L is said to be regular if the equivalent conditions in Proposition 4.5 hold. Otherwise L is called a singular Lagrangian. In particular, L is said to be hyperregular if FL is a global diffeomorphism. Remark 4.7. As a result of the preceding definitions and results, every regular cocontact Lagrangian system has associated the cocontact Hamiltonian system (R × TQ × R, dt, η L , E L ).
Given a regular cocontact Lagrangian system (R × TQ × R, L), from Proposition 2.6 we have that the Reeb vector fields R L t , R L s ∈ X(R × TQ × R) for this system are uniquely determined by the relations where W ij is the inverse of the Hessian matrix of the Lagrangian L, namely W ij W jk = δ i k . Notice that if the Lagrangian function L is singular, the Reeb vector fields are not uniquely determined. This will be discussed in Section 5.
The cocontact Lagrangian equations for a vector field X L ∈ X(R × TQ × R) are The vector field which is the only solution to these equations is called the cocontact Lagrangian vector field.
Notice that a cocontact Lagrangian vector field is a cocontact Hamiltonian vector field for the function E L (and the cocontact structure (dt, η L )).
In natural coordinates, for a holonomic curvec(r) = (t(r), q i (r),q i (r), s(r)), equations (7) arė Condition (9) implies that t(r) = r + k. This justifies the usual identification t = r. Meanwhile, for a vector field X L = f ∂ ∂t where we have used the relations which can be easily proved taking coordinates.
Theorem 4.9. If L is a regular Lagrangian, then X L is a sode and equations (12)- (17) become which, for the integral curves of X L , are the Herglotz-Euler-Lagrange equations (9), (10) and (11).
This sode X L ≡ Γ L is called the Herglotz-Euler-Lagrange vector field associated to the Lagrangian function L.
Hence, the local expression of the Herlgotz-Euler-Lagrange vector field is ∂s .
An integral curve of this vector field satisfies the classical Euler-Lagrange equation for dissipative systems, as can be easily verified: Remark 4.11. Equations (10) (11) coincide with those derived from the Herglotz variational principle [36,35,28].
If the Hessian of the Lagrangian is not regular (in other words, the Lagrangians is singular), the construction of section 4.2 does not lead to a cocontact structure, as shown in 4.5. In order to describe the dynamics of singular Lagrangians we require some minimal regularity conditions. Inspired by previous works on the singular case for contact systems [19] and cosymplectic systems [13] we will define precocontact structures.
If C has constant rank, we say that the couple (τ, η) is of class cl(τ, η) = dim M − rank C.
Proof. Since the one-form τ is closed, we have that locally τ = dt. Moreover, ker τ is an integrable distribution and thus induces a foliation F of M . Consider the leaf F 0 corresponding to t = t 0 . We want to see that the class of η| F 0 is odd (the definition of class of a one-form can be found in Definition VI.1.1 in [30]). It is clear that, on a point p ∈ F 0 , C = C η| F 0 . Hence, and since cl(τ, η) ≥ 2 is even, we have that cl(η| F 0 ) ≥ 1 is odd. Now, using Theorem VI.4.1 in [30] we obtain the desired result.
Remark 5.4. If cl(τ, η) = m then m must be even and we recover the cocontact structure introduced in Definition 2.1.
Given a precocontact manifold (M, τ, η), the morphism can be defined in the same way as in the regular case: : However, in this case it is not an isomorphism (see Proposition 5.6).
A vector field R t ∈ X(M ) is a time Reeb vector field if Both kind of vector fields always exists global thanks to the theorem 5.3, and a global one can be constructed using partitions of the unity. Crucially, in the precocontact case the Reeb vector fields are not unique.
Let R s , R t be a contact and time Reeb vector fields respectively. Contracting both sides of equation (21) with R s , we have On the other hand, contracting with R t , we obtain Hence, we also have that i(X)dη = 0 and then X ∈ ker τ ∩ ker η ∩ ker dη. The other inclusion is trivial. Now we will show that ker = (Im ) • . Let X ∈ ker . By the first equality, i(X)τ = 0, i(X)η = 0 and i(X)dη = 0. Then, for every vector field Y , and hence ker ⊂ (Im ) • . Now, as it is clear that both subspaces of T p M have the same dimension, we have that ker = (Im ) • .
Notice that if R 1 and R 2 are two contact (or two time) Reeb vector fields, then, R 1 − R 2 ∈ C. Conversely, if R is a contact (time) Reeb vector field, then R + V is a contact (or time) Reeb vector field for any V ∈ C. Definition 5.8. Let (M, τ, η, H) be a precocontact Hamiltonian system and R s and R t two contact and time Reeb vector fields respectively. The precocontact Hamiltonian equation for a vector field X is: where Equation (22) has two problems in the singular case: γ H depends (a priori) on the Reeb vector fields we have chosen and there may not exist a solution to the equations. Both problems are solved by applying a suitable constraint algorithm.

Constraint algorithm
The aim of the constraint algorithm is to find a submanifold M f ⊂ M such that there exists a solution to the equation (22) which is tangent to the submanifold M f . The algorithm has two steps: the consistency condition, where we look for the submanifold where the equation has solution, and the tangency condition, where we analyse where the solution is tangent to the submanifold. These steps are applied iteratively, but the first step is specially relevant because it will solve the multiplicity of Reeb vector fields.
Consider a γ H with particular Reeb vector fields R s and R t . M 1 is defined as the subset of the points of M where solutions exist: Proof. Let γ H as above andγ H forR t ,R s . Then, Notice that on M 1 , the precocontact Hamiltonian equation for the precocontact system (M, τ, η, H) does not depend on the choice of the Reeb vector fields R t , R s .
In M 1 (which we assume to be a submanifold) there exists a solution X H of (22), but it may not be tangent to M 1 . Therefore, we define which we also assume to be a submanifold. Iterating this procedure we can obtain a sequence of constraint submanifolds · · · → M f → · · · → M 2 → M 1 → M .
If this procedure stabilizes, that is, there exists a natural number f ∈ N such that M f +1 = M f , and dim M f > 0 we say that M f is the final constraint submanifold. In M f we can find solutions to equations (22) which are tangent to M f . Notice that, in the Lagrangian case, we need to impose the sode condition. In general, the Reeb vector fields are not tangent to the submanifolds provided by this constraint algorithm. One can continue the algorithm by demanding the tangency of the Reeb vector fields, as shown in [19]. This is important if we want a Dirac-Jacobi bracket on the resulting constraint submanifold, which requires a Reeb vector field.

Precocontact Lagrangian systems
Consider a Lagrangian function L : R × TQ × R → R, and the associated objects η L and E L as defined in Section 4.2.
Definition 5.11. A Lagrangian function L : R × TQ × R → R is admissible if the Hessian of L has constant rank and (R × TQ × R, dt, η L ) is a precocontact manifold.
Remark 5.12. Not every Lagrangian whose Hessian has constant rank leads to a precocontact structure. Consider the manifold R × TR × R, with coordinates (t, q, v, s), and the Lagrangian L = vs. The Hessian of L has constant rank equal to 0, and the 1-forms are τ = dt and η L = ds − sdq. We have that dη L = −ds ∧ dq, thus cl(τ, η L ) = 4 − 1 = 3, which is odd (in a set where s = 0) . The main problem of this structure is that there are no Reeb vector fields as defined in 5.5.
Remark 5.13. The condition of being admissible is stronger than the condition proposed in [19], which is just for the Hessian to have constant rank. In light of the previous example, which can also be considered in the precontact setting, we believe it is necessary to require that the Lagrangian is admissible. Non-admissible Lagrangians will be studied in a future work.
The precocontact Herglotz-Euler-Lagrange equations are defined as in Definition 4.8, but there is no result about the solutions like Theorem 4.9. First of all, since we are dealing with a precocontact system, a constraint algorithm is required in order to find solutions. In particular, on the final constraint submanifold, the Herglotz-Euler-Lagrange equations do not depend on the choice of the Reeb vector fields, as proved in Corollary 5.10. Moreover, the holonomy condition is not always recovered and it has to be imposed, leading to new constraints which have to be considered during the constraint algorithm.

The canonical Hamiltonian formalism
In the (hyper)regular case, the Legendre transform gives a diffeomorphism between (R×TQ×R, dt, η L ) and (R × T * Q × R, τ = dt, η) such that FL * η = η L . For the singular case, the Legendre transform can be defined but, in general, P := Im(FL) = FL(R × TQ × R) R × T * Q × R. Some regularity conditions are required to assure that a Hamiltonian precocontact system can be realised on P.
Definition 5.14. A singular Lagrangian L is almost-regular if • L is admisible, • the Legendre map FL is a submersion onto its image, • the fibers FL −1 (FL(t, v q , s)) ⊂ R × TQ × R are connected submanifolds for every (t, v q , s) ∈ R × TQ × R.
In the almost-regular case we can construct the triple(P, τ, η P ), where η P = j * P FL * η ∈ Ω 1 (P), τ = FL * dt and j P : P → R × T * Q × R is the natural embedding. Furthermore, the Lagrangian energy E L is FL-projectable, that is, there is a unique H P ∈ C ∞ (P) such that E L = (j P • FL) * H P . Then, (P, τ, η P , H P ) is a precocontact Hamiltonian system.
The contact Hamiltonian equations for X P ∈ X(P) are (3) adapted to this situation. As in the Lagrangian formalism, these equations are not necessarily consistent everywhere on P and we must implement a suitable constraint algorithm in order to find a final constraint submanifold P f → P (if it exists) where there exist vector fields X ∈ X(P), tangent to P f , which are (not necessarily unique) solutions to (3) on P f .

Damped mechanical systems with holonomic constraints
There are two classes of constraints: holonomic, which only depend on the generalized coordinates and time, and nonholonomic, which have a dependence on velocities or momenta. Nonholonomic constraints are more intricate and there are several ways to implement them (see [33] for a general study of these kind of constraints in the symplectic setting).
In a recent article [20] the authors consider contact systems with nonholonomic constraints and show how a contact system can be understood as a symplectic system with nonholonomic constraints.
This chapter adds to these results by considering singular Lagrangians and allowing explicit dependence on time of both the Lagrangian and the constraints. On the other hand, we only consider holonomic constraints.
Consider a Lagrangian precocontact system (R × TQ × R, L ), with τ = dt. We will denote by η L , C and E L the contact form, characteristic distribution and Lagrangian energy associated to the system (R × TQ × R, L ). Now we add a set of independent constraints f α (t, q i , s) = 0 with 1 ≤ α ≤ d, which define a submanifold S → R × TQ × R. In order to define a suitable constraint submanifold, these constraints functions must verify the condition rank ∂f α ∂q i = d , ∀t, s .
Therefore, we can understand these constraints as a constraint in the generalized coordinates (q i , s) for every value of time t.
In order to find the precocontact Lagrangian vector field for (S, L), we add d new configuration variables λ α , thus the enlarged manifold is We consider the new Lagrangian: thus λ α act as Lagrange multipliers and we consider them dynamical variables.
We have the precocontact Lagrangian system (R × T(Q × R d ) × R, L). The contact form is the same η L = η L , and the characteristic distribution is And the Lagrangian energy is The primary constraints are generated by sections of C, which we can separate in two classes, those which are sections of C and ∂ ∂λ α and ∂ ∂v α . The last ones give the constraints: Thus, we recover the original constraints from the constraint algorithm. If Y is a section of C , then The primary constraints for the Lagrangian L (that is, without imposing f α = 0) are L Y E L . Thus, these constraints become coupled with f α and are not conserved in general. From this point the constraints algorithm should continue imposing the tangency condition. The outcome will depend on the particular Lagrangian and constraints.
We will now compute the dynamical equations, which are complementary to the constraint algorithm. Consider a holonomic vector field: Then the precocontact equations (22) are

Examples
In the following examples we consider mechanical systems in Riemannian manifolds described by Lagrangians of the form L = K − U , with K and U are the kinetic and potential energy respectively [1]. These Lagrangians are hyperregular. In order to introduce dissipation and external forces, we will add some additional terms to these Lagrangians such as γs and G(t, q) respectively. We also consider systems subjected to holonomic time-dependent constraints f α (t, q).

Damped forced harmonic oscillator
In this example we are going to study a forced harmonic oscillator with damping. We will develop both the Lagrangian and Hamiltonian formalisms. Consider a harmonic oscillator of mass m with elastic constant k and an external force f (t) depending on time.

Lagrangian formalism
The configuration manifold for this system is Q = R equipped with coordinate q. Consider the phase manifold R×TQ×R equipped with coordinates (t, q, v, s) and the Lagrangian function L : R×TQ×R → R given by where f (t) is a time-dependent external force. The Lagrangian energy associated to this Lagrangian function is and its differential is The Cartan 1-form for the Lagrangian L is θ L = mvdq. The contact 1-form is η L = ds − mvdq, and its differential is dη L = mdq ∧ dv. The Reeb vector fields are: Consider a vector field X ∈ X(R × TQ × R) with local expression The cocontact Lagrangian equations (8) for this vector field yield the conditions Hence, the vector field X is Its integral curves (t(r), q(r), v(r), s(r)) satisfy the system of differential equations In Figure 1a we see the evolution with respect to time of the position and the velocity of the damped oscillator taking as external force a smooth pulse at t = 1. We can see the damping of the position and the velocity. In Figure 1b we have represented the phase portrait of the same solution where we can see the initial pulse and how the system decays to the equilibrium point due to the friction.
In Figure 2 we can see the dissipation of both the Lagrangian energy and the mechanical energy given by Notice that the Lagrangian energy decays exponentially, while the mechanical energy follows the evolution of the Lagrangian energy but oscillating around it.

Hamiltonian formalism
Consider the Legendre map associated to the Lagrangian function (23): which is given by FL(t, q, v, s) = (t, q, p ≡ mv, s) .
Notice that the Legendre map FL is a global diffeomorphism and hence L is an hyperregular Lagrangian. Then, R × T * Q × R is equipped with the cocontact structure (dt, ds − pdq). The Hamiltonian function H such that FL * H = E L is Then, a vector field Y ∈ X(R × T * Q × R) is a solution to Hamilton's equation (3) if it has local expression Its integral curves (t(r), q(r), p(r), s(r)) satisfy Combining the second and the third equations above, we obtain the second-order differential equation

A time-dependent system with central force and friction
Consider the Kepler problem in the case where the mass of the particle subjected to the central force is a non-vanishing function of time m(t). It is clear that the motion of the particle is on a plane and hence the configuration manifold is Q = R 2 endowed with coordinates (r, ϕ).
The phase bundle R × T * Q × R with coordinates (t, r, ϕ, p r , p ϕ , s) has a natural cocontact structure given by the 1-forms τ = dt and η = ds − p r dr − p ϕ dϕ. The Reeb vector fields are Consider the Hamiltonian function H ∈ C ∞ (R × T * Q × R) given by The vector field X ∈ X(R × T * Q × R) satisfying equations (3) has local expression Then, the integral curves (t, r, ϕ, p r , p ϕ , s) satisfy Hence, the integral curves must fulfill the system of second-order equations

Damped pendulum with variable length
Consider a damped pendulum of mass m with variable length (t) [32]. Its position in the plane can be described using polar coordinates (r, θ). The constraint r = (t) will be introduced in the Lagrangian function via a Lagrange multiplier. The phase space of this system is the bundle R×TR 3 ×R, equipped with coordinates (t, r, θ, λ, v r , v θ , v λ , s). The Lagrangian function describing this system is where λ is the Lagrange multiplier. The contact 1-form is η L = ds − mv r dr − mr 2 v θ dθ , then dη L = mdr ∧ dv r + 2mrv θ dθ ∧ dr + mr 2 dθ ∧ dv θ , and we have the 1-form τ = dt. Hence, (R × TR 3 × R, τ, η L ) is a precocontact manifold. We can take as Reeb vector fields R s = ∂/∂s, R t = ∂/∂t. The characteristic distribution of (τ, η L ) is The Lagrangian energy associated to L is and thus Consider a sode X ∈ X(R × TR 3 × R) with local expression  The dynamical equations for the vector field X yield the conditions and we obtain the constraint function defining the first constraint submanifold Hence, the vector field X has the form Imposing the tangency of the vector field X to the submanifold M 1 , namely the condition L X ξ 1 = 0, we obtain the constraint defining a new constraint submanifold M 3 → M 2 , and we also get G r = (t). Imposing again the tangency condition we obtain a new constraint function defining the submanifold M 4 → M 3 . Requiring X to be tangent to M 4 we determine the last coefficient G λ , whose expression we will omit, and no new constraints appear. Thus, there is a unique vector field solution to equations (8) and has local expression X = ∂ ∂t + (t) ∂ ∂r + v θ ∂ ∂θ + 3m (t)v 2 θ + 2m (t)γv 2 θ + mgv θ sin θ + mγ (t) + m (t) ∂ ∂λ The integral curves of this vector field satisfy the following second-order differential equation Notice that if we consider a pendulum with fixed length (t) = • , we recover the usual equation for a damped pendulum:θ = −γθ − g • sin θ .
On the other hand, setting γ = 0 in equation (24), we obtain the equation of the simple pendulum with variable length studied in [32].
In Figures 3 and 4 we have represented a couple of simulations of a damped pendulum of mass m = 1 with variable length considering (t) = 1+0.1 sin(2πt), friction coefficients γ = 0.5 and γ = 0.75 respectively, and initial conditions θ(0) = π/4 andθ(0) = 0. We have plotted the evolution of the radial and angular coordinates and we can see the loss of amplitude, and hence of energy, of the system. Notice that in this example, the energy does not tend to zero, but to a positive constant since the radial coordinates keeps oscillating forever.

Conclusions and further research
In this paper we have introduced a geometrical formulation for time-dependent contact systems by defining a new geometric structure: cocontact manifolds. This new notion combines the well-known contact and cosymplectic structures. We have also proved that cocontact manifolds are Jacobi manifolds and defined and characterize the notions of isotropic and Legendrian submanifolds.
This geometrical setting allows us to develop the Hamiltonian and Lagrangian formalisms for timedependent contact systems, generalizing those for contact systems [6,18,26] and cosymplectic systems [23]. In addition, we have studied the problem where the system is defined by a singular Lagrangian, thus introducing the notion of precocontact structure. This is useful since many systems are defined by singular Lagrangians. As an application, we have studied the particular case of cocontact systems with time-dependent holonomic constraints.
We have worked out two regular examples: the damped forced harmonic oscillator and the Kepler problem with non-constant mass and friction; and a singular one: a pendulum with variable length and friction. This last example is singular because we have introduced the constraint with a Lagrange multiplier and the constraint algorithm gives back the constraint. Computer simulations of some of these examples have been included.
The structures introduced in this paper could be used to improve our understanding of timedependent dissipative systems. For instance, providing new geometric integrators [7,8,9,49] from the discretization of the obtained equations, discussing symmetries and their associated dissipated and conserved quantities, and studying reduction procedures such as coisotropic reduction [1,18] and Marsden-Weinstein reduction [42]. It would be also interesting to state the Hamilton-Jacobi theory for these systems and describe the Skinner-Rusk unified formalism for cocontact systems.
The formulation presented in this work is also a first step towards finding a geometric formalism for non-autonomous dissipative field theories based on the k-contact setting [25,27,34] and generalizing the multisymplectic formalism [12,46]. The k-contact formalism allows to describe autonomous field theories, such as field theories with damping, some equations from circuit theory, such as the socalled telegrapher's equation, or the Burgers' equation. Nevertheless, there are many examples of non-autonomous field theories, like Maxwell's equations with a non constant charge density or general relativity with matter sources that require a formulation for non-autonomous field theories. erationEU/PRTR. JG, XG, MCML and XR acknowledge the financial support of the Ministerio de Ciencia, Innovación y Universidades (Spain), project PGC2018-098265-B-C33.