From 153137687a8ab20204495b30b71940ebd5737052 Mon Sep 17 00:00:00 2001 From: "Ziyi (Francis) Yin" Date: Wed, 22 Mar 2023 21:44:35 -0400 Subject: [PATCH] quickfix according to jutulexamples --- Project.toml | 6 +++--- src/FlowRules/Types/type_utils.jl | 1 + test/test_gradient.jl | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index ca94bd7..2c05a8d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "JutulDarcyRules" uuid = "41f0c4f5-9bdd-4ef1-8c3a-d454dff2d562" authors = ["Ziyi Yin "] -version = "0.2.3" +version = "0.2.4" [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" @@ -15,8 +15,8 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [compat] ChainRulesCore = "1" Flux = "0.12, 0.13" -Jutul = "0.2.2" -JutulDarcy = "0.2.1" +Jutul = "=0.2.2" +JutulDarcy = "=0.2.1" Optim = "1" julia = "1" diff --git a/src/FlowRules/Types/type_utils.jl b/src/FlowRules/Types/type_utils.jl index 4c4ee95..3a6daa1 100644 --- a/src/FlowRules/Types/type_utils.jl +++ b/src/FlowRules/Types/type_utils.jl @@ -71,6 +71,7 @@ function simple_model(M::jutulModel{D, T}; ρCO2::T=T(ρCO2), ρH2O::T=T(ρH2O)) g = CartesianMesh(M.n, M.d .* M.n) G = discretized_domain_tpfv_flow(tpfv_geometry(g), porosity = M.ϕ, permeability = M.K) model = SimulationModel(G, sys, output_level = :all) + model.primary_variables[:Pressure] = JutulDarcy.Pressure(minimum = -Inf, max_rel = nothing) ρ = ConstantCompressibilityDensities(p_ref = 100*bar, density_ref = [ρCO2, ρH2O], compressibility = [1e-4/bar, 1e-6/bar]) replace_variables!(model, PhaseMassDensities = ρ) replace_variables!(model, RelativePermeabilities = BrooksCoreyRelPerm(sys, [2.0, 2.0], [0.1, 0.1], 1.0)) diff --git a/test/test_gradient.jl b/test/test_gradient.jl index f29a15c..06d8373 100644 --- a/test/test_gradient.jl +++ b/test/test_gradient.jl @@ -29,7 +29,7 @@ g1 = gradient(()->misfit(x0, ϕ, q1, states1), Flux.params(x0, ϕ)) @testset "Taylor-series gradient test of simple jutulModeling" begin grad_test(x0->misfit(x0, ϕ, q1, states1), x0, dx/1.5, g1[x0]) - grad_test(ϕ->misfit(x0, ϕ, q1, states1), ϕ, dϕ/1e2, g1[ϕ]) + grad_test(ϕ->misfit(x0, ϕ, q1, states1), ϕ, dϕ*0.0023, g1[ϕ]) end states2 = S(x, q2)