Exemple #1
0
import numpy as np
#import matplotlib
import matplotlib.pyplot as plt

import numeric
import helper
from helper import Timer
import fem
import assembly

#def rho(x): return 0#math.exp(-0.5/4**2*((x[0]-4)**2+(x[1]-12)**2))*1e-10-math.exp(-0.5/4**2*((x[0]-20)**2+(x[1]-12)**2))*1e-10
#def eps(x): return 1#return if ((x[0] > x1 ) and (x[0] < x2) and (x[1] > y1) and (x[1] < y2))#1

with Timer('importing solution'):
    nodes_to_coordinates = helper.read_matrix_from_file(
        'data/nodes_to_coordinates.txt')

    local_to_global = helper.read_matrix_from_file('data/local_to_global.txt')
    boundary_table = helper.read_matrix_from_file('data/boundary_table.txt')

    #print nodes_to_coordinates

    u_h = helper.read_matrix_from_file('data/u_h.txt')

with Timer('Calculation 1'):
    energy = 0

    # phi1 = (1-xx) * (1-yy)
    # phi2 = xx * (1-yy)
    # phi3 = xx * yy
    # phi4 = (1-xx) * yy
Exemple #2
0
import math

import preparation
import assembly
import solve
import plots
import helper

from helper import Timer

ELEMENTS_PER_LINE = 12
NODES_PER_ELEMENT = 4
STEP_SIZE = 0.2

points = helper.read_matrix_from_file('data/important_points.txt')
print('x1='+str(points[0,0])+'y1='+str(points[0,1]))
x1 = points[0,0]
y1 = points[0,1]

x2 = points[1,0]
y2 = points[1,1]

window = helper.read_matrix_from_file('data/window.txt')
wx1 = window[0,0]
wy1 = window[0,1]

wx2 = window[1,0]
wy2 = window[1,1]

def rho(x): 
Exemple #3
0
import math

import preparation
import assembly
import solve
import plots
import helper

from helper import Timer

ELEMENTS_PER_LINE = 12
NODES_PER_ELEMENT = 4
STEP_SIZE = 0.2

points = helper.read_matrix_from_file('data/important_points.txt')
print('x1=' + str(points[0, 0]) + 'y1=' + str(points[0, 1]))
x1 = points[0, 0]
y1 = points[0, 1]

x2 = points[1, 0]
y2 = points[1, 1]

window = helper.read_matrix_from_file('data/window.txt')
wx1 = window[0, 0]
wy1 = window[0, 1]

wx2 = window[1, 0]
wy2 = window[1, 1]

Exemple #4
0
#import matplotlib
import matplotlib.pyplot as plt

import numeric
import helper
from helper import Timer
import fem
import assembly

#def rho(x): return 0#math.exp(-0.5/4**2*((x[0]-4)**2+(x[1]-12)**2))*1e-10-math.exp(-0.5/4**2*((x[0]-20)**2+(x[1]-12)**2))*1e-10
#def eps(x): return 1#return if ((x[0] > x1 ) and (x[0] < x2) and (x[1] > y1) and (x[1] < y2))#1



with Timer('importing solution'):
    nodes_to_coordinates = helper.read_matrix_from_file('data/nodes_to_coordinates.txt')
    

    local_to_global = helper.read_matrix_from_file('data/local_to_global.txt')
    boundary_table = helper.read_matrix_from_file('data/boundary_table.txt')

    #print nodes_to_coordinates

    u_h = helper.read_matrix_from_file('data/u_h.txt')


with Timer('Calculation 1'):
    energy = 0

     # phi1 = (1-xx) * (1-yy)
     # phi2 = xx * (1-yy)