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

Merging Feature/saraqzhang/ladasdev w/ latest branch of DAS - before going to develop #114

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion src/Applications/GEOSdas_App/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ set(dasscripts
fvsens
fvsvec
g54dvar
fp_seamless
fp_seamless
ldas_run.csh
read_HIST.csh )

set(extraperlscripts
Expand Down
58 changes: 8 additions & 50 deletions src/Applications/GEOSdas_App/GEOSdas.csm
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,7 @@ exit 1
/bin/cp $FVHOME/recycle/$EXPID.ana_radstat_rst.*.tar radstat
endif


# GAAS restart files
#-------------------
if ( ! $DO4DVAR ) then
Expand Down Expand Up @@ -3229,56 +3230,6 @@ endif

#.............................................................................

# ------------------------------
Sub LandAnalysisRun_()
# ------------------------------
if ( $?ECHO___ ) set echo

cd $FVWORK
set rstdate = ( `rst_date ./d_rst` )
set mydate = (`tick $rstdate -21600`) # tick back 6 hours

set DURATION = "060000"
set SUBDIR = "ldas.$mydate[1].$mydate[2]"
set LDINPUT_FORCE = "$FVWORK"
set EXPDOMAIN = "GLOBAL"
set RESOLUTION = "144x91"
set THREEHOURS = 10800

ldsetup -expid $EXPID \
-nymd $mydate[1] \
-nhms $mydate[2] \
-duration $DURATION \
-fvroot $FVROOT \
-fvhome $FVHOME \
-fvwork $FVWORK \
-fvwork_subdir $SUBDIR \
-expdomain $EXPDOMAIN \
-resolution $RESOLUTION \
-ldinput_force $FVWORK \
-mettag $EXPID \
-forcedtstep $THREEHOURS \
-rstrtdir $FVWORK \
-rstrtid $EXPID \
-gid $GID \
-noprompt

echo y | lenkf.pl

# Move output to top FVWORK directory
# -----------------------------------
cd $FVWORK
foreach file ( `find $SUBDIR -name $EXPID\*.txt`)
/bin/mv $file .
end
foreach file ( `find $SUBDIR -name $EXPID\.ens\*`)
/bin/mv $file .
end

# Last line of LandAnalysisRun_()
\end

#.............................................................................

# ------------------------------
Sub EvolveAinc0_( Viter_, Final_ )
Expand Down Expand Up @@ -5742,6 +5693,13 @@ endif
/bin/cp $EXPID.ana_radstat_rst.$rtag.tar $RSTHOLD/ &
endif

# hold lfo files for the next segment of ldas coupling
#----------------------------------------------------------
if ( $LDAS_ANA ) then
mkdir -p $FVHOME/recycle/holdforc
/bin/cp *2d_lfo*nc4 $FVHOME/recycle/holdforc/.
endif

# local copy to be moved by pesto, 2nd copy to be dealt w/ by recycle
#--------------------------------------------------------------------
if ( -e biasinp.$RSTSUFFIX ) then
Expand Down
43 changes: 35 additions & 8 deletions src/Applications/GEOSdas_App/fvpsas
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
# 30May2013 Todling Add GetAODinfo4Fcst_ to retrieve AOD fields for fcsts
# 13Jun2020 Todling Time aerosol analysis
# 19Oct2020 Todling Call to JEDI analysis
# 10Mar2021 sqzhang Add call to LandAnalysis when coupling
#
#-----------------------------------------------------------------------------

Expand Down Expand Up @@ -416,6 +417,24 @@

endif

#--------------------------------------
# Run Land analysis
# -----------------

if ( $LDAS_ANA ) then
echo " LDAS coupling: fvpsas LDAS_ANA run lenkf "
zeit_ci.x ldasRun
ldas_run.csh 0 060000 |& tee -a ldasrun.log
if( $status) then
echo "ldasRun failed"
exit(1)
endif
zeit_co.x ldasRun
endif

##---------------------------------


# Run the analysis if not doing replay
# -----------------------------------
if ( ! -e replay.acq ) then
Expand Down Expand Up @@ -474,6 +493,22 @@
endif
endif

#------------------------------------------------
# check ldas job status and stage ldas increments
#--------------------------------------------------
if ( ( $LDAS_ANA ) && ( $LDASFDBK ) ) then
echo " LDAS coupling: stage 1"
zeit_ci.x ldasStage
ldas_run.csh 1 060000 |& tee -a ldasrun.log
if( $status) then
echo "ldas_run stage 1 failed"
exit(1)
endif
zeit_co.x ldasStage
endif

#-----------------------

# Convert analysis eta file into GCM restart
# ------------------------------------------
zeit_ci.x AnaToGcm
Expand Down Expand Up @@ -511,14 +546,6 @@
Call RenameRstCheckPoint_( 1 )
zeit_co.x RenameRstCheckPoint

# Run Land analysis
# -----------------
if ( $LDAS_ANA ) then
zeit_ci.x LandAnalysisRun
Call LandAnalysisRun_()
zeit_co.x LandAnalysisRun
endif

# Run the vortex tracker
# ----------------------
zeit_ci.x VortexTrack
Expand Down
74 changes: 56 additions & 18 deletions src/Applications/GEOSdas_App/fvsetup
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ my $SECS_PER_DAY = $SECS_PER_HR * $HRS_PER_DAY;

my ($res, $hres);
my ($g5hist_rc, $g5prog_rc);
my ($gocart_tracers, $radcor, $emiss, $lsmodel_flag, $rroute_flag);
my ($gocart_tracers, $radcor, $emiss, $lsmodel_flag, $ldas_flag, $rroute_flag);
my ($agcm_rst_flg, $sensdeg, %setupfile, @otherheaders);
my ($checkFLG, $dbqueue, $runjobFLG, $saveFLG, $stopFLG);
my (@fvprompt, @fvANS1, @fvANS2, $fvsetupflags);
Expand Down Expand Up @@ -509,7 +509,7 @@ $ENV{"PATH"} = $FindBin::Bin .":$ENV{PATH}";
while3 ( \&set_rcov );
while3 ( \&set_acftbias );
while3 ( \&set_newradbc );
while3 ( \&set_ldasANA );
while3 ( \&set_ldasANA );
while3 ( \&get_forecast );
if ($DAO == 0) { while3 ( \&get_mhost ) }
while3 ( \&get_output );
Expand All @@ -520,7 +520,7 @@ $ENV{"PATH"} = $FindBin::Bin .":$ENV{PATH}";

# Create subdirectories in FVHOME
# -------------------------------
mkdir_fvhome();
mkdir_fvhome();

# Create Namelists/tables for main DAS run
# ----------------------------------------
Expand Down Expand Up @@ -570,6 +570,20 @@ $ENV{"PATH"} = $FindBin::Bin .":$ENV{PATH}";
$rc = system("$fvbin/fix_gocart_rc.csh $vres $fvhome/run/gocart");
die "Failed to fix GOCART levels-referencing $!" if ( $rc );

# LDAS Setup is done separately, follow instructions in GEOSldas/README.md
# ------------------------------------------------------------------------
print "\n checkprintout ldas_ana == 1 ($ldas_ana)\n";
if ($ldas_ana == 1 ) {
print "\n Please run ldas_setup following instructions in GEOSldas/README.md\n";
print "\n requires config input files: YOUR_exeinp.txt, YOUR_batinp.txt.\n" ;
print "\n example LDROOT: /discover/nobackup/$user/GEOSldas\n" ;
print "\n example LDHOME: /discover/nobackup/$user/ldascoup_C180\n" ;
print "\n example cd $LDROOT/install/bin/ \n";
print "\n example salloc \n";
print "\n example source g5_modules \n" ;
print "\n example ldas_setup setup $LDHOME exp_exeinp.txt exp_batinp.txt \n" ;
}

# Monthly Setup
# -------------------------------------------------------------
# [this must be after HISTORY.rc.tmpl and silo.arc are created]
Expand Down Expand Up @@ -3353,23 +3367,41 @@ sub set_newradbc {
sub set_ldasANA {

# initialize Land DAS processing flag
#------------------------------------
$ldasANA = 0;

# query for processing flag, if LDAS executable found
#----------------------------------------------------
if (-e "$fvbin/LDASsa_assim_seq.x") {
#------------------------------------
my($dflt, $ans1, $ans2, $ans3, $ans4);
$ldas_ana = 0;
$ldasfdbk = 0;
$ldas_flag = 0;
$dflt = "n";

print "\n-------------\n";
print "LDAS Analysis\n";
print "-------------\n\n";

$ans = query(" Land DAS Analysis (y/n)?", "n");
$ldasANA = 1 if yes($ans);
}
$ans1 = query(" Land DAS Analysis (y/n)?", $dflt) ;
$ldas_ana = 1 if yes($ans1);
print " ldas_ana ($ldas_ana)\n " ;

if ($ldas_ana == 1) {
$ans2 = query(" Enable LDAS feedback to model y/n ? ", $dflt);
$ldasfdbk = 1 if yes($ans2);
print " ldasfdbk ($ldasfdbk)\n" ;

if ($ldasfdbk ==1 ) {
$ldas_flag = 1
}

$ans3 = query("LDAS HOME = /discover/nobackup/$user/$ldasexp, full path? ");
$ldashome = $ans3 ;

$ans4 = query("LDAS HOME for atm_ens = /discover/nobackup/$user/$ldasexp4ens, full path? ");
$ldashome4ens = $ans4 ;

}
return 0;
}


#=======================================================================
sub get_setgsi {

Expand Down Expand Up @@ -3584,6 +3616,8 @@ EOF
$replace{">>>EXPID<<<"} = $expid;
$replace{">>>JOBNJ<<<"} = "$jobn.j";
$replace{">>>FVHOME<<<"} = "$fvhome";
$replace{">>>LDAS_ANA<<<"} = $ldas_ana;
$replace{">>>LDHOME4ens<<<"} = "$ldashome4ens";

$atm_ens_j = "$fvhome/run/atm_ens.j";
$atm_ens_j_tilde = "${atm_ens_j}~";
Expand Down Expand Up @@ -4282,9 +4316,9 @@ sub get_history {

# verify that HISTORY.rc.tmpl has collections needed by LDAS
#-----------------------------------------------------------
if ( $ldasANA ) {
if ( $ldas_ana == 1 ) {
$verify = 0;
@ldasinputs = qw / diag_sfc bkg.eta /;
@ldasinputs = qw / tavg1_2d_lfo inst1_2d_lfo /;
foreach $prod ( @ldasinputs ) {
open HIST, "< $fvroot/etc/$g5hist_rc";
unless ( grep /$prod/, <HIST> ) {
Expand All @@ -4301,7 +4335,7 @@ sub get_history {
. " 2. Select again\n\n";
$ans = query(" Choose option 1 or 2:", "2");
return 1 unless $ans eq "1";
}
}
}
print " Using HISTORY template: $g5hist_rc\n";

Expand Down Expand Up @@ -5206,12 +5240,11 @@ sub secs2hhmmss {

#=========================================================================
sub mkdir_fvhome { # create directories on FVHOME

print "\nSetting up FVHOME directory for $expid experiment ...\n";
foreach $dir (qw(ana diag daotovs etc obs prog radmon)) {
mkpath("$fvhome/$dir") or die ">>> ERROR <<< creating directory $fvhome/$dir;";
}
foreach $dir (qw(rs run recycle fcst asens anasa)) {
foreach $dir (qw(rs run recycle fcst lana asens anasa)) {
mkpath("$fvhome/$dir") or die ">>> ERROR <<< creating directory $fvhome/$dir;";
}
foreach $subdir (qw( gaas gocart )) {
Expand Down Expand Up @@ -7662,7 +7695,10 @@ print SCRIPT <<"EOF";
setenv GAAS_ANA $gaas_ana # 1 = aerosol analysis, 0 = disables it
setenv GAASFDBK $gaasfdbk # 1 = feedback aerosol analysis into GCM, 0 = don't
setenv SKIP_PSAS 0 # sets do_you_want_to_skip_PSAS in ana.rc.tmpl; 0 = no, 1 = yes
setenv LDAS_ANA $ldasANA # 0 = don't run Land DAS Analysis; 1 = run LDAS
setenv LDAS_ANA $ldas_ana # 1 = land analysis, 0 = disables it
setenv LDASFDBK $ldasfdbk # 1 = read land analysis incr into GCM (feedback), 0 = don't
setenv LDHOME $ldashome # land analysis home dir (ldas_exp/) for central
setenv LDHOME4ens $ldashome4ens # land analysis home dir for atm_ens
setenv IGNORE_0 1 # 1 = ignore 0 length obs files in acquire
setenv ACFTBIAS $acftbias
setenv USE_MODIS_STAGE 0 # 1 = use MODIS data from MODIS_STAGE_DIR; 0 = don't
Expand Down Expand Up @@ -9457,6 +9493,7 @@ sub init_agcm_rc {
$flags{"iau"} = $doiau;
$flags{"pcp_forced"} = $pcp_forced;
$flags{"lsmodel_flag"} = $lsmodel_flag;
$flags{"ldas_flag"} = $ldas_flag;
set_AGCM_flags(%flags);

# $num_readers must divide evenly into $ny
Expand Down Expand Up @@ -9569,6 +9606,7 @@ sub init_agcm_rc {
AGCM_label_subst("\@LSM_CHOICE" , $lsmodel_flag);
AGCM_label_subst("\@RUN_ROUTE" , $rroute_flag);
AGCM_label_subst("\@NUM_READERS" , "1");
AGCM_label_subst("\@LDAS_INCR" , $ldas_flag);

# Choice of LSM parameters
if ( "$landbcs" eq "Icarus-NLv3" ) {
Expand Down
Loading