Skip to content

Commit

Permalink
Worked on importing MF6 models.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbwinst-usgs committed May 17, 2024
1 parent 873aa4c commit 93ed4cd
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 44 deletions.
8 changes: 3 additions & 5 deletions MF6InputReader/Mf6.EvtFileReaderUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,7 @@ procedure TEvtPeriod.Read(Stream: TStreamReader; Unhandled: TStreamWriter;
Layered: Boolean;
IntThreeDReader: TInteger3DArrayReader;
Double2DDReader: TDouble2DArrayReader;
// SURFACE: TArrayItem;
// RATE: TArrayItem;
// DEPTH: TArrayItem;
AuxArray: TArrayItem;
// AuxList: TArrayItemList;
RowIndex: Integer;
ColIndex: Integer;
SegIndex: Integer;
Expand Down Expand Up @@ -582,7 +578,6 @@ procedure TEvtPeriod.Read(Stream: TStreamReader; Unhandled: TStreamWriter;
SetLength(IEVT, Length(IEVT), Length(IEVT[0]), Length(IEVT[0,0]));
end;
end;
// AuxList := TArrayItemList.Create;
try
AuxIndex := 0;
while not Stream.EndOfStream do
Expand Down Expand Up @@ -867,7 +862,10 @@ procedure TEvtPeriod.Read(Stream: TStreamReader; Unhandled: TStreamWriter;
end;
Cell.Fpxdp.Add(ABoundValue);
Inc(StartIndex);
end;

for SegIndex := 0 to nseg - 2 do
begin
ABoundValue.Initialize;
if TryFortranStrToFloat(FSplitter[StartIndex], ABoundValue.NumericValue) then
begin
Expand Down
11 changes: 8 additions & 3 deletions ModelMuse/CustomModflowWriterUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,8 @@ TCustomTransientArrayWriter = class(TCustomParameterTransientWriter)
function OkLocationMF6(IDomain: TDataArray;
UsedLocations: T2DSparseBooleanArray;
var Layer: integer; Row, Column: integer; Option: TLayerOption): boolean;
function CountCellsMF6(RateList: TValueCellList; Option: TLayerOption): integer;
function CountCellsMF6(RateList: TValueCellList; Option: TLayerOption;
AssignmentMethod: TUpdateMethod): integer;
public
Constructor Create(Model: TCustomModel; EvaluationType: TEvaluationType); override;
// @name destroys the current instance of @classname.
Expand Down Expand Up @@ -10912,7 +10913,8 @@ function TCustomTransientArrayWriter.OkLocationMF6(IDomain: TDataArray;
end;

function TCustomTransientArrayWriter.CountCellsMF6
(RateList: TValueCellList; Option: TLayerOption): integer;
(RateList: TValueCellList; Option: TLayerOption;
AssignmentMethod: TUpdateMethod): integer;
var
CellIndex: integer;
// ValueCell: TRch_Cell;
Expand All @@ -10938,7 +10940,10 @@ function TCustomTransientArrayWriter.CountCellsMF6
if OkLocationMF6(IDomain, UsedLocations, Layer, ValueCell.Row,
ValueCell.Column, Option) then
begin
UsedLocations.Items[ValueCell.Row, ValueCell.Column] := True;
if AssignmentMethod = umAssign then
begin
UsedLocations.Items[ValueCell.Row, ValueCell.Column] := True;
end;
Inc(result);
end;
end;
Expand Down
18 changes: 18 additions & 0 deletions ModelMuse/Modflow6ModelImporter.pas
Original file line number Diff line number Diff line change
Expand Up @@ -9430,6 +9430,7 @@ procedure TModflow6Importer.ImportModflow6Model(NameFiles, ErrorMessages: TStrin
begin
frmGoPhast.acDefaultCrossSectionExecute(nil);
end;
PhastModel.Mf6TimesSeries.Loaded;
end;

if ErrorMessages.Count > 0 then
Expand Down Expand Up @@ -10311,6 +10312,7 @@ procedure TModflow6Importer.ImportRch(Package: TPackage;
ConnectionItem: TRchConnection;
AScreenObject: TScreenObject;
AuxIFACE: TMf6BoundaryValue;
AuxMult: TMf6BoundaryValue;
AuxIndex: Integer;
ChemSpeciesName: string;
Aux: TMf6BoundaryValue;
Expand All @@ -10334,6 +10336,7 @@ procedure TModflow6Importer.ImportRch(Package: TPackage;
RchPeriod: TRchPeriod;
NextRchPeriod: TRchPeriod;
EndPeriod: Integer;
AuxMultIndex: Integer;
procedure AddItem(AScreenObject: TScreenObject; ACell: TRchTimeItem; Period: Integer);
var
RchItem: TRchItem;
Expand Down Expand Up @@ -10558,6 +10561,8 @@ procedure TModflow6Importer.ImportRch(Package: TPackage;
Model.ModflowPackages.RchPackage.LayerOption := loTopActive;
end;

AuxMultIndex := Options.IndexOfAUXILIARY(Options.AUXMULTNAME);

RchLinkList := TRchLinkList.Create;
SpcList := TSpcList.Create;
CellIds := TCellIdList.Create;
Expand Down Expand Up @@ -10788,6 +10793,19 @@ procedure TModflow6Importer.ImportRch(Package: TPackage;
end;
KeyString := KeyString + ACell.Keystring + ' IFACE:' + IntToStr(IFACE);

if AuxMultIndex >= 0 then
begin
AuxMult := ACell[AuxMultIndex];
if AuxMult.ValueType = vtNumeric then
begin
KeyString := KeyString + ' Num';
end
else
begin
KeyString := KeyString + AuxMult.StringValue;
end;
end;

for var SpcIndex := 0 to SpcDictionaries.Count - 1 do
begin
SpcDictionary := SpcDictionaries[SpcIndex];
Expand Down
2 changes: 1 addition & 1 deletion ModelMuse/ModflowETS_WriterUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ procedure TModflowETS_Writer.WriteDimensions;
for TimeIndex := 0 to Values.Count - 1 do
begin
EtRateList := Values[TimeIndex];
MAXBOUND := Max(MAXBOUND, CountCellsMF6(EtRateList, FEtsPackage.LayerOption));
MAXBOUND := Max(MAXBOUND, CountCellsMF6(EtRateList, FEtsPackage.LayerOption, umAssign));
end;

CountParametersAndParameterCells(NPETS, MXL);
Expand Down
2 changes: 1 addition & 1 deletion ModelMuse/ModflowMawWriterUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ procedure TModflowMAW_Writer.WriteOptions;

if FMawPackage.SaveBudgetCsv then
begin
WriteString(' BUDGET FILEOUT ');
WriteString(' BUDGETCSV FILEOUT ');
AFileName := ChangeFileExt(BaseName, StrMawbudCsv);
Model.AddModelOutputFile(AFileName);
AFileName := ExtractFileName(AFileName);
Expand Down
9 changes: 5 additions & 4 deletions ModelMuse/ModflowRCH_WriterUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,6 @@ procedure TModflowRCH_Writer.WriteDataSets5To8;
end;

procedure TModflowRCH_Writer.WriteDimensions;
//var
// MAXBOUND: Integer;
var
RchRateList: TValueCellList;
TimeIndex: Integer;
Expand All @@ -416,7 +414,7 @@ procedure TModflowRCH_Writer.WriteDimensions;
for TimeIndex := 0 to Values.Count - 1 do
begin
RchRateList := Values[TimeIndex];
MAXBOUND := Max(MAXBOUND, CountCellsMF6(RchRateList, FRchPackage.LayerOption));
MAXBOUND := Max(MAXBOUND, CountCellsMF6(RchRateList, FRchPackage.LayerOption, FRchPackage.AssignmentMethod));
end;

CountParametersAndParameterCells(NPRCH, MXL);
Expand Down Expand Up @@ -677,7 +675,10 @@ procedure TModflowRCH_Writer.WriteCellsMF6(RchRateList: TValueCellList);
if OkLocationMF6(IDomain, UsedLocations, Layer, RchCell.Row,
RchCell.Column, FRchPackage.LayerOption) then
begin
UsedLocations.Items[RchCell.Row, RchCell.Column] := True;
if FRchPackage.AssignmentMethod = umAssign then
begin
UsedLocations.Items[RchCell.Row, RchCell.Column] := True;
end;
WriteInteger(Layer+1);
if not Model.DisvUsed then
begin
Expand Down
4 changes: 2 additions & 2 deletions ModelMuse/frmCustomGoPhastUnit.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ object frmCustomGoPhast: TfrmCustomGoPhast
Left = 550
Top = 496
Caption = 'frmCustomGoPhast'
ClientHeight = 202
ClientWidth = 768
ClientHeight = 201
ClientWidth = 764
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Expand Down
9 changes: 4 additions & 5 deletions ModelMuse/frmFormulaErrorsUnit.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ inherited frmFormulaErrors: TfrmFormulaErrors
ClientWidth = 534
Font.Height = 19
FormStyle = fsStayOnTop
OnResize = FormResize
ExplicitWidth = 546
ExplicitHeight = 256
PixelsPerInch = 120
Expand All @@ -28,15 +27,15 @@ inherited frmFormulaErrors: TfrmFormulaErrors
534
45)
object btnClose: TBitBtn
Left = 397
Left = 393
Top = 6
Width = 83
Height = 33
Anchors = [akTop, akRight]
Kind = bkClose
NumGlyphs = 2
TabOrder = 4
ExplicitLeft = 393
ExplicitLeft = 389
end
object btnCopy: TButton
Left = 8
Expand All @@ -51,7 +50,7 @@ inherited frmFormulaErrors: TfrmFormulaErrors
OnClick = btnCopyClick
end
object btnHelp: TBitBtn
Left = 308
Left = 304
Top = 6
Width = 83
Height = 33
Expand All @@ -60,7 +59,7 @@ inherited frmFormulaErrors: TfrmFormulaErrors
NumGlyphs = 2
TabOrder = 3
OnClick = btnHelpClick
ExplicitLeft = 304
ExplicitLeft = 300
end
object btnClear: TButton
Left = 182
Expand Down
9 changes: 5 additions & 4 deletions ModelMuse/frmGoPhastUnit.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ inherited frmGoPhast: TfrmGoPhast
OnKeyUp = FormKeyUp
OnMouseMove = pnlLowerRightMouseMove
OnMouseWheel = FormMouseWheel
ExplicitWidth = 788
ExplicitHeight = 613
TextHeight = 18
object splitHoriz: TJvNetscapeSplitter
Expand Down Expand Up @@ -674,7 +675,7 @@ inherited frmGoPhast: TfrmGoPhast
end
end
object tbarEditGrid: TToolBar
Left = 484
Left = 178
Top = 66
Width = 212
Height = 28
Expand Down Expand Up @@ -776,7 +777,7 @@ inherited frmGoPhast: TfrmGoPhast
end
end
object tbarCreateScreenObject: TToolBar
Left = 227
Left = 403
Top = 66
Width = 244
Height = 28
Expand Down Expand Up @@ -891,7 +892,7 @@ inherited frmGoPhast: TfrmGoPhast
end
end
object tbarView3D: TToolBar
Left = 73
Left = 24
Top = 66
Width = 141
Height = 28
Expand Down Expand Up @@ -1118,7 +1119,7 @@ inherited frmGoPhast: TfrmGoPhast
object tbarPilotPoints: TToolBar
Left = 11
Top = 66
Width = 49
Width = 0
Height = 28
ButtonHeight = 23
Caption = 'tbarPilotPoints'
Expand Down
20 changes: 10 additions & 10 deletions ModelMuse/frmSelectResultToImportUnit.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ inherited frmSelectResultToImport: TfrmSelectResultToImport
ExplicitTop = 280
end
object btnHelp: TBitBtn
Left = 291
Left = 287
Top = 402
Width = 91
Height = 47
Expand All @@ -44,11 +44,11 @@ inherited frmSelectResultToImport: TfrmSelectResultToImport
NumGlyphs = 2
TabOrder = 7
OnClick = btnHelpClick
ExplicitLeft = 287
ExplicitLeft = 283
ExplicitTop = 401
end
object btnOK: TBitBtn
Left = 388
Left = 384
Top = 402
Width = 91
Height = 47
Expand All @@ -58,31 +58,31 @@ inherited frmSelectResultToImport: TfrmSelectResultToImport
NumGlyphs = 2
TabOrder = 8
OnClick = btnOKClick
ExplicitLeft = 384
ExplicitLeft = 380
ExplicitTop = 401
end
object btnCancel: TBitBtn
Left = 485
Left = 481
Top = 402
Width = 91
Height = 47
Anchors = [akRight, akBottom]
Kind = bkCancel
NumGlyphs = 2
TabOrder = 9
ExplicitLeft = 481
ExplicitLeft = 477
ExplicitTop = 401
end
object comboColorGrid: TComboBox
Left = 8
Top = 370
Width = 567
Width = 563
Height = 26
Style = csDropDownList
Anchors = [akLeft, akRight, akBottom]
TabOrder = 4
ExplicitTop = 369
ExplicitWidth = 563
ExplicitWidth = 559
end
object btnSelectAll: TButton
Left = 8
Expand Down Expand Up @@ -111,7 +111,7 @@ inherited frmSelectResultToImport: TfrmSelectResultToImport
object rgDisplayChoice: TRadioGroup
Left = 8
Top = 302
Width = 567
Width = 563
Height = 42
Anchors = [akLeft, akRight, akBottom]
Caption = 'Display choice'
Expand All @@ -123,7 +123,7 @@ inherited frmSelectResultToImport: TfrmSelectResultToImport
'Neither')
TabOrder = 3
ExplicitTop = 301
ExplicitWidth = 563
ExplicitWidth = 559
end
object pnlSelections: TPanel
AlignWithMargins = True
Expand Down
5 changes: 5 additions & 0 deletions ModelMuse/frmSelectResultToImportUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ implementation
StrMAWHeadDesc = 'MAW Head';
StrUZFWAterConent = 'UZF WAter Conent';
StrMAWBudget = 'MAW Budget';
StrHds = '.hds';

{$R *.dfm}

Expand Down Expand Up @@ -4045,6 +4046,9 @@ procedure TfrmSelectResultToImport.FormCreate(Sender: TObject);
FilterDescriptions.Add(StrBinaryHeadFiles);
FileExtensions.Add(StrBhd);

FilterDescriptions.Add('Alternate ' + StrBinaryHeadFiles);
FileExtensions.Add(StrHds);

FilterDescriptions.Add(StrBinaryDrawdownFile);
FileExtensions.Add(StrBdn);

Expand Down Expand Up @@ -5760,6 +5764,7 @@ function TfrmSelectResultToImport.OpenResultFile(AFileName: string;
or (SameText(Extension, StrConc))
or (SameText(Extension, StrDensityExt))
or (SameText(Extension, StrViscosityExt))
or (SameText(Extension, StrHds))
then
begin
FResultFormat := mrBinary;
Expand Down
Loading

0 comments on commit 93ed4cd

Please sign in to comment.