-!! "tracer","atmos_mod","sphum" -!! -!! "tracer","atmos_mod","sf6" -!! "longname","sulf_hex" -!! "advection_scheme_horiz","2nd_order" -!! "Profile_type","Fixed","surface_value = 0.0E+00"/ -!! -!! "prog_tracers","ocean_mod","age_global" -!! horizontal-advection-scheme = mdfl_sweby -!! vertical-advection-scheme = mdfl_sweby -!! restart_file = ocean_age.res.nc -!!-!! -!! The field table consists of entries in the following format. -!! -!! The first line of an entry should consist of three quoted strings. -!! -!! The first quoted string will tell the field manager what type of -!! field it is. -!! -!! The second quoted string will tell the field manager which model the -!! field is being applied to. -!! The supported types at present are -!!
-!! "coupler_mod" for the coupler, -!! "atmos_mod" for the atmosphere model, -!! "ocean_mod" for the ocean model, -!! "land_mod" for the land model, and, -!! "ice_mod" for the ice model. -!!-!! The third quoted string should be a unique name that can be used as a -!! query. -!! -!! The second and following lines of each entry are called methods in -!! this context. Methods can be developed within any module and these -!! modules can query the field manager to find any methods that are -!! supplied in the field table. -!! -!! These lines can be coded quite flexibly. -!! -!! The line can consist of two or three quoted strings or a simple unquoted -!! string. -!! -!! If the line consists two or three quoted strings, then the first string will -!! be an identifier that the querying module will ask for. -!! -!! The second string will be a name that the querying module can use to -!! set up values for the module. -!! -!! The third string, if present, can supply parameters to the calling module that can be -!! parsed and used to further modify values. -!! -!! If the line consists of a simple unquoted string then quotes are not allowed -!! in any part of the line. -!! -!! An entry is ended with a backslash (/) as the final character in a -!! row. -!! -!! Comments can be inserted in the field table by having a # as the -!! first character in the line. -!! -!! In the example above we have three field entries. -!! -!! The first is a simple declaration of a tracer called "sphum". -!! -!! The second is for a tracer called "sf6". In this case a field named -!! "longname" will be given the value "sulf_hex". A field named -!! "advection_scheme_horiz" will be given the value "2nd_order". Finally a field -!! name "Profile_type" will be given a child field called "Fixed", and that field -!! will be given a field called "surface_value" with a real value of 0.0E+00. -!! -!! The third entry is an example of a oceanic age tracer. Note that the -!! method lines are formatted differently here. This is the flexibility mentioned -!! above. -!! -!! With these formats, a number of restrictions are required. -!! -!! The following formats are equally valid. -!!
-!! "longname","sulf_hex" -!! "longname = sulf_hex" -!! longname = sulf_hex -!!-!! However the following is not valid. -!!
-!! longname = "sulf_hex" -!!-!! -!! In the SF6 example above the last line of the entry could be written in the -!! following ways. -!!
-!! "Profile_type","Fixed","surface_value = 0.0E+00"/ -!! Profile_type/Fixed/surface_value = 0.0E+00/ -!!-!! -!! Values supplied with fields are converted to the various types with the -!! following assumptions. -!!
-!! Real values : These values contain a decimal point or are in exponential format. -!! These values only support e or E format for exponentials. -!! e.g. 10.0, 1e10 and 1E10 are considered to be real numbers. -!! -!! Integer values : These values only contain numbers. -!! e.g 10 is an integer. 10.0 and 1e10 are not. -!! -!! Logical values : These values are supplied as one of the following formats. -!! T, .T., TRUE, .TRUE. -!! t, .t., true, .true. -!! F, .F., FALSE, .FALSE. -!! f, .f., false, .false. -!! These will be converted to T or F in a dump of the field. -!! -!! Character strings : These values are assumed to be strings if a character -!! other than an e (or E) is in the value. Numbers can be suppled in the value. -!! If the value does not meet the criteria for a real, integer or logical type, -!! it is assumed to be a character type. -!!-!! The entries within the field table can be designed by the individual -!! authors of code to allow modification of their routines. -!! - -!> @addtogroup field_manager_mod -!> @{ -module field_manager_mod -#ifndef use_yaml -#ifndef MAXFIELDS_ -#define MAXFIELDS_ 250 -#endif -#endif - -#ifndef use_yaml -#ifndef MAXFIELDMETHODS_ -#define MAXFIELDMETHODS_ 250 -#endif -#endif - -! -!
-! use time_manager_mod -! implicit none -! type(time_type) :: dt, init_date, astro_base_date, time, final_date -! type(time_type) :: next_rad_time, mid_date -! type(time_type) :: repeat_alarm_freq, repeat_alarm_length -! integer :: num_steps, i, days, months, years, seconds, minutes, hours -! integer :: months2, length -! real :: astro_days -! -! !Set calendar type -! ! call set_calendar_type(THIRTY_DAY_MONTHS) -! call set_calendar_type(JULIAN) -! ! call set_calendar_type(NOLEAP) -! -! ! Set timestep -! dt = set_time(1100, 0) -! -! ! Set initial date -! init_date = set_date(1992, 1, 1) -! -! ! Set date for astronomy delta calculation -! astro_base_date = set_date(1970, 1, 1, 12, 0, 0) -! -! ! Copy initial time to model current time -! time = init_date -! -! ! Determine how many steps to do to run one year -! final_date = increment_date(init_date, years = 1) -! num_steps = (final_date - init_date) / dt -! write(*, *) 'Number of steps is' , num_steps -! -! ! Want to compute radiation at initial step, then every two hours -! next_rad_time = time + set_time(7200, 0) -! -! ! Test repeat alarm -! repeat_alarm_freq = set_time(0, 1) -! repeat_alarm_length = set_time(7200, 0) -! -! ! Loop through a year -! do i = 1, num_steps -! -! ! Increment time -! time = time + dt -! -! ! Test repeat alarm -! if(repeat_alarm(time, repeat_alarm_freq, repeat_alarm_length)) & -! write(*, *) 'REPEAT ALARM IS TRUE' -! -! ! Should radiation be computed? Three possible tests. -! ! First test assumes exact interval; just ask if times are equal -! ! if(time == next_rad_time) then -! ! Second test computes rad on last time step that is <= radiation time -! ! if((next_rad_time - time) < dt .and. time < next_rad) then -! ! Third test computes rad on time step closest to radiation time -! if(interval_alarm(time, dt, next_rad_time, set_time(7200, 0))) then -! call get_date(time, years, months, days, hours, minutes, seconds) -! write(*, *) days, month_name(months), years, hours, minutes, seconds -! -! ! Need to compute real number of days between current time and astro_base -! call get_time(time - astro_base_date, seconds, days) -! astro_days = days + seconds / 86400. -! ! write(*, *) 'astro offset ', astro_days -! end if -! -! ! Can compute daily, monthly, yearly, hourly, etc. diagnostics as for rad -! -! ! Example: do diagnostics on last time step of this month -! call get_date(time + dt, years, months2, days, hours, minutes, seconds) -! call get_date(time, years, months, days, hours, minutes, seconds) -! if(months /= months2) then -! write(*, *) 'last timestep of month' -! write(*, *) days, months, years, hours, minutes, seconds -! endif -! -! ! Example: mid-month diagnostics; inefficient to make things clear -! length = days_in_month(time) -! call get_date(time, years, months, days, hours, minutes, seconds) -! mid_date = set_date(years, months, 1) + set_time(0, length) / 2 -! -! if(time < mid_date .and. (mid_date - time) < dt) then -! write(*, *) 'mid-month time' -! write(*, *) days, months, years, hours, minutes, seconds -! endif -! -! end do -! -!-! end program time_main2 - -!
-! use time_manager_mod -! implicit none -! type(time_type) :: dt, init_date, astro_base_date, time, final_date -! type(time_type) :: next_rad_time, mid_date -! type(time_type) :: repeat_alarm_freq, repeat_alarm_length -! integer :: num_steps, i, days, months, years, seconds, minutes, hours -! integer :: months2, length -! real :: astro_days -! -! !Set calendar type -! ! call set_calendar_type(THIRTY_DAY_MONTHS) -! call set_calendar_type(JULIAN) -! ! call set_calendar_type(NOLEAP) -! -! ! Set timestep -! dt = set_time(1100, 0) -! -! ! Set initial date -! init_date = set_date(1992, 1, 1) -! -! ! Set date for astronomy delta calculation -! astro_base_date = set_date(1970, 1, 1, 12, 0, 0) -! -! ! Copy initial time to model current time -! time = init_date -! -! ! Determine how many steps to do to run one year -! final_date = increment_date(init_date, years = 1) -! num_steps = (final_date - init_date) / dt -! write(*, *) 'Number of steps is' , num_steps -! -! ! Want to compute radiation at initial step, then every two hours -! next_rad_time = time + set_time(7200, 0) -! -! ! Test repeat alarm -! repeat_alarm_freq = set_time(0, 1) -! repeat_alarm_length = set_time(7200, 0) -! -! ! Loop through a year -! do i = 1, num_steps -! -! ! Increment time -! time = time + dt -! -! ! Test repeat alarm -! if(repeat_alarm(time, repeat_alarm_freq, repeat_alarm_length)) & -! write(*, *) 'REPEAT ALARM IS TRUE' -! -! ! Should radiation be computed? Three possible tests. -! ! First test assumes exact interval; just ask if times are equal -! ! if(time == next_rad_time) then -! ! Second test computes rad on last time step that is <= radiation time -! ! if((next_rad_time - time) < dt .and. time < next_rad) then -! ! Third test computes rad on time step closest to radiation time -! if(interval_alarm(time, dt, next_rad_time, set_time(7200, 0))) then -! call get_date(time, years, months, days, hours, minutes, seconds) -! write(*, *) days, month_name(months), years, hours, minutes, seconds -! -! ! Need to compute real number of days between current time and astro_base -! call get_time(time - astro_base_date, seconds, days) -! astro_days = days + seconds / 86400. -! ! write(*, *) 'astro offset ', astro_days -! end if -! -! ! Can compute daily, monthly, yearly, hourly, etc. diagnostics as for rad -! -! ! Example: do diagnostics on last time step of this month -! call get_date(time + dt, years, months2, days, hours, minutes, seconds) -! call get_date(time, years, months, days, hours, minutes, seconds) -! if(months /= months2) then -! write(*, *) 'last timestep of month' -! write(*, *) days, months, years, hours, minutes, seconds -! endif -! -! ! Example: mid-month diagnostics; inefficient to make things clear -! length = days_in_month(time) -! call get_date(time, years, months, days, hours, minutes, seconds) -! mid_date = set_date(years, months, 1) + set_time(0, length) / 2 -! -! if(time < mid_date .and. (mid_date - time) < dt) then -! write(*, *) 'mid-month time' -! write(*, *) days, months, years, hours, minutes, seconds -! endif -! -! end do -! -!-! end program time_main2 - -!