tapas can be simply translated to austerity/penance. It includes following the injunctions laid down by guru/shAstra. Performing regular upasana/rituals and doing self study/practice. Which also includes contemplation and other aspects. Rshis too followed agni aupasana and svAdhyAya in order to attain the divine knowledge of Vedas.
The vedas are also known as "brahma". The tripadA gayatri mantra into
which one is initiated as a pre-qualification for the veda adhyayana
actually denotes this brahman. Hence, having been initiated into this
gayatri mantra, the next step is to do the veda adhyayana. The vedas
unequivocally advice svAdhyAya which is nothing but tapas or penance,
as a mode of acquiring the knowledge about brahman. For such a tapas
to fructify, one has to lead a householder's life and worship the
agni. By worshipping the gArhapatyAgni, by being in the
grihasthAshrama, when a person realises that there is a greater bliss
to be experienced/enjoyed which is different and superior to the
enjoyment from the senses, then this is called as brahma jigyAsa.
So svAdhyAya is a form of tapas or penance. After getting the initiation from the guru one has to get engaged in it practice by self (svAdhyAya) and also in satsanga (company of spiritual people or books etc)
Taittiriya Upanishad’s hymn 1.9.1 emphasizes the central importance of Svadhyaya in one’s pursuit of Reality (Ṛta),
Truth (Satya), Self-restraint (Damah), Perseverance (Tapas),
Tranquility and Inner Peace (Samas), Relationships with others,
family, guests (Praja, Prajana, Manush, Atithi) and all Rituals
(Agnaya, Agnihotram)
In verse 1.11.1, the final chapter in the education of a student, the
Taittiriya Upanishad reminds,
सत्यंवद । धर्मंचर । स्वाध्यायान्माप्रमदः ।
Speak the Satya, follow the Dharma, from Svadhyaya never cease.
One of the earliest mention of Svādhyāya is found in Taittiriya
Aranyaka 2.15: "svādhyayo-adhyetavyah" ("svādhyāya must be practiced"). Śatpath Brāhmana also repeats it. Chandogya
Upanishad verse 4.16.1-2 recommends both silent (mānas) and vocal
(vāchika) types of svādhyāya.
Patanjali's Yogasutra, in verse II.44, recommends Svadhyaya as follows
स्वाध्यायादिष्टदेवतासंप्रयोगः॥
Study thy self, discover the divine. — Patanjali’s Yogasutra, II.44
(Wiki)
Kaya Indriya Siddhi Ashuddhi kshyat tapasaha’’ (Patanjali II Sutra 43)
Kaya = body; Indriya = senses; Siddhihi = strong; Ashuddhi =
impurities; Kshayat = eliminated; Tapasaha = by penance.
“By penance or purifying actions, the body and senses become strong as
the impurities are eliminated.”
“Swadhyayadishtadevatasamprayogaha’’ (Patanjali II Sutra 44)
Swadhyayat = by self-study; Ishta = desired; Devata = deity;
Samprayogaha = presence is felt.
“By self-study, the desired deity’s presence is felt.”
Source