Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NDSL] QSat port #994

Merged
merged 25 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b30ae8d
SaturationVaporPressureTable code first pass
FlorianDeconinck Aug 14, 2024
cde8399
QSat_Ice_scalar_exact
FlorianDeconinck Aug 14, 2024
dd15d29
Fix calculation. Table generates OK.
FlorianDeconinck Aug 14, 2024
e6b597c
Fix Murphy and CAM
FlorianDeconinck Aug 14, 2024
5e4e464
Rename estimate_table -> table
FlorianDeconinck Aug 15, 2024
b80185c
Functional QSat module. Can handle optional RAMP/PASCALS/DQSAT inputs…
CharlesKrop Aug 28, 2024
1065cff
More clean up, first attempt at QSat function
CharlesKrop Aug 28, 2024
76b6ec5
Working QSat function. QSat class can still be called outside of sten…
CharlesKrop Aug 28, 2024
fdbf8aa
Minor change for improved DQSAT functionality
CharlesKrop Sep 3, 2024
035f1a9
Minor change for improved DQSAT functionality
CharlesKrop Sep 3, 2024
d826f35
Two new functions: QSat_Float_Liquid and QSat_Float_Ice. These two fu…
CharlesKrop Sep 3, 2024
5aa9b48
Tiny little bugfix fro QSat_Float_Liquid and QSat_Float_Ice
CharlesKrop Sep 5, 2024
b4998d6
Fixed indexing error in QSat_Float_Liquid/Ice, and inserted a workaro…
CharlesKrop Sep 6, 2024
5cc9dd6
Code cleanup, ready to be pulled back into main branch
CharlesKrop Sep 10, 2024
d9d13ed
Few more cleanups, modification to translate test to test sat tables
CharlesKrop Sep 10, 2024
b4d35f9
QSat verifies if tables are read in from netcdf (this is the current …
CharlesKrop Sep 11, 2024
a93a35e
Merge branch 'dsl/develop' into dsl/QSat
Sep 12, 2024
1c96c31
Fix run tests
Sep 12, 2024
e3c636e
Functional QSat module. Table calculations are still incorrect due to…
CharlesKrop Sep 12, 2024
534dcc9
Forgot to apply fix to other QSat functions. All functions now work p…
CharlesKrop Sep 12, 2024
6bd9006
Linting
Sep 13, 2024
4c2609e
Refactor table_method to an enum
Sep 13, 2024
c138b46
Clean up translate test
Sep 13, 2024
8e5b5cc
Revert run_tests.sh to common one
Sep 13, 2024
ece972f
Clean up debug fields for table
Sep 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ repos:
args: [
"--exclude=docs",
"--ignore=W503,E302,E203,F841,F401",
"--max-line-length=88",]
"--max-line-length=100",]
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Saturation formulations

## In Fortran

### GEOS_QSatX

The code lists 3 ways, with each a specific set of formulation.

- `GEOS_QsatLqu` & `GEOS_QsatIce`:
- Latest code, carrying for every subsequent code the "exact" formulations for the different saturations schemes
- Can run with in exact mode or in table mode
- `Qsat` & `DQsat` are the "traditional" called, which are flagged as deprecated in docs but still in use
- Can run in exact mode (and ping back to GEOS_QSatLqu/Ice) or in table mode

The table (ESINIT) is a constant computation that leverages the GEOS_QsatLqu/GEOS_QSatIce to freeze results in increment
of 0.1 Pa (per documenttion)

A lot of the complexity of the code is due to micro-optimization to re-use inlined code instead of using function calls.

### MAPL_EQSatX

TBD

## Our implementation

### Estimated Saturation Table

:warning: This inplements the GEOS_QSatX only

The class `SaturationVaporPressureTable` in `table.py` computes on-demand the table of estimated saturation based on 0.1 Pa
increments. The `get_table` function in conjection with the `SaturationFormulation` in `fomulation.py` returns the correct table
to be sampled across a few fields.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .qsat import QSat, QSat_Float, QSat_Float_Ice, QSat_Float_Liquid, QSat_FloatField
from .types import SaturationFormulation, TableMethod
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import numpy as np

from ndsl.dsl.typing import Float


# Generic constants to be moved to pyMoist global constant file
MAPL_TICE = Float(273.16) # K
MAPL_AIRMW = Float(28.965)
MAPL_H2OMW = Float(18.015) # kg/Kmole

# Saturation specific constants
TMINTBL = Float(150.0)
TMAXTBL = Float(333.0)
TMINLQU = MAPL_TICE - Float(40.0)
DEGSUBS = np.int32(100)
DELTA_T = Float(1.0 / DEGSUBS)
TABLESIZE = np.int32(TMAXTBL - TMINTBL) * DEGSUBS + 1
TMIX = Float(-20.0)
ESFAC = MAPL_H2OMW / MAPL_AIRMW
ERFAC = DEGSUBS / ESFAC

MAX_MIXING_RATIO = Float(1.0)
Binary file not shown.
Loading
Loading