Warp Factory
  • What is Warp Factory?
  • Overview
    • Installing Warp Factory
    • Workflow
    • Codebase Structure
    • Object Types
    • Frames
  • Examples
    • Metrics
      • M1 - First Metric
      • M2 - Default Metrics
      • M3 - Building a Metric
    • Energy Tensor
      • T1 - First Energy Tensor
      • T2 - Cartoon Methods
      • T3 - GPU Computation
      • T4 - Solver Order
      • T5 - Errors
    • Analysis
      • A1 - Energy Conditions
      • A2 - Metric Scalars
      • A3 - Eval Metric
      • A4 - Momentum Flow
    • Warp Shell
      • W1 Warp Shell Comoving
  • Modules
    • Metrics Module
      • Metric Library
        • metricGet_Minkowski
        • metricGet_Alcubierre
        • metricGet_Lentz
        • metricGet_VanDenBroeck
        • metricGet_WarpShellComoving
        • metricGet_ModifiedTime
        • metricGet_Schwarzschild
      • Metric Functions
        • setMinkowski
        • setMinkowskiThreePlusOne
        • threePlusOneBuilder
        • threePlusOneDecomposer
    • Analyzer Module
      • getMomentumFlowLines
      • doFrameTransfer
      • changeTensorIndex
      • getScalars
      • getEnergyConditions
      • evalMetric
    • Solver Module
      • getEnergyTensor
      • verifyTensor
    • Visualizer Module
      • plotThreePlusOne
      • plotTensor
      • Plot Functions
    • Units Module
  • General
    • Contributing
    • FAQ
    • Citing Warp Factory
Powered by GitBook
On this page
  • Computing Momentum Flow Lines
  • Get Metric and Energy Tensor
  • Get Momentum Flow Lines
  • Plot Momentum Flow Lines
  1. Examples
  2. Analysis

A4 - Momentum Flow

Computing Momentum Flow Lines

Get Metric and Energy Tensor

%% Alcubierre
gridSize = [1 20 20 20];
worldCenter = (gridSize+1)./2;
velocity = 0.5;
R = 5;
sigma = 0.5;
Metric = metricGet_AlcubierreComoving(gridSize,worldCenter,velocity,R,sigma);

% Compute energy tensor
EnergyTensor = getEnergyTensor(Metric);

Get Momentum Flow Lines

%% Get momentum flow lines

% Define the inputs
ngridsteps = 4;
stepSize = 0.75;
maxSteps = 10000;
scaleFactor = 1/max(abs(EnergyTensor.tensor{1,2}),[],'all');

% Build a grid of starting points using meshgrid
[X,Y,Z] = meshgrid(1:ngridsteps:gridSize(2),1:ngridsteps:gridSize(3),1:ngridsteps:gridSize(4));

% Assign the starting points into the cell format
startPoints = cell(1,3);
startPoints{1} = X;
startPoints{2} = Y;
startPoints{3} = Z;

% Find the flowline paths
[Paths] = getMomentumFlowLines(EnergyTensor, startPoints, stepSize, maxSteps, scaleFactor);

Plot Momentum Flow Lines

% Setup figure
figure()
hold on

% Define the segment of paths to plot
pathlength = 30; % length of index to plot the path
startIdx = 10; % start index

for i = 1:length(Paths)
    if size(Paths{i},1) > pathlength && length(Paths{i}) > startIdx+pathlength
        plot3(Paths{i}(startIdx:startIdx+pathlength,1), ...
            Paths{i}(startIdx:startIdx+pathlength,2), ...
            Paths{i}(startIdx:startIdx+pathlength,3),'k')
    end
end

% Set the camera view
view(45,45)
PreviousA3 - Eval MetricNextWarp Shell

Last updated 1 year ago