完成求解器雅可比矩阵首轮优化,增加更新目录,整理了文档文件夹,增加了服务启动脚本
This commit is contained in:
1 parent
6bb0591d32
commit
16a7eb2d6c
48 files changed
+8172
-217
No files matched your search
@@ -1,8 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
import os
|
||||
from types import SimpleNamespace
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import numpy as np
|
||||
from scipy.integrate._ivp.common import num_jac
|
||||
@@ -14,13 +16,37 @@ from app.simulation.core.base import DynamicComponent
|
||||
from app.simulation.core.ports import PortDefinition
|
||||
from app.simulation.core.medium import IdealGasMedium
|
||||
from app.simulation.solvers.mechanical import MechanicalConstraintGroup
|
||||
from app.simulation.systems.generic import GenericFluidSystem
|
||||
from app.simulation.systems.generic import (
|
||||
GenericFluidSystem,
|
||||
_requested_ode_jacobian_mode,
|
||||
)
|
||||
from app.simulation.systems.network import Endpoint
|
||||
from tests.test_amesim_pnrp17_xml import pnrp17_coupled_project
|
||||
from tests.test_generic_system_xml_simulation import component_node, physical_edge
|
||||
from tests.test_system_xml_protocol import physical_port
|
||||
|
||||
|
||||
class OdeJacobianModeTests(unittest.TestCase):
|
||||
def test_scipy_is_the_safe_default(self) -> None:
|
||||
with patch.dict(os.environ, {}, clear=True):
|
||||
self.assertEqual(_requested_ode_jacobian_mode(), "scipy")
|
||||
|
||||
def test_optimized_and_hybrid_require_explicit_selection(self) -> None:
|
||||
for value, expected in (("optimized", "optimized"), ("hybrid", "hybrid")):
|
||||
with self.subTest(value=value), patch.dict(
|
||||
os.environ,
|
||||
{"SIMULATION_ODE_JACOBIAN_MODE": value},
|
||||
):
|
||||
self.assertEqual(_requested_ode_jacobian_mode(), expected)
|
||||
|
||||
def test_invalid_mode_is_rejected(self) -> None:
|
||||
with patch.dict(
|
||||
os.environ,
|
||||
{"SIMULATION_ODE_JACOBIAN_MODE": "unknown"},
|
||||
), self.assertRaisesRegex(ValueError, "must be 'optimized'"):
|
||||
_requested_ode_jacobian_mode()
|
||||
|
||||
|
||||
class _DynamicVolumeSource(DynamicComponent):
|
||||
PORTS = (PortDefinition.pneumatic("port"),)
|
||||
state_size = 1
|
||||
|
||||
Reference in new issue
Block a user