Dwarf Fortress Animal Segregation
The simplest way to do what you want with a "barnyard" would be with a pit and a non-pet passable door (marks as keep tightly closed
).
To create the pit you can use the channel command, which will leave an area edged with ramps, so your dwarves can get in and out.
Just make a bunch of ropes and chains and tie them up. They breed via spores, as long as they're not caged they can be chained at opposite ends of the map and still reproduce. Your FPS will thank you.
Another solution would be to build cages(b to build then j for cage) and assign the animals to the cages(query the built cage and assign). A built cage can have any number of tame animals stuffed into it. Newborn animals will appear outside the cages, so you may have to occasionally assign the new animals to the cage as they show up. If you're concerned about FPS cages should be pretty good for that, caged animals won't pathfind at all.