Changeset 5091 for LMDZ6/branches/Amaury_dev/makelmdz_fcm
- Timestamp:
- Jul 20, 2024, 11:17:09 PM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/Amaury_dev/makelmdz_fcm
r5089 r5091 50 50 arch_default_path="arch" 51 51 52 LMDGCM=$( /bin/pwd)52 LMDGCM=$(pwd) 53 53 LIBOGCM=$LMDGCM/libo 54 54 LIBFGCM=$LMDGCM/libf … … 278 278 mkdir .void_dir 279 279 280 if [[ "$arch_defined" = ="TRUE" ]]; then280 if [[ "$arch_defined" = "TRUE" ]]; then 281 281 local i 282 282 for i in "path" "fcm" "env"; do … … 300 300 } 301 301 302 init_vars303 read_cmdline_options "$@"304 init_arch305 306 302 function cpp_keys_and_include_mod_path() { 307 303 ######################################################################## … … 336 332 fi 337 333 338 if [[ "$filtre"= "filtrez" ]]; then334 if [[ $filtre = "filtrez" ]]; then 339 335 FILTRE_PATH=${LIBFGCM}/$filtre 340 336 fi 341 337 342 if [[ "$chimie"= "INCA" ]]; then338 if [[ $chimie = "INCA" ]]; then 343 339 CPP_KEY="$CPP_KEY INCA" 344 340 INCLUDE="$INCLUDE ${INCA_INCDIR}" … … 346 342 fi 347 343 348 if [[ "$isotopes"= "true" ]]; then344 if [[ $isotopes = "true" ]]; then 349 345 CPP_KEY="$CPP_KEY ISO" 350 346 fi 351 347 352 if [[ "$isoverif"= "true" ]]; then348 if [[ $isoverif = "true" ]]; then 353 349 CPP_KEY="$CPP_KEY ISOVERIF" 354 350 fi 355 351 356 if [[ "$diagiso"= "true" ]]; then352 if [[ $diagiso = "true" ]]; then 357 353 CPP_KEY="$CPP_KEY DIAGISO" 358 354 fi 359 355 360 if [[ "$isotrac"= "true" ]]; then356 if [[ $isotrac = "true" ]]; then 361 357 CPP_KEY="$CPP_KEY ISOTRAC" 362 358 fi 363 359 364 if [[ "$couple"!= "false" ]]; then365 if [[ "$couple"= "MPI1" ]]; then360 if [[ $couple != "false" ]]; then 361 if [[ $couple = "MPI1" ]]; then 366 362 CPP_KEY="$CPP_KEY CPP_COUPLE" 367 363 export OASIS_INCDIR=$LMDGCM/../../prism/X64/build/lib/psmile.MPI1 … … 376 372 fi 377 373 378 if [[ "$parallel"= "mpi" ]]; then374 if [[ $parallel = "mpi" ]]; then 379 375 CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI" 380 376 PARA_FFLAGS="%MPI_FFLAGS" 381 377 PARA_LD="%MPI_LD" 382 elif [[ "$parallel"= "omp" ]]; then378 elif [[ $parallel = "omp" ]]; then 383 379 CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP" 384 380 PARA_FFLAGS="%OMP_FFLAGS" 385 381 PARA_LD="%OMP_LD" 386 elif [[ "$parallel"= "mpi_omp" ]]; then382 elif [[ $parallel = "mpi_omp" ]]; then 387 383 CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP" 388 384 PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS" … … 390 386 fi 391 387 392 if [[ ( "$parallel" = "omp" || "$parallel" = "mpi_omp" ) && "$compil_mod"= "debug" ]]; then388 if [[ ( $parallel = "omp" || $parallel = "mpi_omp" ) && $compil_mod = "debug" ]]; then 393 389 echo "Usually, parallelization with OpenMP requires some optimization." 394 390 echo "We suggest switching to \"-dev\"." 395 391 fi 396 392 397 if [[ "$veget" = "true" || "$veget" = "orchidee1.9" || "$veget"= "orchidee2.0" \398 || "$veget" = "orchidee2.1" || "$veget"= "orchideetrunk" ]]; then393 if [[ $veget = "true" || $veget = "orchidee1.9" || $veget = "orchidee2.0" \ 394 || $veget = "orchidee2.1" || $veget = "orchideetrunk" ]]; then 399 395 echo "doing orchidee" 400 396 #NB: option 'true': for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6 … … 404 400 CPP_KEY="$CPP_KEY CPP_VEGET" 405 401 # temporary, for Orchidee versions 1.9.* (before openmp activation) 406 if [[ "$veget" = = "orchidee1.9" ]]; then402 if [[ "$veget" = "orchidee1.9" ]]; then 407 403 CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP" 408 404 fi … … 421 417 echo "orchidee lib" 422 418 echo "${LIB}" 423 elif [[ "$veget"!= "false" ]]; then419 elif [[ $veget != "false" ]]; then 424 420 echo "Option -v $veget does not exist" 425 421 echo "Use ./makelmdz_fcm -h for more information" … … 427 423 fi 428 424 429 if [[ "$inlandsis"= "true" ]]; then425 if [[ $inlandsis = "true" ]]; then 430 426 CPP_KEY="$CPP_KEY CPP_INLANDSIS" 431 427 INLANDSIS_PATH="$LIBFGCM/phy${physique}/inlandsis" 432 428 fi 433 429 434 if [[ "$rad"= "rrtm" ]]; then430 if [[ $rad = "rrtm" ]]; then 435 431 CPP_KEY="$CPP_KEY CPP_RRTM" 436 432 RAD_PATH="$LIBFGCM/phy${physique}/rrtm" 437 fi 438 if [[ "$rad" = "ecrad" ]]; then 433 elif [[ $rad = "ecrad" ]]; then 439 434 CPP_KEY="$CPP_KEY CPP_ECRAD" 440 435 RAD_PATH="$LIBFGCM/phy${physique}/ecrad" 441 436 fi 442 437 443 if [[ "$dust"= "true" ]]; then438 if [[ $dust = "true" ]]; then 444 439 CPP_KEY="$CPP_KEY CPP_Dust" 445 440 DUST_PATH="$LIBFGCM/phy${physique}/Dust" 446 441 fi 447 442 448 if [[ "$strataer"= "true" ]]; then443 if [[ $strataer = "true" ]]; then 449 444 CPP_KEY="$CPP_KEY CPP_StratAer" 450 445 STRATAER_PATH="$LIBFGCM/phy${physique}/StratAer" … … 454 449 LIB="$LIB ${NETCDF95_LIBDIR} ${NETCDF95_LIB}" 455 450 456 if [[ $io = ioipsl]]; then451 if [[ $io = "ioipsl" ]]; then 457 452 CPP_KEY="$CPP_KEY CPP_IOIPSL" 458 453 INCLUDE="$INCLUDE ${IOIPSL_INCDIR}" 459 454 LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB}" 460 elif [[ $io = mix ]]; then 461 # For now, xios implies also using ioipsl 455 elif [[ $io = "mix" ]]; then 462 456 CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS" 463 457 INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}" 464 458 LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}" 465 elif [[ $io = xios ]]; then 466 # For now, xios implies also using ioipsl 459 elif [[ $io = "xios" ]]; then 467 460 CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT" 468 461 INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}" … … 470 463 fi 471 464 472 if [[ "$cosp"= "true" ]]; then465 if [[ $cosp = "true" ]]; then 473 466 CPP_KEY="$CPP_KEY CPP_COSP" 474 467 COSP_PATH="$LIBFGCM/phylmd/cosp" 475 468 fi 476 469 477 if [[ "$cosp2"= "true" ]]; then470 if [[ $cosp2 = "true" ]]; then 478 471 CPP_KEY="$CPP_KEY CPP_COSP2" 479 472 COSP_PATH="$LIBFGCM/phylmd/cosp2" 480 473 fi 481 474 482 if [[ "$cospv2"= "true" ]]; then475 if [[ $cospv2 = "true" ]]; then 483 476 CPP_KEY="$CPP_KEY CPP_COSPV2" 484 477 COSP_PATH="$LIBFGCM/phylmd/cospv2" 485 478 fi 486 479 487 if [[ "$cplocninca"= "TRUE" ]]; then480 if [[ $cplocninca = "TRUE" ]]; then 488 481 CPP_KEY="${CPP_KEY} CPP_CPLOCNINCA" 489 482 fi … … 494 487 } 495 488 496 cpp_keys_and_include_mod_path 497 498 499 ######################################################################## 500 # calcul du nombre de dimensions 501 ######################################################################## 502 503 504 dim_full=$dim 505 dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 506 set $dim 507 dimc=$# 508 echo calcul de la dimension 509 echo dim $dim 510 echo dimc $dimc 511 512 513 ######################################################################## 514 # Gestion des dimensions du modele. 515 # on cree ou remplace le fichier des dimensions 516 ######################################################################## 517 518 cd $LIBFGCM/grid 519 if [[ -f dimensions.h ]] 520 then 521 if [[ $force_compile == true ]] 522 then 523 \rm -f $LIBFGCM/grid/dimensions.h 489 function handle_dimension() { 490 ######################################################################## 491 # calcul du nombre de dimensions 492 ######################################################################## 493 494 dim_full=$dim 495 dim=$(echo "$dim" | sed -e 's/[^0-9]/ /g') 496 dimc=$(awk -F" " '{print NF}' <<< "$dim") 497 echo "calcul de la dimension: dim=$dim, dimc=$dimc" 498 499 ######################################################################## 500 # Gestion des dimensions du modele. 501 # on cree ou remplace le fichier des dimensions 502 ######################################################################## 503 504 cd "$LIBFGCM/grid" 505 if [[ -f dimensions.h ]]; then 506 if [[ $force_compile = "true" ]]; then 507 rm -f "$LIBFGCM/grid/dimensions.h" 508 else 509 echo "WARNING: you are probably already compiling the model somewhere else." 510 echo "Wait until the first compilation is finished before launching this one." 511 echo "If you are sure that you are not compiling elsewhere, " 512 echo "If you are sure that you are not compiling elsewhere, then" 513 echo "rm -f \"$LIBFGCM/grid/dimensions.h\"" 514 echo "before reruning the compilation" 515 echo "or run makelmdz_fcm with option -force_compile" 516 exit 1 517 fi 518 fi 519 520 cd "$LIBFGCM/grid/dimension" 521 # shellcheck disable=SC2086 522 ./makdim $dim 523 cat "$LIBFGCM/grid/dimensions.h" 524 cd "$LMDGCM" 525 } 526 527 function different_dynamics() { 528 ######################################################################## 529 # Differentes dynamiques (3d, 2d, 1d) 530 ######################################################################## 531 532 if [[ $dimc = 3 ]]; then 533 cd "$LIBFGCM/grid" 534 rm fxyprim.h 535 cp -p "fxy_${grille}.h" fxyprim.h 536 fi 537 538 if [[ $dimc = 1 ]]; then 539 CPP_KEY="$CPP_KEY CPP_1D" 540 ## no filtre in 1d: 541 FILTRE_PATH="$LMDGCM/.void_dir" 542 ## no need to compile all routines in dyn3d_common either: 543 DYN_COMMON_PATH="$LMDGCM/.void_dir" 544 ## no need to compile all routines in dynlmdz_phy...; 545 ## (because key ones are included in 1D main program) 546 DYN_PHYS_PATH="$LMDGCM/.void_dir" 547 DYN_PHYS_SUB_PATH="$LMDGCM/.void_dir" 548 fi 549 550 ###################################################################### 551 # Gestion du filtre qui n'existe qu'en 3d. 552 ###################################################################### 553 if [[ $dimc -gt 2 ]]; then 554 filtre="FILTRE=$filtre" 555 else 556 filtre="FILTRE= L_FILTRE= " 557 fi 558 echo "MACRO FILTRE $filtre (dimc=$dimc)" 559 } 560 561 function create_config_suffix() { 562 ###################################################################### 563 # Creation du suffixe de la configuration 564 ###################################################################### 565 566 SUFF_NAME=_${dim_full} 567 SUFF_NAME=${SUFF_NAME}_phy${physique}_${rad} 568 569 if [[ $parallel != "none" ]]; then 570 SUFF_NAME=${SUFF_NAME}_para 571 DYN=dyn${dimc}d${paramem} 572 if [[ $paramem = "mem" ]]; then 573 SUFF_NAME=${SUFF_NAME}_${paramem} 524 574 else 525 echo "WARNING: you are probably already compiling the model somewhere else." 526 echo "Wait until the first compilation is finished before launching this one." 527 echo "If you are sure that you are not compiling elsewhere, " 528 echo "If you are sure that you are not compiling elsewhere, then" 529 echo rm -f $LIBFGCM/grid/dimensions.h 530 echo "before reruning the compilation" 531 echo "or run makelmdz_fcm with option -force_compile" 575 echo "The version of the dynamics in dyn3dpar is no longer updated." 576 echo "You should use option \"-mem\"." 532 577 exit 1 533 578 fi 534 fi535 536 537 538 cd $LIBFGCM/grid/dimension539 ./makdim $dim540 cat $LIBFGCM/grid/dimensions.h541 cd $LMDGCM542 543 544 ########################################################################545 # Differentes dynamiques (3d, 2d, 1d)546 ########################################################################547 548 dimension=`echo $dim | wc -w`549 echo dimension $dimension550 551 if (( $dimension == 3 ))552 then553 cd $LIBFGCM/grid554 \rm fxyprim.h555 cp -p fxy_${grille}.h fxyprim.h556 #else557 # echo "Probleme dans les dimensions de la dynamique !!"558 # echo "Non reactive pour l'instant !!!"559 fi560 561 if (( $dimension == 1 ))562 then563 CPP_KEY="$CPP_KEY CPP_1D"564 ## no filtre in 1d:565 FILTRE_PATH=$LMDGCM/.void_dir566 ## no need to compile all routines in dyn3d_common either:567 DYN_COMMON_PATH=$LMDGCM/.void_dir568 ## no need to compile all routines in dynlmdz_phy... ;569 ## (because key ones are included in 1D main program)570 DYN_PHYS_PATH=$LMDGCM/.void_dir571 DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir572 fi573 574 ######################################################################575 # Traitement special pour le nouveau rayonnement de Laurent Li.576 # ---> YM desactive pour le traitemement en parallele577 ######################################################################578 579 #if [[ -f $libf/phy$physique/raddim.h ]]580 #then581 # if [[ -f $libf/phy$physique/raddim.$dimh.h ]]582 #then583 # \rm -f $libf/phy$physique/raddim.h584 # cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h585 # echo $libf/phy$physique/raddim.$dimh.h586 # cat $libf/phy$physique/raddim.h587 # else588 # echo On peut diminuer la taille de l executable en creant589 # echo le fichier $libf/phy$physique/raddim.$dimh.h590 # \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h591 # fi592 #fi593 594 ######################################################################595 # Gestion du filtre qui n'existe qu'en 3d.596 ######################################################################597 598 if (( `expr $dimc \> 2` == 1 ))599 then600 filtre="FILTRE=$filtre"601 else602 filtre="FILTRE= L_FILTRE= "603 fi604 echo MACRO FILTRE $filtre605 606 echo $dimc607 608 609 610 ######################################################################611 # Creation du suffixe de la configuration612 ######################################################################613 614 615 SUFF_NAME=_${dim_full}616 SUFF_NAME=${SUFF_NAME}_phy${physique}_${rad}617 618 if [[ "$parallel" != "none" ]]619 then620 SUFF_NAME=${SUFF_NAME}_para621 DYN=dyn${dimc}d${paramem}622 if [[ "$paramem" == "mem" ]]623 then624 SUFF_NAME=${SUFF_NAME}_${paramem}625 579 else 626 echo "The version of the dynamics in dyn3dpar is no longer updated." 627 echo "You should use option \"-mem\"." 628 exit 1 629 fi 630 else 631 SUFF_NAME=${SUFF_NAME}_seq 632 if (( $dimension == 1 )) 633 then 634 # dynamics-related routines in"dyn1d" subdirectory of phy${physique} 635 DYN=phy${physique}/dyn1d 580 SUFF_NAME=${SUFF_NAME}_seq 581 if [[ $dimc = 1 ]]; then 582 # dynamics-related routines in"dyn1d" subdirectory of phy${physique} 583 DYN=phy${physique}/dyn1d 584 else 585 DYN=dyn${dimc}d 586 fi 587 fi 588 589 if [[ $veget != "false" ]]; then 590 SUFF_NAME=${SUFF_NAME}_orch 591 fi 592 593 if [[ $dust = "true" ]]; then 594 SUFF_NAME=${SUFF_NAME}_spla 595 fi 596 597 if [[ $couple != "false" ]]; then 598 SUFF_NAME=${SUFF_NAME}_couple 599 fi 600 601 if [[ $chimie = "INCA" ]]; then 602 SUFF_NAME=${SUFF_NAME}_inca 603 fi 604 605 if [[ "$isotopes" = "true" ]]; then 606 SUFF_NAME=${SUFF_NAME}_iso 607 fi 608 if [[ "$isoverif" = "true" ]]; then 609 SUFF_NAME=${SUFF_NAME}_isoverif 610 fi 611 if [[ "$isotrac" = "true" ]]; then 612 SUFF_NAME=${SUFF_NAME}_isotrac 613 fi 614 if [[ "$diagiso" = "true" ]]; then 615 SUFF_NAME=${SUFF_NAME}_diagiso 616 fi 617 618 if [[ $libphy = "true" ]]; then 619 # special case where we compile only the physics 620 DYN=$LMDGCM/.void_dir 621 DYN_COMMON_PATH=$LMDGCM/.void_dir 622 FILTRE_PATH=$LMDGCM/.void_dir 623 DYN_PHYS_PATH=$LMDGCM/.void_dir 624 DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir 625 #and there is no main program to generate 626 code="" 627 SUFF_NAME="" 636 628 else 637 DYN=dyn${dimc}d 638 fi 639 fi 640 641 if [[ $veget != "false" ]] 642 then 643 SUFF_NAME=${SUFF_NAME}_orch 644 fi 645 646 if [[ $dust == "true" ]] 647 then 648 SUFF_NAME=${SUFF_NAME}_spla 649 fi 650 651 if [[ $couple != "false" ]] 652 then 653 SUFF_NAME=${SUFF_NAME}_couple 654 fi 655 656 if [[ $chimie == "INCA" ]] 657 then 658 SUFF_NAME=${SUFF_NAME}_inca 659 fi 660 661 if [[ "$isotopes" == "true" ]] 662 then 663 SUFF_NAME=${SUFF_NAME}_iso 664 fi 665 if [[ "$isoverif" == "true" ]] 666 then 667 SUFF_NAME=${SUFF_NAME}_isoverif 668 fi 669 if [[ "$isotrac" == "true" ]] 670 then 671 SUFF_NAME=${SUFF_NAME}_isotrac 672 fi 673 if [[ "$diagiso" == "true" ]] 674 then 675 SUFF_NAME=${SUFF_NAME}_diagiso 676 fi 677 678 if [[ $libphy == "true" ]] 679 then 680 # special case where we compile only the physics 681 DYN=$LMDGCM/.void_dir 682 DYN_COMMON_PATH=$LMDGCM/.void_dir 683 FILTRE_PATH=$LMDGCM/.void_dir 684 DYN_PHYS_PATH=$LMDGCM/.void_dir 685 DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir 686 #and there is no main program to generate 687 code="" 688 SUFF_NAME="" 689 else 690 SUFF_NAME=${SUFF_NAME}.e 691 fi 692 693 cd $LMDGCM 694 config_fcm="config.fcm" 695 rm -f $config_fcm 696 touch $config_fcm 697 rm -f bin/${code}${SUFF_NAME}.e 698 rm -f arch.fcm 699 rm -f arch.opt 700 701 echo "%ARCH $arch" >> $config_fcm 702 echo "%INCDIR $INCLUDE" >> $config_fcm 703 echo "%LIB $LIB" >> $config_fcm 704 echo "%ROOT_PATH $PWD" >> $config_fcm 705 echo "%LIBF $LIBFGCM" >> $config_fcm 706 echo "%LIBO $LIBOGCM" >> $config_fcm 707 echo "%DYN $DYN" >> $config_fcm 708 echo "%DYN_COMMON $DYN_COMMON_PATH" >> $config_fcm 709 echo "%PHY_COMMON $PHY_COMMON_PATH" >> $config_fcm 710 echo "%FILTRE $FILTRE_PATH" >> $config_fcm 711 echo "%PHYS phy${physique}" >> $config_fcm 712 echo "%DYN_PHYS $DYN_PHYS_PATH" >> $config_fcm 713 echo "%DYN_PHYS_SUB $DYN_PHYS_SUB_PATH" >> $config_fcm 714 echo "%RAD $RAD_PATH" >> $config_fcm 715 echo "%DUST $DUST_PATH" >> $config_fcm 716 echo "%STRATAER $STRATAER_PATH" >> $config_fcm 717 echo "%INLANDSIS $INLANDSIS_PATH" >> $config_fcm 718 echo "%COSP $COSP_PATH" >> $config_fcm 719 echo "%CPP_KEY $CPP_KEY" >> $config_fcm 720 echo "%EXEC $code" >> $config_fcm 721 echo "%SUFF_NAME $SUFF_NAME" >> $config_fcm 722 echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> $config_fcm 723 echo "%PARA_FFLAGS $PARA_FFLAGS" >> $config_fcm 724 echo "%PARA_LD $PARA_LD" >> $config_fcm 725 echo "%EXT_SRC $EXT_SRC" >> $config_fcm 726 727 if [[ "$rad" == "ecrad" ]] 728 then 729 \cp bld.cfg.ecrad bld.cfg 730 else 731 \cp bld.cfg.rrtm bld.cfg 732 fi 733 734 ln -s arch/arch-${arch}.fcm arch.fcm 735 if test -f arch/arch-${arch}.opt && [ $compil_mod = "prod" ] 736 then 737 ln -s arch/arch-${arch}.opt arch.opt 738 else 739 ln -s .void_file arch.opt 740 fi 741 742 set +e 743 744 rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock 745 ./build_gcm ${fcm_path} -j $job $full 746 build_status=$? 747 748 rm -rf tmp_src 749 rm -rf config 750 ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config 751 ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/ppsrc tmp_src 752 753 if [[ -r $LIBFGCM/grid/dimensions.h ]] 754 then 755 # Cleanup: remove dimension.h file 756 \rm -f $LIBFGCM/grid/dimensions.h 757 fi 758 759 # build netcdf95 library necessary for the makelmdz script 760 if [[ $build_status = 0 ]] 761 then 762 if [[ ! -d tools/netcdf95/include ]] 763 then 764 mkdir tools/netcdf95/include tools/netcdf95/lib 765 cp config/inc/netcdf95.mod config/inc/nf95_*mod tools/netcdf95/include 766 cp config/obj/netcdf95.o config/obj/nf95_*o config/obj/check_start_count_m.o tools/netcdf95/lib 767 cd tools/netcdf95/lib; ar rv libnetcdf95.a *.o; ranlib libnetcdf95.a 768 cd - 769 fi 770 fi 771 772 exit $build_status 629 SUFF_NAME=${SUFF_NAME}.e 630 fi 631 } 632 633 function create_fcm_conf() { 634 cd "$LMDGCM" 635 config_fcm="config.fcm" 636 rm -f "bin/${code}${SUFF_NAME}.e" 637 rm -f arch.fcm 638 rm -f arch.opt 639 640 { 641 echo "%ARCH $arch" 642 echo "%INCDIR $INCLUDE" 643 echo "%LIB $LIB" 644 echo "%ROOT_PATH $PWD" 645 echo "%LIBF $LIBFGCM" 646 echo "%LIBO $LIBOGCM" 647 echo "%DYN $DYN" 648 echo "%DYN_COMMON $DYN_COMMON_PATH" 649 echo "%PHY_COMMON $PHY_COMMON_PATH" 650 echo "%FILTRE $FILTRE_PATH" 651 echo "%PHYS phy${physique}" 652 echo "%DYN_PHYS $DYN_PHYS_PATH" 653 echo "%DYN_PHYS_SUB $DYN_PHYS_SUB_PATH" 654 echo "%RAD $RAD_PATH" 655 echo "%DUST $DUST_PATH" 656 echo "%STRATAER $STRATAER_PATH" 657 echo "%INLANDSIS $INLANDSIS_PATH" 658 echo "%COSP $COSP_PATH" 659 echo "%CPP_KEY $CPP_KEY" 660 echo "%EXEC $code" 661 echo "%SUFF_NAME $SUFF_NAME" 662 echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" 663 echo "%PARA_FFLAGS $PARA_FFLAGS" 664 echo "%PARA_LD $PARA_LD" 665 echo "%EXT_SRC $EXT_SRC" 666 } > $config_fcm 667 668 # ecrad conf 669 if [[ $rad = "ecrad" ]]; then 670 cp bld.cfg.ecrad bld.cfg 671 else 672 cp bld.cfg.rrtm bld.cfg 673 fi 674 675 # arch.fcm and arch.opt 676 ln -s "arch/arch-$arch.fcm" arch.fcm 677 if [[ -f arch/arch-$arch.opt && $compil_mod = "prod" ]]; then 678 ln -s "arch/arch-$arch.opt" arch.opt 679 else 680 ln -s .void_file arch.opt 681 fi 682 } 683 684 function build_gcm() { 685 set +e 686 687 rm -f "$LIBOGCM/$arch$SUFF_NAME/.config/fcm.bld.lock" 688 ./build_gcm "$fcm_path" -j "$job" $full 689 build_status=$? 690 691 rm -rf tmp_src 692 rm -rf config 693 ln -s "$LIBOGCM/$arch$SUFF_NAME/.config" config 694 ln -s "$LIBOGCM/$arch$SUFF_NAME/.config/ppsrc" tmp_src 695 696 if [[ -r $LIBFGCM/grid/dimensions.h ]]; then 697 # Cleanup: remove dimension.h file 698 rm -f "$LIBFGCM/grid/dimensions.h" 699 fi 700 701 # build netcdf95 library necessary for the makelmdz script 702 if [[ $build_status = 0 ]]; then 703 if [[ ! -d tools/netcdf95/include ]]; then 704 mkdir tools/netcdf95/include tools/netcdf95/lib 705 cp config/inc/netcdf95.mod config/inc/nf95_*mod tools/netcdf95/include 706 cp config/obj/netcdf95.o config/obj/nf95_*o config/obj/check_start_count_m.o tools/netcdf95/lib 707 cd tools/netcdf95/lib; ar rv libnetcdf95.a -- *.o; ranlib libnetcdf95.a 708 cd - 709 fi 710 fi 711 712 exit $build_status 713 } 714 715 init_vars 716 read_cmdline_options "$@" 717 init_arch 718 cpp_keys_and_include_mod_path 719 handle_dimension 720 different_dynamics 721 create_config_suffix 722 create_fcm_conf 723 build_gcm
Note: See TracChangeset
for help on using the changeset viewer.