Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Maginor committed Sep 19, 2024
1 parent 25761e7 commit 68f3e9d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 181 deletions.
17 changes: 8 additions & 9 deletions dev_notes/todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,24 @@

Made it possible to add properties to solvers manually, but it could be error prone.
Fix errors if they appear.



Something is broken with airsea, but only in some cases .... (has something to do with ice or longwave).


Not including declaration of union index set in data set can create an internal error.
wb_index : index_set("Water body") @union(sc, lake)


SimplyTox:
This variable should depend on contaminant type. Issue is that we aggregate to a "compartment" rather than to a location...
"aggregate(carried_flux(Dissolved contaminants, Recharge), Groundwater)"

We actually need a new system for this.
Could group the needed agg var by the max index sets of the target instead of by the compartment?

Get rid of the idea of aggregating to a *compartment*. Instead, only aggregate to the index set tuple.
Difficulties:
Serialization name depends on compartment (should be easy to change)
aggregation_weight depends on compartment. Make it work like unit_conversion instead?
See other suggestion about merging unit_conversion and aggregation_weight.
Make par_aggregate work the same as regular_aggregate.





Specific models

Expand Down
4 changes: 4 additions & 0 deletions docs/gettingstarted/gettingstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ Open ftp://mobiserver.niva.no/Mobius2 in a file explorer (not a web browser), th

In your local copy, edit MobiView2/config.txt so that the "Mobius2 base path" field contains the location where you put the Mobius2 repository, e.g. `"C:/Data/Mobius2"`.

Try to run MobiView2.exe . If it doesn't open a window, you need to install the Visual Studio redistributables from
https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
You should use the installer https://aka.ms/vs/17/release/vc_redist.x64.exe .

You can now run MobiView2.exe. Click the ![Open](../img/toolbar/Open.png) open icon in the top left and select e.g. `"Mobius2/models/simplyq.txt"`, then `"Mobius2/models/data/simplyq_simple.dat"`. If the model loaded correctly you can now run it by clicking the ![Run](../img/toolbar/Run.png) runner icon in the MobiView2 toolbar. You can then select the series to plot in the result and input series selections in the bottom right.

If you chose `simplyq.txt`, you are running [SimplyQ](../existingmodels/simply.html#simplyq), which is a simple hydrology model for predicting river discharge.
Expand Down
7 changes: 6 additions & 1 deletion models/modules/airsea.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ Authors: Magnus D. Norling

flux(out, top_water.heat, [J, day-1], "Net longwave") {
net_rad := (1 - surf.albedo)*air.lwd - surf.lwu, # W/m2 # TODO: Should really albedo be detracted from longwave?
(!surf.ice.indicator) * A_surf * net_rad ->>

#tw := top_water.temp->[K],
#ta := air.temp ->[K],
#net_rad := -0.98*4*(tw^3)*(tw - ta)*stefan_boltzmann,

(!surf.ice.indicator) * A_surf * net_rad ->>
}

flux(out, top_water.heat, [J, day-1], "Freeze heating") { A_surf * surf.ice.energy ->> } # Energy used to melt ice instead of heating the water body (or other way around with freezing)
Expand Down
169 changes: 0 additions & 169 deletions models/modules/airseaRes.txt

This file was deleted.

5 changes: 3 additions & 2 deletions models/modules/easylake.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ Authors: François Clayer, Magnus D. Norling
z_outflow : par_real("Water level at which outflow is 0", [m], 10, 0.1, 1642.0)
th_epi_w : par_real("Winter epilimnion thickness", [m], 2, 0.1, 10)
th_epi_s : par_real("Spring epilimnion thickness", [m], 2, 0.1, 10)
theta : par_real("Lake bathymetry factor", [], 0, 0, 1, "The cross-section area of the lake at level z is A_0*(z/z_0)^theta")
theta : par_real("Lake bathymetry factor", [], 0, 0, 5, "The cross-section area of the lake at level z is A_0*(z/z_0)^(theta+1)")
dz_epi : par_real("Epilimnion thickening rate", [m, day-1], 0.01, "How fast the thickness of the epilimnion changes during summer")
rate_l : par_real("Rating function linear component", [m 2, s-1], 10, 0, 1000)
t_epi : par_real("Initial epilimnion temperature", [deg_c], 15, 0, 50)
t_bot : par_real("Bottom temperature", [deg_c], 4, 0, 50)
wnd_rate : par_real("Wind mixing rate", [day-1], 0.1, 0, 10)
}

# The basin has a horizontal cross-section that is parametrized by A_surf (surface area when outflow is 0), z_outflow (max depth when outflow is 0) and theta (a shape factor)
Expand Down Expand Up @@ -172,7 +173,7 @@ Authors: François Clayer, Magnus D. Norling
# The magnitude of the rate is pretty arbitrary as long as it is big enough to "quickly" mix the entire lake.
mix_down :
flux(epi.water, hyp.water, [m 3, day-1], "Mixing") {
A_surf * epi.th * epi.ind * 0.1[day-1]
A_surf * epi.th * epi.ind * wnd_rate
} @mixing @no_carry { heat }

}
1 change: 1 addition & 0 deletions src/model_compilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,7 @@ build_instructions(Model_Application *app, std::vector<Model_Instruction> &instr
// TODO: If we are in the initial step, we would not need to clear it.
int clear_id = make_clear_instr(instructions, var_id, var_solver);
make_add_to_aggregate_instr(app, instructions, var_solver, var_id, agg_of, clear_id);


// The instruction for the var. It compiles to a no-op, but it is kept in the model structure to indicate the location of when this var has its final value. (also used for result storage structure).
// Since we generate one aggregation variable per target compartment, we have to give it the full index set dependencies of that compartment
Expand Down

0 comments on commit 68f3e9d

Please sign in to comment.