Commit 6afa3dc7 authored by Miguel Tremblay's avatar Miguel Tremblay
Browse files

Everything that we need to retrieve the temperature for all the levels into the ground.

parent 56bcecc0
......@@ -51,7 +51,7 @@
* EPSILON, Z0, Z0T, ZU, ZT, ECHEC, dpRT,
* dpRA, dpSN,
* npRC, dpIR, dpSF, dpFV,
* dpFC, dpFA, dpG, dpBB, dpFP, dpSST)
* dpFC, dpFA, dpG, dpBB, dpFP, dpSST, dpLT)
IMPLICIT NONE
INTEGER i, j
......@@ -114,10 +114,10 @@
DOUBLE PRECISION dpFC(DTMAX), dpFA(DTMAX)
DOUBLE PRECISION dpG(DTMAX), dpBB(DTMAX)
DOUBLE PRECISION dpRT(DTMAX), dpFV(DTMAX)
DOUBLE PRECISION dpFP(DTMAX), dpSST(DTMAX)
DOUBLE PRECISION dpFP(DTMAX), dpSST(DTMAX), dpLT(DTMAX*n)
INTEGER npRC(DTMAX)
***
* Input/Output
* Output
* ---------------
* FLUX Matrix contening the output fields
* FLUX(1,i): FT(i)
......@@ -138,6 +138,7 @@
* 6. -> Freezing rain
* 7. -> Snow
* TS:Time series of surface temperature
* dpLT: Temperature at every level of the grid
***
LOGICAL ECHEC
DOUBLE PRECISION ER1, ER2
......@@ -344,14 +345,9 @@
dpFP(i) = PRG
dpG(i) = G(0)
dpSST(i) = T(ir40, now)
IF ( MOD(i,40) .eq. 0 ) THEN
* WRITE(*,*) "<vl>", i
DO j=1, iref
* WRITE(*,*) '<level-temp num="', j-1, '">', T(j, now),
* * '</lev-temp>'
END DO
* WRITE(*,*) "</vl>"
END IF
DO j=1, iref
dpLT((i-1)*iref+j) = T(j, now)
END DO
G(1) = CNT(1,1) * ( T(2,now) - T(1,now) )
* Phase Transition when passing the melting point
......
......@@ -79,6 +79,7 @@ static struct doubleStruct stFP; /* Phase change energy */
static struct longStruct stEc; /* Boolean to know if the execution was a success */
static struct doubleStruct stSST; /* Subsurface temperature */
static struct doubleStruct stDepth; /* Depth of grid levels */
static struct doubleStruct stLT; /* Level temperature */
/****************************************************************************
Name: Do_Metro
......@@ -196,7 +197,7 @@ void Do_Metro( BOOL bFlat, double dMLat, double dMLon, double* dpZones, long nNb
long nDeltaTIndice=0;
/* Allocate memory for all structures */
init_structure(nDTMAX);
init_structure(nDTMAX, nNGRILLEMAX);
for (i=0; i<nNbrTimeSteps; i++){
......@@ -350,7 +351,7 @@ void Do_Metro( BOOL bFlat, double dMLat, double dMLon, double* dpZones, long nNb
stRT.pdArray, stRA.pdArray ,stSN.pdArray, stRC.plArray,\
stIR.pdArray, stSF.pdArray, stFV.pdArray, stFC.pdArray,\
stFA.pdArray, stG.pdArray, stBB.pdArray, stFP.pdArray,\
stSST.pdArray);
stSST.pdArray, stLT.pdArray);
if(*(stEc.plArray)){
if(!bSilent)
......@@ -385,43 +386,45 @@ int main(argc, argv)
return 0;
}
void init_structure(long nSize)
void init_structure(long nTimeStepMax, long nGrilleLevelMax)
{
/* Memory allocation */
/* Size */
stRC.nSize = nSize;
stRA.nSize = nSize;
stRT.nSize = nSize;
stIR.nSize = nSize;
stSF.nSize = nSize;
stSN.nSize = nSize;
stFV.nSize = nSize;
stFC.nSize = nSize;
stFA.nSize = nSize;
stG.nSize = nSize;
stBB.nSize = nSize;
stFP.nSize = nSize;
stRC.nSize = nTimeStepMax;
stRA.nSize = nTimeStepMax;
stRT.nSize = nTimeStepMax;
stIR.nSize = nTimeStepMax;
stSF.nSize = nTimeStepMax;
stSN.nSize = nTimeStepMax;
stFV.nSize = nTimeStepMax;
stFC.nSize = nTimeStepMax;
stFA.nSize = nTimeStepMax;
stG.nSize = nTimeStepMax;
stBB.nSize = nTimeStepMax;
stFP.nSize = nTimeStepMax;
stEc.nSize = 1;
stSST.nSize = nSize;
stSST.nSize = nTimeStepMax;
stDepth.nSize = 0; /* Will be computed later */
stLT.nSize = nTimeStepMax*nGrilleLevelMax;
/* Memory alloc */
stRC.plArray = (long*)calloc((nSize),sizeof(long));
stRA.pdArray = (double*)calloc((nSize),sizeof(double));
stIR.pdArray = (double*)calloc((nSize),sizeof(double));
stSF.pdArray = (double*)calloc((nSize),sizeof(double));
stRT.pdArray = (double*)calloc((nSize),sizeof(double));
stSN.pdArray = (double*)calloc((nSize),sizeof(double));
stFV.pdArray = (double*)calloc((nSize),sizeof(double));
stFC.pdArray = (double*)calloc((nSize),sizeof(double));
stFA.pdArray = (double*)calloc((nSize),sizeof(double));
stG.pdArray = (double*)calloc((nSize),sizeof(double));
stBB.pdArray = (double*)calloc((nSize),sizeof(double));
stFP.pdArray = (double*)calloc((nSize),sizeof(double));
stRC.plArray = (long*)calloc((nTimeStepMax),sizeof(long));
stRA.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stIR.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stSF.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stRT.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stSN.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stFV.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stFC.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stFA.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stG.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stBB.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stFP.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stEc.plArray = (long*)calloc((1),sizeof(long));
stSST.pdArray = (double*)calloc((nSize),sizeof(double));
stDepth.pdArray = (double*)calloc((nSize),sizeof(double));
stSST.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stDepth.pdArray = (double*)calloc((nTimeStepMax),sizeof(double));
stLT.pdArray = (double*)calloc((nTimeStepMax*nGrilleLevelMax),sizeof(double));
}
struct doubleStruct get_ra(void){
......@@ -505,3 +508,8 @@ long get_nbr_levels(void){
return stDepth.nSize;
}
struct doubleStruct get_lt(void){
return stLT;
}
......@@ -42,7 +42,7 @@
void Do_Metro(BOOL bFlat, double dMLat, double dMLon, double* dpZones, long nNbrOfZone, long* npMateriau, double* dpTA, double* dpQP, double* dpFF, double* dpPS, double* dpFsPy, double* dpFI, double* dpFT, double* dpTYP, double* dpRc, double* dpTAO, double* dpRTO, double* dpDTO, double* dpAH, double* dpTimeO, long* npSWO, BOOL* bpNoObs, double dDeltaT, long nLenObservation, long nNbrTimeSteps, BOOL bSilent);
void init_structure(long nSize);
void init_structure(long nTimeStepMax, long nGrilleLevelMax);
struct doubleStruct get_ra(void);
struct doubleStruct get_sn(void);
......@@ -60,3 +60,4 @@ struct longStruct get_echec(void);
struct doubleStruct get_sst(void);
struct doubleStruct get_depth(void);
long get_nbr_levels(void);
struct doubleStruct get_lt(void);
......@@ -408,3 +408,4 @@ extern struct longStruct get_echec(void);
extern struct doubleStruct get_sst(void);
extern struct doubleStruct get_depth(void);
extern long get_nbr_levels(void);
extern struct doubleStruct get_lt(void);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment