Skip to content

Commit

Permalink
fixed large model
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-v-k committed Oct 24, 2023
1 parent 08924e8 commit 6f24cd5
Show file tree
Hide file tree
Showing 8 changed files with 21,042 additions and 21 deletions.
9 changes: 5 additions & 4 deletions src/Solver/Equation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Equation::Equation(NodeVector nodes, Simulation::Options options) : options(opti
Eigen::SparseMatrix<pr_t> __A(numberOfNodesTotal, numberOfNodesTotal);

A = std::move(__A);
maxNumOfNeighbours = (std::sqrt(maxRefinement)*4)+2;
A.reserve(long_vector::Constant(numberOfNodesTotal, maxNumOfNeighbours+1));
maxNumOfNeighbours = (std::sqrt(maxRefinement)*4)+2; // +2 for top/down
A.reserve(long_vector::Constant(numberOfNodesTotal, maxNumOfNeighbours+1)); // +1 for this node

//Init first result vector x by writing initial heads
//Initial head should be positive
Expand Down Expand Up @@ -170,7 +170,7 @@ Equation::updateMatrix_zetas(large_num iterOffset, int localZetaID) {
const long numActive = numberOfNodesPerLayer - numInactive;
Eigen::SparseMatrix<pr_t> __A_zetas(numActive, numActive);
A_zetas = std::move(__A_zetas);
A_zetas.reserve(long_vector::Constant(numActive, maxNumOfNeighbours+1));
A_zetas.reserve(long_vector::Constant(numActive, maxNumOfNeighbours-2+1)); // +1 for this node, -2 since no top/down
// todo acutally, A_zetas needs 2 less (top and down not required), fix first in getMarixEntries(int localZetaID)
long_vector __b_zetas(numActive);
b_zetas = std::move(__b_zetas);
Expand Down Expand Up @@ -493,6 +493,7 @@ Equation::solve() {
*/
void
Equation::solve_zetas(){
LOG(numerics) << "Solving for zeta surfaces";
updateZetas_TZero();
LOG(numerics) << "If unconfined: clipping top zeta to new surface heights";
updateTopZetasToHeads();
Expand Down Expand Up @@ -527,7 +528,7 @@ Equation::solve_zetas(){
auto isZetaChangeGreater = [this, &maxZetaChange, &iterOffset]() -> bool {
double zetaChangeMax = 0;

//#pragma omp parallel for
#pragma omp parallel for
for (large_num k = 0; k < numberOfNodesPerLayer; ++k) {
double zetaChangeNode;
for (int l = 1; l < numberOfZones; l++) { // localZetaID needs to be defined within "isZetaChangeGreater"
Expand Down
2 changes: 2 additions & 0 deletions tests/LargeModel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ configure_file(out.json ${CMAKE_CURRENT_BINARY_DIR}/../../data/out.json COPYONLY
# read the NewZealand grid and initial head
configure_file(data_5min/grid_nz.csv ${CMAKE_CURRENT_BINARY_DIR}/../../data/grid_nz.csv COPYONLY)
configure_file(data_5min/grid_nz_refined.csv ${CMAKE_CURRENT_BINARY_DIR}/../../data/grid_nz_refined.csv COPYONLY)
configure_file(data_5min/grid_nz_refined_16.csv ${CMAKE_CURRENT_BINARY_DIR}/../../data/grid_nz_refined_16.csv COPYONLY)
configure_file(data_5min/grid_na.csv ${CMAKE_CURRENT_BINARY_DIR}/../../data/grid_na.csv COPYONLY)
configure_file(../../data_5min/grid.csv ${CMAKE_CURRENT_BINARY_DIR}/../../data/grid.csv COPYONLY)
configure_file(../../data_5min/grid_refined_16.csv ${CMAKE_CURRENT_BINARY_DIR}/../../data/grid_refined_16.csv COPYONLY)
configure_file(../../data_5min/mean_wtd.csv ${CMAKE_CURRENT_BINARY_DIR}/../../data/mean_wtd.csv COPYONLY)

# read the data for the model (nodes that are not in the grid read above are ignored)
Expand Down
11 changes: 4 additions & 7 deletions tests/LargeModel/config_na.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
"resolution_in_degree": 0.08333,
"edge_length_left_right": -0,
"edge_length_front_back": -0,
"layers": 2,
"layers": 1,
"use_efolding": "true",
"confinement": [
"true",
"true"
],
"grid_refined": "false",
Expand All @@ -21,7 +20,7 @@
"sensitivity": "false"
},
"vdf_config": {
"density_variable": "false",
"density_variable": "true",
"density_zones": [
999.5,
1001.1,
Expand All @@ -34,7 +33,7 @@
"vdf_lock": 0.001
},
"numerics": {
"threads": 10,
"threads": 50,
"solver": "PCG",
"iterations": 30,
"inner_itter": 5,
Expand Down Expand Up @@ -65,16 +64,14 @@
"effective_porosity": 0.002,
"initial_head": 0,
"K": [
0.27,
0.027
0.27
],
"ghb_K": 10,
"aquifer_thickness": [
100,
100
],
"anisotropy": [
10,
10
],
"specific_yield": 0.15,
Expand Down
8 changes: 2 additions & 6 deletions tests/LargeModel/config_nz.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
"resolution_in_degree": 0.08333,
"edge_length_left_right": -0,
"edge_length_front_back": -0,
"layers": 2,
"layers": 1,
"use_efolding": "true",
"confinement": [
"true",
"true"
],
"grid_refined": "false",
Expand Down Expand Up @@ -65,16 +64,13 @@
"effective_porosity": 0.002,
"initial_head": 0,
"K": [
0.27,
0.027
0.27
],
"ghb_K": 10,
"aquifer_thickness": [
100,
100
],
"anisotropy": [
10,
10
],
"specific_yield": 0.15,
Expand Down
Loading

0 comments on commit 6f24cd5

Please sign in to comment.