WVModel
Integrate a fluid state represented by a WVTransform.
Declaration
classdef WVModel < handleOverview
Construct a transform and use it to initialize the model:
wvt = WVTransformConstantStratification([40e3,30e3,2e3],[8,6,9],N0=5.2e-3,latitude=45);
model = WVModel(wvt);
By default WVModel integrates the transform’s nonlinear forcing and
registers its coefficient observing system. Pass
shouldUseLinearDynamics=true for analytical linear evolution. Use
setupIntegrator to change time-stepping settings.
Model output is assembled in three layers: a model owns one or more
WVModelOutputFile objects, each file contains one or more
WVModelOutputGroup schedules, and each group writes one or more
WVObservingSystem objects. Observing systems with flux components,
including coefficients, particles, and tracers, are integrated alongside
the transform state; other observing systems sample it at output times.
Restore a model and its output graph from one restart-capable file:
model = WVModel.modelFromFile("SomeFile.nc");
Topics
- Create and restore a model
WVModelInitialize a model from a WVTransform instance.modelFromFileInitialize a model from an existing file
- Inspect model state
initialTimeInitial model time (seconds)isDynamicsLinearWhether the model uses analytical linear dynamics.summarizePrint a summary of integrated systems and output files.tCurrent model time (seconds)wvtWVTransform instance representing the ocean state.
- Configure and run integration
integrateToTimeTime step the model forward to the requested time.setupIntegratorCustomize the time-stepping
- Track particles
addParticlesAdd particles to be advected by the flow.drifterPositionsCurrent positions of the drifter particlesfloatPositionsReturns the positions of the floats at the current time as well as the value of the fields being tracked.particlePositionsPositions and values of tracked fields of particles at the current model time.setDrifterPositionsSet positions of drifter-like particles to be advected.setFloatPositionsSet positions of float-like particles to be advected by the model.
- Advect tracers
- Manage observing systems
addFluxedCoefficientsadd theWVCoefficientsto the fluxed observing systems arrayaddFluxedObservingSystemadd a WVObservingSystem to the fluxed observing systems arrayeulerianObservingSystemfluxedObservingSystemWithNameretrieve a WVObservingSystem by namefluxedObservingSystemsremoveFluxedObservingSystemremove a WVObservingSystem to the fluxed observing systems arraywvCoefficientFluxedObservingSystemreturn theWVCoefficientsfluxed observing system
- Write model output
addNetCDFOutputVariablesAdd variables to list of variables to be written to the NetCDF variable during the model run.addNewOutputFileadd a WVModelOutputFile, by passing an output pathaddOutputFileadd a WVModelOutputFile, by passing a WVModelOutputFile instancecloseNetCDFFilecreateNetCDFFileForModelOutputCreate a NetCDF file for model outputncfilereturns the first/primary NetCDF file being written tooutputFileNamesretrieve the names of all output filesoutputFileWithNameretrieve a WVModelOutputFile by nameoutputFilesArray of WVModelOutputFile instancesremoveNetCDFOutputVariablesRemove variables from the list of variables to be written to the NetCDF variable during the model run.setNetCDFOutputVariablesSet list of variables to be written to the NetCDF variable during the model run.
Developer Topics
These items document internal implementation details and are not part of the primary public API.
- Integrator state
absErrorToleranceCellArraydidBlowUpdidSetupIntegratorfinalIntegrationTimeset only during an integrationintegrationCallbackintegrationInformTimeintegrationLastInformModelTimeintegrationLastInformWallTimewall clock, to keep track of the expected integration timeintegrationStartModelTimeintegrationStartWallTimeintegratorTypeArray integratoroutputTimesForIntegrationPeriodThis will be called exactly once before an integrationpseudoIntegrateToTimeTime step the model forward linearlyshouldShowIntegrationDiagnosticsshowIntegrationFinishDiagnosticsshowIntegrationStartDiagnosticsshowIntegrationTimeDiagnosticsupdateIntegratorValuesFromCellArrayWe must set the time here. If we are integrating the
- Flux assembly
- Output scheduling and persistence
- Model internals
initialConditionsCellArraywritePortableRunRequestWrite a portable-runtime request for a MATLAB-authored NetCDF bundle.