Changeset 3918


Ignore:
Timestamp:
Sep 19, 2025, 2:53:16 PM (4 months ago)
Author:
jbclement
Message:

Mars PCM 1D:

  • "profile.F" is transformed into a module "profile_temp_mod.F90" with F90 format. The file "profile" where the temperature is read is renamed into "profile_temp" to avoid any confusion.
  • Small corrections and improvements throughout the code and scripts in the deftank.

JBC

Location:
trunk/LMDZ.MARS
Files:
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/changelog.txt

    r3913 r3918  
    49734973== 05/09/2025 == JBC
    49744974Partial reversion of r3847: removal of the incompatibility test ['activice' requires 'microphys']. Therefore, in "updatereffrad_mod.F", without microphysics, we use a typical value for 'tau' (0.2) to assess the number of cloud condensation nuclei in the same way than done before r744. Comments and unused variables are cleaned.
     4975
     4976== 19/09/2025 == JBC
     4977- "profile.F" is transformed into a module "profile_temp_mod.F90" with F90 format. The file "profile" where the temperature is read is renamed into "profile_temp" to avoid any confusion.
     4978- Small corrections and improvements throughout the code and scripts in the deftank.
  • trunk/LMDZ.MARS/deftank/launch_1Dchained.sh

    r3580 r3918  
    77
    88
    9 echo "The launching script is starting!"
    10 echo "The output file is \"loglaunch.txt\"."
    11 if [ "$1" = "bg" ]; then
    12     date
    13 else
    14     nohup "$0" bg > loglaunch.txt 2>&1 &
    15     exit 1
    16 fi
    17 
    18 # Save the current value of LC_NUMERIC and set it to a locale that uses a dot as the decimal separator
    19 OLD_LC_NUMERIC=$LC_NUMERIC
    20 LC_NUMERIC=en_US.UTF-8
    21 
    229################################################################
    2310# Modify here the parameters for the simulation
     
    2714
    2815# Set the number of Martian years to be simulated:
    29 n_myears=1000
     16n_myear=100
    3017
    3118# Name of executable for the PCM:
    32 exePCM="testphys1d_29_phymars_seq.e"
     19exePCM="testphys1d_32_phymars_seq.e"
    3320################################################################
    3421
    3522
    36 # Check if files/directories necessary for the script exist
     23echo "The launching script is starting!"
     24echo "The output file is \"launch.log\"."
     25exec > launch.log 2>&1
     26
     27# Save the current value of LC_NUMERIC and set it to a locale that uses a dot as the decimal separator
     28OLD_LC_NUMERIC=$LC_NUMERIC
     29LC_NUMERIC=en_US.UTF-8
     30
     31# To end the launching script with error
     32errlaunch() {
     33    # Restore the previous value of LC_NUMERIC
     34    LC_NUMERIC=$OLD_LC_NUMERIC
     35
     36    date
     37    echo "Error: an issue occured in the launching script!"
     38    exit 1
     39}
     40
     41
     42# Check if the set-up is correct
    3743dir=`pwd`
    3844machine=`hostname`
    3945address=`whoami`
     46if [ -v n_myear ]; then
     47    if [ $(echo "$n_myear <= 0." | bc -l) -eq 1 ]; then
     48        echo "Error: 'n_myear' must be > 0!"
     49        errlaunch
     50    fi
     51else
     52    echo "Error: the number of years to be simulated is not set!"
     53    errlaunch
     54fi
    4055if [ ! -f "$exePCM" ]; then
    4156    echo "Error: file \"$exePCM\" does not exist in $dir!"
    42     exit 1
     57    errlaunch
    4358fi
    44 if [ ! -d "out_PCM" ]; then
    45     mkdir out_PCM
     59if [ ! -d "logs" ]; then
     60    mkdir logs
    4661fi
    4762if [ ! -d "starts" ]; then
     
    5671machine=`hostname`
    5772address=`whoami`
    58 echo "This is a chained simulation for PCM runs in $dir on $machine."
    59 echo "Number of years to be simulated: $n_myears Martian years."
    60 myear=686.9725      # Number of Earth days in Martian year
    61 eyear=365.256363004 # Number of days in Earth year
    62 convert_years=$(echo "$myear/$eyear" | bc -l)
    63 convert_years=$(printf "%.4f" $convert_years) # Rounding to the 4th decimal to respect the precision of Martian year
     73echo "This is a chained simulation for PCM 1D runs in $dir on $machine."
     74echo "Number of years to be simulated: $n_myear Martian years."
    6475i_myear=0
    6576iPCM=1
    66 cp startfi.nc starts/
    67 if [ -f "star1D.nc" ]; then
    68     cp star1D.txt starts/
     77if [ -f "startfi.nc" ]; then
     78    cp startfi.nc starts/
     79fi
     80if [ -f "start1D.txt" ]; then
     81    cp start1D.txt starts/
    6982fi
    7083
    7184# Main loop to to run PCM year by year
    72 while [ $i_myear -lt $n_myears ]; do
     85while [ $i_myear -lt $n_myear ]; do
    7386    # Run the PCM
    74     echo "Run PCM $iPCM: year $iPCM/$n_myears..."
    75     ./$exePCM > out_runPCM${iPCM} 2>&1
    76     if [ ! -f "restartfi.nc" ]; then # Check if run ended abnormally
    77         echo "Error: the run PCM $iPCM crashed!"
    78         exit 1
     87    echo "Run $iPCM: year $iPCM/$n_myear..."
     88    ./$exePCM > run.log 2>&1
     89    if [ ! -f "restartfi.nc" ] || ! (tail -n 100 run.log | grep -iq "everything is cool!"); then # Check if it ended abnormally
     90        echo "Error: the run $iPCM crashed!"
     91        errlaunch
    7992    fi
    8093    # Copy data files and prepare the next run
    81     mv out_runPCM${iPCM} out_PCM/run${iPCM}
    82     mv diagfi.nc diags/diagfi${iPCM}.nc
     94    mv run.log logs/run${iPCM}.log
     95    if [ -f "diagfi.nc" ]; then
     96        mv diagfi.nc diags/diagfi${iPCM}.nc
     97    fi
    8398    if [ -f "diagsoil.nc" ]; then
    8499        mv diagsoil.nc diags/diagsoil${iPCM}.nc
     
    105120
    106121date
    107 echo "The launching script ended."
     122echo "Success: the launching script completed normally!"
     123exit 0
  • trunk/LMDZ.MARS/deftank/launch_orb_1Dchained.sh

    r3580 r3918  
    77trap 'echo -e "\033[31mError: an issue occurred in the script on line $LINENO! Please review the command and try again.\033[0m"' ERR
    88
    9 echo "The launching script is starting!"
    10 echo "The output file is \"loglaunch.txt\"."
    11 if [ "$1" = "bg" ]; then
    12     date
    13 else
    14     nohup "$0" bg > loglaunch.txt 2>&1 &
    15     exit 1
    16 fi
    17 
    18 # Save the current value of LC_NUMERIC and set it to a locale that uses a dot as the decimal separator
    19 OLD_LC_NUMERIC=$LC_NUMERIC
    20 LC_NUMERIC=en_US.UTF-8
    219
    2210################################################################
     
    2715
    2816# Set the number of Earth years before present to start:
    29 eyears_bp_ini=-1000
    30 
    31 # Set the number of Martian years to be simulated:
    32 n_myears=500
     17year_earth_bp_ini=-100
     18
     19# Set the number of years to be simulated, either Martian or Earth years (> 0):
     20n_mars_years=100.
     21#n_earth_years=300
    3322
    3423# Name of executable for the PCM:
    35 exePCM="testphys1d_29_phymars_para.e"
     24exePCM="testphys1d_32_phymars_seq.e"
    3625
    3726# Name of the orbital data file:
     
    4029
    4130
    42 # Check if files/directories necessary for the script exist
     31echo "The launching script is starting!"
     32echo "The output file is \"launch.log\"."
     33exec > launch.log 2>&1
     34
     35# Save the current value of LC_NUMERIC and set it to a locale that uses a dot as the decimal separator
     36OLD_LC_NUMERIC=$LC_NUMERIC
     37LC_NUMERIC=en_US.UTF-8
     38
     39# To end the launching script with error
     40errlaunch() {
     41    # Restore the previous value of LC_NUMERIC
     42    LC_NUMERIC=$OLD_LC_NUMERIC
     43
     44    date
     45    echo "Error: an issue occured in the launching script!"
     46    exit 1
     47}
     48
     49# To convert Earth years into Mars years
     50convertyears() {
     51    myear=686.9725      # Number of Earth days in Martian year
     52    eyear=365.256363004 # Number of days in Earth year
     53    convert_years=$(echo "$myear/$eyear" | bc -l)
     54    convert_years=$(printf "%.4f" $convert_years) # Rounding to the 4th decimal to respect the precision of Martian year
     55    if [ -v n_mars_years ]; then
     56        n_myear=$n_mars_years
     57        echo "Number of years to be simulated: $n_myear Martian years."
     58    elif [ -v n_earth_years ]; then
     59        n_myear=$(echo "$n_earth_years/$convert_years" | bc -l)
     60        echo "Number of years to be simulated: $n_earth_years Earth years = $n_myear Martian years."
     61    fi
     62}
     63
     64# Check if the set-up is correct
    4365dir=`pwd`
    4466machine=`hostname`
    4567address=`whoami`
     68if [ -v n_mars_years ] && [ ! -z "$n_mars_years" ]; then
     69    if [ $(echo "$n_mars_years <= 0." | bc -l) -eq 1 ]; then
     70        echo "Error: 'n_mars_years' must be > 0!"
     71        errlaunch
     72    fi
     73elif [ -v n_earth_years ] && [ ! -z "$n_earth_years" ]; then
     74    if [ $(echo "$n_earth_years <= 0." | bc -l) -eq 1 ]; then
     75        echo "Error: 'n_earth_years' must be > 0!"
     76        errlaunch
     77    fi
     78else
     79    echo "Error: the number of years to be simulated is not set!"
     80    errlaunch
     81fi
    4682if [ ! -f "$exePCM" ]; then
    4783    echo "Error: file \"$exePCM\" does not exist in $dir!"
    48     exit 1
     84    errlaunch
    4985fi
    5086if [ ! -f "$orb_data" ]; then
    5187    echo "Error: file \"$orb_data\" does not exist in $dir!"
    52     exit 1
     88    errlaunch
    5389fi
    5490if [ ! -f "startfi.nc" ]; then
    5591    echo "Error: file \"startfi.nc\" does not exist in $dir!"
    56     exit 1
    57 fi
    58 if [ ! -d "out_PCM" ]; then
    59     mkdir out_PCM
     92    errlaunch
     93fi
     94if [ ! -d "logs" ]; then
     95    mkdir logs
    6096fi
    6197if [ ! -d "starts" ]; then
     
    70106machine=`hostname`
    71107address=`whoami`
    72 echo "This is a chained simulation for PCM runs in $dir on $machine."
    73 echo "Number of years to be simulated: $n_myears Martian years."
    74 myear=686.9725      # Number of Earth days in Martian year
    75 eyear=365.256363004 # Number of days in Earth year
    76 convert_years=$(echo "$myear/$eyear" | bc -l)
    77 convert_years=$(printf "%.4f" $convert_years) # Rounding to the 4th decimal to respect the precision of Martian year
     108echo "This is a chained simulation for PCM 1D runs in $dir on $machine."
     109convertyears
    78110i_myear=0
    79111iPCM=1
    80 cp startfi.nc starts/
    81 if [ -f "star1D.nc" ]; then
    82     cp star1D.txt starts/
    83 fi
    84 
    85 # Main loop to to run PCM year by year
    86 while [ $i_myear -lt $n_myears ]; do
     112if [ -f "startfi.nc" ]; then
     113    cp startfi.nc starts/
     114fi
     115if [ -f "start1D.txt" ]; then
     116    cp start1D.txt starts/
     117fi
     118
     119# To modify orbital parameters of a file "startfi.nc"
     120modify_startfi_orb() {
    87121    # Get the new values for the orbital parameters
    88     yearlask=$(echo "($eyears_bp_ini + $i_myear*$convert_years)/1000." | bc -l)
     122    yearlask=$(echo "($year_earth_bp_ini + $i_myear*$convert_years)/1000." | bc -l)
    89123    found=false
    90124    read -r y1 obl1 ecc1 lsp1 < "$orb_data"
     
    153187    echo "New peri_day = $peri_day"
    154188    echo "Done!"
     189}
     190
     191
     192# Main loop to to run PCM year by year
     193while [ $i_myear -lt $n_myear ]; do
    155194    # Run the PCM
    156     echo "Run PCM $iPCM: year $iPCM/$n_myears..."
    157     ./$exePCM > out_runPCM${iPCM} 2>&1
    158     if [ ! -f "restartfi.nc" ]; then # Check if run ended abnormally
    159         echo "Error: the run PCM $iPCM crashed!"
    160         exit 1
     195    echo "Run $iPCM: year $iPCM/$n_mars_years..."
     196    ./$exePCM > run.log 2>&1
     197    if [ ! -f "restartfi.nc" ] || ! (tail -n 100 run.log | grep -iq "everything is cool!"); then # Check if it ended abnormally
     198        echo "Error: the run $iPCM crashed!"
     199        errlaunch
    161200    fi
    162201    # Copy data files and prepare the next run
    163     mv out_runPCM${iPCM} out_PCM/run${iPCM}
    164     mv diagfi.nc diags/diagfi${iPCM}.nc
     202    mv run.log logs/run${iPCM}.log
     203    if [ -f "diagfi.nc" ]; then
     204        mv diagfi.nc diags/diagfi${iPCM}.nc
     205    fi
    165206    if [ -f "diagsoil.nc" ]; then
    166207        mv diagsoil.nc diags/diagsoil${iPCM}.nc
     
    187228
    188229date
    189 echo "The launching script ended."
     230echo "Success: the launching script completed normally!"
     231exit 0
  • trunk/LMDZ.MARS/deftank/run.def.1d

    r3912 r3918  
    5757# Relaxation time (s). If <0 then no time relaxation i.e. forcing
    5858relaxtime_h2oice=-1.
    59 
    6059# hybrid vertical coordinate ? (.true. for hybrid and .false. for sigma levels)
    6160hybrid=.true.
    6261
    6362###### Initial atmospheric temperature profile
     63# It matters only if there is no "start1D.txt"
    6464#
    6565# Type of initial temperature profile
  • trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90

    r3912 r3918  
    1919use infotrac,                 only: nqtot, tname, nqperes, nqfils
    2020use read_profile_mod,         only: read_profile
     21use profile_temp_mod,         only: profile_temp
    2122use iostart,                  only: open_startphy, get_var, close_startphy
    2223use physics_distribution_mod, only: init_physics_distribution
     
    9394integer                   :: dayn ! Final date
    9495real, dimension(nlayer)   :: zlay ! altitude estimee dans les couches (km)
    95 real, dimension(0:nlayer) :: tmp1, tmp2
     96real, dimension(0:nlayer) :: zkm, teta
    9697
    9798! Dummy variables along "dynamics scalar grid"
     
    655656pks = psurf**rcp
    656657
    657 ! Altitude in km in profile: divide zlay by 1000
    658 tmp1(0) = 0.
    659 tmp1(1:) = zlay/1000.
    660 
    661 call profile(nlayer + 1,tmp1,tmp2)
    662 
    663658if (.not. therestart1D) then
    664     tsurf = tmp2(0)
    665     temp = tmp2(1:)
     659    ! Altitude in km in "profile_temp": divide zlay by 1000
     660    zkm(0) = 0.
     661    zkm(1:) = zlay/1000.
     662
     663    call profile_temp(nlayer + 1,zkm,teta)
     664    tsurf = teta(0)
     665    temp = teta(1:)
    666666else
    667667    read(3,*) header, (tsurf(1,j), j = 1,size(tsurf,2)), (temp(ilayer), ilayer = 1,nlayer)
     
    745745flux_geo = flux_geo(1,1)
    746746
    747 
    748747! Initialize traceurs
    749748! -------------------
  • trunk/LMDZ.MARS/libf/phymars/dyn1d/profile_temp_mod.F90

    r3917 r3918  
    1 !      SUBROUTINE profile(unit,nlev,zkm,temp)
    2       SUBROUTINE profile(nlev,zkm,temp)
    3 ! to use  'getin'
    4       USE ioipsl_getincom
    5       IMPLICIT NONE
    6 c=======================================================================
    7 c     Subroutine utilisee dans le modele 1-D  "testphys1d"
    8 c     pour l'initialisation du profil atmospherique
    9 c=======================================================================
    10 c
    11 c   differents profils d'atmospheres. T=f(z)
    12 c   entree:
    13 c     nlev    nombre de niveaux
    14 c     zkm     alititudes en km
    15 c     ichoice choix de l'atmosphere:
    16 c             1 Temperature constante
    17 c             2 profil Savidjari
    18 c             3 Lindner (profil polaire)
    19 c             4 Inversion pour Francois
    20 c             5 Seiff (moyen)
    21 c             6 T constante + perturbation gauss (level) (christophe 10/98)
    22 c             7 T constante + perturbation gauss   (km)  (christophe 10/98)
    23 c             8 Lecture du profile dans un fichier ASCII (profile)
    24 c     tref    temperature de reference
    25 c     isin    ajout d'une perturbation (isin=1)
    26 c     pic     pic perturbation gauss pour ichoice = 6 ou 7
    27 c     largeur largeur de la perturbation gauss pour ichoice = 6 ou 7
    28 c     hauteur hauteur de la perturbation gauss pour ichoice = 6 ou 7
    29 c
    30 c   sortie:
    31 c     temp    temperatures en K
    32 c     
    33 c=======================================================================
    34 c-----------------------------------------------------------------------
    35 c   declarations:
    36 c   -------------
    37 
    38 c   arguments:
    39 c   ----------
    40 
    41        INTEGER nlev
    42        REAL zkm(nlev),temp(nlev)
    43 
    44 c   local:
    45 c   ------
    46 
    47       INTEGER il,ichoice,nseiff,iseiff,isin,iter
    48       REAL pi
    49       PARAMETER(nseiff=37)
    50       REAL tref,t1,t2,t3,ww
    51       REAL tseiff(nseiff)
    52       DATA tseiff/214.,213.8,213.4,212.4,209.3,205.,201.4,197.8,
    53      $           194.6,191.4,188.2,185.2,182.5,180.,177.5,175,
    54      $           172.5,170.,167.5,164.8,162.4,160.,158.,156.,
    55      $           154.1,152.2,150.3,148.7,147.2,145.7,144.2,143.,
    56      $           142.,141.,140,139.5,139./
    57       REAL pic,largeur
    58       REAL hauteur,tmp
    59 
    60 c-----------------------------------------------------------------------
    61 c   read input profile type:
    62 c--------------------------
    63 
    64       ichoice=1 ! default value for ichoice
    65       call getin("ichoice",ichoice)
    66       tref=200 ! default value for tref
    67       call getin("tref",tref)
    68       isin=0 ! default value for isin (=0 means no perturbation)
    69       call getin("isin",isin)
    70       pic=26.522 ! default value for pic
    71       call getin("pic",pic)
    72       largeur=10 ! default value for largeur
    73       call getin("largeur",largeur)
    74       hauteur=30 ! default value for hauteur
    75       call getin("hauteur",hauteur)
    76 
    77 c-----------------------------------------------------------------------
    78 c   ichoice=1 temperature constante:
    79 c   --------------------------------
    80 
    81       IF(ichoice.EQ.1) THEN
    82          DO il=1,nlev
    83             temp(il)=tref
    84          ENDDO
    85 
    86 c-----------------------------------------------------------------------
    87 c   ichoice=2 savidjari:
    88 c   --------------------
    89 
    90       ELSE IF(ichoice.EQ.2) THEN
    91          DO il=1,nlev
    92             temp(il)=AMAX1(219.-2.5*zkm(il),140.)
    93          ENDDO
    94 
    95 c-----------------------------------------------------------------------
    96 c   ichoice=3 Lindner:
    97 c   ------------------
    98 
    99       ELSE IF(ichoice.EQ.3) THEN
    100          DO il=1,nlev
    101             IF(zkm(il).LT.2.5) THEN
    102                temp(il)=150.+30.*zkm(il)/2.5
    103             ELSE IF(zkm(il).LT.5.) THEN
    104                temp(il)=180.
    105             ELSE
    106                temp(il)=AMAX1(180.-2.*(zkm(il)-5.),130.)
    107             ENDIF
    108          ENDDO
    109 
    110 c-----------------------------------------------------------------------
    111 c   ichoice=4 Inversion pour Francois:
    112 c   ------------------
    113 
    114       ELSE IF(ichoice.EQ.4) THEN
    115          DO il=1,nlev
    116             IF(zkm(il).LT.20.) THEN
    117                temp(il)=135.
    118             ELSE
    119                temp(il)=AMIN1(135.+5.*(zkm(il)-20.),200.)
    120             ENDIF
    121          ENDDO
    122 
    123 
    124 c-----------------------------------------------------------------------
    125 c   ichoice=5 Seiff:
    126 c   ----------------
    127 
    128       ELSE IF(ichoice.EQ.5) THEN
    129          DO il=1,nlev
    130             iseiff=INT(zkm(il)/2.)+1
    131             IF(iseiff.LT.nseiff-1) THEN
    132                temp(il)=tseiff(iseiff)+(zkm(il)-2.*(iseiff-1))*
    133      $         (tseiff(iseiff+1)-tseiff(iseiff))/2.
    134             ELSE
    135                temp(il)=tseiff(nseiff)
    136             ENDIF
    137          ENDDO
    138 c IF(ichoice.EQ.6) THEN
    139 c           DO iter=1,6
    140 c           t2=temp(1)
    141 c           t3=temp(2)
    142 c           DO il=2,nlev-1
    143 c              t1=t2
    144 c              t2=t3
    145 c              t3=temp(il+1)
    146 c              ww=tanh(zkm(il)/20.)
    147 c              ww=ww*ww*ww
    148 c              temp(il)=t2+ww*.5*(t1-2.*t2+t3)
    149 c           ENDDO
    150 c           ENDDO
    151 c        ENDIF
    152 
    153 c-----------------------------------------------------------------------
    154 c   ichoice=6
    155 c   ---------
    156 
    157       ELSE IF(ichoice.EQ.6) THEN
    158       DO il=1,nlev
     1MODULE profile_temp_mod
     2
     3implicit none
     4
     5CONTAINS
     6
     7SUBROUTINE profile_temp(nlev,zkm,temp)
     8
     9use ioipsl_getincom, only: getin ! To use 'getin'
     10use comcstfi_h,      only: pi
     11     
     12IMPLICIT NONE
     13
     14!=======================================================================
     15!     Subroutine utilisee dans le modele 1-D "testphys1d"
     16!     pour l'initialisation du profil atmospherique
     17!=======================================================================
     18!
     19!   differents profils d'atmospheres. T=f(z)
     20!   entree:
     21!     nlev    nombre de niveaux
     22!     zkm     alititudes en km
     23!     ichoice choix de l'atmosphere:
     24!             1 Temperature constante
     25!             2 profil Savidjari
     26!             3 Lindner (profil polaire)
     27!             4 Inversion pour Francois
     28!             5 Seiff (moyen)
     29!             6 T constante + perturbation gauss (level) (christophe 10/98)
     30!             7 T constante + perturbation gauss    (km) (christophe 10/98)
     31!             8 Lecture du profile dans un fichier ASCII (profile_temp)
     32!     tref    temperature de reference
     33!     isin    ajout d'une perturbation (isin=1)
     34!     pic     pic perturbation gauss pour ichoice = 6 ou 7
     35!     largeur largeur de la perturbation gauss pour ichoice = 6 ou 7
     36!     hauteur hauteur de la perturbation gauss pour ichoice = 6 ou 7
     37!
     38!   sortie:
     39!     temp    temperatures en K
     40!     
     41!=======================================================================
     42!-----------------------------------------------------------------------
     43!   declarations:
     44!   -------------
     45
     46!   arguments:
     47!   ----------
     48
     49INTEGER,               intent(in) :: nlev
     50REAL, dimension(nlev), intent(in) :: zkm
     51REAL, dimension(nlev), intent(out) :: temp
     52
     53!   local:
     54!   ------
     55
     56INTEGER :: il,ichoice,iseiff,isin,iter,ierr
     57INTEGER, PARAMETER :: nseiff = 37
     58REAL :: tref,t1,t2,t3,ww
     59REAL, dimension(nseiff) :: tseiff
     60DATA tseiff/214. ,213.8,213.4,212.4,209.3,205. ,201.4,197.8, &
     61            194.6,191.4,188.2,185.2,182.5,180. ,177.5,175  , &
     62            172.5,170. ,167.5,164.8,162.4,160. ,158. ,156. , &
     63            154.1,152.2,150.3,148.7,147.2,145.7,144.2,143. , &
     64            142. ,141. ,140  ,139.5,139./
     65REAL :: pic,largeur
     66REAL :: hauteur,tmp
     67
     68!-----------------------------------------------------------------------
     69!   read input profile type:
     70!--------------------------
     71
     72ichoice=1 ! default value for ichoice
     73call getin("ichoice",ichoice)
     74tref=200 ! default value for tref
     75call getin("tref",tref)
     76isin=0 ! default value for isin (=0 means no perturbation)
     77call getin("isin",isin)
     78pic=26.522 ! default value for pic
     79call getin("pic",pic)
     80largeur=10 ! default value for largeur
     81call getin("largeur",largeur)
     82hauteur=30 ! default value for hauteur
     83call getin("hauteur",hauteur)
     84
     85!-----------------------------------------------------------------------
     86!   ichoice=1 temperature constante:
     87!   --------------------------------
     88
     89IF(ichoice.EQ.1) THEN
     90    DO il=1,nlev
     91        temp(il)=tref
     92    ENDDO
     93
     94!-----------------------------------------------------------------------
     95!   ichoice=2 savidjari:
     96!   --------------------
     97
     98ELSE IF(ichoice.EQ.2) THEN
     99    DO il=1,nlev
     100        temp(il)=AMAX1(219.-2.5*zkm(il),140.)
     101    ENDDO
     102
     103!-----------------------------------------------------------------------
     104!   ichoice=3 Lindner:
     105!   ------------------
     106
     107ELSE IF(ichoice.EQ.3) THEN
     108    DO il=1,nlev
     109        IF(zkm(il).LT.2.5) THEN
     110            temp(il)=150.+30.*zkm(il)/2.5
     111        ELSE IF(zkm(il).LT.5.) THEN
     112            temp(il)=180.
     113        ELSE
     114            temp(il)=AMAX1(180.-2.*(zkm(il)-5.),130.)
     115        ENDIF
     116    ENDDO
     117
     118!-----------------------------------------------------------------------
     119!   ichoice=4 Inversion pour Francois:
     120!   ------------------
     121
     122ELSE IF(ichoice.EQ.4) THEN
     123    DO il=1,nlev
     124        IF(zkm(il).LT.20.) THEN
     125            temp(il)=135.
     126        ELSE
     127            temp(il)=AMIN1(135.+5.*(zkm(il)-20.),200.)
     128        ENDIF
     129    ENDDO
     130
     131!-----------------------------------------------------------------------
     132!   ichoice=5 Seiff:
     133!   ----------------
     134
     135ELSE IF(ichoice.EQ.5) THEN
     136    DO il=1,nlev
     137        iseiff=INT(zkm(il)/2.)+1
     138        IF(iseiff.LT.nseiff-1) THEN
     139            temp(il)=tseiff(iseiff)+(zkm(il)-2.*(iseiff-1))*(tseiff(iseiff+1)-tseiff(iseiff))/2.
     140        ELSE
     141            temp(il)=tseiff(nseiff)
     142        ENDIF
     143    ENDDO
     144! IF(ichoice.EQ.6) THEN
     145!    DO iter=1,6
     146!        t2=temp(1)
     147!        t3=temp(2)
     148!        DO il=2,nlev-1
     149!            t1=t2
     150!            t2=t3
     151!            t3=temp(il+1)
     152!            ww=tanh(zkm(il)/20.)
     153!            ww=ww*ww*ww
     154!            temp(il)=t2+ww*.5*(t1-2.*t2+t3)
     155!        ENDDO
     156!    ENDDO
     157!ENDIF
     158
     159!-----------------------------------------------------------------------
     160!   ichoice=6
     161!   ---------
     162
     163ELSE IF(ichoice.EQ.6) THEN
     164    DO il=1,nlev
    159165        tmp=il-pic
    160166        temp(il)=tref + hauteur*exp(-tmp*tmp/largeur/largeur)
    161       ENDDO
    162 
    163 
    164 c-----------------------------------------------------------------------
    165 c   ichoice=7
    166 c   ---------
    167 
    168       ELSE IF(ichoice.EQ.7) THEN
    169       DO il=1,nlev
     167    ENDDO
     168
     169!-----------------------------------------------------------------------
     170!   ichoice=7
     171!   ---------
     172
     173ELSE IF(ichoice.EQ.7) THEN
     174    DO il=1,nlev
    170175        tmp=zkm(il)-pic
    171176        temp(il)=tref + hauteur*exp(-tmp*tmp*4/largeur/largeur)
    172       ENDDO
    173 
    174 c-----------------------------------------------------------------------
    175 c   ichoice=8
    176 c   ---------
    177 
    178       ELSE IF(ichoice.GE.8) THEN
    179       OPEN(11,file='profile',status='old',form='formatted',err=101)
    180       DO il=1,nlev
    181         READ (11,*) temp(il)
    182       ENDDO
    183 
    184       GOTO 201
    185 101   STOP'fichier profile inexistant'
    186 201   CONTINUE
    187       CLOSE(10)
    188 
    189 c-----------------------------------------------------------------------
    190 
    191       ENDIF
    192 
    193 c-----------------------------------------------------------------------
    194 c   rajout eventuel d'une perturbation:
    195 c   -----------------------------------
    196 
    197       IF(isin.EQ.1) THEN
    198          pi=2.*ASIN(1.)
    199          DO il=1,nlev
    200 c       if (nlev.EQ.501) then
    201 c         if (zkm(il).LE.70.5) then
    202 c       temp(il)=temp(il)+(1.-1000./(1000+zkm(il)*zkm(il)))*(
    203 c    s      6.*SIN(zkm(il)*pi/6.)+9.*SIN(zkm(il)*pi/10.3) )
    204 c         endif
    205 c       else
    206         temp(il)=temp(il)+(1.-1000./(1000+zkm(il)*zkm(il)))*(
    207      s      6.*SIN(zkm(il)*pi/6.)+9.*SIN(zkm(il)*pi/10.3) )
    208 c       endif
    209          ENDDO
    210       ENDIF
    211 
    212 
    213 c-----------------------------------------------------------------------
    214 c   Ecriture du profil de temperature dans un fichier profile.out
    215 c   -------------------------------------------------------------
    216 
    217 
    218       OPEN(12,file='profile.out',form='formatted')
    219           DO il=1,nlev
    220             write(12,*) temp(il)
    221           ENDDO
    222       CLOSE(12)
    223 
    224       RETURN
    225       END
     177    ENDDO
     178
     179!-----------------------------------------------------------------------
     180!   ichoice=8
     181!   ---------
     182
     183ELSE IF(ichoice.GE.8) THEN
     184    OPEN(11,file='profile_temp',status='old',form='formatted',iostat=ierr)
     185    if (ierr == 0) then
     186        DO il=1,nlev
     187            READ (11,*) temp(il)
     188        ENDDO
     189    else
     190        error stop 'File "profile_temp" not found!'
     191    endif
     192    CLOSE(11)
     193
     194!-----------------------------------------------------------------------
     195ENDIF
     196
     197!-----------------------------------------------------------------------
     198!   rajout eventuel d'une perturbation:
     199!   -----------------------------------
     200
     201IF (isin.EQ.1) THEN
     202    DO il=1,nlev
     203!        if (nlev.EQ.501) then
     204!            if (zkm(il).LE.70.5) then
     205!                temp(il)=temp(il)+(1.-1000./(1000+zkm(il)*zkm(il)))*( 6.*SIN(zkm(il)*pi/6.)+9.*SIN(zkm(il)*pi/10.3) )
     206!            endif
     207!        else
     208        temp(il)=temp(il)+(1.-1000./(1000+zkm(il)*zkm(il)))*( 6.*SIN(zkm(il)*pi/6.)+9.*SIN(zkm(il)*pi/10.3) )
     209!        endif
     210    ENDDO
     211ENDIF
     212
     213!-----------------------------------------------------------------------
     214!   Ecriture du profil de temperature dans un fichier profile_temp.out
     215!   ------------------------------------------------------------------
     216
     217OPEN(12,file='profile_temp.out',status='unknown',form='formatted')
     218    DO il=1,nlev
     219        write(12,*) temp(il)
     220    ENDDO
     221CLOSE(12)
     222
     223END SUBROUTINE profile_temp
     224
     225END MODULE profile_temp_mod
  • trunk/LMDZ.MARS/libf/phymars/physiq_mod.F

    r3904 r3918  
    697697           inertiedat(:,:)=400.
    698698           inertiesoil(:,:,:)=400.
    699            write(*,*) "Physiq: initializing day_ini to pdat !"
     699           write(*,*) "Physiq: initializing day_ini to pday !"
    700700           day_ini=pday
    701701        endif
  • trunk/LMDZ.MARS/libf/phymars/watercloud_mod.F

    r3902 r3918  
    696696#ifndef MESOSCALE
    697697c=======================================================================
    698       call write_output("watercloud_pdqh2oice","pdqcloud_h2o_ice "//
    699      &   "after microphysics","kg/kg.s-1",pdqcloud(:,:,igcm_h2o_ice))
    700       call write_output("watercloud_pdqh2ovap","pdqcloud_h2o_vap "//
    701      &   "after microphysics","kg/kg.s-1",pdqcloud(:,:,igcm_h2o_vap))
    702       if (hdo) then
    703         call write_output("watercloud_pdqhdoice","pdqcloud_hdo_ice "//
    704      &     "after microphysics","kg/kg.s-1",pdqcloud(:,:,igcm_hdo_ice))
    705         call write_output("watercloud_pdqhdovap","pdqcloud_hdo_vap "//
    706      &     "after microphysics","kg/kg.s-1",pdqcloud(:,:,igcm_hdo_vap))
    707       endif
    708698!      call write_output("pdqccn2","pdqcloudccn apres microphysique"
    709699!     &      ,"kg/kg.s-1",pdqcloud(:,:,
Note: See TracChangeset for help on using the changeset viewer.