rompy.swan.components.numerics.NUMERIC#
- pydantic model rompy.swan.components.numerics.NUMERIC[source]#
Numerical properties.
NUMeric ( STOPC [dabs] [drel] [curvat] [npnts] ->STAT|NONSTAT [limiter] ) & ( DIRimpl [cdd] ) ( SIGIMpl [css] [eps2] [outp] [niter] ) & ( CTheta [cfl] ) ( CSigma [cfl] ) ( SETUP [eps2] [outp] [niter] )
Examples
In [4]: from rompy.swan.components.numerics import NUMERIC In [5]: numeric = NUMERIC() In [6]: print(numeric.render()) NUMERIC In [7]: numeric = NUMERIC( ...: stop=dict( ...: model_type="stopc", ...: dabs=0.05, ...: drel=0.01, ...: curvat=0.05, ...: npnts=99.5, ...: ), ...: dirimpl=dict(cdd=0.5), ...: sigimpl=dict(css=0.5, eps2=1e-4, outp=0, niter=20), ...: ctheta=dict(cfl=0.9), ...: csigma=dict(cfl=0.9), ...: setup=dict(eps2=1e-4, outp=0, niter=20), ...: ) ...: In [8]: print(numeric.render()) NUMERIC STOPC dabs=0.05 drel=0.01 curvat=0.05 npnts=99.5 DIRIMPL cdd=0.5 SIGIMPL css=0.5 eps2=0.0001 outp=0 niter=20 CTHETA cfl=0.9
Show JSON schema
{ "title": "NUMERIC", "description": "Numerical properties.\n\n.. code-block:: text\n\n NUMeric ( STOPC [dabs] [drel] [curvat] [npnts] ->STAT|NONSTAT [limiter] ) &\n ( DIRimpl [cdd] ) ( SIGIMpl [css] [eps2] [outp] [niter] ) &\n ( CTheta [cfl] ) ( CSigma [cfl] ) ( SETUP [eps2] [outp] [niter] )\n\nExamples\n--------\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.components.numerics import NUMERIC\n numeric = NUMERIC()\n print(numeric.render())\n numeric = NUMERIC(\n stop=dict(\n model_type=\"stopc\",\n dabs=0.05,\n drel=0.01,\n curvat=0.05,\n npnts=99.5,\n ),\n dirimpl=dict(cdd=0.5),\n sigimpl=dict(css=0.5, eps2=1e-4, outp=0, niter=20),\n ctheta=dict(cfl=0.9),\n csigma=dict(cfl=0.9),\n setup=dict(eps2=1e-4, outp=0, niter=20),\n )\n print(numeric.render())", "type": "object", "properties": { "model_type": { "default": "numeric", "description": "Model type discriminator", "enum": [ "numeric", "NUMERIC" ], "title": "Model Type", "type": "string" }, "stop": { "anyOf": [ { "discriminator": { "mapping": { "ACCUR": "#/$defs/ACCUR", "STOPC": "#/$defs/STOPC", "accur": "#/$defs/ACCUR", "stopc": "#/$defs/STOPC" }, "propertyName": "model_type" }, "oneOf": [ { "$ref": "#/$defs/STOPC" }, { "$ref": "#/$defs/ACCUR" } ] }, { "type": "null" } ], "default": null, "description": "Iteration termination criteria", "title": "Stop" }, "dirimpl": { "anyOf": [ { "$ref": "#/$defs/DIRIMPL" }, { "type": "null" } ], "default": null, "description": "Numerical scheme for refraction" }, "sigimpl": { "anyOf": [ { "$ref": "#/$defs/SIGIMPL" }, { "type": "null" } ], "default": null, "description": "Frequency shifting accuracy" }, "ctheta": { "anyOf": [ { "$ref": "#/$defs/CTHETA" }, { "type": "null" } ], "default": null, "description": "Prevents excessive directional turning" }, "csigma": { "anyOf": [ { "$ref": "#/$defs/CSIGMA" }, { "type": "null" } ], "default": null, "description": "Prevents excessive frequency shifting" }, "setup": { "anyOf": [ { "$ref": "#/$defs/SETUP" }, { "type": "null" } ], "default": null, "description": "Stop criteria in the computation of wave setup" } }, "$defs": { "ACCUR": { "additionalProperties": false, "description": "Stop the iterative procedure.\n\n.. code-block:: text\n\n ACCUR [drel] [dhoval] [dtoval] [npnts] ->STAT|NONSTAT [limiter]\n\nWith this option the user can influence the criterion for terminating the iterative\nprocedure in the SWAN computations (both stationary and non-stationary modes).\nSWAN stops the iterations if (a), (b) and (c) are all satisfied:\n\na) The change in the local significant wave height Hs from one iteration to the\n next is less than (1) fraction `drel` of that height or (2) fraction `dhoval`\n of the average Hs over all grid points.\n\nb) The change in the local mean wave period Tm01 from one iteration to the next is\n less than (1) fraction `drel` of that period or (2) fraction `dtoval` of the\n average mean wave period over all wet grid points.\n\nc) Conditions (a) and (b) are fulfilled in more than fraction `npnts%` of all wet\n grid points.\n\nNote\n----\nThis command has become obsolete in SWAN 41.01. The command STOPC should be used.\n\nExamples\n--------\n\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.subcomponents.numerics import ACCUR\n accur = ACCUR()\n print(accur.render())\n accur = ACCUR(\n drel=0.01,\n dhoval=0.02,\n dtoval=0.02,\n npnts=98.0,\n mode=dict(model_type=\"nonstat\", mxitns=1),\n limiter=0.1,\n )\n print(accur.render())", "properties": { "model_type": { "default": "accur", "description": "Model type discriminator", "enum": [ "accur", "ACCUR" ], "title": "Model Type", "type": "string" }, "drel": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Maximum relative change in Hs or Tm01 from one iteration to the next (SWAN default: 0.02)", "title": "Drel" }, "dhoval": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Fraction of the average Hs over all wet grid points below which the the stopping criteria needs to be satisfied (SWAN default: 0.02)", "title": "Dhoval" }, "dtoval": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Fraction of the average Tm01 over all wet grid points below which the the stopping criteria needs to be satisfied (SWAN default: 0.02)", "title": "Dtoval" }, "npnts": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Percentage of points in the computational grid above which the stopping criteria needs to be satisfied (SWAN default: 98)", "title": "Npnts" }, "mode": { "anyOf": [ { "discriminator": { "mapping": { "NONSTAT": "#/$defs/NONSTAT", "STAT": "#/$defs/STAT", "nonstat": "#/$defs/NONSTAT", "stat": "#/$defs/STAT" }, "propertyName": "model_type" }, "oneOf": [ { "$ref": "#/$defs/STAT" }, { "$ref": "#/$defs/NONSTAT" } ] }, { "type": "null" } ], "default": null, "description": "Termination criteria for stationary or nonstationary runs", "title": "Mode" }, "limiter": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Determines the maximum change per iteration of the energy density per spectral-bin given in terms of a fraction of the omni-directional Phillips level (SWAN default: 0.1)", "title": "Limiter" } }, "title": "ACCUR", "type": "object" }, "CSIGMA": { "additionalProperties": false, "description": "Prevents excessive directional turning.\n\n.. code-block:: text\n\n CSigma [cfl]\n\nThis option prevents an excessive frequency shifting at a single grid point or\nvertex due to a very coarse bathymetry or current locally. This option limits the\nfrequency shifting rate csigma based on the CFL restriction. See also the final\nremark in Section 2.6.3. Note that if this command is not specified, then the\nlimiter is not activated.\n\nExamples\n--------\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.subcomponents.numerics import CSIGMA\n csigma = CSIGMA()\n print(csigma.render())\n csigma = CSIGMA(cfl=0.9)\n print(csigma.render())", "properties": { "model_type": { "default": "ctheta", "description": "Model type discriminator", "enum": [ "ctheta", "CTHETA" ], "title": "Model Type", "type": "string" }, "cfl": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Upper limit for the CFL restriction for csigma. A suggestion for this parameter is `cfl = 0.9` (SWAN default: 0.9 when CSIGMA is activated)", "title": "Cfl" } }, "title": "CSIGMA", "type": "object" }, "CTHETA": { "additionalProperties": false, "description": "Prevents excessive directional turning.\n\n.. code-block:: text\n\n CTheta [cfl]\n\nThis option prevents an excessive directional turning at a single grid point or\nvertex due to a very coarse bathymetry or current locally. This option limits the\ndirectional turning rate c\u03b8 based on the CFL restriction. (See Eq. 3.41 of\nScientific/Technical documentation). See also the final remark in Section 2.6.3.\nNote that if this command is not specified, then the limiter is not activated.\n\nExamples\n--------\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.subcomponents.numerics import CTHETA\n ctheta = CTHETA()\n print(ctheta.render())\n ctheta = CTHETA(cfl=0.9)\n print(ctheta.render())", "properties": { "model_type": { "default": "ctheta", "description": "Model type discriminator", "enum": [ "ctheta", "CTHETA" ], "title": "Model Type", "type": "string" }, "cfl": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Upper limit for the CFL restriction for ctheta. A suggestion for this parameter is `cfl = 0.9` (SWAN default: 0.9 when CTHETA is activated)", "title": "Cfl" } }, "title": "CTHETA", "type": "object" }, "DIRIMPL": { "additionalProperties": false, "description": "Numerical scheme for refraction.\n\n.. code-block:: text\n\n DIRIMPL [cdd]\n\nExamples\n--------\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.subcomponents.numerics import DIRIMPL\n dirimpl = DIRIMPL()\n print(dirimpl.render())\n dirimpl = DIRIMPL(cdd=0.5)\n print(dirimpl.render())", "properties": { "model_type": { "default": "dirimpl", "description": "Model type discriminator", "enum": [ "dirimpl", "DIRIMPL" ], "title": "Model Type", "type": "string" }, "cdd": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "A value of `cdd=0` corresponds to a central scheme and has the largest accuracy (diffusion \u2248 0) but the computation may more easily generatespurious fluctuations. A value of `cdd=1` corresponds to a first orderupwind scheme and it is more diffusive and therefore preferable if (strong) gradients in depth or current are present (SWAN default: 0.5)", "title": "Cdd" } }, "title": "DIRIMPL", "type": "object" }, "NONSTAT": { "additionalProperties": false, "description": "Computation parameters in nonstationary computation.", "properties": { "model_type": { "default": "nonstat", "description": "Model type discriminator", "enum": [ "nonstat", "NONSTAT" ], "title": "Model Type", "type": "string" }, "mxitns": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The maximum number of iterations per time step for nonstationary computations. The computation moves to the next time step when this number is exceeded (SWAN default: `mxitns = 1`", "title": "Mxitns" } }, "title": "NONSTAT", "type": "object" }, "SETUP": { "additionalProperties": false, "description": "Stop criteria in the computation of wave setup.\n\n.. code-block:: text\n\n SETUP [eps2] [outp] [niter]\n\nControls the stopping criterion and amount of output for the SOR solver in the\ncomputation of the wave-induced set-up.\n\nExamples\n--------\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.subcomponents.numerics import SETUP\n setup = SETUP()\n print(setup.render())\n setup = SETUP(eps2=1e-4, outp=0, niter=20)\n print(setup.render())", "properties": { "model_type": { "default": "setup", "description": "Model type discriminator", "enum": [ "setup", "SETUP" ], "title": "Model Type", "type": "string" }, "eps2": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Relative stopping criterion to terminate the linear solver (SIP or SOR). (SWAN default: 1.e-4 in case of SIP and 1.e-6 in case of SOR)", "title": "Eps2" }, "outp": { "anyOf": [ { "enum": [ 0, 1, 2, 3 ], "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output for the iterative solver:\n\n* 0 = no output\n* 1 = additional information about the iteration process is written to the PRINT file \n* 2 = gives a maximal amount of output concerning the iteration process \n* 3 = summary of the iteration process\n\n(SWAN default: 0)", "title": "Outp" }, "niter": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Maximum number of iterations for the linear solver (SWAN default: 20 in case of SIP and 1000 in case of SOR)", "title": "Niter" } }, "title": "SETUP", "type": "object" }, "SIGIMPL": { "additionalProperties": false, "description": "Frequency shifting accuracy.\n\n.. code-block:: text\n\n SIGIMpl [cfl] [eps2] [outp] [niter]\n\nControls the accuracy of computing the frequency shifting and the stopping\ncriterion and amount of output for the SIP solver (used in the computations in the\npresence of currents or time varying depth)\n\nExamples\n--------\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.subcomponents.numerics import SIGIMPL\n sigimpl = SIGIMPL()\n print(sigimpl.render())\n sigimpl = SIGIMPL(css=0.5, eps2=1e-4, outp=0, niter=20)\n print(sigimpl.render())", "properties": { "model_type": { "default": "sigimpl", "description": "Model type discriminator", "enum": [ "sigimpl", "SIGIMPL" ], "title": "Model Type", "type": "string" }, "css": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "A value of `css=0` corresponds to a central scheme and has the largest accuracy (diffusion \u2248 0) but the computation may more easily generate spurious fluctuations. A value of `css=1` corresponds to a first order upwind scheme and it is more diffusive and therefore preferable if (strong) gradients in depth or current are present (SWAN default: 0.5)", "title": "Css" }, "eps2": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Relative stopping criterion to terminate the linear solver (SIP or SOR). (SWAN default: 1.e-4 in case of SIP and 1.e-6 in case of SOR)", "title": "Eps2" }, "outp": { "anyOf": [ { "enum": [ 0, 1, 2, 3 ], "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output for the iterative solver:\n\n* 0 = no output\n* 1 = additional information about the iteration process is written to the PRINT file \n* 2 = gives a maximal amount of output concerning the iteration process\n* 3 = summary of the iteration process\n\n(SWAN default: 0)", "title": "Outp" }, "niter": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Maximum number of iterations for the linear solver (SWAN default: 20 in case of SIP and 1000 in case of SOR)", "title": "Niter" } }, "title": "SIGIMPL", "type": "object" }, "STAT": { "additionalProperties": false, "description": "Computation parameters in stationary computation.", "properties": { "model_type": { "default": "stat", "description": "Model type discriminator", "enum": [ "stat", "STAT" ], "title": "Model Type", "type": "string" }, "mxitst": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The maximum number of iterations for stationary computations. The computation stops when this number is exceeded (SWAN default: 50)", "title": "Mxitst" }, "alfa": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Proportionality constant used in the frequency-dependent under-relaxation technique. Based on experiences, a suggestion for this parameter is `alfa = 0.01`. In case of diffraction computations, the use of this parameter is recommended (SWAN default: 0.00)", "title": "Alfa" } }, "title": "STAT", "type": "object" }, "STOPC": { "additionalProperties": false, "description": "Stopping criteria of Zijlema and Van der Westhuysen (2005).\n\n.. code-block:: text\n\n STOPC [dabs] [drel] [curvat] [npnts] ->STAT|NONSTAT [limiter]\n\nWith this option the user can influence the criterion for terminating the iterative\nprocedure in the SWAN computations (both stationary and nonstationary). The\ncriterion makes use of the second derivative, or curvature, of the iteration curve\nof the significant wave height. As the solution of a simulation approaches full\nconvergence, the curvature of the iteration curve will tend to zero. SWAN stops the\nprocess if the relative change in Hs from one iteration to the next is less than\n`drel` and the curvature of the iteration curve of Hs normalized with Hs is less\nthan `curvat` or the absolute change in Hs from one iteration to the next is less\nthan `dabs`. Both conditions need to be fulfilled in more than fraction `npnts`\npercent of all wet grid points.\n\nWith respect to the QC modelling, another stopping criteria will be employed.\nNamely, SWAN stops the iteration process if the absolute change in Hs from one\niterate to another is less than `dabs` * Hinc, where Hinc is the representative\nincident wave height, or the relative change in Hs from one to the next iteration\nis less than `drel`. These criteria must be fulfilled in more than `npnts`\npercent of all active, well-defined points.\n\nReferences\n----------\n- Zijlema, M. and Van der Westhuysen, A. (2005). On convergence behaviour and\n numerical accuracy in stationary SWAN simulations of nearshore wind wave spectra,\n Coastal Engineering, 52(3), p. 337-256.\n\nExamples\n--------\n\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.subcomponents.numerics import STOPC\n stop = STOPC()\n print(stop.render())\n stop = STOPC(\n dabs=0.005,\n drel=0.01,\n curvat=0.005,\n npnts=99.5,\n mode=dict(model_type=\"nonstat\", mxitns=1),\n limiter=0.1,\n )\n print(stop.render())", "properties": { "model_type": { "default": "stopc", "description": "Model type discriminator", "enum": [ "stopc", "STOPC" ], "title": "Model Type", "type": "string" }, "dabs": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Maximum absolute change in Hs from one iteration to the next (SWAN default: 0.005 [m] or 0.05 [-] in case of QC model)", "title": "Dabs" }, "drel": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Maximum relative change in Hs from one iteration to the next (SWAN default: 0.01 [-])", "title": "Drel" }, "curvat": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Maximum curvature of the iteration curve of Hs normalised with Hs (SWAN default: 0.005 [-] (not used in the QC model))", "title": "Curvat" }, "npnts": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Percentage of points in the computational grid above which the stopping criteria needs to be satisfied (SWAN default: 99.5 [-])", "title": "Npnts" }, "mode": { "anyOf": [ { "discriminator": { "mapping": { "NONSTAT": "#/$defs/NONSTAT", "STAT": "#/$defs/STAT", "nonstat": "#/$defs/NONSTAT", "stat": "#/$defs/STAT" }, "propertyName": "model_type" }, "oneOf": [ { "$ref": "#/$defs/STAT" }, { "$ref": "#/$defs/NONSTAT" } ] }, { "type": "null" } ], "default": null, "description": "Termination criteria for stationary or nonstationary runs", "title": "Mode" }, "limiter": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Determines the maximum change per iteration of the energy density per spectral-bin given in terms of a fraction of the omni-directional Phillips level (SWAN default: 0.1)", "title": "Limiter" } }, "title": "STOPC", "type": "object" } }, "additionalProperties": false }
- Fields:
- field model_type: Literal['numeric', 'NUMERIC'] = 'numeric'#
Model type discriminator