source: trunk/LMDZ.MARS/deftank/pem/modify_startfi_orbit.sh @ 3026

Last change on this file since 3026 was 3026, checked in by jbclement, 16 months ago

Mars PCM/PEM 1D:
Small fixes to be able to run the Mars PCM 1D without "water" + Improvements/addition of scripts in deftank/pem to run the PEM 1D model according to Laskar orbital parameters.
JBC

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/bin/bash
2
3# Bash script to modify the orbital parameters of a file "startfi.nc"
4name_file="startfi.nc"
5
6new_obl=30.0286
7new_exc=0.08212066
8new_Lsp=347.443947402
9
10
11# Calculate modified values
12year_day=669.
13halfaxe=227.94
14pi=$(echo "4*a(1)" | bc -l)
15degrad=$(echo "360./(2.*$pi)" | bc -l)
16tan=$(echo "s(0.5*$new_Lsp/$degrad)/c(0.5*$new_Lsp/$degrad)" | bc -l)
17zx0=$(echo "-2.*a($tan*sqrt((1.-$new_exc)/(1.+$new_exc)))" | bc -l)
18if [ $(echo "$zx0 <= 0" | bc -l) -eq 1 ]; then
19  zx0=$(echo "$zx0 + 2.*$pi" | bc -l)
20fi
21solp=$(echo "$year_day*(1.-($zx0 - $new_exc*s($zx0))/(2*$pi))" | bc -l)
22
23# Update the netCDF file
24# controle(15) = periheli ! min. Sun-Mars distance (Mkm)  ̃206.66
25# controle(16) = aphelie  ! max. SUn-Mars distance (Mkm)  ̃249.22
26# controle(17) = peri_day ! date of perihelion (sols since N. spring)
27# controle(18) = obliquit ! Obliquity of the planet (deg)  ̃23.98
28ncap2 -O -s "controle(17)=$new_obl" \
29      -s "controle(14)=$halfaxe*(1-$new_exc)" \
30      -s "controle(15)=$halfaxe*(1+$new_exc)" \
31      -s "controle(16)=$solp" \
32      $name_file $name_file.temp
33
34# Rename the temporary file back to the original filename
35mv $name_file.temp $name_file
36
37echo New obliquit = $new_obl
38echo New periheli = $(echo "$halfaxe*(1-$new_exc)" | bc -l)
39echo New aphelie = $(echo "$halfaxe*(1+$new_exc)" | bc -l)
40echo New peri_day = $solp
Note: See TracBrowser for help on using the repository browser.