예제 #1
0
    def __init__(self, options=Options(), **kw):

        # Define the default options
        default_options = Options(
            name="Jemmy's Example 1",
            numSegments=3,
            bifurcationPoints=1,
            domainE=Domains(space=[0, 1], time=[0, 1]),
            domainLw=Domains(space=[1, 2], time=[0, 1]),
            domainUp=Domains(space=[1, 3], time=[0, 1]),
            bcDomainE=BoundaryConditions(SealedEnd(), SealedEnd()),
            bcDomainLw=BoundaryConditions(SealedEnd(), SealedEnd()),
            bcDomainUp=BoundaryConditions(SealedEnd(), SealedEnd()),
            solutionE=[],
            solutionLw=[],
            solutionUp=[],
            description="This is the solution for the \
                                                  following problem:\
                                                  Problem being solved is: [0,3]X[0,1]\
                                                  d2u/dx2 = du\dt + u \
                                                  BC:  du/dx(0,t) = du/dx(2,t) = du/dx(3,t) = 0 \
                                                  Initial Conditions:\
                                                  u(x,0) = cos(pi*x)\
                                                  Solution: u = (e^(-(1 + pi^2)*t)*cos(pi*x)"
        )

        # Merge the default options and the user generated options
        whole_options = default_options << options

        super(JemmyEx1, self).__init__(whole_options, **kw)
예제 #2
0
    def __init__(self, options=Options(), **kw):

        # Define the default options
        default_options = Options(
            name="Jemmy's Example 2",
            numSegments=3,
            bifurcationPoints=1,
            segmentsDomain=[
                Domains(space=[0, pi / 2], time=[0, 1]),
                Domains(space=[pi / 2, pi], time=[0, 1]),
                Domains(space=[pi / 2, 3 * (pi / 2)], time=[0, 1])
            ],
            boundaryConditions=[
                BoundaryConditions(SealedEnd(), SealedEnd()),
                BoundaryConditions(SealedEnd(), SealedEnd()),
                BoundaryConditions(SealedEnd(), SealedEnd())
            ],
            description="This is the solution for the \
                                                  following problem:\
                                                  Problem being solved is: [0,3*pi/2]X[0,1]\
                                                  d2u/dx2 = du\dt - 2*u \
                                                  BC:  du/dx(0,t) = -e^t, du/dx(pi,t) = e^t , du/dx(3*pi/2,t) = 0 \
                                                  Initial Conditions:\
                                                  u(x,0) = -sin(x)\
                                                  Solution: u = (e^-t)*sin(x)")

        # Merge the default options and the user generated options
        whole_options = default_options << options

        super(JemmyEx2, self).__init__(whole_options, **kw)
예제 #3
0
from Plotting.Simulation import Simulation
from Plotting.IDataPlot import IDataPlot
from numpy import arange

########################################
###      Simulation Variable         ###
########################################

simDomain = Domains(space=[0, 1], time=[0, 10])
simSteps = Steps(space=0.1, time=0.1)

diffusionValue = 1
reactionValue = 1
kValue = 1

boundaryConditions = BoundaryConditions(KilledEnd(), KilledEnd())

sElements = arange(0, simDomain.space[-1] + simSteps.space,\
                                simSteps.space)

########################################
###      Setting the Simulation      ###
########################################


analytical = ValidationWithF(domain=simDomain,steps=simSteps,\
                             BCs=boundaryConditions,\
                             kValue = kValue)

font = analytical.createFont()
예제 #4
0
###      Mesh Prep Work              ###
########################################

k = 1
coeff_t = 1/k
coeff_dx2 = -1
coeff_v = 1

def f(x,t):
   return 4*(math.pi**2)*math.exp(-t)*math.sin(2*math.pi*x)

simModel = CableModel(iApproximation=GalerkinApproximation(),\
                      font=f,coeff_dx2 = coeff_dx2,coeff_v = coeff_v,
                      coeff_t=coeff_t,)

segment0 = ISegment('Axon0',BoundaryConditions(KilledEnd(),KilledEnd()),\
                    simDomain,simSteps,simModel)

#geoMesh = ISegment()
#geoMesh.insert_segments(segment0)


########################################
###      Setting the Simulation      ###
########################################

#ode_approximation = BackwardEuler(delta_t=delta_t,coeff_t=coeff_t)


#geoMesh.create_region(cable_model)
예제 #5
0
from NeuroCore.Neuron.Segment.Base import ISegment
from Plotting.IDataPlot import IDataPlot
from Plotting.IDataPlots import IDataPlots
from Plotting.Simulation import Simulation

########################################
###      Simulation Variable         ###
########################################

simDomain = Domains(space=[0, 12])
simSteps = Steps(space=0.01)

diffusionValue = 100
reactionValue = 10

boundaryConditions = BoundaryConditions(SealedEnd(), SealedEnd())

sElements = numpy.arange(0, simDomain.space[-1] + simSteps.space, \
                         simSteps.space)

########################################
###      Setting the Simulation      ###
########################################

analytical = ValidationWithF(domain=simDomain, steps=simSteps, \
                             BCs=boundaryConditions, \
                             diffusionValue=diffusionValue, \
                             reactionValue=reactionValue)

font = analytical.createFont()
예제 #6
0
simDomain = Domains(space=[0, 1])
simSteps = Steps(space=0.1)

########################################
###      Setting the Simulation      ###
########################################


def f(x):
    return 0


diffusionValue = -0.01
reactionValue = 1

boundaryConditions = BoundaryConditions(Neumann(bcValue=1), Neumann(bcValue=1))

simModel = GeneralModel(iApproximation=GalerkinApproximation(numIntegration=Trapezoidal()),\
                      font=f,coeff_dx2 = diffusionValue,coeff_v = reactionValue)

segment0 = ISegment('Axon0', boundaryConditions, simDomain, simSteps, simModel)

########################################
###      Running the Simulation      ###
########################################

sElements = numpy.arange(0, simDomain.space[-1] + simSteps.space,\
                                simSteps.space)

analytical = analyCableModel(domain=simDomain,steps=simSteps,\
                             BCs=boundaryConditions,\