Johns Hopkins Turbulence Databases

Using JHTDB with Matlab


Download

Matlab Code: turbmat-20171102 (tar.gz) (zip)

This downloads a directory which constains the Matlab interface. Included are sample Matlab M-files (turbm.m, mhd.m, channelm.m, mixingm.m) that illustrate the basic functionality of the interface. These files may also be adapted to the end-user's needs. The directory also includes several gSOAP wrapper functions that need not be modified. The interface has been tested under newer installations of Matlab on various versions of Mac OS X, Linux, and Windows.

Please see the README file for more information.

Overview

We have written several routines which use Matlab web service functions to call JHTDB. All communication with JHTDB is provided through the TurbulenceService Matlab class which uses the Matlab intrinsic web service functions to create SOAP messages, query the Turbulence Database, and parse the results. For each database function a wrapper has been created to perform the data translation and retrieval.

The Matlab interface now includes the Matlab-Fast-SOAP package which provides optimized web service functions for creating, sending, and parsing SOAP messages. The Matlab-Fast-SOAP package has been found to provide a 100x speedup over the intrinsic Matlab SOAP functions used in the original implementation of the interface. Clients are now able to easily and quickly retrieve large datasets which previously would have taken Matlab much longer to process the request and parse the results.

Limitations and Known Issues

  • Error handling is performed by the Matlab SOAP communication calls. If a
    SOAP error occurs during execution of the interface functions, all SOAP
    error information will be display to the Matlab terminal and the execution
    will be terminated. We do not currently provide a method for explicit error
    handling/catching.

  • When retrieving large amounts of data, the heap memory of Matlab's Java
    Virtual Machine may overflow. In this event it is required to increase the
    Java heap memory in Matlab. For additional information please see:

    How to increase Matlab JVM heap space

Interpolation Flags

Note: Detailed descriptions of the underlying functions can be found in the analysis tools documentation.

% ---- Temporal Interpolation Options ----
NoTInt = 'None'; % No temporal interpolation
PCHIPInt = 'PCHIP'; % Piecewise cubic Hermit interpolation in time

% ---- Spatial Interpolation Flags for Get[Field] functions ----
NoSInt = 'None'; % No spatial interpolation
Lag4 = 'Lag4'; % 4th order Lagrangian interpolation in space
Lag6 = 'Lag6'; % 6th order Lagrangian interpolation in space
Lag8 = 'Lag8'; % 8th order Lagrangian interpolation in space

% ---- Spatial Differentiation & Interpolation Flags for Get[Field]Gradient, Get[Field]Laplacian & Get[Field]Hessian ----
FD4NoInt = 'None_Fd4'; % 4th order finite differential scheme for grid values, no spatial interpolation
FD6NoInt = 'None_Fd6'; % 6th order finite differential scheme for grid values, no spatial interpolation
FD8NoInt = 'None_Fd8'; % 8th order finite differential scheme for grid values, no spatial interpolation
FD4Lag4 = 'Fd4Lag4'; % 4th order finite differential scheme for grid values, 4th order Lagrangian interpolation in space

% ---- Spatial Differentiation & Interpolation Flags for Get[Field], Get[Field]Gradient, Get[Field]Laplacian & Get[Field]Hessian ----
M1Q4 = 'M1Q4'; % Splines with smoothness 1 (3rd order) over 4 data points. Not applicable for Hessian.
M2Q8 = 'M2Q8'; % Splines with smoothness 2 (5th order) over 8 data points.
M2Q14 = 'M2Q14'; % Splines with smoothness 2 (5th order) over 14 data points.

Function Descriptions

GetVelocity

real(3,count) output = getVelocity(char authkey, char dataset, real time,
  spatial interpolation option, temporal interpolation option, integer count,
  real(3,count) input);


Example

for i = 1:10
  points(1, i) = 0.1*i; % x
  points(2, i) = 0.3*i; % y
  points(3, i) = 0.2*i; % z
end

fprintf('\nRequesting velocity at 10 points...\n');
result3 = getVelocity (authkey, dataset, time, Lag6, NoTInt, 10, points);
for i = 1:10
  fprintf(1,'Vx = %f\n', result3(1,i));
  fprintf(1,'Vy = %f\n', result3(2,i));
  fprintf(1,'Vz = %f\n', result3(3,i));
end

GetVelocityAndPressure

real(4,count) output = getvelocityandpressure(char authkey, char dataset, real time,
  spatial interpolation option, temporal interpolation option, integer count,
  real(3,count) input);


Example

fprintf('Requesting velocity and pressure at 10 points...\n');
result4 = getVelocityAndPressure(authkey, dataset, time, Lag6, NoTInt, 10, points);
for i = 1:10
  fprintf(1,'Vx = %f\n', result4(1,i));
  fprintf(1,'Vy = %f\n', result4(2,i));
  fprintf(1,'Vz = %f\n', result4(3,i));
  fprintf(1,'Pressure = %f\n', result4(4,i));
end

GetVelocityGradient

real(9,count) output = getVelocityAndPressure(char authkey, char dataset, real time,
  spatial interpolation option, temporal interpolation option, integer count,
  real(3,count) input);


Example

