Skip to content

Commit

Permalink
Merge pull request #5 from uramirez8707/gh_2021.02
Browse files Browse the repository at this point in the history
Merge 2021.02
  • Loading branch information
thomas-robinson authored Aug 4, 2021
2 parents 6ec253d + 2fa7f5c commit 46817a1
Show file tree
Hide file tree
Showing 176 changed files with 14,886 additions and 8,902 deletions.
59 changes: 59 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
*~
*.o
*.mod
*.s
*.out
pathnames*
/*.zip
/*.tar.gz

Makefile
# From https://github.com/github/gitignore/blob/master/Autotools.gitignore
# http://www.gnu.org/software/automake
Makefile.in
/ar-lib
/mdate-sh
/py-compile
/test-driver
/tap-driver.sh
/ylwrap
*.log
*.trs

# http://www.gnu.org/software/autoconf
autom4te.cache
/autoscan.log
/autoscan-*.log
/aclocal.m4
/compile
/config.guess
/config.h.in
/config.log
/config.status
/config.sub
/configure
/configure.scan
/depcomp
/install-sh
/missing
/stamp-h1
.deps

# https://www.gnu.org/software/libtool/
libtool
/ltmain.sh
*.lo
*.la
.libs

# http://www.gnu.org/software/texinfo
/texinfo.tex

# http://www.gnu.org/software/m4/
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4

.dirstamp
43 changes: 43 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
before_script:
- hostname


.ncrc_build: &ncrc_build
script:
- source /opt/cray/pe/modules/default/init/bash
- module rm cray-netcdf cray-hdf5 PrgEnv-intel PrgEnv-pgi PrgEnv-gnu PrgEnv-cray
- module load PrgEnv-${COMPILER_FAMILY}
- module swap ${COMPILER_NAME} ${COMPILER_NAME}/${COMPILER_VERSION}
- module load cray-hdf5 cray-netcdf
- mkdir local
- git clone https://github.com/NOAA-GFDL/FMS.git FMS
- cd FMS
- autoreconf --install
- ./configure --prefix=${CI_BUILDS_DIR}/local
- make
- make install
- cd ..
- autoreconf --install
- ./configure
- make


build:ncrc:intel19:debug:
stage: build
tags:
- ncrc
variables:
CC: cc
COMPILER_FAMILY: intel
COMPILER_NAME: intel
COMPILER_VERSION: 19.0.5.281
FC: ftn
F77: ftn
FCFLAGS: "-I${CI_BUILDS_DIR}/local/include -O0"
FFLAGS: "-I${CI_BUILDS_DIR}/local/include -O0"
LDFLAGS: "-L${CI_BUILDS_DIR}/local/lib"
<<: *ncrc_build
artifacts:
paths:
- .libs/libatmos_phys.so
- ./*.mod
2,118 changes: 2,118 additions & 0 deletions Makefile.am

Large diffs are not rendered by default.

109 changes: 109 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# atmos_phys
This is the repository that combines the atmosphere physics and chemistry
## Table of contents
* [Guidelines for Contributing](README.md#guidelines-for-contributing)
* [Instructions on merging in code from atmos_param or atmos_shared](README.md#instructions-on-merging-in-code-from-atmos_param-or-atmos_shared)
* [XML changes to checkout atmos_phys](README.md#xml-changes-to-checkout-atmos_phys)
## Guidelines for Contributing
If you have code you would like to contribute, you will first create a git branch.
Your branch should be in the format of /user/**ini**/**BranchName** where **ini**
are your initals and **BranchName** is a name that describes the purpose of your
branch. Avoid using a BranchName like *bugfix* or *update* because this is not
descritive.
```bash
git checkout -b user/ini/BranchName
```
Second, you will commit your changes, and push them to the atmos_phys remote
repository.
```bash
git push -u origin user/ini/BranchName
```
After the changes are pushed, you can share your code with others. If your code
should be included in the main model development, you can submit a merge request by
clicking on the Merge Requests link on the gitlab page. Please include a detailed
description of the changes made by your branch. You should submit the merge to the
main development branch (*master*). Assign your merge request to Uriel Ramirez.

