Last change
on this file since 3026 was
3026,
checked in by jbclement, 17 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
|
Rev | Line | |
---|
[3024] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | # Bash script to modify the orbital parameters of a file "startfi.nc" |
---|
| 4 | name_file="startfi.nc" |
---|
| 5 | |
---|
[3026] | 6 | new_obl=30.0286 |
---|
| 7 | new_exc=0.08212066 |
---|
| 8 | new_Lsp=347.443947402 |
---|
[3024] | 9 | |
---|
[3026] | 10 | |
---|
| 11 | # Calculate modified values |
---|
[3024] | 12 | year_day=669. |
---|
| 13 | halfaxe=227.94 |
---|
| 14 | pi=$(echo "4*a(1)" | bc -l) |
---|
[3026] | 15 | degrad=$(echo "360./(2.*$pi)" | bc -l) |
---|
| 16 | tan=$(echo "s(0.5*$new_Lsp/$degrad)/c(0.5*$new_Lsp/$degrad)" | bc -l) |
---|
| 17 | zx0=$(echo "-2.*a($tan*sqrt((1.-$new_exc)/(1.+$new_exc)))" | bc -l) |
---|
| 18 | if [ $(echo "$zx0 <= 0" | bc -l) -eq 1 ]; then |
---|
[3024] | 19 | zx0=$(echo "$zx0 + 2.*$pi" | bc -l) |
---|
| 20 | fi |
---|
| 21 | solp=$(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 |
---|
[3026] | 26 | # controle(17) = peri_day ! date of perihelion (sols since N. spring) |
---|
[3024] | 27 | # controle(18) = obliquit ! Obliquity of the planet (deg) ̃23.98 |
---|
| 28 | ncap2 -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 |
---|
| 35 | mv $name_file.temp $name_file |
---|
[3026] | 36 | |
---|
| 37 | echo New obliquit = $new_obl |
---|
| 38 | echo New periheli = $(echo "$halfaxe*(1-$new_exc)" | bc -l) |
---|
| 39 | echo New aphelie = $(echo "$halfaxe*(1+$new_exc)" | bc -l) |
---|
| 40 | echo New peri_day = $solp |
---|
Note: See
TracBrowser
for help on using the repository browser.