void IdealGasPhase::getGibbs_ref(doublereal* g) const { const vector_fp& gibbsrt = gibbs_RT_ref(); scale(gibbsrt.begin(), gibbsrt.end(), g, _RT()); }
/* * Returns the vector of the * gibbs function of the reference state at the current temperature * and reference pressure. * units = J/kmol */ void PecosGasPhase::getGibbs_ref(doublereal *g) const { const array_fp& gibbsrt = gibbs_RT_ref(); scale(gibbsrt.begin(), gibbsrt.end(), g, _RT()); }
void PecosGasPhase::getStandardVolumes_ref(doublereal *vol) const { doublereal tmp = _RT() / m_p0; for (int k = 0; k < m_kk; k++) { vol[k] = tmp; } }
//==================================================================================================================== void FixedChemPotSSTP::getEnthalpy_RT_ref(doublereal* hrt) const { double rt = _RT(); hrt[0] = chemPot_ / rt; }
//==================================================================================================================== void FixedChemPotSSTP::getGibbs_RT_ref(doublereal* grt) const { double rt = _RT(); grt[0] = chemPot_ / rt; }
/* Give some pretty, formatted output */ int mr4kd_sprintf ( char *dest, char *name, uint32_t instruction, uint32_t pc, char *fmt ) { /* ** Format specifiers: ** - %rs ** - %rt ** - %rd ** ** - %fs ** - %ft ** - %fd ** ** - %cp Coprocessor register ** ** - %ff FP mode (single, double etc) ** - %fc FP compare condition ** ** - %ih Immediate (hex) ** - %id Immediate (dec) ** - %br Branch address ** - %jm Jump target ** ** - %co COP # ** ** - %ns Name ** - %nc Name with COP number ** - %nf Name with FP format ** ** - %sa Shift amount ** ** - %SP Remainder spacing */ int s = 0; /* Source */ int d = 0; /* Dest */ uint16_t token; /* Scan the format string for specifiers */ for( s = 0; fmt[s]; s++ ) { /* No token? */ if( fmt[s] != '%' ) { dest[d++] = fmt[s]; continue; } /* Got token, read it in */ token = (fmt[s + 1] << 8 | fmt[s + 2]); /* Check */ switch( token ) { /* GPRs */ case TOKEN('r', 's'): d += mr4kd_rcpy_gpr( &dest[d], _RS(instruction) ); break; case TOKEN('r', 't'): d += mr4kd_rcpy_gpr( &dest[d], _RT(instruction) ); break; case TOKEN('r', 'd'): d += mr4kd_rcpy_gpr( &dest[d], _RD(instruction) ); break; /* FPRs */ case TOKEN('f', 's'): d += mr4kd_rcpy_fpr( &dest[d], _FS(instruction) ); break; case TOKEN('f', 't'): d += mr4kd_rcpy_fpr( &dest[d], _FT(instruction) ); break; case TOKEN('f', 'd'): d += mr4kd_rcpy_fpr( &dest[d], _FD(instruction) ); break; /* COP */ case TOKEN('c', 'p'): d += sprintf( &dest[d], "%s", registers_a_cop[_FS(instruction)] ); break; /* Immediate (hex) */ case TOKEN('i', 'h'): d += sprintf( &dest[d], MR4KD_FLAG_GET(MR4KD_HLOWER) ? "0x%04x" : "0x%04X", _IMMEDIATE(instruction) ); break; /* Immediate (decimal) */ case TOKEN('i', 'd'): d += sprintf( &dest[d], "%i", (int)((short)_IMMEDIATE(instruction)) ); break; /* Branch address */ case TOKEN('b', 'r'): d += sprintf( &dest[d], MR4KD_FLAG_GET(MR4KD_HLOWER) ? "0x%08x" : "0x%08X", ((unsigned int)pc + 4 + (short)(instruction & 0xFFFF) * 4) ); break; /* Jump target */ case TOKEN('j', 'm'): d += sprintf( &dest[d], MR4KD_FLAG_GET(MR4KD_HLOWER) ? "0x%08x" : "0x%08X", _TARGET(instruction) | (pc & 0xF0000000) ); break; /* Coprocessor number */ case TOKEN('c', 'o'): d += sprintf( &dest[d], "%u", _COP(instruction) ); break; /* Shift amount */ case TOKEN('s', 'a'): d += sprintf( &dest[d], "%u", _SHAM(instruction) ); break; /* Floating point compare mode */ case TOKEN('f', 'c'): d += sprintf( &dest[d], "%s", fp_compare_types[instruction & 0xF] ); break; /* Floating point mode */ case TOKEN('f', 'f'): d += sprintf( &dest[d], "%c", fpu_fmt_names[_FMT(instruction) - 16] ); break; /* Spacing! */ case TOKEN('S', 'P'): d += sprintf( &dest[d], "%*s", (int)-((mr4kd_conf >> 24) - d), " "); break; /* Instruction name - regular (no space) */ case TOKEN('n', '0'): { int i; char nb[32]; /* Convert to the proper case */ for( i = 0; name[i]; i++ ) nb[i] = ( mr4kd_conf & MR4KD_OLOWER ) ? tolower((uint8_t)name[i]) : toupper((uint8_t)name[i]); /* Copy it to dest */ d += sprintf( &dest[d], "%.*s", i, nb ); } break; /* Instruction name - regular */ case TOKEN('n', 's'): { int i; char nb[32]; /* Convert to the proper case */ for( i = 0; name[i]; i++ ) nb[i] = ( mr4kd_conf & MR4KD_OLOWER ) ? tolower((uint8_t)name[i]) : toupper((uint8_t)name[i]); /* Copy it to dest */ d += sprintf( &dest[d], "%*.*s", (int)-(mr4kd_conf >> 24), i, nb ); } break; /* Instruction name - with COP# */ case TOKEN('n', 'c'): { int i; char nb[32]; /* Convert to the proper case */ for( i = 0; name[i]; i++ ) nb[i] = ( mr4kd_conf & MR4KD_OLOWER ) ? tolower((uint8_t)name[i]) : toupper((uint8_t)name[i]); /* Copy number */ i += sprintf( &nb[i], "%u", _COP(instruction) ); /* Copy it to dest */ d += sprintf( &dest[d], "%*.*s", (int)-(mr4kd_conf >> 24), i, nb ); } break; /* Floating point format */ case TOKEN('n', 'f'): { int i; char nb[32]; /* Convert to the proper case */ for( i = 0; name[i]; i++ ) nb[i] = ( mr4kd_conf & MR4KD_OLOWER ) ? tolower((uint8_t)name[i]) : toupper((uint8_t)name[i]); /* Copy the precision mode */ i += sprintf( &nb[i], ".%c",( mr4kd_conf & MR4KD_OLOWER ) ? tolower((uint8_t)fpu_fmt_names[_FMT(instruction)-16]) : toupper((uint8_t)fpu_fmt_names[_FMT(instruction)-16]) ); /* Copy it to dest */ d += sprintf( &dest[d], "%*.*s", (int)-(mr4kd_conf >> 24), i, nb ); } break; } /* Update source pointer */ s += 2; } /* Null terminate output */ dest[d] = 0; /* Return chars processed */ return d; }
void LatticePhase::getPureGibbs(doublereal* gpure) const { const array_fp& gibbsrt = gibbs_RT_ref(); scale(gibbsrt.begin(), gibbsrt.end(), gpure, _RT()); }
void LatticePhase::getStandardChemPotentials(doublereal* mu0) const { const array_fp& gibbsrt = gibbs_RT_ref(); scale(gibbsrt.begin(), gibbsrt.end(), mu0, _RT()); }
doublereal MixtureFugacityTP::z() const { return pressure() * meanMolecularWeight() / (density() * _RT()); }
void MixtureFugacityTP::getGibbs_ref(doublereal* g) const { const vector_fp& gibbsrt = gibbs_RT_ref(); scale(gibbsrt.begin(), gibbsrt.end(), g, _RT()); }