コード例 #1
0
from dolfin import *
from dolfin_adjoint import *
from math import exp, sqrt, pi

import sw_lib

params = sw_lib.parameters({
    'depth': 2.,
    'g': 9.81,
    'f': 0.0,
    'dump_period': 1,
    'eta0': 2  # Wave height
})

# Basin radius.
basin_x = 3000  # The length of the basin
basin_y = 1000  # The width of the basin
nx = 20  # Number of cells in x direction
ny = 3  # Number of cells in y direction
# Long wave celerity.
c = sqrt(params["g"] * params["depth"])

params["finish_time"] = 100
params["dt"] = params["finish_time"] / 4000.


class InitialConditions(UserExpression):
    def eval(self, values, X):
        values[0] = params['eta0'] * sqrt(params['g'] * params['depth']) * cos(
            pi * X[0] / 3000)
        values[1] = 0.
コード例 #2
0
from dolfin import Mesh, Expression
from math import exp, sqrt, pi

import sw_lib

params=sw_lib.parameters({
    'depth' : 5.,
    'g' : 10.,
    'f' : 1.0313e-4,
    'dump_period' : 10
    })

# Basin radius.
r0=250000
# Long wave celerity.
c=sqrt(params["g"]*params["depth"])


params["finish_time"]=4*2*pi*r0/c
params["dt"]=params["finish_time"]/4000.

# Rossby radius.
LR=c/params["f"]

class InitialConditions(Expression):
    def __init__(self):
        pass
    def eval(self, values, X):
        r=(X[0]**2+X[1]**2)**0.5
        if r>0.0001:
            values[0]=-0.05*c*exp((r-r0)/LR)*X[0]/r*X[1]/r
コード例 #3
0
ファイル: divett.py プロジェクト: cpknowles/dolfin-adjoint
from dolfin import *
from math import exp, sqrt, pi

import sw_lib

params=sw_lib.parameters({
    'depth' : 2.,
    'g' : 9.81,
    'f' : 0.0,
    'dump_period' : 1,
    'eta0' : 2 # Wave height
    })

# Basin radius.
basin_x=3000 # The length of the basin
basin_y=1000 # The width of the basin
nx=20 # Number of cells in x direction
ny=3 # Number of cells in y direction
# Long wave celerity.
c=sqrt(params["g"]*params["depth"])


params["finish_time"]=100
params["dt"]=params["finish_time"]/4000.

class InitialConditions(Expression):
    def __init__(self):
        pass
    def eval(self, values, X):
        values[0]=params['eta0']*sqrt(params['g']*params['depth'])*cos(pi*X[0]/3000)
        values[1]=0.
コード例 #4
0
from dolfin import Mesh, Expression
from math import exp, sqrt, pi

import sw_lib

params = sw_lib.parameters({
    'depth': 5.,
    'g': 10.,
    'f': 1.0313e-4,
    'dump_period': 10
})

# Basin radius.
r0 = 250000
# Long wave celerity.
c = sqrt(params["g"] * params["depth"])

params["finish_time"] = 4 * 2 * pi * r0 / c
params["dt"] = params["finish_time"] / 4000.

# Rossby radius.
LR = c / params["f"]


class InitialConditions(Expression):
    def eval(self, values, X):
        r = (X[0]**2 + X[1]**2)**0.5
        if r > 0.0001:
            values[0] = -0.05 * c * exp((r - r0) / LR) * X[0] / r * X[1] / r
            values[1] = 0.05 * c * exp((r - r0) / LR) * X[0] / r * X[0] / r
            values[2] = 0.05 * exp((r - r0) / LR) * X[0] / r
コード例 #5
0
ファイル: divett.py プロジェクト: ellipsis14/dolfin-adjoint
from dolfin import *
from math import exp, sqrt, pi

import sw_lib

params = sw_lib.parameters({"depth": 2.0, "g": 9.81, "f": 0.0, "dump_period": 1, "eta0": 2})  # Wave height

# Basin radius.
basin_x = 3000  # The length of the basin
basin_y = 1000  # The width of the basin
nx = 20  # Number of cells in x direction
ny = 3  # Number of cells in y direction
# Long wave celerity.
c = sqrt(params["g"] * params["depth"])


params["finish_time"] = 100
params["dt"] = params["finish_time"] / 4000.0


class InitialConditions(Expression):
    def __init__(self):
        pass

    def eval(self, values, X):
        values[0] = params["eta0"] * sqrt(params["g"] * params["depth"]) * cos(pi * X[0] / 3000)
        values[1] = 0.0
        values[2] = params["eta0"] * cos(pi * X[0] / 3000)

    def value_shape(self):
        return (3,)