Skip to content

Commit

Permalink
Worked on importing existing MODFLOW 6 models.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbwinst-usgs committed May 30, 2024
1 parent 5d0d355 commit 17d72e2
Show file tree
Hide file tree
Showing 7 changed files with 478 additions and 316 deletions.
26 changes: 25 additions & 1 deletion MF6InputReader/Mf6.CustomMf6PersistentUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ TMfCellId = record
function SameLocation(OtherCellID: TMfCellId): Boolean;
end;

TCellIdList = TList<TMfCellId>;
TCellIdList = class(TList<TMfCellId>)
procedure Sort;
end;

TValueType = (vtNumeric, vtString);

Expand Down Expand Up @@ -2070,4 +2072,26 @@ procedure TDimensionedPackageReader.SetDimensions(const Value: TDimensions);
end;
end;

{ TCellIdList }

procedure TCellIdList.Sort;
begin
inherited Sort(
TComparer<TMfCellId>.Construct(
function(const Left, Right: TMfCellId): Integer
begin
result := Left.Row - Right.Row;
if Result = 0 then
begin
result := Left.column - Right.column;
if result = 0 then
begin
result := Left.Layer - Right.Layer;
end;
end;
end
));

end;

end.
10 changes: 9 additions & 1 deletion ModelMuse/CustomModflowWriterUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6269,7 +6269,10 @@ procedure TCustomListWriter.WriteStressPeriods(const VariableIdentifiers,
begin
if (ITMP < 0) and (NP = 0) and (FEvaluationType <> etExportCsv) then
begin
Continue;
if not Model.ModflowPackages.MvrPackage.IsSelected then
begin
Continue;
end;
end;
if FEvaluationType <> etExportCsv then
begin
Expand All @@ -6282,6 +6285,11 @@ procedure TCustomListWriter.WriteStressPeriods(const VariableIdentifiers,
begin
WriteCells := True;
end;
if (Model.ModelSelection = msModflow2015)
and Model.ModflowPackages.MvrPackage.IsSelected then
begin
WriteCells := True;
end;

if WriteCells then
begin
Expand Down
2 changes: 1 addition & 1 deletion ModelMuse/Modflow2005ImporterUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5949,7 +5949,7 @@ procedure TDisImporter.ReadVariableTopElev;
ALine := Trim(ALine);
if ALine = 'TOP ELEVATION OF LAYER 1' then
begin
Read2DRealArray(FElevations[0], 'Model_Top');
Read2DRealArray(FElevations[0], kModelTop);
end
else
begin
Expand Down
Loading

0 comments on commit 17d72e2

Please sign in to comment.