Casanova Drift Model (CDM)

A mechanistic model for simulating pesticide spray drift during agricultural applications

Design Specification

Document Version: 1.0 Date: October 30, 2025

This page provides an overview. View the full Design Specification on GitHub.

Purpose

The Design Specification provides technical implementation details for CDM developers and maintainers. It covers the software architecture, data structures, algorithms, and coding standards.

System Architecture

┌─────────────────────────────────────────────────────┐
│              Client Applications                    │
│          (CLI, R Package, Custom)                   │
├─────────────────────────────────────────────────────┤
│                   C API Layer                       │
│              (CDM.h / CDM.cpp)                      │
├─────────────────────────────────────────────────────┤
│              Model Orchestration                    │
│                 (Model.hpp)                         │
├──────────┬──────────┬──────────┬────────────────────┤
│ Atmos.   │ Wind     │ Droplet  │ Transport /        │
│ Props    │ Profile  │ Size     │ Deposition         │
├──────────┴──────────┴──────────┴────────────────────┤
│           SUNDIALS / Ceres / Blaze                  │
└─────────────────────────────────────────────────────┘

Model Component Diagram

The following diagram shows how inputs flow through the model processing pipeline to produce outputs, and how the different interfaces connect to the system.

CDM model component diagram

Module Design

Source Files

File Purpose
CDM.cpp C API implementation
CDMCLI.cpp Command-line interface
Model.hpp Model orchestration and state
AtmosphericProperties.cpp/hpp Atmospheric property calculations
WindVelocityProfile.cpp/hpp Wind profile characterization
DropletSizeModel.cpp/hpp Droplet size distribution processing
DropletTransport.cpp/hpp ODE-based droplet transport
NozzleVelocity.cpp/hpp Nozzle exit velocity calculations
Deposition.cpp/hpp Deposition accumulation and reporting
Serialization.cpp/hpp JSON input/output
CVodeIntegrator.hpp CVODE wrapper with RAII
Interpolate1D.hpp 1D interpolation utilities
Constants.hpp Physical constants
CVodeError.hpp CVODE error handling

Key Design Decisions

Algorithm Design

ODE Integration

Droplet Size Distribution

Wind Profile

Build System

CMake Configuration

Directory Structure

Directory Contents
include/cdm/ Public C API header
src/ C++ implementation files
tests/ Test case JSON files
R/cdm/ R package source
cmake/ CMake helper scripts
docs/ Documentation

Code Quality Standards