Skip to content

Commit

Permalink
Fixed bug in dispersion.
Browse files Browse the repository at this point in the history
Worked on importing GWT MF6 models.
  • Loading branch information
rbwinst-usgs committed Mar 12, 2024
1 parent 4e04a73 commit 1af77d3
Show file tree
Hide file tree
Showing 11 changed files with 650 additions and 110 deletions.
9 changes: 6 additions & 3 deletions MF6InputReader/Mf6.AdvFileReaderUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ interface
type
TAdvOptions = class(TCustomMf6Persistent)
private
SCHEME: string;
FSCHEME: string;
procedure Read(Stream: TStreamReader; Unhandled: TStreamWriter);
protected
procedure Initialize; override;
public
property SCHEME: string read FSCHEME;
end;

TAdv = class(TPackageReader)
Expand All @@ -22,6 +24,7 @@ TAdv = class(TPackageReader)
constructor Create(PackageType: string); override;
destructor Destroy; override;
procedure Read(Stream: TStreamReader; Unhandled: TStreamWriter; const NPER: Integer); override;
property Options: TAdvOptions read FOptions;
end;


Expand All @@ -32,7 +35,7 @@ implementation
procedure TAdvOptions.Initialize;
begin
inherited;
SCHEME := '';
FSCHEME := '';
end;

procedure TAdvOptions.Read(Stream: TStreamReader; Unhandled: TStreamWriter);
Expand Down Expand Up @@ -62,7 +65,7 @@ procedure TAdvOptions.Read(Stream: TStreamReader; Unhandled: TStreamWriter);
end
else if FSplitter[0] = 'SCHEME' then
begin
SCHEME := FSplitter[1];
FSCHEME := FSplitter[1];
end
else
begin
Expand Down
74 changes: 43 additions & 31 deletions MF6InputReader/Mf6.DspFileReaderUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,36 @@ interface
type
TDspOptions = class(TCustomMf6Persistent)
private
XT3D_OFF: Boolean;
XT3D_RHS: Boolean;
FXT3D_OFF: Boolean;
FXT3D_RHS: Boolean;
procedure Read(Stream: TStreamReader; Unhandled: TStreamWriter);
protected
procedure Initialize; override;
public
property XT3D_OFF: Boolean read FXT3D_OFF;
property XT3D_RHS: Boolean read FXT3D_RHS;
end;

TDspGridData = class(TCustomMf6Persistent)
private
DIFFC: TDArray3D;
ALH: TDArray3D;
ALV: TDArray3D;
ATH1: TDArray3D;
ATH2: TDArray3D;
ATV: TDArray3D;
FDIFFC: TDArray3D;
FALH: TDArray3D;
FALV: TDArray3D;
FATH1: TDArray3D;
FATH2: TDArray3D;
FATV: TDArray3D;
FDimensions: TDimensions;
procedure Read(Stream: TStreamReader; Unhandled: TStreamWriter; Dimensions: TDimensions);
protected
procedure Initialize; override;
public
constructor Create(PackageType: string); override;
property DIFFC: TDArray3D read FDIFFC;
property ALH: TDArray3D read FALH;
property ALV: TDArray3D read FALV;
property ATH1: TDArray3D read FATH1;
property ATH2: TDArray3D read FATH2;
property ATV: TDArray3D read FATV;
end;

TDsp = class(TDimensionedPackageReader)
Expand All @@ -39,7 +48,10 @@ TDsp = class(TDimensionedPackageReader)
public
constructor Create(PackageType: string); override;
destructor Destroy; override;
procedure Read(Stream: TStreamReader; Unhandled: TStreamWriter; const NPER: Integer); override;
procedure Read(Stream: TStreamReader; Unhandled: TStreamWriter;
const NPER: Integer); override;
property Options: TDspOptions read FOptions;
property GridData: TDspGridData read FGridData;
end;


Expand All @@ -51,8 +63,8 @@ implementation
procedure TDspOptions.Initialize;
begin
inherited;
XT3D_OFF := False;
XT3D_RHS := False;
FXT3D_OFF := False;
FXT3D_RHS := False;
end;

procedure TDspOptions.Read(Stream: TStreamReader; Unhandled: TStreamWriter);
Expand Down Expand Up @@ -82,11 +94,11 @@ procedure TDspOptions.Read(Stream: TStreamReader; Unhandled: TStreamWriter);
end
else if FSplitter[0] = 'XT3D_OFF' then
begin
XT3D_OFF := True;
FXT3D_OFF := True;
end
else if FSplitter[0] = 'XT3D_RHS' then
begin
XT3D_RHS := True;
FXT3D_RHS := True;
end
else
begin
Expand All @@ -107,12 +119,12 @@ constructor TDspGridData.Create(PackageType: string);
procedure TDspGridData.Initialize;
begin
inherited;
SetLength(DIFFC, 0);
SetLength(ALH, 0);
SetLength(ALV, 0);
SetLength(ATH1, 0);
SetLength(ATH2, 0);
SetLength(ATV, 0);
SetLength(FDIFFC, 0);
SetLength(FALH, 0);
SetLength(FALV, 0);
SetLength(FATH1, 0);
SetLength(FATH2, 0);
SetLength(FATV, 0);

end;

Expand Down Expand Up @@ -148,72 +160,72 @@ procedure TDspGridData.Read(Stream: TStreamReader; Unhandled: TStreamWriter;
end
else if FSplitter[0] = 'DIFFC' then
begin
SetLength(DIFFC, FDimensions.NLay, FDimensions.NRow, FDimensions.NCol);
SetLength(FDIFFC, FDimensions.NLay, FDimensions.NRow, FDimensions.NCol);
Layered := (FSplitter.Count >= 2) and (FSplitter[1] = 'LAYERED');
DoubleThreeDReader := TDouble3DArrayReader.Create(FDimensions, Layered, FPackageType);
try
DoubleThreeDReader.Read(Stream, Unhandled);
DIFFC := DoubleThreeDReader.FData;
FDIFFC := DoubleThreeDReader.FData;
finally
DoubleThreeDReader.Free;
end;
end
else if FSplitter[0] = 'ALH' then
begin
SetLength(ALH, FDimensions.NLay, FDimensions.NRow, FDimensions.NCol);
SetLength(FALH, FDimensions.NLay, FDimensions.NRow, FDimensions.NCol);
Layered := (FSplitter.Count >= 2) and (FSplitter[1] = 'LAYERED');
DoubleThreeDReader := TDouble3DArrayReader.Create(FDimensions, Layered, FPackageType);
try
DoubleThreeDReader.Read(Stream, Unhandled);
ALH := DoubleThreeDReader.FData;
FALH := DoubleThreeDReader.FData;
finally
DoubleThreeDReader.Free;
end;
end
else if FSplitter[0] = 'ALV' then
begin
SetLength(ALV, FDimensions.NLay, FDimensions.NRow, FDimensions.NCol);
SetLength(FALV, FDimensions.NLay, FDimensions.NRow, FDimensions.NCol);
Layered := (FSplitter.Count >= 2) and (FSplitter[1] = 'LAYERED');
DoubleThreeDReader := TDouble3DArrayReader.Create(FDimensions, Layered, FPackageType);
try
DoubleThreeDReader.Read(Stream, Unhandled);
ALV := DoubleThreeDReader.FData;
FALV := DoubleThreeDReader.FData;
finally
DoubleThreeDReader.Free;
end;
end
else if FSplitter[0] = 'ATH1' then
begin
SetLength(ATH1, FDimensions.NLay, FDimensions.NRow, FDimensions.NCol);
SetLength(FATH1, FDimensions.NLay, FDimensions.NRow, FDimensions.NCol);
Layered := (FSplitter.Count >= 2) and (FSplitter[1] = 'LAYERED');
DoubleThreeDReader := TDouble3DArrayReader.Create(FDimensions, Layered, FPackageType);
try
DoubleThreeDReader.Read(Stream, Unhandled);
ATH1 := DoubleThreeDReader.FData;
FATH1 := DoubleThreeDReader.FData;
finally
DoubleThreeDReader.Free;
end;
end
else if FSplitter[0] = 'ATH2' then
begin
SetLength(ATH2, FDimensions.NLay, FDimensions.NRow, FDimensions.NCol);
SetLength(FATH2, FDimensions.NLay, FDimensions.NRow, FDimensions.NCol);
Layered := (FSplitter.Count >= 2) and (FSplitter[1] = 'LAYERED');
DoubleThreeDReader := TDouble3DArrayReader.Create(FDimensions, Layered, FPackageType);
try
DoubleThreeDReader.Read(Stream, Unhandled);
ATH2 := DoubleThreeDReader.FData;
FATH2 := DoubleThreeDReader.FData;
finally
DoubleThreeDReader.Free;
end;
end
else if FSplitter[0] = 'ATV' then
begin
SetLength(ATV, FDimensions.NLay, FDimensions.NRow, FDimensions.NCol);
SetLength(FATV, FDimensions.NLay, FDimensions.NRow, FDimensions.NCol);
Layered := (FSplitter.Count >= 2) and (FSplitter[1] = 'LAYERED');
DoubleThreeDReader := TDouble3DArrayReader.Create(FDimensions, Layered, FPackageType);
try
DoubleThreeDReader.Read(Stream, Unhandled);
ATV := DoubleThreeDReader.FData;
FATV := DoubleThreeDReader.FData;
finally
DoubleThreeDReader.Free;
end;
Expand Down
7 changes: 6 additions & 1 deletion MF6InputReader/Mf6.NameFileReaderUnit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ TNameFile<Options: TCustomNameFileOptions; Packages: TCustomPackages> = class(
end;

TFlowNameFile = TNameFile<TFlowNameFileOptions, TFlowPackages>;
TTransportNameFile = TNameFile<TTransportNameFileOptions, TTransportPackages>;
TTransportNameFile = class(TNameFile<TTransportNameFileOptions, TTransportPackages>)
private
FSpeciesName: string;
public
property SpeciesName: string read FSpeciesName write FSpeciesName;
end;

implementation

Expand Down
Loading

0 comments on commit 1af77d3

Please sign in to comment.