c1ddb4c814 2021-03-01 jeff@gridfini: % Calculations concerning the special metric of Dieter Egger
c1ddb4c814 2021-03-01 jeff@gridfini: % Small and capital letters are treated as being equivalent
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Dimension of space-time
c1ddb4c814 2021-03-01 jeff@gridfini: n:=4;
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % turn off extra echoes
c1ddb4c814 2021-03-01 jeff@gridfini: off echo;
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % smaller exponents first
c1ddb4c814 2021-03-01 jeff@gridfini: on revpri;
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Coordinates
c1ddb4c814 2021-03-01 jeff@gridfini: OPERATOR X$
c1ddb4c814 2021-03-01 jeff@gridfini: X(0):=t$
c1ddb4c814 2021-03-01 jeff@gridfini: X(1):=lambda0$
c1ddb4c814 2021-03-01 jeff@gridfini: X(2):=lambda1$
c1ddb4c814 2021-03-01 jeff@gridfini: X(3):=lambda2$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Vectors (1-dim arrays start with index 0)
c1ddb4c814 2021-03-01 jeff@gridfini: ARRAY U(n), V(n)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % place (fixed to origin)
c1ddb4c814 2021-03-01 jeff@gridfini: U(0):=a0*asin(t)$
c1ddb4c814 2021-03-01 jeff@gridfini: U(1):=0$
c1ddb4c814 2021-03-01 jeff@gridfini: U(2):=0$
c1ddb4c814 2021-03-01 jeff@gridfini: U(3):=0$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Rule
c1ddb4c814 2021-03-01 jeff@gridfini: trig1:={sin(~x)^2=>(1-cos(x)^2)}$
c1ddb4c814 2021-03-01 jeff@gridfini: let trig1$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Procedure
c1ddb4c814 2021-03-01 jeff@gridfini: procedure showMatrix(mm); begin
c1ddb4c814 2021-03-01 jeff@gridfini: MATRIX hh(n,n)$
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO hh(I+1,J+1):=mm(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: write hh; end;
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Arrays (2-dim arrays start with indices (0,0))
c1ddb4c814 2021-03-01 jeff@gridfini: ARRAY G(n,n), GINV(n,n), CHRIST(n,n,n), RIEM(n,n,n,n), RICCI(n,n), EINST(n,n)$
c1ddb4c814 2021-03-01 jeff@gridfini: ARRAY EIT(n,n), ENI(n,n)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Metric (cellar indices)
c1ddb4c814 2021-03-01 jeff@gridfini: G(0,0):=a0^2/(1-t^2)$
c1ddb4c814 2021-03-01 jeff@gridfini: G(1,1):=a0^2*(1-t^2)$
c1ddb4c814 2021-03-01 jeff@gridfini: G(2,2):=a0^2*(1-t^2)*cos(lambda0)^2$
c1ddb4c814 2021-03-01 jeff@gridfini: G(3,3):=a0^2*(1-t^2)*cos(lambda0)^2*cos(lambda1)^2$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Inverse Metric (roof indices)
c1ddb4c814 2021-03-01 jeff@gridfini: MATRIX MG(n,n), MGINV(n,n)$
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO MG(I+1,J+1):=G(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: MGINV:=1/MG$
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO GINV(I,J):=MGINV(I+1,J+1)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: write "g = ",mg$
c1ddb4c814 2021-03-01 jeff@gridfini: write "ginv = ",mginv$
c1ddb4c814 2021-03-01 jeff@gridfini: write "g*ginv = ",mg*mginv$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % velocity
c1ddb4c814 2021-03-01 jeff@gridfini: for i:=0:n-1 do v(i):=df(u(i),t)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % max. velocity
c1ddb4c814 2021-03-01 jeff@gridfini: Array vmax(n)$
c1ddb4c814 2021-03-01 jeff@gridfini: svmax:=a0/sqrt(1-t^2)$
c1ddb4c814 2021-03-01 jeff@gridfini: for i:=0:n-1 do vmax(i):=svmax$
c1ddb4c814 2021-03-01 jeff@gridfini: svmaxq:=svmax*svmax$
c1ddb4c814 2021-03-01 jeff@gridfini: write "max. velocity = ",svmax$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % energy impulse tensor (eit, roof indices)
c1ddb4c814 2021-03-01 jeff@gridfini: for i:=0:n-1 do for j:=0:n-1 do eit(i,j):=v(i)*v(j)*(p/svmaxq + rho) - p * ginv(i,j)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "eit roof = "$ showMatrix(eit)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % energy impulse tensor (eni, cellar indices, including kappa)
c1ddb4c814 2021-03-01 jeff@gridfini: for i:=0:n-1 do for j:=0:n-1 do eni(i,j) := - kappa * for k:=0:n-1 sum g(i,k)* for l:=0:n-1 sum g(j,l)*eit(k,l)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "eni = -kappa*(eit cellar) = "$ showMatrix(eni)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Christoffel symbols (Fliessbach)
c1ddb4c814 2021-03-01 jeff@gridfini: for k:=0:n-1 do for l:=0:n-1 do for m:=0:n-1 do CHRIST(k,l,m):= for n:=0:n-1 sum GINV(k,n)/2 * (DF(G(m,n),X(l)) + DF(G(l,n),X(m)) - DF(G(m,l),X(n)))$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % curvature tensor (Fliessbach)
c1ddb4c814 2021-03-01 jeff@gridfini: for m:=0:n-1 do for i:=0:n-1 do for k:=0:n-1 do for p:=0:n-1 do RIEM(m,i,k,p) := DF(CHRIST(m,i,k),X(p)) - DF(CHRIST(m,i,p),X(k)) + FOR r:=0:n-1 SUM CHRIST(r,i,k)*CHRIST(m,r,p) - CHRIST(r,i,p)*CHRIST(m,r,k)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Ricci tensor (Fliessbach)
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO RICCI(I,J):= FOR M:=0:n-1 SUM RIEM(M,I,M,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "ricci = "$ showMatrix(ricci)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % curvature scalar
c1ddb4c814 2021-03-01 jeff@gridfini: R:= FOR I:=0:n-1 SUM FOR J:=0:n-1 SUM GINV(I,J)*RICCI(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "curvature scalar r = ",r;
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Einstein tensor
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO EINST(I,J):=RICCI(I,J)-R/2*G(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "einstein = "$ showMatrix(einst)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % solving field equations
c1ddb4c814 2021-03-01 jeff@gridfini: write "solving field equations ...";
c1ddb4c814 2021-03-01 jeff@gridfini: on factor;
c1ddb4c814 2021-03-01 jeff@gridfini: erho:=solve(eni(0,0)=einst(0,0),rho)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "mass density = ", erho$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: ep:=solve(eni(1,1)=einst(1,1),p)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "pressure = ", ep$
c1ddb4c814 2021-03-01 jeff@gridfini: off factor;
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: ferho:=sub(ep,erho)$
c1ddb4c814 2021-03-01 jeff@gridfini: write "final mass density = ", ferho$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: %--------------------------------------------------------------
c1ddb4c814 2021-03-01 jeff@gridfini: % write results to file
c1ddb4c814 2021-03-01 jeff@gridfini: OUT "metric4d_results.txt";
c1ddb4c814 2021-03-01 jeff@gridfini: off echo;
c1ddb4c814 2021-03-01 jeff@gridfini: off nat;
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Metric
c1ddb4c814 2021-03-01 jeff@gridfini: write "metric = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ", G(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Inverse Metric
c1ddb4c814 2021-03-01 jeff@gridfini: WRITE "inverse metric = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ", GINV(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Christoffel symbols
c1ddb4c814 2021-03-01 jeff@gridfini: write "christoffel symbols = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR K:=0:n-1 DO FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",K,",",I,",",J,") = ", CHRIST(K,I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % curvature tensor
c1ddb4c814 2021-03-01 jeff@gridfini: write "curvature tensor = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO FOR K:=0:n-1 DO FOR L:=0:n-1 DO WRITE "(",I,",",J,",",K,",",L,") = ", RIEM(I,J,K,L)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Ricci tensor
c1ddb4c814 2021-03-01 jeff@gridfini: write "ricci tensor = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ", RICCI(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % curvature scalar
c1ddb4c814 2021-03-01 jeff@gridfini: write "curvature scalar = ",R$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % Einstein tensor
c1ddb4c814 2021-03-01 jeff@gridfini: write "einstein tensor = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ",EINST(I,J)$
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % energy impulse tensor
c1ddb4c814 2021-03-01 jeff@gridfini: write "energy impulse tensor eit (roof) = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ",eit(I,J);
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % energy impulse tensor
c1ddb4c814 2021-03-01 jeff@gridfini: write "energy impulse tensor eni (with kappa, cellar) = ";
c1ddb4c814 2021-03-01 jeff@gridfini: FOR I:=0:n-1 DO FOR J:=0:n-1 DO WRITE "(",I,",",J,") = ",eni(I,J);
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: % solving field equations
c1ddb4c814 2021-03-01 jeff@gridfini: write "solving field equations ...";
c1ddb4c814 2021-03-01 jeff@gridfini: on factor;
c1ddb4c814 2021-03-01 jeff@gridfini: write "mass density = ", erho;
c1ddb4c814 2021-03-01 jeff@gridfini: write "pressure = ", ep;
c1ddb4c814 2021-03-01 jeff@gridfini: off factor;
c1ddb4c814 2021-03-01 jeff@gridfini: write "final mass density = ", ferho;
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: SHUT "metric4d_results.txt";
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: off revpri;
c1ddb4c814 2021-03-01 jeff@gridfini: on nat;
c1ddb4c814 2021-03-01 jeff@gridfini:
c1ddb4c814 2021-03-01 jeff@gridfini: END;
c1ddb4c814 2021-03-01 jeff@gridfini: