A method for assembling a first element made of a composite material to a second element made of a composite material, comprising the steps of: a) producing the first element made of a composite material, the composite material or its precursor comprising reinforcing fibers embedded in a thermoplastic material, the method of producing said element comprising: - providing a blank made of composite material, - placing the blank in a mold comprising a first part and a second part movable relative to each other between an opened position and a closed position, wherein the first part and the second part define together a molding cavity having the shape of the element to be produced, - shaping the blank to the shape of the element to be produced by moving the mold in the closed position, - retrieving the element from the mold in the opened position, the mold being arranged such that at least a compression area A of the blank is compressed between the first and second parts (300, 400) of the mold such that a part of the thermoplastic material of the blank is directed in at least one rib forming area of the mold cavity wherein a rib, made of the thermoplastic material displaced from the blank by the compression of the compression area A, is formed during the shaping of the blank, wherein a first force F1 is applied on the first part, and a second force F2 is applied on the second part being opposite to the first force F1, during the shaping of the blank such that a volume of thermoplastic material below a top surface plane SP of the blank is directed in the rib forming area to form a rib above the surface plane SP, b) assembling the first element to the second element by welding, the welding material being the thermoplastic material forming the rib of the first element a) producing the first element made of a composite material, the composite material or its precursor comprising reinforcing fibers embedded in a thermoplastic material, the method of producing said element comprising: - providing a blank made of composite material, - placing the blank in a mold comprising a first part and a second part movable relative to each other between an opened position and a closed position, wherein the first part and the second part define together a molding cavity having the shape of the element to be produced, - shaping the blank to the shape of the element to be produced by moving the mold in the closed position, - retrieving the element from the mold in the opened position, the mold being arranged such that at least a compression area A of the blank is compressed between the first and second parts (300, 400) of the mold such that a part of the thermoplastic material of the blank is directed in at least one rib forming area of the mold cavity wherein a rib, made of the thermoplastic material displaced from the blank by the compression of the compression area A, is formed during the shaping of the blank, wherein a first force F1 is applied on the first part, and a second force F2 is applied on the second part being opposite to the first force F1, during the shaping of the blank such that a volume of thermoplastic material below a top surface plane SP of the blank is directed in the rib forming area to form a rib above the surface plane SP, - providing a blank made of composite material, - placing the blank in a mold comprising a first part and a second part movable relative to each other between an opened position and a closed position, - shaping the blank to the shape of the element to be produced by moving the mold in the closed position, - retrieving the element from the mold in the opened position, the mold being arranged such that at least a compression area A of the blank is compressed between the first and second parts (300, 400) of the mold such that a part of the thermoplastic material of the blank is directed in at least one rib forming area of the mold cavity wherein a rib, made of the thermoplastic material displaced from the blank by the compression of the compression area A, is formed during the shaping of the blank, b) assembling the first element to the second element by welding, the welding material being the thermoplastic material forming the rib of the first element