-
Notifications
You must be signed in to change notification settings - Fork 0
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
add nudgecoeffs_e and wgtfac_c #322
Conversation
nudge_max_coeffs: wpfloat, | ||
) -> Field[[EdgeDim], wpfloat]: | ||
|
||
return nudge_max_coeffs * EXP(-(refin_ctrl - grf_nudge_start_e)/ 4.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is an exp
builtin in gt4py
that you might need to use here and import here.
from gt4py.next.ffront.fbuiltins import Field, int32, neighbor_sum, exp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case you need floating points for the args to exp
there is an astype
function for casting in gt4py
(also in fbuiltins
I believe)
nudge_max_coeffs: wpfloat, | ||
) -> Field[[EdgeDim], wpfloat]: | ||
|
||
return nudge_max_coeffs * EXP(-(refin_ctrl - grf_nudge_start_e)/ 4.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is this if condition on the refin_ctl in the icon code:
IF (ptr_patch%edges%refin_ctrl(je,jb) > 0 .AND. &
& ptr_patch%edges%refin_ctrl(je,jb) <= grf_nudge_start_e+9)
you could include this in the calculation by using a where
something like
where(refin_ctl > int32(0) & refin_ctl <= upper_bound, true-case, false-case)
dann kannst du die upper_bound
als Argument mit uebergeben. Der false-case
ist wahrscheinlich einfach 0?
|
||
|
||
@field_operator | ||
def _mo_intp_coeffs_nudgecoeff_e( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ich persoenlich wuerde es eher so def calc_nudgecoeffs
nennen, ich finde diese icon Referenz mit mo_intp
nicht sehr hilfreich, und in the long run eher unverstaendlich.
Wahrscheinlich kannst du die Berechnung der nudgeing coeff in den andern Dimensionen mit dem gleichen stencil erschlagen, dann auf jeden Fall die _e
in den Namen weg. (Zumindest sieht die Berechnung von den Zellen dort drueber beim schnell drueber fliegen in der Struktur in etwa gleich aus.
Kannst du noch einen test dafuer schreiben?
|
launch jenkins spack |
cscs-ci run default |
launch jenkins spack |
cscs-ci run default |
launch jenkins spack |
model/common/src/icon4py/model/common/interpolation/stencils/calc_nudgecoeffs.py
Outdated
Show resolved
Hide resolved
launch jenkins spack |
cscs-ci run default |
cscs-ci run default |
launch jenkins spack |
cscs-ci run default |
@halungge Due to the many fixes in icon4py recently I merged the branch for wgtfac_c into this branch as well. Please only revisit these files for the review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only have some renamings...
model/common/src/icon4py/model/common/metrics/stencils/calc_wgtfac_c.py
Outdated
Show resolved
Hide resolved
@field_operator | ||
def _calc_wgtfac_c( | ||
z_ifc: Field[[CellDim, KDim], wpfloat], | ||
k_field: Field[[KDim], int32], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently in most of the dycore stencils they just call it 'k' we should stick to this convention.
model/common/src/icon4py/model/common/metrics/stencils/calc_wgtfac_c.py
Outdated
Show resolved
Hide resolved
model/common/src/icon4py/model/common/metrics/stencils/calc_wgtfac_c.py
Outdated
Show resolved
Hide resolved
model/common/src/icon4py/model/common/metrics/stencils/calc_nudgecoeffs.py
Outdated
Show resolved
Hide resolved
launch jenkins spack |
cscs-ci run default |
cscs-cu run default |
launch jenkins spack |
cscs-ci run default |
Mandatory Tests Please make sure you run these tests via comment before you merge!
Optional Tests To run benchmarks you can use:
To run tests and benchmarks with the DaCe backend you can use:
In case your change might affect downstream icon-exclaim, please consider running
For more detailed information please look at CI in the EXCLAIM universe. |
launch jenkins spack |
cscs-ci run default |
* add nudgecoeffs_e * add test * test parses * remove horizontal bounds * stencil runs * second implementation of stencil * cleanup stencil * correct indexing for end_index and refin_ctrl * remove unused import * import all fixtures, format * hardcode grf_nudge_start_e to 10 * translate index to Fortran value * Introduce RefinCtrlLevel * formatting * add dot * review suggestions * Port wgtfac_c (#365) * cleanup * formatting * rename stencils, review suggestions * formatting --------- Co-authored-by: Jonas Jucker <jonas.jucker@c2sm.ethz.ch>
Port interpolation fields
nudgecoeffs_e
fromsrc/shr_horizontal/mo_intp_coeffs.f90
.Indices are used not only for accessing arrays, but also to do computations.
In order to get the correct result in Python, the indices have to be translated to true Fortran values.
Port stencil for field
wgtfac_c
from src/atm_dyn_iconam/mo_vertical_grid.f90