-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from slimgroup/verticalwell
vertical wells
- Loading branch information
Showing
13 changed files
with
137 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
## A simple 2D example for fluid-flow simulation | ||
|
||
using DrWatson | ||
@quickactivate "JutulDarcyAD-example" | ||
|
||
using JutulDarcyAD | ||
using LinearAlgebra | ||
using PyPlot | ||
|
||
## grid size | ||
n = (30, 1, 15) | ||
d = (30.0, 30.0, 30.0) | ||
|
||
## permeability | ||
K0 = 200 * md * ones(n) | ||
K = deepcopy(K0) | ||
K[:,:,1:2:end] .*= 100 | ||
|
||
ϕ = 0.25 | ||
model = jutulModel(n, d, ϕ, K1to3(K)) | ||
|
||
## simulation time steppings | ||
tstep = 50 * ones(10) | ||
tot_time = sum(tstep) | ||
|
||
## injection & production | ||
inj_loc = (15, 1, 10) .* d | ||
irate = 5e-3 | ||
q = jutulVWell(irate, (450., 30.); startz = 270., endz = 330.) | ||
|
||
## set up modeling operator | ||
S = jutulModeling(model, tstep) | ||
|
||
## simulation | ||
Trans = KtoTrans(CartesianMesh(model), K1to3(K)) | ||
Trans0 = KtoTrans(CartesianMesh(model), K1to3(K0)) | ||
@time states = S(log.(Trans), q) | ||
@time states0 = S(log.(Trans0), q) | ||
|
||
## plotting | ||
fig=figure(figsize=(20,12)); | ||
subplot(1,2,1); | ||
imshow(reshape(Saturations(states.states[end]), n[1], n[end])'); colorbar(); title("saturation") | ||
subplot(1,2,2); | ||
imshow(reshape(Pressure(states.states[end]), n[1], n[end])'); colorbar(); title("pressure") | ||
|
||
## plotting | ||
fig=figure(figsize=(20,12)); | ||
subplot(1,2,1); | ||
imshow(reshape(Saturations(states0.states[end]), n[1], n[end])'); colorbar(); title("saturation") | ||
subplot(1,2,2); | ||
imshow(reshape(Pressure(states0.states[end]), n[1], n[end])'); colorbar(); title("pressure") | ||
|
||
exist_co2 = sum(Saturations(states.states[end]) .* states.states[end].state[:Reservoir][:PhaseMassDensities][1,:] .* model.ϕ) * prod(model.d) | ||
inj_co2 = JutulDarcyAD.ρCO2 * q.irate * JutulDarcyAD.day * sum(tstep) | ||
|
||
norm(exist_co2-inj_co2)/norm(exist_co2+inj_co2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export jutulVWell | ||
|
||
struct jutulVWell{D, T} | ||
irate::T | ||
name::Vector{Symbol} | ||
loc::Vector | ||
startz | ||
endz | ||
end | ||
|
||
jutulVWell(irate::T, loc::NTuple{D, T}; startz=nothing, endz=nothing) where {D, T} = jutulVWell(irate, [loc]; startz=startz, endz=endz) | ||
jutulVWell(irate::T, loc::Vector{NTuple{D, T}}; startz=nothing, endz=nothing) where {D, T}= jutulVWell{D+1, T}(irate, vcat(:Injector, [:Producer for i = 1:length(loc)]), loc, startz, endz) | ||
|
||
display(f::jutulVWell{D, T}) where {D, T} = | ||
println("$(D)D jutulVWell structure with $(length(f.loc)) injection/production wells and rate $(f.irate) m^3/s") | ||
|
||
==(A::jutulVWell{D, T}, B::jutulVWell{D, T}) where {D,T} = (A.irate == B.irate && A.name == B.name && A.loc == B.loc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@testset "Test jutulVWell" begin | ||
|
||
d = (1.0, 20.0, 3.0) | ||
inj_loc = (3, 1) .* d[1:2] | ||
prod_loc = (28, 1) .* d[1:2] | ||
irate = rand() | ||
q = jutulVWell(irate, [inj_loc, prod_loc]) | ||
q1 = jutulVWell(irate, [inj_loc]) | ||
|
||
@test q != q1 | ||
@test q.irate == q1.irate | ||
@test q.loc[1] == q1.loc[1] | ||
@test q.name[1] == q1.name[1] | ||
@test q.name[2] == :Producer | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters