forked from ESCOMP/CISM
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDyCoreToGlimmer.H
147 lines (113 loc) · 4.01 KB
/
DyCoreToGlimmer.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// The DyCoreToGlimmer class provides methods to move Glimmer Fortran data to C++ structures
// for access by C++ based dynamical cores. The structure names and structure member
// names mostly correspond to derived types defined in Glimmer. In general, pointers to
// the Fortran data arrays are used, rather than copies of these arrays. This saves space
// and reduces the steps needed to update the Glimmer data between calls to the core
// ice sheet modeling program. Methods are provided to set these array pointers, and
// copy array dimension information. Objects of this class are accessed by extern C
// routines in dycore_to_glimmer_extern.cpp, and by the dynamical core front end. DMR--5/24/10
//#pragma once
#ifndef DYCORETOGLIMMER
#define DYCORETOGLIMMER
#include <stdio.h>
#include <iostream>
class DyCoreToGlimmer
{
private:
// Keep track of dycore_type and dycore_index. Dycore_index is used to index the
// the external dycore object storage array.
struct {
int dycore_type;
int dycore_index;
} dycore_info;
// The following structures are based on the derived types in glide_types.F90
struct {
double * thck;
double * usrf;
double * lsrf;
double * topg;
double * floating_mask;
double * ice_mask;
double * lower_cell_loc; // z-location of lowest cell-center
double * lower_cell_temp; // temperature in lowest cell
long * dimInfo;
long * ewlb;
long * ewub;
long * nslb;
long * nsub;
long * nhalo;
//double * thkmask;
//double * marine_bc_normal;
} geometry;
struct {
double * uvel; //output
double * vvel; //output
double * wvel;
double * wgrd;
double * btrc; // basal traction coefficient
long * dimInfo;
} velocity;
struct {
double * temp; // Three-dimensional temperature field.
double * bheatflx; // basal heat flux (2D)
double * bmlt; // Basal melt-rate
long * dimInfo;
} temper;
struct {
} lithot_type;
struct {
double * tstart;
double * tend;
double * time;
//double * tinc;
double * dew; // ew cell size
double * dns; // ns cell size
} numerics;
struct {
double * acab; // Annual mass balance.
double * acab_tavg; // Annual mass balance (time average)
double * calving; // Calving flux (scaled as mass balance, thickness, etc)
long * dimInfo;
double * eus; // eustatic sea level
} climate;
struct {
double * beta; // basal shear coefficient
double * btraction; // -dir (1,:,:) and y-dir (2,:,:) "consistent" basal
// traction fields (calculated from matrix coeffs)
long dimInfo;
} velocity_hom;
struct {
double seconds_per_year;
double gravity;
double rho_ice;
double rho_seawater;
double therm_diffusivity_ice;
double heat_capacity_ice;
} constants;
struct {
long * communicator;
long * process_count;
long * my_rank;
} mpi_vars;
public:
DyCoreToGlimmer();
virtual ~DyCoreToGlimmer();
int setDoubleVar( double *var, const char *var_name, const char *struct_name);
double * getDoubleVar( const char *var_name, const char *struct_name);
int setLongVar( long * var, const char * var_name, const char *struct_name);
long * getLongVar( const char * var_name, const char *struct_name);
int setInt4Var( int * var, const char * var_name, const char *struct_name);
int * getInt4Var( const char * var_name, const char *struct_name);
int copyInDoubleVar( const double *var, const char *var_name,
const char *struct_name, const long *var_dim_info);
int copyInLongVar( const long *var, const char *var_name,
const char *struct_name, const long *var_dim_info);
virtual int initDyCore(const char *input_fname); // = 0;
virtual int runDyCore(double& cur_time_yr, const double time_inc_yr); // = 0;
virtual int deleteDyCore(); // = 0;
int setDyCoreType(const int dycore_type);
int getDyCoreType();
int setDyCoreIndex(const int dycore_index);
int getDyCoreIndex();
};
#endif