Commit 7b23d776 authored by rink's avatar rink
Browse files

set time step based on method

parent f4f85501
...@@ -377,6 +377,9 @@ public class TrajectoryManager { ...@@ -377,6 +377,9 @@ public class TrajectoryManager {
} }
float timeStep = (float) timeSteps[i]/numIntrpPts; float timeStep = (float) timeSteps[i]/numIntrpPts;
if (!trajDoIntrp && (method == TrajectoryParams.Method.RK4)) {
timeStep *= 2;
}
if ((timeAccum >= trajRefreshInterval)) { // for non steady state trajectories (refresh frequency) if ((timeAccum >= trajRefreshInterval)) { // for non steady state trajectories (refresh frequency)
trajectories = new ArrayList<Trajectory>(); trajectories = new ArrayList<Trajectory>();
...@@ -439,7 +442,7 @@ public class TrajectoryManager { ...@@ -439,7 +442,7 @@ public class TrajectoryManager {
int numTrajectories = trajectories.size(); int numTrajectories = trajectories.size();
reset(); reset();
for (int ti=0; ti<numIntrpPts; ti++) { // additional points per domain time step for (int ti=0; ti<numIntrpPts; ti++) { // additional points per domain time step
double dst = (x1 - x0)/numIntrpPts; double dst = (x1 - x0)/numIntrpPts;
double xt = x0 + dst*ti; double xt = x0 + dst*ti;
...@@ -450,54 +453,37 @@ public class TrajectoryManager { ...@@ -450,54 +453,37 @@ public class TrajectoryManager {
vInterp.interpolate(xt, intrpV); vInterp.interpolate(xt, intrpV);
wInterp.interpolate(xt, intrpW); wInterp.interpolate(xt, intrpW);
if (method == TrajectoryParams.Method.RK4) { if (method == TrajectoryParams.Method.RK4) { // Runge-Kutta
if ((ti == numIntrpPts-1) && (k == dataDomainLength-2)) { double step = dst;
System.arraycopy(values1[0], 0, intrpU_1, 0, intrpU_1.length); if (!trajDoIntrp) {
System.arraycopy(values1[1], 0, intrpV_1, 0, intrpV_1.length); step = 2*dst;
System.arraycopy(values1[2], 0, intrpW_1, 0, intrpW_1.length);
intrpU = mean(intrpU, intrpU_1);
intrpV = mean(intrpV, intrpV_1);
intrpW = mean(intrpW, intrpW_1);
for (int t=0; t<numTrajectories; t++) {
Trajectory traj = trajectories.get(t);
traj.currentTimeIndex = direction*i;
traj.currentTime = direction*times[i];
traj.forward(info, new float[][] {intrpU, intrpV, intrpW}, color_values, spatialSetTraj, terrain, direction, timeStep);
} }
} if (k == dataDomainLength-2 && ti > numIntrpPts-2) {
else { continue;
uInterp.interpolate(xt+dst, intrpU_1); }
vInterp.interpolate(xt+dst, intrpV_1); uInterp.interpolate(xt+step/2, intrpU_1);
wInterp.interpolate(xt+dst, intrpW_1); vInterp.interpolate(xt+step/2, intrpV_1);
wInterp.interpolate(xt+step/2, intrpW_1);
uInterp.interpolate(xt+2*dst, intrpU_2); uInterp.interpolate(xt+step, intrpU_2);
vInterp.interpolate(xt+2*dst, intrpV_2); vInterp.interpolate(xt+step, intrpV_2);
wInterp.interpolate(xt+2*dst, intrpW_2); wInterp.interpolate(xt+step, intrpW_2);
for (int t=0; t<numTrajectories; t++) { for (int t=0; t<numTrajectories; t++) {
Trajectory traj = trajectories.get(t); Trajectory traj = trajectories.get(t);
traj.currentTimeIndex = direction*i; traj.currentTimeIndex = direction*i;
traj.currentTime = direction*times[i]; traj.currentTime = direction*times[i];
traj.forwardRK4(info, new float[][] {intrpU, intrpV, intrpW}, traj.forwardRK4(info, new float[][] {intrpU, intrpV, intrpW},
new float[][] {intrpU_1, intrpV_1, intrpW_1}, new float[][] {intrpU_1, intrpV_1, intrpW_1},
new float[][] {intrpU_2, intrpV_2, intrpW_2}, new float[][] {intrpU_2, intrpV_2, intrpW_2},
color_values, spatialSetTraj, terrain, direction, timeStep); color_values, spatialSetTraj, terrain, direction, timeStep);
} }
}
} }
else { else {
if (method == TrajectoryParams.Method.HySplit) { // NOAA HySplit if (method == TrajectoryParams.Method.HySplit) { // NOAA HySplit
if (ti == numIntrpPts-1) { uInterp.interpolate(xt+dst, intrpU_1);
System.arraycopy(values1[0], 0, intrpU_1, 0, intrpU_1.length); vInterp.interpolate(xt+dst, intrpV_1);
System.arraycopy(values1[1], 0, intrpV_1, 0, intrpV_1.length); wInterp.interpolate(xt+dst, intrpW_1);
System.arraycopy(values1[2], 0, intrpW_1, 0, intrpW_1.length);
}
else {
uInterp.interpolate(xt+dst, intrpU_1);
vInterp.interpolate(xt+dst, intrpV_1);
wInterp.interpolate(xt+dst, intrpW_1);
}
intrpU = mean(intrpU, intrpU_1); intrpU = mean(intrpU, intrpU_1);
intrpV = mean(intrpV, intrpV_1); intrpV = mean(intrpV, intrpV_1);
...@@ -2380,43 +2366,49 @@ public class TrajectoryManager { ...@@ -2380,43 +2366,49 @@ public class TrajectoryManager {
String propStr = null; String propStr = null;
propStr = prop.getProperty("CylinderWidthFactor"); propStr = prop.getProperty("CylinderWidthFactor");
if (propStr != null) { if (propStr != null) {
float fac = Float.valueOf(propStr); float fac = Float.valueOf(propStr.trim());
trajParams.setCylinderWidth(trajParams.getCylinderWidth()*fac); trajParams.setCylinderWidth(trajParams.getCylinderWidth()*fac);
} }
propStr = prop.getProperty("RibbonWidthFactor"); propStr = prop.getProperty("RibbonWidthFactor");
if (propStr != null) { if (propStr != null) {
float fac = Float.valueOf(propStr); float fac = Float.valueOf(propStr.trim());
trajParams.setRibbonWidthFactor(fac); trajParams.setRibbonWidthFactor(fac);
} }
propStr = prop.getProperty("ManualIntrpPts"); propStr = prop.getProperty("ManualIntrpPts");
if (propStr != null) { if (propStr != null) {
trajParams.setManualIntrpPts(Boolean.valueOf(propStr)); trajParams.setManualIntrpPts(Boolean.valueOf(propStr.trim()));
} }
propStr = prop.getProperty("TrajDoIntrp"); propStr = prop.getProperty("TrajDoIntrp");
if (propStr != null) { if (propStr != null) {
trajParams.setDoIntrp(Boolean.valueOf(propStr)); trajParams.setDoIntrp(Boolean.valueOf(propStr.trim()));
} }
propStr = prop.getProperty("TerrainFollow"); propStr = prop.getProperty("TerrainFollow");
if (propStr != null) { if (propStr != null) {
trajParams.setTerrainFollowing(Boolean.valueOf(propStr)); trajParams.setTerrainFollowing(Boolean.valueOf(propStr.trim()));
} }
propStr = prop.getProperty("NumIntrpPts"); propStr = prop.getProperty("NumIntrpPts");
if (propStr != null) { if (propStr != null) {
trajParams.setNumIntrpPts(Integer.valueOf(propStr)); trajParams.setNumIntrpPts(Integer.valueOf(propStr.trim()));
} }
propStr = prop.getProperty("TrajRefreshInterval"); propStr = prop.getProperty("TrajRefreshInterval");
if (propStr != null) { if (propStr != null) {
trajParams.setTrajRefreshInterval(Double.valueOf(propStr)); trajParams.setTrajRefreshInterval(Double.valueOf(propStr.trim()));
}
propStr = prop.getProperty("StartSkip");
if (propStr != null) {
trajParams.setStartSkip(Integer.valueOf(propStr.trim()));
} }
propStr = prop.getProperty("TrajForm"); propStr = prop.getProperty("TrajForm");
if (propStr != null) { if (propStr != null) {
propStr = propStr.trim();
if (propStr.equals("LINE")) { if (propStr.equals("LINE")) {
trajParams.setTrajectoryForm(TrajectoryParams.LINE); trajParams.setTrajectoryForm(TrajectoryParams.LINE);
} }
...@@ -2436,6 +2428,7 @@ public class TrajectoryManager { ...@@ -2436,6 +2428,7 @@ public class TrajectoryManager {
propStr = prop.getProperty("Method"); propStr = prop.getProperty("Method");
if (propStr != null) { if (propStr != null) {
propStr = propStr.trim();
if (propStr.equals("HYSPLIT")) { if (propStr.equals("HYSPLIT")) {
trajParams.setMethod(TrajectoryParams.Method.HySplit); trajParams.setMethod(TrajectoryParams.Method.HySplit);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment