Skip to content

Nonlinear Scenarios in physical Mode¤

apebench.scenarios.physical.Burgers ¤

Bases: Convection

Source code in apebench/scenarios/physical/_convection.py
63
64
65
66
67
68
69
70
71
72
73
class Burgers(Convection):
    convection_coef: float = -0.125  # Overwrite
    diffusion_coef: float = 0.0003

    def __post_init__(self):
        self.a_coefs = (0.0, 0.0, self.diffusion_coef, 0.0, 0.0)

        super().__post_init__()

    def get_scenario_name(self) -> str:
        f"{self.num_spatial_dims}d_phy_burgers"
convection_coef class-attribute instance-attribute ¤
convection_coef: float = -0.125
diffusion_coef class-attribute instance-attribute ¤
diffusion_coef: float = 0.0003
__post_init__ ¤
__post_init__()
Source code in apebench/scenarios/physical/_convection.py
67
68
69
70
def __post_init__(self):
    self.a_coefs = (0.0, 0.0, self.diffusion_coef, 0.0, 0.0)

    super().__post_init__()
get_scenario_name ¤
get_scenario_name() -> str
Source code in apebench/scenarios/physical/_convection.py
72
73
def get_scenario_name(self) -> str:
    f"{self.num_spatial_dims}d_phy_burgers"

apebench.scenarios.physical.BurgersSingleChannel ¤

Bases: Nonlinear

Source code in apebench/scenarios/physical/_nonlinear.py
61
62
63
64
65
66
67
68
69
70
class BurgersSingleChannel(Nonlinear):
    convection_sc_coef: float = -0.125
    diffusion_coef: float = 0.0003

    def __post_init__(self):
        self.a_coefs = (0.0, 0.0, self.diffusion_coef, 0.0, 0.0)
        self.b_coefs = (0.0, self.convection_sc_coef, 0.0)

    def get_scenario_name(self) -> str:
        return f"{self.num_spatial_dims}d_phy_burgers_sc"
convection_sc_coef class-attribute instance-attribute ¤
convection_sc_coef: float = -0.125
diffusion_coef class-attribute instance-attribute ¤
diffusion_coef: float = 0.0003
__post_init__ ¤
__post_init__()
Source code in apebench/scenarios/physical/_nonlinear.py
65
66
67
def __post_init__(self):
    self.a_coefs = (0.0, 0.0, self.diffusion_coef, 0.0, 0.0)
    self.b_coefs = (0.0, self.convection_sc_coef, 0.0)
get_scenario_name ¤
get_scenario_name() -> str
Source code in apebench/scenarios/physical/_nonlinear.py
69
70
def get_scenario_name(self) -> str:
    return f"{self.num_spatial_dims}d_phy_burgers_sc"

apebench.scenarios.physical.KortewegDeVries ¤

Bases: Nonlinear

Source code in apebench/scenarios/physical/_nonlinear.py
73
74
75
76
77
78
79
80
81
82
83
84
class KortewegDeVries(Nonlinear):
    domain_extent: float = 50.0  # Overwrite
    convection_sc_coef: float = -6.0
    dispersion_coef: float = -1.0
    hyp_diffusion_coef: float = -0.125

    def __post_init__(self):
        self.a_coefs = (0.0, 0.0, 0.0, self.dispersion_coef, self.hyp_diffusion_coef)
        self.b_coefs = (0.0, self.convection_sc_coef, 0.0)

    def get_scenario_name(self) -> str:
        return f"{self.num_spatial_dims}d_phy_kdv"
convection_sc_coef class-attribute instance-attribute ¤
convection_sc_coef: float = -6.0
dispersion_coef class-attribute instance-attribute ¤
dispersion_coef: float = -1.0
hyp_diffusion_coef class-attribute instance-attribute ¤
hyp_diffusion_coef: float = -0.125
__post_init__ ¤
__post_init__()
Source code in apebench/scenarios/physical/_nonlinear.py
79
80
81
def __post_init__(self):
    self.a_coefs = (0.0, 0.0, 0.0, self.dispersion_coef, self.hyp_diffusion_coef)
    self.b_coefs = (0.0, self.convection_sc_coef, 0.0)
get_scenario_name ¤
get_scenario_name() -> str
Source code in apebench/scenarios/physical/_nonlinear.py
83
84
def get_scenario_name(self) -> str:
    return f"{self.num_spatial_dims}d_phy_kdv"

apebench.scenarios.physical.KuramotoSivashinsky ¤

Bases: Nonlinear

Source code in apebench/scenarios/physical/_nonlinear.py
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
class KuramotoSivashinsky(Nonlinear):
    domain_extent: float = 60.0  # Overwrite
    gradient_norm_coef: float = -1
    diffusion_coef: float = -1.0  # Negative diffusion; producing energy!
    hyp_diffusion_coef: float = -1.0

    num_warmup_steps: int = 500  # Overwrite
    vlim: tuple[float, float] = (-6.5, 6.5)  # Overwrite

    report_metrics: str = "mean_nRMSE,mean_correlation"  # Overwrite

    def __post_init__(self):
        self.a_coefs = (0.0, 0.0, self.diffusion_coef, 0.0, self.hyp_diffusion_coef)
        self.b_coefs = (0.0, 0.0, self.gradient_norm_coef)

    def get_scenario_name(self) -> str:
        return f"{self.num_spatial_dims}d_phy_ks"
gradient_norm_coef class-attribute instance-attribute ¤
gradient_norm_coef: float = -1
diffusion_coef class-attribute instance-attribute ¤
diffusion_coef: float = -1.0
hyp_diffusion_coef class-attribute instance-attribute ¤
hyp_diffusion_coef: float = -1.0
num_warmup_steps class-attribute instance-attribute ¤
num_warmup_steps: int = 500
vlim class-attribute instance-attribute ¤
vlim: tuple[float, float] = (-6.5, 6.5)
report_metrics class-attribute instance-attribute ¤
report_metrics: str = 'mean_nRMSE,mean_correlation'
__post_init__ ¤
__post_init__()
Source code in apebench/scenarios/physical/_nonlinear.py
 98
 99
100
def __post_init__(self):
    self.a_coefs = (0.0, 0.0, self.diffusion_coef, 0.0, self.hyp_diffusion_coef)
    self.b_coefs = (0.0, 0.0, self.gradient_norm_coef)
get_scenario_name ¤
get_scenario_name() -> str
Source code in apebench/scenarios/physical/_nonlinear.py
102
103
def get_scenario_name(self) -> str:
    return f"{self.num_spatial_dims}d_phy_ks"

apebench.scenarios.physical.KuramotoSivashinskyConservative ¤

Bases: Convection

Source code in apebench/scenarios/physical/_convection.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
class KuramotoSivashinskyConservative(Convection):
    domain_extent: float = 60.0  # Overwrite
    convection_coef: float = -3.6  # Overwrite
    diffusion_coef: float = -1.44
    hyp_diffusion_coef: float = -0.4

    num_warmup_steps: int = 500  # Overwrite
    vlim: tuple[float, float] = (-2.5, 2.5)  # Overwrite

    report_metrics: str = "mean_nRMSE,mean_correlation"  # Overwrite

    def __post_init__(self):
        if self.num_spatial_dims != 1:
            raise ValueError(
                "Conservative Kuramoto-Sivashinsky is only defined for 1 spatial dimension. Check out the non-conservative version for 2d."
            )
        self.a_coefs = (0.0, 0.0, self.diffusion_coef, 0.0, self.hyp_diffusion_coef)

    def get_scenario_name(self) -> str:
        return f"{self.num_spatial_dims}d_phy_ks_conservative"
convection_coef class-attribute instance-attribute ¤
convection_coef: float = -3.6
diffusion_coef class-attribute instance-attribute ¤
diffusion_coef: float = -1.44
hyp_diffusion_coef class-attribute instance-attribute ¤
hyp_diffusion_coef: float = -0.4
num_warmup_steps class-attribute instance-attribute ¤
num_warmup_steps: int = 500
vlim class-attribute instance-attribute ¤
vlim: tuple[float, float] = (-2.5, 2.5)
report_metrics class-attribute instance-attribute ¤
report_metrics: str = 'mean_nRMSE,mean_correlation'
__post_init__ ¤
__post_init__()
Source code in apebench/scenarios/physical/_convection.py
87
88
89
90
91
92
def __post_init__(self):
    if self.num_spatial_dims != 1:
        raise ValueError(
            "Conservative Kuramoto-Sivashinsky is only defined for 1 spatial dimension. Check out the non-conservative version for 2d."
        )
    self.a_coefs = (0.0, 0.0, self.diffusion_coef, 0.0, self.hyp_diffusion_coef)
get_scenario_name ¤
get_scenario_name() -> str
Source code in apebench/scenarios/physical/_convection.py
94
95
def get_scenario_name(self) -> str:
    return f"{self.num_spatial_dims}d_phy_ks_conservative"