## Instructions on merging in code from atmos_param or atmos_shared
In order to commit changes that currently exist on atmos_param or atmos_shared,
you first have to commit and push the changes to a branch in the repository you are
working in. Next you will clone atmos_phys. After that, you will add the original
repository to as a remote in your atmos_phys directory. You can then fetch from the
original repository and merge in the branch you were working on.

Below is an example set of instructions to accomplish this. This assumes that you
cloned atmos_param.
```bash
git clone https://gitlab.gfdl.noaa.gov/fms/atmos_phys.git #clone atmos_param
cd atmos_phys
pushd ../atmos_param/ #Set up a directory stack with the two repo directories
git checkout user/ter/exampleBranch #check out your user branch
git fetch #fetch any changes that may have occurred in atmos_param since you branched
git pull origin/master #merge in the master (update your code base)
## The following 3 lines can be skipped if you already have committed changes ##
touch test.file #Make your changes (DO NOT COPY THIS, it is just an example)
git add test.file #stage your changes
git commit -m "Save a test commit to user branch" #commit your changes
## The folowing can be skipped if you have already pushed your changes ##
git push -u origin user/ter/exampleBranch
pushd #change directory to the atmos_phys folder
git checkout -b user/ter/exampleBranch #create your branch in atmos_phys
git remote add param https://gitlab.gfdl.noaa.gov/fms/atmos_param.git #add atmos_param as a remote
git fetch param #fetch the contents of the atmos_param
git merge param/user/ter/exampleBranch #merge your branch from atmos_param into your branch on atmos_phys
git push -u origin user/ter/exampleBranch
```
A note on git remotes:

The default name for a remote is **origin**. When you clone a repository, the remote
is automatically given the name **origin**. When you add a remote, you can name it
anything except origin. In the above example, I named the remote **param**. That's
why I fetch from **param**. To see what remotes you have set up, you can issue the
command
```bash
git remote -v
```

## XML changes to checkout atmos_phys
There are a few modifications to an XML in order switch to the atmos_phys code.
An XML will have a section in the compile experiment that looks like the following:
```xml
<component name="atmos_phys" requires="fms" paths="atmos_param atmos_shared">
<description domainName="" communityName="" communityVersion="$(RELEASE)" communityGrid=""/>
<source versionControl="git" root="http://gitlab.gfdl.noaa.gov/fms">
<codeBase version="$(RELEASE)"> atmos_shared.git atmos_param.git </codeBase>
<csh><![CDATA[
( cd atmos_shared && git checkout $(ATMOS_GIT_TAG) )
( cd atmos_param && git checkout $(ATMOS_GIT_TAG) )
]]>
</csh>
</source>
<compile>
<cppDefs>$(F2003_FLAGS) -DCLUBB</cppDefs>
</compile>
</component>
```
This can be found by searching the XML for *atmos_phys* or *atmos_shared.git* or
*atmos_param.git*. This <component> block should be updated to the following:
```xml
<component name="atmos_phys" requires="fms" paths="atmos_phys">
<description domainName="" communityName="" communityVersion="$(RELEASE)" communityGrid=""/>
<source versionControl="git" root="http://gitlab.gfdl.noaa.gov/fms">
<codeBase version="$(RELEASE)"> atmos_phys.git </codeBase>
<csh><![CDATA[
( cd atmos_phys && git checkout $(ATMOS_GIT_TAG) )
]]>
</csh>
</source>
<compile>
<cppDefs>$(F2003_FLAGS) -DCLUBB</cppDefs>
</compile>
</component>
```
1. The **paths** has been changed from "atmos_param atmos_shared" to "atmos_phys".
2. The **codeBase** was changed from **atmos_shared.git atmos_param.git** to **atmos_phys.git**
3. The `csh` block was updated to only `cd` to atmos_phys

NOTE: Users should switch to atmos_phys if they are checking out code that is newer
than xanadu. If your model is running code older than xanadu, you should check the
code out from atmos_shared and atmos_param.
20 changes: 4 additions & 16 deletions atmos_param/aerosol_cloud/aerosol_cloud.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ MODULE aerosol_cloud_mod
!-----------------------------------------------------------------------

