Theoretical economy calculation of closed country Is there any well-known theoretical solution to the problem as described below? I am considering an ideal very simplified case.
There is a closed country/community of N people. All people are working. Let's say they have A% out of N people producing food, B% out of N people working in the industry (producing everything from the phones to cars), C% work in government, D% work in the service like a haircut, cleaning, etc. Initially, the GDP of this community is G or maybe it is better to tell, that initially, they have G amount of money. Let's assume that everything that is produced will be bought by others.
In other words, I can formulate it like this. N people decided to leave this planet and move to Mars/another planet because they fed up with unfair live on The Earth :) They decided to take with them things with total costs G (initial GDP). Let's assume they have everything on the other planet like air, water, Sun, good climate, resources, etc. the same as on The Earth. They divided the people between different occupations as mentioned above.
The questions:

I am not an economist, but I would expect this kind of problem was solved already a long time back and it is well-known and has some specific name. Is not it?
How this economy (GDP) will depend on time G(t)?
Are there any conditions when it will grow or it always will go down at some point?
Does G(t) depend on how big is N?
You are basically asking for a growth model and yes there are plenty of them the two most popular are:

Solow-Swan growth model.
Endogenous growth model.

I will go over simplified version of both in order to answer how 'G' depends on time and also how 'N' plays a role but I will change the name of all variables to follow standard economic terminology and notation as your non-standard terminology is bit confusing and all over the place. Furthermore, I will present only the most simplest versions of such models, skipping some derivations for the sake of brevity, for more advanced versions and full treatment I would direct you toward Romer Advanced Macroeconomics or Barro &amp; Sala-i-Martin Economic Growth.
Solow-Swan Model
The Solow-Swan model is currently the more dominant model in mainstream economics as the latter endogenous growth model, while theoretically appealing, is very hard to empirically test.  A long story short in this model evolution of GDP (real output - denoted by $Y$) would depend on a) exogenously given technology (denoted by $A$) growth ($g$) and also population ($L$) growth ($n$). However, living standards depend not just on total of $Y$ but on $Y$ per head (country with 100 GDP but 10 people is arguably richer than country with 100 GDP but 100 people).
The model goes as follows:
We need to start with specifying some production function as we need to have some way of determining the output $Y$. A classical example would be:
$$Y = F(K,L) = K^{\alpha}AL^{1-\alpha}$$,
where $K$ is the stock of capital and $L$ the labor which is for simplicity assumed to correspond to population. Furthermore, the production function will be expressed per unit of effective worker ($AL$):
$$\frac{Y}{AL}= F(\frac{K}{AL},1) = (\frac{K}{AL})^{\alpha} = f(k) = k^{\alpha}$$
with $0&lt;\alpha&lt;1$ and $f(0)=0, f'(k)&gt;0$ &amp;  $f''(k)&lt;0$. The evolution of population and technology in the model would be given by $\dot{L}(t) = nL(t)$ and $\dot{A}(t) = gA(t)$. Furthermore, the evolution of $K$ is given by $\dot{K}(t)= sY(t) -\delta K(t)$ where $sY(t)$ is the proportion of output saved under savings rate $s$ and $\delta$ is the depreciation rate -i.e. the rate at which capital breaks down.
I will skip most of the derivations but under the above conditions it can be showed that the capital per person has following dynamics: $\dot{k}=sf(k(t))-(n+g+\delta)k(t)$. Given this conditions in a steady state (a state where $\dot{k}=0$) it can be shown that the evolution of capital ($K=ALk$) will be given by:
$$\frac{\dot{K}}{K} = n+g \implies \frac{\dot{Y}}{Y}=n+g  $$
The reason why above implication holds is because in this case production function implies constant returns to scale. When expressed in per capita terms the growth of $Y/L$ will simply be $n$.
Hence, your closed martian economy will grow at the rate of $n+g$ in absolute terms and in per capita terms at the rate of $n$. Hence, In this model the output/GDP of your martian economy would grow as long as combined growth of population and technology is bigger than zero ($n+g&gt;0)$ and would shrink if the inequality would go other way. In per capita terms only the growth of technology would matter.  The stock of $Y(0)$ and population $L(0)$ as well as capital $K(0)$ (which you dont mention) that people will bring to the mars will determine the initial conditions but not the growth rate of the colony.
As mentioned by Giskard in his +1 comments the exact solution depends on assumptions about the production function. For example, if we would not have constant returns to scale there would also the $Y$ would not grow exactly at $n+g$ but generally speaking the  growth rate of total output would still be a function of $n$ and $g$ and per capita output of $g$.
Endogenous Growth Model
I wont cover endogenous growth model in such explicit detail as Solow-Swan model as endogenous growth model is far more complex and even surface level treatment would take several pages. However, I will cover some departures from the above Solow-Swan model.
In endogenous growth model the rate at which technology grows ($g$) is not just exogenously given but determined by the model. For example, according to Romer's textbook mentioned above a simple endogenous model inspired by the works of Romer, Grossman and Helpman and Aghion and Howitt would use the following production function:
$$Y(t) = ((1-a_k)K(t))^{\alpha} (A(t)(1-a_L)L(t))^{1-\alpha}$$
with the change in technology given by:
$$\dot{A}(t) =B(a_k K(t))^{\beta} (a_L L(t))^{\gamma}A(t)^{\theta}$$
Translated to plain English the first equation says that the output will be given by the share of capital and people devoted to production of goods and services   ($(1-a_k)K(t)$ and $(1-a_L)L(t)$ respectively as well as technology $A$ - this is really just modified version of production function in the first part.
The next equation in plain English says that the change of technology in time depends on how much capital and labor is devoted to production of this new technology as well as on the current stock of technology ($a_k K(t)$,  $a_L L(t)$ and $A(t)$) respectively.
I wont provide rigorous solution to this problem but the solution would show that depending on exactly what are the parameters of the model - especially the $\theta$ parameter which tells us what the effect of current knowledge and 'success' of future R&amp;D will be. If past knowledge makes generating future knowledge easier $\theta&gt;1$ if harder $\theta&lt;1$ and if its effect is constant $\theta=1$. I will grossly oversimplify here but generally if $\theta&lt;1$ the model will predict virtually the same result as Solow model. If $\theta&gt;1$ the model will exhibit ever increasing rate of economic growth and in such case having more people will have dramatic impact on speeding up economic growth. If $\theta=1$ the population growth will still matter but the effect wont be as dramatic as in the previous case and even if population growth is zero the saving rate will play a crucial role in determining long run growth.
To sum it up, in this case depending on what are the parameters of the model we can either say that the result will be similar to the one from Solow model or that here population growth and choose savings rate will also matter for the growth of economic output in your Mars colony. As in the previous case growth would cease or output would decline if either technology or factors of production would decline.
Furthermore, again endogenous growth models have many variants but general takeaway from these models is that population growth or peoples decisions to invest in R&amp;D can also affect the rate of per capita growth of output. Hence in this case the rate of growth of your martian colony would also depend on the number of people on mars and how many of them are engaged in 'production' of R&amp;D or more generally how much they decide to invest resources in such endeavor.

PS: You will note that none of the models above really care about how people are distributed between different sectors of economy (your A, B, C and D) - aside from the fraction of factors of production devoted to R&amp;D in endogenous growth model or how much money economy has. Money stock should be not confused with output or GDP and since in the long run money is considered by most economists neutral most economic growth models will not even explicitly include stock of money as it is not considered important.
Moreover, the treatment here is surface level just to showcase some different ways how you could think about the problem. For more full treatment you should refer to sources I cited and sources cited therein.