Aubrey and Maturin are purely fictional and well textured characters, but the character and ship seem generally based on the HMS Shannon in the War of 1812. The Shannon was the only ship of the Royal Navy to beat a ship of the U.S. Navy in a fair fight when it took Lawrence in the Chesapeake. (He said, "Dont' give up the ship." He then died, and they promptly gave it up.)
Both were frigates, and the Shannon had the reputation as a 'happy ship' and a history of vigorous gunnery practice that was not typical in the Royal Navy as a whole
The hapless Chesapeake was just leaving Boston, heavily laden with a stores (fust as when it was bush-wacked by the treacherous Leopard ten years ealier when both sides were at peace) and a new, untried crew mostly made of foreign 'volunteers' for pay . Still take nothing from the Shannon--it was a smaller ship that fought cleanly and well.
Anyway, O'Brien is creative and his bibliographies are rich. After reading everything he wrote I followed his bibliographies through the entire Pepys diaries, several volumes of a documents from the War of 1812--Battles from each side's logs, letters to the bosses at home and (sometimes more telling) inventories of who had what, where and when.
The most accessible source on that war, by far, is Theodore Roosevelt's incomparable Naval History of the War of 1812. It is impeccably researched and makes lively entertaining reading (especially when debunkning each side's post hoc propaganda). Written at age 24, this is the book that made his career and gave him the credibility that led to a high position in the Navy Dept. and ultimately to the White House, after some horseing around in Cuba, of course.