use fms_mod, only : error_mesg, FATAL, mpp_pe, &
mpp_root_pe, open_namelist_file, &
check_nml_error, close_file, &
write_version_number, file_exist, &
mpp_root_pe, &
check_nml_error, &
write_version_number, &
stdlog
use constants_mod, ONLY : grav, cp_air, rdgas, rvgas, tfreeze
use time_manager_mod, only : time_type
Expand Down Expand Up @@ -145,7 +145,7 @@ subroutine aerosol_cloud_init (Constants_lsc, Nml_lsc, Nml_mp, Exch_ctrl)

!-----local variables

integer :: unit, io, ierr, logunit
integer :: io, ierr, logunit

!-----------------------------------------------------------------------
if (module_is_initialized) return
Expand All @@ -171,20 +171,8 @@ subroutine aerosol_cloud_init (Constants_lsc, Nml_lsc, Nml_mp, Exch_ctrl)
!-------------------------------------------------------------------------
! process namelist.
!-------------------------------------------------------------------------
#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=aerosol_cloud_nml, iostat=io)
ierr = check_nml_error(io,'aerosol_cloud_nml')
#else
if ( file_exist('input.nml')) then
unit = open_namelist_file ( )
ierr=1; do while (ierr /= 0)
read (unit, nml=aerosol_cloud_nml, iostat=io, end=10)
ierr = check_nml_error(io,'aerosol_cloud_nml')
enddo
10 call close_file (unit)
endif
#endif

!-------------------------------------------------------------------------
! write version and namelist to standard log.
!-------------------------------------------------------------------------
Expand Down
51 changes: 18 additions & 33 deletions atmos_param/betts_miller/betts_miller.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
module betts_miller_mod

!----------------------------------------------------------------------
!use utilities_mod, only: file_exist, error_mesg, open_file, &
! check_nml_error, get_my_pe, FATAL, &
! close_file

use mpp_mod, only: input_nml_file
use fms_mod, only: file_exist, error_mesg, open_namelist_file, &
use fms_mod, only: error_mesg, &
check_nml_error, mpp_pe, mpp_root_pe, &
FATAL, close_file, write_version_number, stdlog
FATAL, write_version_number, stdlog

