source: trunk/LMDZ.MARS/deftank/pem/modify_startfi.sh @ 3024

Last change on this file since 3024 was 3024, checked in by jbclement, 17 months ago

Mars Deftank:
Addition of a bash script "modify_startfi.sh" to modify orbital parameters in "startfi.nc". It is needed to initialize the PCM/PEM simulation with right orbital parameters according to the year in Laskar data.
JBC

  • Property svn:executable set to *
File size: 1.1 KB
RevLine 
[3024]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.
7new_exc=0.
8new_Lsp=250.
9
10year_day=669.
11halfaxe=227.94
12
13
14# Calculate modified values
15pi=$(echo "4*a(1)" | bc -l)
16arg=$(echo "0.5*2.*$pi*$new_Lsp/360." | bc -l)
17zx0=$(echo "-2.*-2.0*a(s($arg)/c($arg)*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(16) = 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
Note: See TracBrowser for help on using the repository browser.