a walk is a good idea, sometimes I do that, ususally if it's in a rural area (otherwise I just get stressed out from so many people everywhere)... My advice might not be good for you or it might be great (depending on what you tend to write music about) I will often do things like... read up on stories such as at crimelibrary.com (that gets me feeling pretty emotional, to see what people do to people for no good reason at all)... Sometimes I will look at some visual art... I often will listen to some operas to get inspiration (wow! Some of those have such rediculously amazing hooks (to put it in vulgar modern descriptions).
Really, what you describe of your life... there is a wealth of stuff to draw from. The thing I find with songwriting, you have to allow yourself to lose control and be a vessel for your emotions, even if they aren't concious emotions, even if they disturb you, or creep you out. Embrace your unconcious regardless of what you think is correct (nothing is correct, anyone who tells you songwriting is done this way or that way or THIS MAKES A GOOD SONG or that does, makes shitty music, or just wants to throw you off). I've found out a lot about myself from music I come up with, that I would have never thought of by just sitting and pondering about it. One thing to think about with your frustrations... say you are feeling a lot about these custody issues... you don't nessisarily have to write a song about that, but allow yourself to feel the emotions and hurt that goes allong with it. Think, feel, what notes are that hurt. What texture, what sound does that emotion create in your subconcious? If you close your eyes when emotions are high, do you hear anything, even noise? (nothing wrong with noise...it's all part of music, hand and hand with melodies and rythm) When you feel that noise, do you hear any aural textures in your head? Do any notes (even two notes... so many amazing melodies can start by only one interval, and just playing with that interval in different ways) speak your pain in ways that you could never use something as vulgar and disgusting as human language to describe? Does any of this make sense? I think really you have to treat it like you would if a psychologist was giving you a word association test. Your worst enemy when writing is your brain. Don't think about what you are doing as much as you would think, just sometimes it's a matter of stretching your fingers out on the keyboard, or fretboard, or whatever you stretch your fingers, or other members (heh) onto in order to express your art, and just play. Even if it's stupid. Stupid isn't always bad, sometimes it works perfectly, and sometimes stupid becomes brilliance. Just write...A LOT....tons of riffs, melodies, sequences, embarsing ones, good ones, stupid ones, anything that you feel: record them, archive them and lots of them, the first things that come to mind in response to your emotions. If you have a huge collection of bits and pieces, if you are stuck sometimes that one thing you did back a few months ago that you thought was stupid might just click, and therefore become perfect, and will just complete your auditory story. Sometimes great music is written part at a time even, not all at once. If you can't think of lyrics, start with instruments, if yu can't think of melody, start with rythm, if you can't think of arrangement, start with simple melodies on a piano or simple instrument, or vice versa. You can always utilize many styles of writing and keep with your writing style, as your writing style is essentially what you experience, what you feel, and how you approach the instrument that you are using to compose. I use several different methods of writing, depending on this.
Anyway, beyond that. It's never a bad idea to do what most people suggest for this (which actually do work quite a bit) Take a break from the song for a while, listen to lots of music (a variety, and not just the type of music you are trying to write). Sometimes just breathe, have a drink, or a smoke, or meditate, do something you enjoy. Sometimes before a writing session I'll play some video games, or watch a very funny show, or listen to some funny music, because that is something that relaxes me, and makes me feel well. Not saying, do that... just giving an example. If you love fishing go out and have a nice relaxing time fishing, and pondering, and feeling. The most important thing though, regardless of what type of music you write, or the subject. Day dream, and feel. Never deny yourself those two beautiful ecstacies, it'll de-humanize you, and will take away from such an essential piece of the human emotional experience, in which all art is an expression of.
Just really, don't let your common sense get in the way, leave that for the mix and arrangement. great music is from the heart, and doesn't always come from genius riffs, perfect lyrics or great melodies, just from the pure passion and emotion that is sometimes beyond what we even realize conciously is happening constantly within us. Let your music have a life of it's own if it takes one, let it tell you what it wants to do, let it guide you, let it develope into whatever it turns into. If it doesn't fit with the project your concentrating on, it will fit with something, sometime: Maybe even a project you haven't thought about yet.
Use everything, nature, animals, hate, love, intillect, stupidness, selfishness, selflessness, throw your mind in the garbage and feel, and it will happen, and you'll feel better. Oh and, good luck about your issues man, I've been going through a very rough patch lately and I know how difficult it can be. Just let your music be your therapy.