source: LMDZ6/branches/LMDZ-tracers/libf/dyn3d_common/iso_verif_dyn.F90 @ 3852

Last change on this file since 3852 was 3852, checked in by dcugnet, 3 years ago

Extension of the tracers management.

The tracers files can be:

1) "traceur.def": old format, with:

  • the number of tracers on the first line
  • one line for each tracer: <tracer name> <hadv> <vadv> [<parent name>]

2) "tracer.def": new format with one section each model component.
3) "tracer_<name>.def": new format with a single section.

The formats 2 and 3 reading is driven by the "type_trac" key, which can be a

coma-separated list of components.

  • Format 2: read the sections from the "tracer.def" file.
  • format 3: read one section each "tracer_<section name>.def" file.
  • the first line of a section is "&<section name>
  • the other lines start with a tracer name followed by <key>=<val> pairs.
  • the "default" tracer name is reserved ; the other tracers of the section inherit its <key>=<val>, except for the keys that are redefined locally.

This format helps keeping the tracers files compact, thanks to the "default"
special tracer and the three levels of factorization:

  • on the tracers names: a tracer name can be a coma-separated list of tracers => all the tracers of the list have the same <key>=<val> properties
  • on the parents names: the value of the "parent" property can be a coma-separated list of tracers => only possible for geographic tagging tracers
  • on the phases: the property "phases" is [g](l][s] (gas/liquid/solid)

Read information is stored in the vector "tracers(:)", of derived type "tra".

"isotopes_params.def" is a similar file, with one section each isotopes family.
It contains a database of isotopes properties ; if there are second generation
tracers (isotopes), the corresponding sections are read.

Read information is stored in the vector "isotopes(:)", of derived type "iso".

The "getKey" function helps to get the values of the parameters stored in
"tracers" or "isotopes".

File size: 2.1 KB
Line 
1LOGICAL FUNCTION iso_verif_noNaN_nostop(x,err_msg) RESULT(out)
2  USE infotrac, ONLY: isoCheck
3  IMPLICIT NONE
4  !--- Display the message if x is NaN and return .TRUE. if an error occured.
5  REAL,             INTENT(IN) :: x
6  CHARACTER(LEN=*), INTENT(IN) :: err_msg
7  include "iniprint.h"
8  REAL, PARAMETER :: borne=1e19
9  out = .FALSE.
10  IF(.NOT.isoCheck) RETURN
11  out = x<=-borne .OR. x>=borne
12  IF(.NOT.out) RETURN
13  WRITE(lunout,*) 'Error detected by iso_verif_noNaN: '//TRIM(err_msg)
14  WRITE(lunout,*) 'x=',x
15END FUNCTION iso_verif_noNaN_nostop
16
17LOGICAL FUNCTION iso_verif_egalite_nostop(a,b,err_msg) RESULT(out)
18  USE infotrac, ONLY: isoCheck
19  IMPLICIT NONE
20  !--- Display the message if a/=b and return .FALSE. if an error occured.
21  !    Equality is checked for absolute and relative error.
22  REAL,             INTENT(IN) :: a,b
23  CHARACTER(LEN=*), INTENT(IN) :: err_msg
24  include "iniprint.h"
25  REAL, PARAMETER :: errmax=1e-8, errmaxrel=1e-3
26  out = .FALSE.
27  IF(.NOT.isoCheck) RETURN
28  out = ABS(a-b)>errmax
29  IF(out) out = ABS((a-b)/MAX(MAX(ABS(b),ABS(a)),1e-18))>errmaxrel
30  IF(.NOT.out)      RETURN
31  WRITE(lunout,*) 'Error detected by iso_verif_egalite: '//TRIM(err_msg)
32  WRITE(lunout,*) 'a=',a
33  WRITE(lunout,*) 'b=',b
34END FUNCTION iso_verif_egalite_nostop
35
36LOGICAL FUNCTION iso_verif_aberrant_nostop(x,kiso,q,err_msg) RESULT(out)
37  USE infotrac, ONLY: isoCheck, tnat
38  IMPLICIT NONE
39  !--- Display the message if a/=b and return .FALSE. if an error occured.
40  !    Equality is checked for absolute and relative error.
41  REAL,             INTENT(IN) :: x, q
42  INTEGER,          INTENT(IN) :: kiso ! 2=HDO, 1=O18
43  CHARACTER(LEN=*), INTENT(IN) :: err_msg
44  include "iniprint.h"
45  REAL, PARAMETER :: qmin=1e-11, deltaDmax=200.0, deltaDmin=-999.9
46  REAL :: deltaD
47  out = .FALSE.
48  IF(.NOT.isoCheck) RETURN
49  IF(q<qmin)        RETURN
50  deltaD = (x/q/tnat(kiso)-1)*1000
51  out = deltaD>deltaDmax .OR. deltaD<deltaDmin
52  IF(.NOT.out)      RETURN
53  WRITE(lunout,*) 'Error detected by iso_verif_aberrant: '//TRIM(err_msg)
54  WRITE(lunout,*) 'q = ',q
55  WRITE(lunout,*) 'deltaD = ',deltaD
56  WRITE(lunout,*) 'kiso = ',kiso
57END FUNCTION iso_verif_aberrant_nostop
58
Note: See TracBrowser for help on using the repository browser.