I went to college at UCSD and lived there for a while after. It's been over a decade since I moved back to SF, so my info may be a bit outdated...
The Balboa tennis club at Morley field has got to be one of the best public facilities in the United States. The courts are maintained very well, there are lights, and the fees are remarkably low ($5/day for a "membership" and low court fees, though they may have gone up in the past 10 years). One of the best things about this club is the doubles challenge courts. The "advanced" doubles challenge court here is a really reliable way to find a quality match. On the weekend, you really can show up, alone with your rackets, and have a very high probability of spending the day playing 4.0+ level tennis (and not just low 4.0 - plenty of the players on the advanced challenge courts are 4.5+). BTW, don't worry if you aren't at that level - there's also a second court that is probably 3.0-4.0 that is also very well attended.
If you're north county, the La Jolla public courts are also a good bet. Again, there are plenty of 4.5+ players who hang out here. It isn't quite as easy to get a match as it is at Morley (Balboa), but definitely worth a look.
Beyond that... well, I've always enjoyed playing at the La Jolla Beach and Tennis Club, though it's $$$ enough that I rarely do this anymore. Pretty excellent if you have the scratch, though. You get access as a hotel guest, but you can also join as a member if you have something like $60K to spend and a few years for the waiting list. No worries
There's also a semi-private club in pacific beach with clay courts. I've heard good things about it, but never played there.
Anyway, as a 4.0, your best bet is Balboa tennis club. All you really need to do is show up with your rackets, and you'll get to play. Good luck! I envy you, San Diego is an incredibly good place to be a tennis player.