Commit 1efb2d33 authored by Johannes Blaschke's avatar Johannes Blaschke

rename modules to make more sense moving forward

parent abdfc5f2
......@@ -8,7 +8,7 @@
{
"data": {
"text/plain": [
"Main.FP"
"Main.ModFluxArray"
]
},
"execution_count": 1,
......@@ -17,7 +17,7 @@
}
],
"source": [
"include(\"src/fp.jl\")"
"include(\"src/flux_array.jl\")"
]
},
{
......@@ -26,7 +26,7 @@
"metadata": {},
"outputs": [],
"source": [
"using .FP"
"using .ModFluxArray"
]
},
{
......@@ -101,16 +101,16 @@
"data": {
"text/plain": [
"10-element Array{Float64,1}:\n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0022742765607139948\n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 "
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.1936697622933632\n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 "
]
},
"execution_count": 7,
......@@ -131,16 +131,16 @@
"data": {
"text/plain": [
"10-element Array{Float64,1}:\n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.997725723439286\n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 "
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.8063302377066368\n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 "
]
},
"execution_count": 8,
......@@ -200,17 +200,17 @@
"data": {
"text/plain": [
"11-element Array{Float64,1}:\n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 2.2742765607139948\n",
" -997.725723439286 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 "
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 193.6697622933632\n",
" -806.3302377066368\n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" 0.0 "
]
},
"execution_count": 11,
......@@ -240,17 +240,17 @@
"data": {
"text/plain": [
"11-element Array{Float64,1}:\n",
" -0.8640646960498399\n",
" 0.0 \n",
" 1.662956306086986 \n",
" 0.0 \n",
" -0.0 \n",
" 0.3672085709169771\n",
" -2.924360797089483 \n",
" 0.0 \n",
" 0.0 \n",
" -0.0 \n",
" 4.240011808025856 \n",
" 2.710972258785979 \n",
" -0.0 \n",
" 0.0 \n",
" 0.3838915655069409"
" -0.0 \n",
" -0.0 \n",
" -0.3416384648516665"
]
},
"execution_count": 13,
......@@ -280,17 +280,17 @@
"data": {
"text/plain": [
"11-element Array{Float64,1}:\n",
" 0.0 \n",
" 0.0 \n",
" 0.0 \n",
" -0.0 \n",
" 0.3672085709169771\n",
" -2.924360797089483 \n",
" 0.0 \n",
" 0.0 \n",
" -0.0 \n",
" 0.0 \n",
" 0.0 "
" 0.0 \n",
" 0.0 \n",
" -0.0 \n",
" -0.0 \n",
" 4.240011808025856\n",
" 2.710972258785979\n",
" -0.0 \n",
" 0.0 \n",
" -0.0 \n",
" -0.0 \n",
" 0.0 "
]
},
"execution_count": 15,
......
module FP
module StochFluxArray
export DistributionArray
export size
......@@ -172,7 +172,7 @@ function fill_ft!(flx::FluxArray{T}, h::T, k::T) where T
for i=2:size_cc(flx)
# Total particle number
P::T = flx.right[i-1] + flx.left[i]
P::T = flx.right[i-1] + flx.left[i];
# Number in right box (i.e. number of particles going left)
x0::T = flx.left[i];
# Valid range of fluxes
......@@ -182,55 +182,6 @@ function fill_ft!(flx::FluxArray{T}, h::T, k::T) where T
end
#function getFlux(n, h, N, k, D, FP, time)
# #get the diffusive flux for FV solver
#
# #create flux vectors
# Ftot = zeros(1,N+1); #total flux
# Fd = zeros(1,N+1); #diffusive flux
# Fs = zeros(1,N+1); #stochastic flux
#
# #get the fraction of particles going in each direction
# fr = rand(1,N); #fraction going right, 1-fr is fraction going left
# left = n.*(1-fr);right = n.*fr; #define left and right particle numbers
#
# #compute the diffusive flux
# for i = 2:N
# Fd(i) = D/h * (left(i) - right(i-1)); #random fractions
# #Fd(i) = D/h * (n(i) - n(i-1)); #usual fv
# end
#
# #compute the stochastic flux - assume gaussian
# R = randn(1,N+1); #standard normals
# for i = 2:N
# avg = left(i) + right(i-1); #average over cell, ignore factor of 2
# Fs(i) = R(i)*sqrt(D*avg/(k*sqrt(h))); #set correct variance, 2 cancels
# end
#
# #check if each box has a physical flux
# nu = k/h; #ratio of time to space step to propogate soln
# Ftot = Fd + Fs; #set total flux
# Q = -Ftot*nu; #take time step to get real fluxes
# for i=1:N-1
# P = right(i)+left(i+1); #total particle number
# x0 = left(i+1); #number in right box
# lower = -x0; upper = P-x0; #valid range of fluxes
# if (Q(i+1)>upper || Q(i+1) < lower)
# #if particle num is low enough, sample uniform - approx FP
# if (P < 1e-3)
# Ftot(i+1) = -1/nu*(P*rand()-x0);
# else
# #do a fokker planck solve - sample flux
# #divide by nu to remain consistent.
# flux = FPsample(P,x0,D,h,k);
# Ftot(i+1) = -1/nu*flux;
# FP{i}(time) = 1;
# end
# end
# end
#
# return Ftot, FP
#end
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment