Skip to content

Commit a955f63

Browse files
committed
Add for the 1D the saturation degree variable, the 2D is the new version
1 parent d78df7f commit a955f63

File tree

2 files changed

+386
-242
lines changed

2 files changed

+386
-242
lines changed

src/main/java/it/geoframe/blogpsot/netcdf/monodimensionalproblemtimedependent/WriteNetCDFRichards1DDouble.java

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ public class WriteNetCDFRichards1DDouble {
183183
Variable psiICVar;
184184
Variable temperatureVar;
185185
Variable thetaVar;
186+
Variable saturationDegreeVar;
186187
Variable darcyVelocitiesVar;
187188
Variable darcyVelocitiesCapillaryVar;
188189
Variable darcyVelocitiesGravityVar;
@@ -206,6 +207,7 @@ public class WriteNetCDFRichards1DDouble {
206207

207208
ArrayDouble.D2 dataPsi;
208209
ArrayDouble.D2 dataTheta;
210+
ArrayDouble.D2 dataSaturationDegree;
209211
ArrayDouble.D2 dataDarcyVelocities;
210212
ArrayDouble.D2 dataDarcyVelocitiesCapillary;
211213
ArrayDouble.D2 dataDarcyVelocitiesGravity;
@@ -304,6 +306,10 @@ public void writeNetCDF() throws IOException {
304306
dataFile.addVariableAttribute(thetaVar, new Attribute("units", " "));
305307
dataFile.addVariableAttribute(thetaVar, new Attribute("long_name", "theta for within soil and water depth."));
306308

309+
saturationDegreeVar = dataFile.addVariable(null, "saturationDegree", DataType.DOUBLE, dims);
310+
dataFile.addVariableAttribute(saturationDegreeVar, new Attribute("units", "1"));
311+
dataFile.addVariableAttribute(saturationDegreeVar, new Attribute("long_name", "saturation degree."));
312+
307313
if (outVariablesList.contains("darcyVelocity") || outVariablesList.contains("all")) {
308314
darcyVelocitiesVar = dataFile.addVariable(null, "darcyVelocity", DataType.DOUBLE, dualDims);
309315
dataFile.addVariableAttribute(darcyVelocitiesVar, new Attribute("units", "m/s"));
@@ -431,6 +437,7 @@ public void writeNetCDF() throws IOException {
431437
dataPsi = new ArrayDouble.D2(NREC, KMAX);
432438
dataTheta = new ArrayDouble.D2(NREC, KMAX);
433439
dataWaterVolume = new ArrayDouble.D2(NREC, KMAX);
440+
dataSaturationDegree = new ArrayDouble.D2(NREC, KMAX);
434441
dataError = new ArrayDouble.D1(NREC);
435442
dataTopBC = new ArrayDouble.D1(NREC);
436443
dataBottomBC = new ArrayDouble.D1(NREC);
@@ -502,8 +509,15 @@ public void writeNetCDF() throws IOException {
502509

503510
}
504511

512+
tempVariable = entry.getValue().get(3);
513+
for (int k = 0; k < KMAX; k++) {
514+
515+
dataSaturationDegree.set(i, k, tempVariable[k]);
516+
517+
}
518+
505519
if (outVariablesList.contains("darcyVelocity") || outVariablesList.contains("all")) {
506-
tempVariable = entry.getValue().get(3);
520+
tempVariable = entry.getValue().get(4);
507521
for (int k = 0; k < DUALKMAX; k++) {
508522

509523
dataDarcyVelocities.set(i, k, tempVariable[k]);
@@ -512,7 +526,7 @@ public void writeNetCDF() throws IOException {
512526
}
513527

514528
if (outVariablesList.contains("darcyVelocityCapillary") || outVariablesList.contains("all")) {
515-
tempVariable = entry.getValue().get(4);
529+
tempVariable = entry.getValue().get(5);
516530
for (int k = 0; k < DUALKMAX; k++) {
517531

518532
dataDarcyVelocitiesCapillary.set(i, k, tempVariable[k]);
@@ -521,7 +535,7 @@ public void writeNetCDF() throws IOException {
521535
}
522536

523537
if (outVariablesList.contains("darcyVelocityGravity") || outVariablesList.contains("all")) {
524-
tempVariable = entry.getValue().get(5);
538+
tempVariable = entry.getValue().get(6);
525539
for (int k = 0; k < DUALKMAX; k++) {
526540

527541
dataDarcyVelocitiesGravity.set(i, k, tempVariable[k]);
@@ -530,7 +544,7 @@ public void writeNetCDF() throws IOException {
530544
}
531545

532546
if (outVariablesList.contains("poreVelocity") || outVariablesList.contains("all")) {
533-
tempVariable = entry.getValue().get(6);
547+
tempVariable = entry.getValue().get(7);
534548
for (int k = 0; k < DUALKMAX; k++) {
535549

536550
dataPoreVelocities.set(i,k, tempVariable[k]);
@@ -539,7 +553,7 @@ public void writeNetCDF() throws IOException {
539553
}
540554

541555
if (outVariablesList.contains("celerity") || outVariablesList.contains("all")) {
542-
tempVariable = entry.getValue().get(7);
556+
tempVariable = entry.getValue().get(8);
543557
for (int k = 0; k < DUALKMAX; k++) {
544558

545559
dataCelerity.set(i,k, tempVariable[k]);
@@ -548,21 +562,21 @@ public void writeNetCDF() throws IOException {
548562
}
549563

550564
if (outVariablesList.contains("kinematicRatio") || outVariablesList.contains("all")) {
551-
tempVariable = entry.getValue().get(8);
565+
tempVariable = entry.getValue().get(9);
552566
for (int k = 0; k < DUALKMAX; k++) {
553567

554568
dataKinematicRatio.set(i,k, tempVariable[k]);
555569

556570
}
557571
}
558572

559-
dataError.set(i, entry.getValue().get(9)[0]);
573+
dataError.set(i, entry.getValue().get(10)[0]);
560574

561-
dataTopBC.set(i, entry.getValue().get(10)[0]);
575+
dataTopBC.set(i, entry.getValue().get(11)[0]);
562576

563-
dataBottomBC.set(i, entry.getValue().get(11)[0]);
577+
dataBottomBC.set(i, entry.getValue().get(12)[0]);
564578

565-
dataRunOff.set(i, entry.getValue().get(12)[0]);
579+
dataRunOff.set(i, entry.getValue().get(13)[0]);
566580

567581
i++;
568582
}
@@ -579,7 +593,8 @@ public void writeNetCDF() throws IOException {
579593
dataFile.write(dataFile.findVariable("time"), time_origin, times);
580594
dataFile.write(dataFile.findVariable("psi"), origin, dataPsi);
581595
dataFile.write(dataFile.findVariable("theta"), origin, dataTheta);
582-
dataFile.write(dataFile.findVariable("waterVolume"), origin, dataWaterVolume);
596+
dataFile.write(dataFile.findVariable("waterVolume"), origin, dataWaterVolume);
597+
dataFile.write(dataFile.findVariable("saturationDegree"), origin, dataSaturationDegree);
583598

584599
if (outVariablesList.contains("darcyVelocity") || outVariablesList.contains("all")) {
585600
dataFile.write(dataFile.findVariable("darcyVelocity"), origin, dataDarcyVelocities);

0 commit comments

Comments
 (0)