fprintf(1,'Velocity gradient at 10 particle locations...\n');
result9 = getVelocityGradient(authkey, dataset, time, FD4Lag4, NoTInt, 10, points);
for i = 1:10
  fprintf(1,'%i : duxdx=%f', i, result9(1,i));
  fprintf(1,', duxdy=%f', result9(2,i));
  fprintf(1,', duxdz=%f', result9(3,i));
  fprintf(1,', duydx=%f', result9(4,i));
  fprintf(1,', duydy=%f', result9(5,i));
  fprintf(1,', duydz=%f', result9(6,i));
  fprintf(1,', duzdx=%f', result9(7,i));
  fprintf(1,', duzdy=%f', result9(8,i));
  fprintf(1,', duzdz=%f', result9(9,i));
end

GetVelocityHessian

real(18,count) output = getVelocityHessian(char authkey, char dataset, real time,
  spatial interpolation option, temporal interpolation option,
  integer count, real(3,count) input)


Example

fprintf(1,'Velocity Hessian at 10 particle locations...\n');
result18 = getVelocityHessian(authkey, dataset, time, FD4Lag4, NoTInt, 10, points);
for i = 1:10
  fprintf(1,'%i : d2uxdxdx=%f', i, result18(1,i));
  fprintf(1,', d2uxdxdy=%f', result18(2,i));
  fprintf(1,', d2uxdxdz=%f', result18(3,i));
  fprintf(1,', d2uxdydy=%f', result18(4,i));
  fprintf(1,', d2uxdydz=%f', result18(5,i));
  fprintf(1,', d2uxdzdz=%f', result18(6,i));
  fprintf(1,', d2uydxdx=%f', result18(7,i));
  fprintf(1,', d2uydxdy=%f', result18(8,i));
  fprintf(1,', d2uydxdz=%f', result18(9,i));
  fprintf(1,', d2uydydy=%f', result18(10,i));
  fprintf(1,', d2uydydz=%f', result18(11,i));
  fprintf(1,', d2uydzdz=%f', result18(12,i));
  fprintf(1,', d2uzdxdx=%f', result18(13,i));
  fprintf(1,', d2uzdxdy=%f', result18(14,i));
  fprintf(1,', d2uzdxdz=%f', result18(15,i));
  fprintf(1,', d2uzdydy=%f', result18(16,i));
  fprintf(1,', d2uzdydz=%f', result18(18,i));
  fprintf(1,', d2uzdzdz=%f\n', result18(18,i));
end

GetVelocityLaplacian

real(3,count) output = getVelocityLaplacian(char authkey, char dataset, real time,
  spatial interpolation option, temporal interpolation option, integer count,
  real(3,count) input);


Example

fprintf(1,'Velocity Laplacian at 10 particle locations...\n');
result3 = getVelocityLaplacian(authkey, dataset, time, FD4Lag4, NoTInt, 10, points);
for i = 1:10
  fprintf(1,'%i: (grad2ux=%f, grad2uy=%f, grad2uz=%f\n', ...
    i, result3(1,i), result3(2,i), result3(3,i));
end

GetPressureGradient

real(3,count) output = getPressureGradient(char authkey, char dataset, real time,
  spatial interpolation option, temporal interpolation option, integer count,
  real(3,count) input);


Example

fprintf(1,'Pressure gradient at 10 particle locations...\n');
result3 = getPressureGradient(authkey, dataset, time, FD4Lag4, NoTInt, 10, points);
for i = 1:10
  fprintf(1,'%i: dpdx=%f, dpdy=%f, dpdz=%f\n', ...
    i, result3(1,i), result3(2,i), result3(3,i));
end

GetPressureHessian

real(6,count) output = getPressureHessian(char authkey, char dataset, real time,
  spatial interpolation option, temporal interpolation option, integer count,
  real(3,count) input);


Example

fprintf(1,'Velocity hessian at 10 particle locations...\n');
result6 = getPressureHessian(authkey, dataset, time, FD4Lag4, NoTInt, 10, points);
for i = 1:10
  fprintf(1,'%i: d2pdxdx=%f', i, result6(1,i));
  fprintf(1,', d2pdxdy=%f', result6(2,i));
  fprintf(1,', d2pdxdz=%f', result6(3,i));
  fprintf(1,', d2pdydy=%f', result6(4,i));
  fprintf(1,', d2pdydz=%f', result6(5,i));
  fprintf(1,', d2pdzdz=%f\n', result6(6,i));
end

GetForce

real(3,count) output = getForce(char authkey, char dataset, real time,
  spatial interpolation option, temporal interpolation option, integer count,
  real(3,count) input);


Example

fprintf(1,'Requesting forcing at 10 points...\n');
result3 = getForce(authkey, dataset, time, Lag6, NoTInt, 10, points);
for i = 1:10
  fprintf(1,'%i: %f, %f, %f\n', i, result3(1,i), result3(2,i), result3(3,i));
end

And similarly for GetPosition, GetMagneticField, GetVectorPotential, GetMagneticFieldGradient, GetBoxFilter, GetThreshold etc.

Disclaimer: While many efforts have been made to ensure that these data are accurate and reliable within the limits of the current state of the art, neither JHU nor any other party involved in creating, producing or delivering the website shall be liable for any damages arising out of users' access to, or use of, the website or web services. Users use the website and web services at their own risk. JHU does not warrant that the functional aspects of the website will be uninterrupted or error free, and may make changes to the site without notice.

Last update: 11/4/2017 10:31:55 PM