use sat_vapor_pres_mod, only: escomp, descomp
use constants_mod, only: HLv,HLs,Cp_air,Grav,rdgas,rvgas, &
Expand Down Expand Up @@ -511,9 +507,9 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
call escomp(t0,es)
rs = rdgas/rvgas*es/p(kx)
if (r0.ge.rs) then
! if you¹re already saturated, set lcl to be the surface value.
! if you're already saturated, set lcl to be the surface value.
plcl = p(kx)
! the first level where you¹re completely saturated.
! the first level where you're completely saturated.
klcl = kx
! saturate out to get the parcel temp and humidity at this level
! first order (in delta T) accurate expression for change in temp
Expand All @@ -522,7 +518,7 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
rp(kx) = rdgas/rvgas*es/p(kx)
else
! if not saturated to begin with, use the analytic expression to calculate the
! exact pressure and temperature where you¹re saturated.
! exact pressure and temperature where you're saturated.
theta0 = tin(kx)*(pstar/p(kx))**kappa
! the expression that we utilize is
! log(r/theta**(1/kappa)*pstar*rvgas/rdgas/es00) = log(es/T**(1/kappa))
Expand Down Expand Up @@ -599,14 +595,14 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
! write (*,*) 'tp, rp klcl:kx, new', tp(klcl:kx), rp(klcl:kx)
! CAPE/CIN stuff
if ((tp(klcl).lt.tin(klcl)).and.nocape) then
! if you¹re not yet buoyant, then add to the CIN and continue
! if you're not yet buoyant, then add to the CIN and continue
cin = cin + rdgas*(tin(klcl) - &
tp(klcl))*log(phalf(klcl+1)/phalf(klcl))
else
! if you¹re buoyant, then add to cape
! if you're buoyant, then add to cape
cape = cape + rdgas*(tp(klcl) - &
tin(klcl))*log(phalf(klcl+1)/phalf(klcl))
! if it¹s the first time buoyant, then set the level of free convection to k
! if it's the first time buoyant, then set the level of free convection to k
if (nocape) then
nocape = .false.
klfc = klcl
Expand Down Expand Up @@ -636,7 +632,7 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
! reset CIN to zero.
cin = 0.
! again, use the analytic expression to calculate the exact pressure and
! temperature where you¹re saturated.
! temperature where you're saturated.
! the expression that we utilize is
! log(r/theta**(1/kappa)*pstar*rvgas/rdgas/es00)= log(es/T**(1/kappa))
! (the division by es00 is necessary because the RHS values are tabulated
Expand All @@ -661,7 +657,7 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
cin = cin + rdgas*(tin(k) - tp(k))*log(phalf(k+1)/phalf(k))
k = k-1
end do
! first level where you¹re saturated at the level
! first level where you're saturated at the level
klcl2 = k
if (klcl2.eq.1) klcl2 = 2
! do a saturated ascent to get the parcel temp at the LCL.
Expand Down Expand Up @@ -694,14 +690,14 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
rp(klcl2) = rdgas/rvgas*es/p(klcl2)
! CAPE/CIN stuff
if ((tp(klcl2).lt.tin(klcl2)).and.nocape) then
! if you¹re not yet buoyant, then add to the CIN and continue
! if you're not yet buoyant, then add to the CIN and continue
cin = cin + rdgas*(tin(klcl2) - &
tp(klcl2))*log(phalf(klcl2+1)/phalf(klcl2))
else
! if you¹re buoyant, then add to cape
! if you're buoyant, then add to cape
cape = cape + rdgas*(tp(klcl) - &
tin(klcl))*log(phalf(klcl+1)/phalf(klcl))
! if it¹s the first time buoyant, then set the level of free convection to k
! if it's the first time buoyant, then set the level of free convection to k
if (nocape) then
nocape = .false.
klfc = klcl2
Expand Down Expand Up @@ -740,17 +736,17 @@ subroutine capecalcnew(kx,p,phalf,cp_air,rdgas,rvgas,hlv,kappa,tin,rin,&
call escomp(tp(k),es)
rp(k) = rdgas/rvgas*es/p(k)
if ((tp(k).lt.tin(k)).and.nocape) then
! if you¹re not yet buoyant, then add to the CIN and continue
! if you're not yet buoyant, then add to the CIN and continue
cin = cin + rdgas*(tin(k) - tp(k))*log(phalf(k+1)/phalf(k))
elseif((tp(k).lt.tin(k)).and.(.not.nocape)) then
! if you have CAPE, and it¹s your first time being negatively buoyant,
! if you have CAPE, and it's your first time being negatively buoyant,
! then set the level of zero buoyancy to k+1, and stop the moist ascent
klzb = k+1
go to 11
else
! if you¹re buoyant, then add to cape
! if you're buoyant, then add to cape
cape = cape + rdgas*(tp(k) - tin(k))*log(phalf(k+1)/phalf(k))
! if it¹s the first time buoyant, then set the level of free convection to k
! if it's the first time buoyant, then set the level of free convection to k
if (nocape) then
nocape = .false.
klfc = k
Expand Down Expand Up @@ -851,23 +847,12 @@ subroutine betts_miller_init ()
!
!-----------------------------------------------------------------------

integer unit,io,ierr, logunit
integer io,ierr, logunit

!----------- read namelist ---------------------------------------------

#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=betts_miller_nml, iostat=io)
ierr = check_nml_error(io,'betts_miller_nml')
#else
if (file_exist('input.nml')) then
unit = open_namelist_file ( )
ierr=1; do while (ierr /= 0)
read (unit, nml=betts_miller_nml, iostat=io, end=10)
ierr = check_nml_error (io,'betts_miller_nml')
enddo
10 call close_file (unit)
endif
#endif

!---------- output namelist --------------------------------------------

Expand Down
Loading

0 comments on commit 46817a1

Please sign in to comment.