I have studied applied math and got a phd (3yrs) in that field with applications in fluid dynamics. Then in my first postdoc (1.5yrs) I did again a postdoc in applied math but studied applications in biological modeling. Now in my second postdoc (started 2 months ago) I am studying a new application, avalanches. The unifying theme is supposed to be the modeling. My problem is that I am feeling a bit lost, feeling like I have to start again from the beginning in this field (methods, codes et.c). I am completely lost and even if I try to make myself see that as a challenge, I am thinking that I want to go and study computational cosmology but then in this way I will never be enough successful for academia. This is because no ones wants someone that knows a little bit of everything but is expert in nothing. There are other things that I like as topics but not my current postdoc ( I actually got it only because I could not find another position on time to leave the first postodoc ). Can you please give me some advice? I would really appreciate it, since I am feeling lost for too long now.
Research involves both a field/topic and a methodology. In my experience the work is more satisfying if you like both aspects. It seems like you have a technique (modeling) that you're succesful with, but haven't discovered a field you love. Unfortunately, academia is more strongly organized around topics than techniques. Conferences, journals, and research groups tend to be about a field or subfield, with many technqiues or methodologies used to answer questions in that field. Given that, it makes sense that you might feel lost or like an outsider.
I suggest you explore widely to find fields that not only interest you, but where you feel compelled to use your modeling skills to make a contribution to advance understanding within that field. This could include reading general articles, attending/watching seminars, but also visiting labs and talking with researchers. If you have that passion and feel like you've found 'your people' then it will be easier to persist through the difficult times.
You also need to honestly assess how much of your interest in cosmology, for example, is a case of "the grass is always greener", that is, something over there looks more appealing than where you are currently just because it's different and you're not immersed in the struggle of doing the work.
Best of luck finding your way!