diff --git a/.github/workflows/ci-runtest.yml b/.github/workflows/ci-runtest.yml index 88f45d9..1ce778e 100644 --- a/.github/workflows/ci-runtest.yml +++ b/.github/workflows/ci-runtest.yml @@ -1,4 +1,4 @@ -name: CI-JutulDarcyAD +name: CI-JutulDarcyRules on: # Trigger the workflow on push to main or pull request @@ -29,7 +29,7 @@ jobs: - x64 steps: - - name: Checkout JutulDarcyAD + - name: Checkout JutulDarcyRules uses: actions/checkout@v2 - name: Setup julia diff --git a/Project.toml b/Project.toml index a19771e..e0fb615 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ -name = "JutulDarcyAD" +name = "JutulDarcyRules" uuid = "41f0c4f5-9bdd-4ef1-8c3a-d454dff2d562" authors = ["Ziyi Yin "] -version = "0.2.1" +version = "0.2.2" [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" diff --git a/README.md b/README.md index e2ddaec..096fd6b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

JutulDarcyAD: auto-differentiable two-phase flow solvers based on Jutul and JutulDarcy

+

JutulDarcyRules: auto-differentiable two-phase flow solvers based on Jutul and JutulDarcy

[![][license-img]][license-status] [![][zenodo-img]][zenodo-status] @@ -22,5 +22,5 @@ SLIM public GitHub account, [https://github.com/slimgroup](https://github.com/sl [ChainRules.jl]:https://github.com/JuliaDiff/ChainRules.jl [license-status]:LICENSE [license-img]:http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat?style=plastic -[zenodo-status]:https://doi.org/10.5281/zenodo.7587717 -[zenodo-img]:https://zenodo.org/badge/DOI/10.5281/zenodo.7587717.svg?style=plastic \ No newline at end of file +[zenodo-status]:https://zenodo.org/badge/latestdoi/594128866 +[zenodo-img]:https://zenodo.org/badge/594128866.svg?style=plastic \ No newline at end of file diff --git a/examples/Project.toml b/examples/Project.toml index 1285185..8499d5f 100644 --- a/examples/Project.toml +++ b/examples/Project.toml @@ -1,4 +1,4 @@ -name = "JutulDarcyAD-example" +name = "JutulDarcyRules-example" authors = ["Ziyi Yin"] [deps] diff --git a/examples/Vwell_2D.jl b/examples/Vwell_2D.jl index b10baef..a26134d 100644 --- a/examples/Vwell_2D.jl +++ b/examples/Vwell_2D.jl @@ -1,9 +1,9 @@ ## A simple 2D example for fluid-flow simulation using DrWatson -@quickactivate "JutulDarcyAD-example" +@quickactivate "JutulDarcyRules-example" -using JutulDarcyAD +using JutulDarcyRules using LinearAlgebra using PyPlot @@ -52,6 +52,6 @@ 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) +inj_co2 = JutulDarcyRules.ρCO2 * q.irate * JutulDarcyRules.day * sum(tstep) norm(exist_co2-inj_co2)/norm(exist_co2+inj_co2) diff --git a/examples/basic2D.jl b/examples/basic2D.jl index e9ff8dc..621962c 100644 --- a/examples/basic2D.jl +++ b/examples/basic2D.jl @@ -1,9 +1,9 @@ ## A simple 2D example for fluid-flow simulation using DrWatson -@quickactivate "JutulDarcyAD-example" +@quickactivate "JutulDarcyRules-example" -using JutulDarcyAD +using JutulDarcyRules using LinearAlgebra using PyPlot @@ -52,6 +52,6 @@ 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) +inj_co2 = JutulDarcyRules.ρCO2 * q.irate * JutulDarcyRules.day * sum(tstep) norm(exist_co2-inj_co2)/norm(exist_co2+inj_co2) diff --git a/examples/compass.jl b/examples/compass.jl index e385bc9..cfcea71 100644 --- a/examples/compass.jl +++ b/examples/compass.jl @@ -1,9 +1,9 @@ ## A 2D compass example using DrWatson -@quickactivate "JutulDarcyAD-example" +@quickactivate "JutulDarcyRules-example" -using JutulDarcyAD +using JutulDarcyRules using LinearAlgebra using PyPlot using Flux diff --git a/examples/end2end.jl b/examples/end2end.jl index 1febd2b..6de1807 100644 --- a/examples/end2end.jl +++ b/examples/end2end.jl @@ -1,9 +1,9 @@ ## A 64×64 2D example for end-to-end inversion of a tortuous channel using DrWatson -@quickactivate "JutulDarcyAD-example" +@quickactivate "JutulDarcyRules-example" -using JutulDarcyAD +using JutulDarcyRules using LinearAlgebra using PyPlot using Flux diff --git a/examples/inv_2D.jl b/examples/inv_2D.jl index a856682..874a2c5 100644 --- a/examples/inv_2D.jl +++ b/examples/inv_2D.jl @@ -1,9 +1,9 @@ ## A simple 2D example for permeability inversion using DrWatson -@quickactivate "JutulDarcyAD-example" +@quickactivate "JutulDarcyRules-example" -using JutulDarcyAD +using JutulDarcyRules using LinearAlgebra using PyPlot using Flux diff --git a/examples/inv_logK.jl b/examples/inv_logK.jl index 8f8f447..e6f0262 100644 --- a/examples/inv_logK.jl +++ b/examples/inv_logK.jl @@ -1,9 +1,9 @@ ## A simple 2D example for permeability inversion using DrWatson -@quickactivate "JutulDarcyAD-example" +@quickactivate "JutulDarcyRules-example" -using JutulDarcyAD +using JutulDarcyRules using LinearAlgebra using PyPlot using Flux diff --git a/examples/inv_tortuous.jl b/examples/inv_tortuous.jl index bc41b50..c1b784a 100644 --- a/examples/inv_tortuous.jl +++ b/examples/inv_tortuous.jl @@ -1,9 +1,9 @@ ## A 64×64 2D example for permeability inversion of a tortuous channel using DrWatson -@quickactivate "JutulDarcyAD-example" +@quickactivate "JutulDarcyRules-example" -using JutulDarcyAD +using JutulDarcyRules using LinearAlgebra using PyPlot using Flux diff --git a/examples/inv_trans.jl b/examples/inv_trans.jl index 3ffa450..7a5fc26 100644 --- a/examples/inv_trans.jl +++ b/examples/inv_trans.jl @@ -1,9 +1,9 @@ ## A simple 2D example for transmissibility inversion using DrWatson -@quickactivate "JutulDarcyAD-example" +@quickactivate "JutulDarcyRules-example" -using JutulDarcyAD +using JutulDarcyRules using LinearAlgebra using PyPlot using Flux diff --git a/examples/optim_K.jl b/examples/optim_K.jl index 278e842..5cb1094 100644 --- a/examples/optim_K.jl +++ b/examples/optim_K.jl @@ -1,7 +1,7 @@ using DrWatson -@quickactivate "JutulDarcyAD-example" +@quickactivate "JutulDarcyRules-example" -using JutulDarcyAD +using JutulDarcyRules using Flux using LinearAlgebra using Optim diff --git a/examples/simple_2D.jl b/examples/simple_2D.jl index a22beee..ee04305 100644 --- a/examples/simple_2D.jl +++ b/examples/simple_2D.jl @@ -1,9 +1,9 @@ ## A simple 2D example for fluid-flow simulation using DrWatson -@quickactivate "JutulDarcyAD-example" +@quickactivate "JutulDarcyRules-example" -using JutulDarcyAD +using JutulDarcyRules using LinearAlgebra using PyPlot diff --git a/src/FlowAD/FlowAD.jl b/src/FlowRules/FlowRules.jl similarity index 100% rename from src/FlowAD/FlowAD.jl rename to src/FlowRules/FlowRules.jl diff --git a/src/FlowAD/Operators/jutulModeling.jl b/src/FlowRules/Operators/jutulModeling.jl similarity index 100% rename from src/FlowAD/Operators/jutulModeling.jl rename to src/FlowRules/Operators/jutulModeling.jl diff --git a/src/FlowAD/Operators/rrule.jl b/src/FlowRules/Operators/rrule.jl similarity index 100% rename from src/FlowAD/Operators/rrule.jl rename to src/FlowRules/Operators/rrule.jl diff --git a/src/FlowAD/Types/jutulForce.jl b/src/FlowRules/Types/jutulForce.jl similarity index 100% rename from src/FlowAD/Types/jutulForce.jl rename to src/FlowRules/Types/jutulForce.jl diff --git a/src/FlowAD/Types/jutulModel.jl b/src/FlowRules/Types/jutulModel.jl similarity index 100% rename from src/FlowAD/Types/jutulModel.jl rename to src/FlowRules/Types/jutulModel.jl diff --git a/src/FlowAD/Types/jutulSource.jl b/src/FlowRules/Types/jutulSource.jl similarity index 100% rename from src/FlowAD/Types/jutulSource.jl rename to src/FlowRules/Types/jutulSource.jl diff --git a/src/FlowAD/Types/jutulState.jl b/src/FlowRules/Types/jutulState.jl similarity index 100% rename from src/FlowAD/Types/jutulState.jl rename to src/FlowRules/Types/jutulState.jl diff --git a/src/FlowAD/Types/jutulVWell.jl b/src/FlowRules/Types/jutulVWell.jl similarity index 100% rename from src/FlowAD/Types/jutulVWell.jl rename to src/FlowRules/Types/jutulVWell.jl diff --git a/src/FlowAD/Types/type_utils.jl b/src/FlowRules/Types/type_utils.jl similarity index 100% rename from src/FlowAD/Types/type_utils.jl rename to src/FlowRules/Types/type_utils.jl diff --git a/src/JutulDarcyAD.jl b/src/JutulDarcyRules.jl similarity index 83% rename from src/JutulDarcyAD.jl rename to src/JutulDarcyRules.jl index 3856cc0..54a6ee1 100644 --- a/src/JutulDarcyAD.jl +++ b/src/JutulDarcyRules.jl @@ -1,7 +1,7 @@ __precompile__() -module JutulDarcyAD +module JutulDarcyRules - export JutulDarcyADPATH, Darcy, md + export JutulDarcyRulesPATH, Darcy, md using LinearAlgebra using Statistics @@ -19,7 +19,7 @@ module JutulDarcyAD import LinearAlgebra: norm, dot import ChainRulesCore: rrule - JutulDarcyADPATH = dirname(pathof(JutulDarcyAD)) + JutulDarcyRulesPATH = dirname(pathof(JutulDarcyRules)) visCO2 = 1e-4 visH2O = 1e-3 @@ -33,6 +33,6 @@ module JutulDarcyAD const day = 24*3600.0 include("PropertyConversion/PropertyConversion.jl") - include("FlowAD/FlowAD.jl") + include("FlowRules/FlowRules.jl") -end # module JutulDarcyAD +end # module JutulDarcyRules diff --git a/test/runtests.jl b/test/runtests.jl index a8b0016..73dbfbe 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,6 @@ using Test using Jutul -using JutulDarcyAD +using JutulDarcyRules using Flux using Printf using Random diff --git a/test/test_jutulModeling.jl b/test/test_jutulModeling.jl index b59fbe9..7436934 100644 --- a/test/test_jutulModeling.jl +++ b/test/test_jutulModeling.jl @@ -11,7 +11,7 @@ x0 = log.(KtoTrans(CartesianMesh(model0), model0.K)) states = S(x, q) for i = 1:length(states.states) exist_co2 = sum(Saturations(states.states[i]) .* states.states[i].state[:Reservoir][:PhaseMassDensities][1,:] .* model.ϕ) * prod(model.d) - inj_co2 = JutulDarcyAD.ρCO2 * q.irate * JutulDarcyAD.day * sum(tstep[1:i]) + inj_co2 = JutulDarcyRules.ρCO2 * q.irate * JutulDarcyRules.day * sum(tstep[1:i]) @test isapprox(exist_co2, inj_co2) rtol=1e-3 end end @@ -20,7 +20,7 @@ end states = S(x, q1) for i = 1:length(states.states) exist_co2 = sum(Saturations(states.states[i]) .* states.states[i].state[:PhaseMassDensities][1,:] .* model.ϕ) * prod(model.d) - inj_co2 = JutulDarcyAD.ρCO2 * q.irate * JutulDarcyAD.day * sum(S.tstep[1:i]) + inj_co2 = JutulDarcyRules.ρCO2 * q.irate * JutulDarcyRules.day * sum(S.tstep[1:i]) @test isapprox(exist_co2, inj_co2) rtol=1e-3 end end @@ -33,7 +33,7 @@ end states_end = S(x, q2; state0=states) for i = 1:length(states_end.states) exist_co2 = sum(Saturations(states_end.states[i]) .* states_end.states[i].state[:Reservoir][:PhaseMassDensities][1,:] .* model.ϕ) * prod(model.d) - inj_co2 = JutulDarcyAD.ρCO2 * q2.irate * JutulDarcyAD.day * sum(S.tstep[1:i]) + inj_co2 = JutulDarcyRules.ρCO2 * q2.irate * JutulDarcyRules.day * sum(S.tstep[1:i]) @test isapprox(exist_co2-pre_co2, inj_co2) rtol=1e-3 end end @@ -42,7 +42,7 @@ end states = S(x, q2) for i = 1:length(states.states) exist_co2 = sum(Saturations(states.states[i]) .* states.states[i].state[:Reservoir][:PhaseMassDensities][1,:] .* model.ϕ) * prod(model.d) - inj_co2 = JutulDarcyAD.ρCO2 * q.irate * JutulDarcyAD.day * sum(tstep[1:i]) + inj_co2 = JutulDarcyRules.ρCO2 * q.irate * JutulDarcyRules.day * sum(tstep[1:i]) @test isapprox(exist_co2, inj_co2) rtol=1e-3 end end diff --git a/test/test_jutulState.jl b/test/test_jutulState.jl index ca1a97f..62eed88 100644 --- a/test/test_jutulState.jl +++ b/test/test_jutulState.jl @@ -24,6 +24,6 @@ model, model0, q, q1, q2, init_state, init_state_simple, tstep = test_config(); @info "test translation" half_init_state = init_state(vec(init_state) ./ 2) - JutulDarcyAD.check_valid_state(half_init_state) + JutulDarcyRules.check_valid_state(half_init_state) @test vec(half_init_state) == 0.5 * vec(init_state) end \ No newline at end of file diff --git a/test/test_utils.jl b/test/test_utils.jl index 8a508df..4d184a5 100644 --- a/test/test_utils.jl +++ b/test/test_utils.jl @@ -21,7 +21,7 @@ function test_config() q = jutulForce(irate, inj_loc) q1 = jutulSource(irate, [inj_loc, prod_loc]) q2 = jutulVWell(irate, inj_loc[1:2]; startz = 9 * d[3], endz = 11 * d[3]) - state0 = jutulState(JutulDarcyAD.setup_well_model(model, q, tstep)[3]) + state0 = jutulState(JutulDarcyRules.setup_well_model(model, q, tstep)[3]) state1 = jutulSimpleState(model) return model, model0, q, q1, q2, state0, state1, tstep end