Beispiel #1
0
# Load a grid approximating a unit sphere

grid_factory = lib.createGridFactory()
grid = grid_factory.importGmshGrid(
    "triangular", "../../meshes/sphere-h-0.1.msh")

# Create a space of piecewise constant basis functions over the grid.

pwiseConstants = lib.createPiecewiseConstantScalarSpace(context, grid)

# We now initialize the boundary operators.
# A boundary operator always takes three space arguments: a domain space,
# a range space, and the test space (dual to the range).
# Here, we just use L^2 projections. Hence, all spaces are identical.

slpOp = lib.createHelmholtz3dSingleLayerBoundaryOperator(
    context, pwiseConstants, pwiseConstants, pwiseConstants, k)
adlpOp = lib.createHelmholtz3dAdjointDoubleLayerBoundaryOperator(
    context, pwiseConstants, pwiseConstants, pwiseConstants, k)
idOp = lib.createIdentityOperator(
    context, pwiseConstants, pwiseConstants, pwiseConstants)

# Standard arithmetic operators can be used to create linear combinations of
# boundary operators.

lhsOp = idOp + 2 * adlpOp - 2j * k * slpOp

# Use the rhsData() Python function defined earlier to initialize the grid
# function that represents the right-hand side. The spaces are the domain space
# and the test space (in this case they are identical). rhsData() takes the
# surface normal as a parameter, so we set surfaceNormalDependent to True.
Beispiel #2
0
accuracyOptions.doubleRegular.setRelativeQuadratureOrder(2)
accuracyOptions.singleRegular.setRelativeQuadratureOrder(2)
quadStrategy = lib.createNumericalQuadratureStrategy("float64", "complex128", accuracyOptions)

options = lib.createAssemblyOptions()
options.switchToAca(lib.createAcaOptions())
context = lib.createContext(quadStrategy, options)

grid = lib.createGridFactory().importGmshGrid("triangular", "airplane.msh")
pconsts = lib.createPiecewiseConstantScalarSpace(context, grid)

k = 16
#k = 64; #16; #0.16

# ansatz: direction of incident plane wave: assume x here
lhsOp = lib.createHelmholtz3dSingleLayerBoundaryOperator(context, pconsts, pconsts, pconsts, k, "SLP")

# Create a grid function representing the Dirichlet trace of the incident wave
def uIncData(point):
	x, y, z = point
	return np.exp(1j * k * x)

def incident(point):
	x, y, z = point
	res = 0.0*x + 0.0j*y + 0*z
	for pt in range(0,x.size):
		res[pt] = np.exp(1j*k*x[pt]) 
	return res

def evalInc(point):
    x, y, z = point
Beispiel #3
0
    "triangular", "../../examples/meshes/sphere-h-0.1.msh")

# Create a function space

pconsts = lib.createPiecewiseConstantScalarSpace(context, grid)

# Define material and wave parameters

rhoInt = 2.
rhoExt = 1.
kInt = 1.
kExt = 5.

# Create boundary operators

slpOpInt = lib.createHelmholtz3dSingleLayerBoundaryOperator(
    context, pconsts, pconsts, pconsts, kInt, "SLP_int")
slpOpExt = lib.createHelmholtz3dSingleLayerBoundaryOperator(
    context, pconsts, pconsts, pconsts, kExt, "SLP_ext")
dlpOpInt = lib.createHelmholtz3dDoubleLayerBoundaryOperator(
    context, pconsts, pconsts, pconsts, kInt, "DLP_int")
dlpOpExt = lib.createHelmholtz3dDoubleLayerBoundaryOperator(
    context, pconsts, pconsts, pconsts, kExt, "DLP_ext")
idOp = lib.createIdentityOperator(
    context, pconsts, pconsts, pconsts, "Id")

# Create blocks of the operator on the lhs of the equation...

lhsOp00 =  0.5 * idOp - dlpOpExt
lhsOp01 =  slpOpExt
lhsOp10 =  0.5 * idOp + dlpOpInt
lhsOp11 = -rhoInt / rhoExt * slpOpInt
Beispiel #4
0
accuracyOptions.singleRegular.setRelativeQuadratureOrder(2)
quadStrategy = lib.createNumericalQuadratureStrategy("float64", "complex128",
                                                     accuracyOptions)

options = lib.createAssemblyOptions()
options.switchToAca(lib.createAcaOptions())
context = lib.createContext(quadStrategy, options)

grid = lib.createGridFactory().importGmshGrid("triangular", "airplane.msh")
pconsts = lib.createPiecewiseConstantScalarSpace(context, grid)

k = 16
#k = 64; #16; #0.16

# ansatz: direction of incident plane wave: assume x here
lhsOp = lib.createHelmholtz3dSingleLayerBoundaryOperator(
    context, pconsts, pconsts, pconsts, k, "SLP")


# Create a grid function representing the Dirichlet trace of the incident wave
def uIncData(point):
    x, y, z = point
    return np.exp(1j * k * x)


def incident(point):
    x, y, z = point
    res = 0.0 * x + 0.0j * y + 0 * z
    for pt in range(0, x.size):
        res[pt] = np.exp(1j * k * x[pt])
    return res
Beispiel #5
0
# Load a grid approximating a unit sphere

grid_factory = lib.createGridFactory()
grid = grid_factory.importGmshGrid(
    "triangular", "../../examples/meshes/sphere-h-0.1.msh")

# Create a space of piecewise constant basis functions over the grid.

pwiseConstants = lib.createPiecewiseConstantScalarSpace(context, grid)

# We now initialize the boundary operators.
# A boundary operator always takes three space arguments: a domain space,
# a range space, and the test space (dual to the range).
# Here, we just use L^2 projections. Hence, all spaces are identical.

slpOp = lib.createHelmholtz3dSingleLayerBoundaryOperator(
    context, pwiseConstants, pwiseConstants, pwiseConstants, k)
adlpOp = lib.createHelmholtz3dAdjointDoubleLayerBoundaryOperator(
    context, pwiseConstants, pwiseConstants, pwiseConstants, k)
idOp = lib.createIdentityOperator(
    context, pwiseConstants, pwiseConstants, pwiseConstants)

# Standard arithmetic operators can be used to create linear combinations of
# boundary operators.

lhsOp = idOp + 2 * adlpOp - 2j * k * slpOp

# Use the rhsData() Python function defined earlier to initialize the grid
# function that represents the right-hand side. The spaces are the domain space
# and the test space (in this case they are identical). rhsData() takes the
# surface normal as a parameter, so we set surfaceNormalDependent to True.
Beispiel #6
0
    "triangular", "../../examples/meshes/sphere-h-0.1.msh")

# Create a function space

pconsts = lib.createPiecewiseConstantScalarSpace(context, grid)

# Define material and wave parameters

rhoInt = 2.
rhoExt = 1.
kInt = 1.
kExt = 5.

# Create boundary operators

slpOpInt = lib.createHelmholtz3dSingleLayerBoundaryOperator(
    context, pconsts, pconsts, pconsts, kInt, "SLP_int")
slpOpExt = lib.createHelmholtz3dSingleLayerBoundaryOperator(
    context, pconsts, pconsts, pconsts, kExt, "SLP_ext")
dlpOpInt = lib.createHelmholtz3dDoubleLayerBoundaryOperator(
    context, pconsts, pconsts, pconsts, kInt, "DLP_int")
dlpOpExt = lib.createHelmholtz3dDoubleLayerBoundaryOperator(
    context, pconsts, pconsts, pconsts, kExt, "DLP_ext")
idOp = lib.createIdentityOperator(
    context, pconsts, pconsts, pconsts, "Id")

# Create blocks of the operator on the lhs of the equation...

lhsOp00 =  0.5 * idOp - dlpOpExt
lhsOp01 =  slpOpExt
lhsOp10 =  0.5 * idOp + dlpOpInt
lhsOp11 = -rhoInt / rhoExt * slpOpInt