# Differentiate Numeric Postprocess Results Twice Second derivatives are not limited to Cartesian field exports. This example builds a scalar objective from Fourier data, differentiates it twice, and inspects second derivatives in Fourier and scattering results. ```{admonition} Experimental feature :class: warning The `jcmsuite.torch` integration is experimental. Its API and behavior can change in future releases. Do not depend on its current interface for production workflows without testing each package update. ``` You need PyTorch, pandas, and a configured JCMsuite runtime with a solver license. All project files are in the example folder. Run from the repository root: ```bash python demos/documentation_tutorials/derivatives/torch/second_order_postprocess/run.py ``` ```{literalinclude} ../../../../demos/documentation_tutorials/derivatives/torch/second_order_postprocess/run.py :language: python ``` ## What To Notice The Fourier objective is approximately `0.1589`, its first derivative `0.1423`, and its second derivative `-0.0796`. The script also differentiates an objective built directly from first-sensitivity values. {attr}`Derivative lookup ` uses the bound {term}`project key ` `permittivity`. Select {ref}`.real ` before exporting a sensitivity with complex output quantities. Nested lookup then gives the selected second solver derivative, without another solve. Torch exports use dictionaries containing tensors. To get a pandas table, the script returns to ordinary results with {meth}`result.untorch() ` and selects the solver labels. Coordinate metadata and quantity names remain in the export. The project requests `Order = 2`. The numbers demonstrate material derivatives on a fixed geometry; they are not convergence or accuracy assertions. A second-derivative inspection is detached, and third-order solver derivatives are not supported. ## Project Files
project.jcmp ```{literalinclude} ../../../../demos/documentation_tutorials/derivatives/torch/second_order_postprocess/project.jcmp :language: jcm ```
materials.jcmt ```{literalinclude} ../../../../demos/documentation_tutorials/derivatives/torch/second_order_postprocess/materials.jcmt :language: jcm ```
layout.jcm ```{literalinclude} ../../../../demos/documentation_tutorials/derivatives/torch/second_order_postprocess/layout.jcm :language: jcm ```
sources.jcm ```{literalinclude} ../../../../demos/documentation_tutorials/derivatives/torch/second_order_postprocess/sources.jcm :language: jcm ```