Skip to content

Commit

Permalink
Merge pull request #56 from sintefmath/dev
Browse files Browse the repository at this point in the history
Bugfix to initialization and fault plots
  • Loading branch information
moyner authored Sep 8, 2024
2 parents 983bad2 + 0d055b1 commit 8ecc3cb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "JutulDarcy"
uuid = "82210473-ab04-4dce-b31b-11573c4f8e0a"
authors = ["Olav Møyner <olav.moyner@gmail.com>"]
version = "0.2.29"
version = "0.2.30"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand Down
2 changes: 1 addition & 1 deletion src/ext.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function plot_faults!(ax, mesh::UnstructuredMesh; kwarg...)
if length(v) == 0
continue
end
plot_mesh!(ax, mesh; faces = v, color = i, colorrange = (1, n), kwarg...)
plot_mesh!(ax, mesh; faces = v, color = i, colorrange = (1, max(n, 2)), kwarg...)
i += 1
end
end
Expand Down
8 changes: 3 additions & 5 deletions src/forces/bc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ function Jutul.apply_forces_to_equation!(acc, storage, model::SimulationModel{D,
end

function compute_bc_mass_fluxes(bc, state, nph)

# Get reservoir properties
p = state.Pressure
mu = state.PhaseViscosities
Expand All @@ -181,7 +180,8 @@ function compute_bc_mass_fluxes(bc, state, nph)
Δp = p[c] - bc.pressure
q_tot = T_f*Δp

q = Vector{typeof(q_tot)}(undef, nph)
num_t = Base.promote_type(typeof(q_tot), eltype(kr), eltype(mu), eltype(rho))
q = zeros(MVector{nph, num_t})
if q_tot > 0
# Pressure inside is higher than outside, flow out from domain
for ph in 1:nph
Expand Down Expand Up @@ -222,12 +222,10 @@ function compute_bc_mass_fluxes(bc, state, nph)
end
end

return q

return SVector{nph, num_t}(q)
end

function compute_bc_heat_fluxes(bc, state, nph)

q = compute_bc_mass_fluxes(bc, state, nph)
c = bc.cell

Expand Down
8 changes: 7 additions & 1 deletion src/init/init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ function parse_state0_equil(model, datafile; normalize = :sum)
has_oil = haskey(datafile["RUNSPEC"], "OIL")
has_gas = haskey(datafile["RUNSPEC"], "GAS")

is_co2 = haskey(datafile["RUNSPEC"], "JUTUL_CO2BRINE")
is_single_phase = (has_water + has_oil + has_gas) == 1

sys = model.system
Expand Down Expand Up @@ -435,7 +436,12 @@ function parse_state0_equil(model, datafile; normalize = :sum)
contacts = []
contacts_pc = []
elseif nph == 2
if has_oil && has_gas
if is_co2
contacts = (woc, )
# TODO: Check sign here. Usually these models are
# initialized without CO2.
contacts_pc = (woc_pc, )
elseif has_oil && has_gas
contacts = (goc, )
contacts_pc = (goc_pc, )
else
Expand Down
1 change: 1 addition & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,7 @@ function partitioner_input(model, parameters; conn = :trans)
if conn == :unit
T = ones(Int, length(trans))
else
trans = max.(trans, 1e-20)
if conn == :trans
T = copy(trans)
T = length(T)*T./sum(T)
Expand Down

2 comments on commit 8ecc3cb

@moyner
Copy link
Member Author

@moyner moyner commented on 8ecc3cb Sep 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/114766

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.30 -m "<description of version>" 8ecc3cb3f148f96d02ca77dfb79bc71fb8fee6a6
git push origin v0.2.30

Please sign in to comment.