Commit d66bfbe8 authored by alainm's avatar alainm
Browse files

regroup a few fields under ThermoFields


git-svn-id: https://svn.oca.eu/codes/DISK/fargoADC@2382 d5a9fe6a-16c7-4aab-97df-e63fc41ba8b9

Former-commit-id: 2f1df94884fe163a4ddbf5d8dcfddfca086fe48d
parent c68e255c
......@@ -21,7 +21,7 @@ namespace ADC {
Force *AllocateForce (void);
void FreeForce (Force *force);
void ComputeForce (Force *force, PolarGrid *Density, PlanetarySystem* sys, int planet_index, real* torque, int flag_torque=2);
void UpdateForceLog (Force *fc, PlanetarySystem *psys, PolarGrid *Density, PolarGrid *Energy, int outputnb, real time);
void UpdateForceLog (Force *fc, PlanetarySystem *psys, PolarGrid *Densityd, int outputnb, real time);
real HillCut (real d, real rh);
void GetTorque (real* torque1D, PolarGrid* Density, PlanetarySystem *sys, int planetindex);
}
......
#ifndef FARGO_ADC_CHECKCONSERVATION_H
#define FARGO_ADC_CHECKCONSERVATION_H
#include "ADC/PolarGrid.h"
#include "ADC/PlanetarySystem.h"
namespace ADC {
struct PolarGrid;
struct ThermoFields;
real GasTotalMass (PolarGrid* const Density);
real TotalDustMass (PolarGrid* const density, PolarGrid* const dustfraction);
real GasMomentum (PolarGrid *Density, PolarGrid *Vtheta);
real GasTotalEnergy (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, PolarGrid *Energy);
real GasTotalEnergy (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, ThermoFields const* tf);
void CheckMomentumConservation (PolarGrid *Density, PolarGrid *Vtheta, PlanetarySystem *sys);
//dev note : the following were collected from various modules and deserve a new one just for them
void ComputeVortensity (PolarGrid *Density, PolarGrid *Vr, PolarGrid *Vt);
void ComputeQplus (PolarGrid *Density);
void ComputeSoundSpeed (PolarGrid *Density, PolarGrid *Energy, PolarGrid *DustFraction);
void UpdatePressure (PolarGrid *Pressure, PolarGrid *Density, PolarGrid *DustFraction, PolarGrid *Energy);
void ComputeTemperatureField (PolarGrid *Density, PolarGrid *DustFraction, PolarGrid *Energy);
void ComputeSoundSpeed (ThermoFields *thermoFields, PolarGrid *Density, PolarGrid *DustFraction);
void UpdatePressure (ThermoFields *tf, PolarGrid const*Density, PolarGrid const*DustFraction);
void ComputeTemperatureField (ThermoFields *tf, PolarGrid *Density, PolarGrid *DustFraction);
real CircumPlanetaryMass (PolarGrid *Density, PlanetarySystem *sys, int planet_index);
}
#endif
#ifndef FARGO_ADC_DUST_METHOD_H
#define FARGO_ADC_DUST_METHOD_H
#include "ADC/PolarGrid.h"
namespace ADC {
typedef enum { EPS_FLAT, EPS_WINDOW } EpsProfileType;
struct ThermoFields;
struct PolarGrid;
void InitDustFraction (PolarGrid *array, EpsProfileType EpsProfile);
void InitImplicitDust (void);
void ActualiseStoppingTime (PolarGrid *DustFraction, PolarGrid *Density);
void ComputeMatrixElementsDF (PolarGrid *Density, PolarGrid *DustFraction, real dt);
void ComputeMatrixElementsDF (ThermoFields *tf, PolarGrid *Density, PolarGrid *DustFraction, real dt);
void SolveMatrixDF (PolarGrid *Rhs, PolarGrid *DustFraction, PolarGrid *DustFractionNew, PolarGrid *Density, real dt, bool Evanescent);
}
......
......@@ -46,7 +46,7 @@ namespace ADC {
bool UseCentrifugalBalance, ExcludeHill, SloppyCFL;
struct PolarGrid *CellAbscissa;
struct PolarGrid *CellOrdinate;
struct PolarGrid *RhoStar, *RhoInt, *Potential, *Pressure, *SoundSpeed, *Temperature;
struct PolarGrid *RhoStar, *RhoInt, *Potential;
struct PolarGrid *DivergenceVelocity, *TAURR, *TAUPP, *TAURP, *Qplus, *Vortensity;
bool LogGrid;
bool OverridesOutputdir;
......
......@@ -7,23 +7,24 @@
#include "ADC/dustMethods.h"
namespace ADC {
struct ThermoFields;
void StoreTheoretical1DGrids (real *density, real *vr, real *vt, EpsProfileType epsprofile);
void StoreInitialBoundaryValues (PolarGrid *Vr,
PolarGrid *Vt,
PolarGrid *Density,
EpsProfileType EpsProfile);
void Initialization (PolarGrid *gas_density,
PolarGrid *gas_v_rad,
PolarGrid *gas_v_theta,
PolarGrid *gas_energy,
PolarGrid *gas_pressure,
PolarGrid *gas_label,
PolarGrid *dust_fraction,
void Initialization (PolarGrid *gas_density,
PolarGrid *gas_v_rad,
PolarGrid *gas_v_theta,
ThermoFields *thermoFields,
PolarGrid *gas_label,
PolarGrid *dust_fraction,
PlanetarySystem *pla_sys,
EpsProfileType EpsProfile);
void InitGasDensity (PolarGrid *Density, EpsProfileType EpsProfile);
void InitGasEnergy (PolarGrid *Energy, EpsProfileType EpsProfile);
void InitGasEnergy (ThermoFields *thermoFields, EpsProfileType EpsProfile);
void InitGasVelocities (PolarGrid *Vr, PolarGrid *Vt, EpsProfileType EpsProfile);
void InitLabel (PolarGrid *Label, PolarGrid *Density, PolarGrid *DustFraction, PlanetarySystem *sys);
......
#ifndef FARGO_ADC_INTERPRET_H
#define FARGO_ADC_INTERPRET_H
#include <boost/property_tree/ptree.hpp>
#include "ADC/precision.h"
#include "ADC/Param.h"
#include "ADC/timeProcess.h"
namespace ADC {
void var (char const *name, void *ptr, VarType type, bool necessary, char const *deflt);
void ReadVariables (char *filename);
void PrintUsage (char *execname);
real TellNbOrbits (real time);
real TellNbOutputs (real time);
void TellEverything (void);
void GiveTimeInfo (int number);
void InitSpecificTime (bool profiling, TimeProcess *process_name, char const *title);
void GiveSpecificTime (bool profiling, TimeProcess process_name);
void var (char const *name, void *ptr, VarType type, bool necessary, char const *deflt);
void ReadVariables (char *filename, boost::property_tree::ptree& cfg);
void PrintUsage (char *execname);
real TellNbOrbits (real time);
real TellNbOutputs (real time);
void TellEverything (void);
void GiveTimeInfo (int number);
void InitSpecificTime (bool profiling, TimeProcess *process_name, char const *title);
void GiveSpecificTime (bool profiling, TimeProcess process_name);
}
#endif
......@@ -8,17 +8,17 @@
#include "ADC/TracerCollection.h"
namespace ADC {
struct ThermoFields;
void EmptyPlanetSystemFile (PlanetarySystem *sys);
void WriteDiskInfo (PolarGrid *dens, PolarGrid *vr, PolarGrid *vt, PolarGrid *ener,
void WriteDiskInfo (PolarGrid *dens, PolarGrid *vr, PolarGrid *vt, ThermoFields const* tf,
PolarGrid *df, PlanetarySystem *sys);
void WritePlanetSystemFile (PlanetarySystem *sys, int t);
void WriteBigPlanetFile (int TimeStep, int n);
void WriteBigPlanetSystemFile (PlanetarySystem *sys, int t);
void WriteDiskPolar(PolarGrid *array, int number);
void WriteDim (void);
void SendOutput (int output_number, PolarGrid *dens, PolarGrid *gasvr, PolarGrid *gasvt, PolarGrid *gasenerg,
PolarGrid *label, PolarGrid *dustfrac, PolarGrid *dustdens, PolarGrid *gasonlydens, PolarGrid *pressure,
void SendOutput (int output_number, PolarGrid *dens, PolarGrid *gasvr, PolarGrid *gasvt, ThermoFields const* thermoFields,
PolarGrid *label, PolarGrid *dustfrac, PolarGrid *dustdens, PolarGrid *gasonlydens,
PlanetarySystem *sys, TracerCollection *tc);
void WriteTorque (real* torque1D_local, PlanetarySystem* sys, int planet_index, int output_number);
void WriteBigPlanetFile (int TimeStep, int n);
......
......@@ -5,13 +5,14 @@
#include "ADC/Tuples.h"
namespace ADC {
struct ThermoFields;
void ApplySideEuler (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, PolarGrid *Energy, PolarGrid *DustFraction, real step);
void OpenBoundary (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, PolarGrid *Energy, PolarGrid *DustFraction, real step);
void NonReflectingBoundary (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, PolarGrid *Energy, PolarGrid *DustFraction, real step);
void EvanescentBoundary (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, PolarGrid *Energy, PolarGrid *DustFraction, real step);
void OpenMdotBoundary (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, PolarGrid *Energy, PolarGrid *DustFraction, real step);
void FixedBoundary (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, PolarGrid *Energy, PolarGrid *DustFraction, real step);
void ApplySideEuler (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, ThermoFields *thermoFields, PolarGrid *DustFraction, real step);
void OpenBoundary (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, ThermoFields *thermoFields, PolarGrid *DustFraction, real step);
void NonReflectingBoundary (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, ThermoFields *thermoFields, PolarGrid *DustFraction, real step);
void EvanescentBoundary (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, ThermoFields *thermoFields, PolarGrid *DustFraction, real step);
void OpenMdotBoundary (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, ThermoFields *thermoFields, PolarGrid *DustFraction, real step);
void FixedBoundary (PolarGrid *Density, PolarGrid *Vrad, PolarGrid *Vtheta, ThermoFields *thermoFields, PolarGrid *DustFraction, real step);
//dev note : the following belong to a different module
void ApplyOuterSourceMass (PolarGrid *Density, PolarGrid *Vrad);
......
#ifndef FARGO_ADC_SOURCEULER_H
#define FARGO_ADC_SOURCEULER_H
#include "ADC/PolarGrid.h"
#include "ADC/PlanetarySystem.h"
#include "ADC/Force.h"
#include "ADC/dustMethods.h"
#include "ADC/TracerCollection.h"
namespace ADC {
struct PolarGrid;
struct ThermoFields {
int nrad;
int nsec;
PolarGrid *pressure;
PolarGrid *energy;
PolarGrid *energyInt;
PolarGrid *energyNew;
PolarGrid *soundSpeed;
PolarGrid *temperature;
ThermoFields(int nrad, int nsec);
};
void InitEuler (PolarGrid *Vr,
PolarGrid *Vt,
PolarGrid *Density,
PolarGrid *DustFraction,
PolarGrid *Energy,
ThermoFields *tf,
EpsProfileType EpsProfile);
void CopyArrayValues (PolarGrid *array, PolarGrid *newarray);
void AlgoGas (Force *force,
PolarGrid *Density,
PolarGrid *Vrad,
PolarGrid *Vtheta,
PolarGrid *Energy,
ThermoFields *thermoFields,
PolarGrid *Label,
PolarGrid *DustFraction,
PolarGrid *DustDensity,
......@@ -32,11 +45,11 @@ namespace ADC {
real* vrad_init,
real* vtheta_init);
void SubStepDust1 (PolarGrid *DustFraction, PolarGrid *Vtheta, PolarGrid *Density, real dt);
void SubStepDust2 (PolarGrid *DustFraction, PolarGrid *Density, real dt);
void SubStep1 (PolarGrid *Vrad, PolarGrid *Vtheta, PolarGrid *Density, real dt);
void SubStep2 (PolarGrid *Density, PolarGrid *Energy, real dt);
void SubStep3 (PolarGrid *Density, real dt);
void SubStepDust1 (ThermoFields *tf, PolarGrid *DustFraction, PolarGrid *Vtheta, PolarGrid *Density, real dt);
void SubStepDust2 (ThermoFields *tf, PolarGrid *DustFraction, PolarGrid *Density, real dt);
void SubStep1 (ThermoFields const* tf, PolarGrid *Vrad, PolarGrid *Vtheta, PolarGrid *Density, real dt);
void SubStep2 (PolarGrid *Density, ThermoFields *thermoFields, real dt);
void SubStep3 (PolarGrid *Density, ThermoFields *thermoFields, real dt);
//dev note : those belong to other modules
bool DetectCrash (PolarGrid *array);
......@@ -44,6 +57,6 @@ namespace ADC {
real min2 (real a, real b);
real max2 (real a, real b);
int ConditionCFL (PolarGrid *Vrad, PolarGrid *Vtheta, real deltaT);
int ConditionCFL (ThermoFields *tf, PolarGrid *Vrad, PolarGrid *Vtheta, real deltaT);
}
#endif
......@@ -43,7 +43,6 @@ namespace ADC {
extern int NbRestart;
extern int TimeStep;
extern int begin_i;
extern PolarGrid *Pressure;
extern EpsProfileType EpsProfile;
extern char *LabelMeaning;
}
......@@ -122,7 +121,8 @@ main(int argc,
PrsExit (0);
}
if (ParameterFile[0] == 0) PrintUsage (argv[0]);
ReadVariables (ParameterFile);
boost::property_tree::ptree cfg;
ReadVariables (ParameterFile, cfg);
SplitDomain ();
if (verbose == true) TellEverything ();
if (disable == true) PrsExit (0);
......@@ -136,19 +136,16 @@ main(int argc,
OFileBackup("dims.dat");
}
DumpSources (argc, argv);
MasterPrint ("Allocating arrays...");
fflush (stdout);
ThermoFields thermoFields(NRAD, NSEC);
PolarGrid* gas_density = CreatePolarGrid(NRAD, NSEC, "dens" );
PolarGrid* gas_v_rad = CreatePolarGrid(NRAD, NSEC, "vrad" );
PolarGrid* gas_v_theta = CreatePolarGrid(NRAD, NSEC, "vtheta" );
PolarGrid* gas_energy = CreatePolarGrid(NRAD, NSEC, "energy" );
PolarGrid* gas_label = CreatePolarGrid(NRAD, NSEC, "label" );
PolarGrid* dust_fraction = CreatePolarGrid(NRAD, NSEC, "epsilon" );
PolarGrid* dust_density = CreatePolarGrid(NRAD, NSEC, "dustdens" );
PolarGrid* gasonly_density = CreatePolarGrid(NRAD, NSEC, "gasonlydens");
MasterPrint ("done.\n");
FillRadialGrids ();
Force *force = AllocateForce ();
......@@ -162,7 +159,7 @@ main(int argc,
/* If energy equation is taken into account, we initialize the gas
thermal energy */
if ( Adiabatic ) {
InitGasEnergy (gas_energy, EpsProfile);
InitGasEnergy (&thermoFields, EpsProfile);
}
real Density_init[NRAD], Vrad_init[NRAD], Vtheta_init[NRAD];
......@@ -177,7 +174,7 @@ main(int argc,
/* Only gas velocities remain to be initialized */
Initialization (gas_density, gas_v_rad, gas_v_theta,
gas_energy, Pressure,
&thermoFields,
gas_label, dust_fraction,
sys, EpsProfile);
......@@ -214,12 +211,12 @@ main(int argc,
if (InnerOutputCounter == 1) {
InnerOutputCounter = 0;
//WriteBigPlanetSystemFile (sys, TimeStep);
UpdateForceLog (force, sys, gas_density, gas_energy, TimeStep, PhysicalTime);
UpdateForceLog (force, sys, gas_density, TimeStep, PhysicalTime);
}
if (NINTERM * (TimeStep = (i / NINTERM)) == i) {
/* Outputs are done here */
TimeToWrite = true;
SendOutput (TimeStep, gas_density, gas_v_rad, gas_v_theta, gas_energy, gas_label, dust_fraction, dust_density, gasonly_density, Pressure, sys, tracers);
SendOutput (TimeStep, gas_density, gas_v_rad, gas_v_theta, &thermoFields, gas_label, dust_fraction, dust_density, gasonly_density, sys, tracers);
WritePlanetSystemFile (sys, TimeStep);
if ((OnlyInit) || ((GotoNextOutput) && (!StillWriteOneOutput))) {
MPI_Finalize();
......@@ -237,7 +234,7 @@ main(int argc,
InitSpecificTime (Profiling, &t_Hydro, "Eulerian Hydro algorithms");
AlgoGas (force, gas_density, gas_v_rad,
gas_v_theta, gas_energy, gas_label,
gas_v_theta, &thermoFields, gas_label,
dust_fraction, dust_density, gasonly_density,
sys, tracers, EpsProfile,
Density_init, Vrad_init, Vtheta_init);
......@@ -250,8 +247,8 @@ main(int argc,
ClearAccretionInfo (sys);
}
if (MonitorIntegral) {
WriteDiskInfo(gas_density, gas_v_rad, gas_v_theta, \
gas_energy, dust_fraction, sys);
WriteDiskInfo(gas_density, gas_v_rad, gas_v_theta,
&thermoFields, dust_fraction, sys);
}
}
FreePlanetary (sys);
......
......@@ -156,7 +156,7 @@ namespace ADC {
}
void UpdateForceLog (Force *fc, PlanetarySystem *psys, PolarGrid *Density, PolarGrid *Energy, int outputnb, real time)
void UpdateForceLog (Force *fc, PlanetarySystem *psys, PolarGrid *Density, int outputnb, real time)
{
int i, nb;
real x, y, r, m, vx, vy;
......
......@@ -50,7 +50,7 @@ namespace ADC {
bool UseCentrifugalBalance, SloppyCFL;
struct PolarGrid *CellAbscissa;
struct PolarGrid *CellOrdinate;
struct PolarGrid *RhoStar, *RhoInt, *Potential, *Pressure, *SoundSpeed, *Temperature;
struct PolarGrid *RhoStar, *RhoInt, *Potential;
struct PolarGrid *DivergenceVelocity, *TAURR, *TAUPP, *TAURP, *Qplus, *Vortensity;
bool LogGrid;
bool OverridesOutputdir;
......
......@@ -8,6 +8,7 @@
#include "ADC/lowTasks.h"
#include "ADC/planet.h"
#include "ADC/theo.h"
#include "ADC/sourceEuler.h"
#include "ADC/checkConservation.h"
......@@ -77,12 +78,12 @@ namespace ADC {
real GasTotalEnergy (PolarGrid *Density,
PolarGrid *Vrad,
PolarGrid *Vtheta,
PolarGrid *Energy)
ThermoFields const* thermoFields)
{
extern PolarGrid* Potential;
MPI_Status stat;
int i, j, l, ns;
real *density, *vrad, *vtheta, *energy, *pot;
real *density, *vrad, *vtheta, *pot;
real vr_cent, vt_cent;
real total=0.0, fulltotal=0.0;
......@@ -90,11 +91,11 @@ namespace ADC {
density = Density->Field;
vrad = Vrad->Field;
vtheta = Vtheta->Field;
energy = Energy->Field;
pot = Potential->Field;
for (i = Zero_or_active; i < Max_or_active; i++) {
for (j = 0; j < ns; j++) {
l = j+i*ns;
real energy = thermoFields->energy ? thermoFields->energy->Field[l] : 0;
/* centered-in-cell radial velocity */
vr_cent = (Rmed[i]-Rinf[i])*vrad[l+ns] + (Rsup[i]-Rmed[i])*vrad[l];
vr_cent /= (Rsup[i]-Rinf[i]);
......@@ -104,8 +105,8 @@ namespace ADC {
} else {
vt_cent = 0.5*(vtheta[l]+vtheta[i*ns]) + Rmed[i]*OmegaFrame;
}
total += 0.5*Surf[i]*density[l]*(vr_cent*vr_cent + vt_cent*vt_cent) \
+ Surf[i]*energy[l] \
total += 0.5*Surf[i]*density[l]*(vr_cent*vr_cent + vt_cent*vt_cent)
+ Surf[i]*energy
- Surf[i]*density[l]*pot[l];
/* Gas total energy is the sum of its kinematic energy, internal energy */
/* and gravitational potential energy, including self-gravity */
......@@ -266,31 +267,29 @@ namespace ADC {
}
void ComputeSoundSpeed (PolarGrid *Density, PolarGrid *Energy, PolarGrid *DustFraction)
void ComputeSoundSpeed (ThermoFields *thermoFields, PolarGrid *Density, PolarGrid *DustFraction)
{
extern PolarGrid *SoundSpeed;
extern bool Adiabatic;
bool adiabatic = bool(thermoFields->energy);
int nr = Density -> Nrad;
int ns = Density -> Nsec;
real* dens = Density -> Field;
real* energ = Energy -> Field;
real* cs = SoundSpeed -> Field;
int nr = thermoFields->nrad;
int ns = thermoFields->nsec;
real* cs = thermoFields->soundSpeed->Field;
if (adiabatic) {
real* dens = Density -> Field;
real* energ = thermoFields->energy->Field;
int l;
if (Adiabatic) {
for (int i=0; i<nr; i++) {
for (int j=0; j<ns; j++) {
l = i*ns + j;
int l = i*ns + j;
cs[l] = AdiabaticSoundSpeed (dens[l], energ[l]);
}
}
} else {
real r;
} else {
for (int i=0; i<nr; i++) {
r = Rmed[i];
real r = Rmed[i];
for (int j=0; j<ns; j++) {
l = i*ns + j;
int l = i*ns + j;
cs[l] = IsothermalSoundSpeedTheo (r);
}
}
......@@ -298,33 +297,31 @@ namespace ADC {
}
void UpdatePressure (PolarGrid* Pressure, PolarGrid *Density, PolarGrid *DustFraction, PolarGrid *Energy)
void UpdatePressure (ThermoFields *thermoFields, PolarGrid const*Density, PolarGrid const*DustFraction)
{
extern PolarGrid *SoundSpeed;
extern bool Adiabatic;
int nr = Density -> Nrad;
int ns = Density -> Nsec;
real* dens = Density -> Field;
real* pres = Pressure -> Field;
real* energ = Energy -> Field;
real* cs = SoundSpeed -> Field;
real* eps = DustFraction -> Field;
int l;
if (Adiabatic) {
bool adiabatic = bool(thermoFields->energy);
int const nr = thermoFields->nrad;
int const ns = thermoFields->nsec;
real* pres = thermoFields->pressure->Field;
if (adiabatic) {
real* energ = thermoFields->energy->Field;
for (int i=0; i<nr; i++) {
for (int j=0; j<ns; j++) {
l = i*ns + j;
int l = i*ns + j;
pres[l] = AdiabaticPressure (energ[l]);
}
}
} else {
real r;
} else {
real const* dens = Density -> Field;
real const* cs = thermoFields->soundSpeed->Field;
real const* eps = DustFraction -> Field;
for (int i=0; i<nr; i++) {
r = Rmed[i];
real r = Rmed[i];
for (int j=0; j<ns; j++) {
l = i*ns + j;
int l = i*ns + j;
pres[l] = IsothermalPressure (dens[l], eps[l], cs[l]);
// devnote : from iniatialization, cs remains axisymmetric
// since SoundSpeed is not updated ...
......@@ -334,29 +331,30 @@ namespace ADC {
}
void ComputeTemperatureField (PolarGrid *Density, PolarGrid *DustFraction, PolarGrid *Energy)
void ComputeTemperatureField (ThermoFields *thermoFields, PolarGrid *Density, PolarGrid *DustFraction)
{
int i, j, l, nr, ns;
real *dens, *pres, *energ, *temp, *eps;
extern PolarGrid *Pressure;
extern PolarGrid *Temperature;
extern bool Adiabatic;
nr = Density -> Nrad;
ns = Density -> Nsec;
dens = Density -> Field;
pres = Pressure -> Field;
energ = Energy -> Field;
temp = Temperature -> Field;
eps = DustFraction -> Field;
for ( i = 0; i < nr; i++ ) {
for ( j = 0; j < ns; j++ ) {
l = i*ns + j;
if (!Adiabatic) {
temp[l] = MU/R* pres[l]/(dens[l]*(1.-eps[l]));
} else {
bool const adiabatic = bool(thermoFields->energy);
int const nr = thermoFields->nrad;
int const ns = thermoFields->nrad;
real const* dens = Density -> Field;
real const *eps = DustFraction -> Field;
real *temp = thermoFields->temperature->Field;
if (adiabatic) {
real const* energ = thermoFields->energy->Field;
for (int i = 0; i < nr; i++ ) {
for (int j = 0; j < ns; j++ ) {
int l = i*ns + j;
temp[l] = MU/R*(ADIABATICINDEX-1.0)*energ[l]/(dens[l]*(1.-eps[l]));
}
}
} else {
real const* pres = thermoFields->pressure -> Field;
for (int i = 0; i < nr; i++ ) {
for (int j = 0; j < ns; j++ ) {
int l = i*ns + j;
temp[l] = MU/R* pres[l]/(dens[l]*(1.-eps[l]));
}
}
}
......
......@@ -69,8 +69,8 @@ namespace ADC {
memcpy (SendOuterBoundary+4*l, Energy->Field+o, l*sizeof(real));
}
if (UseLabel == true) {
memcpy (SendInnerBoundary+(4+(Adiabatic == true ? 1:0))*l, Label->Field+l, l*sizeof(real));
memcpy (SendOuterBoundary+(4+(Adiabatic == true ? 1:0))*l, Label->Field+o, l*sizeof(real));
memcpy (SendInnerBoundary+(4+(Adiabatic ? 1 : 0))*l, Label->Field+l, l*sizeof(real));
memcpy (SendOuterBoundary+(4+(Adiabatic ? 1 : 0))*l, Label->Field+o, l*sizeof(real));
}
/* ------------------------------------------ */
......@@ -107,7 +107,7 @@ namespace ADC {
if (Adiabatic)
memcpy (Energy->Field, RecvInnerBoundary+4*l, l*sizeof(real));
if (UseLabel == true)
memcpy (Label->Field, RecvInnerBoundary+(4+(Adiabatic == true ? 1:0))*l, l*sizeof(real));
memcpy (Label->Field, RecvInnerBoundary+(4+(Adiabatic ? 1:0))*l, l*sizeof(real));
}
if (CPU_Rank != CPU_Highest) {
MPI_Wait (&req3, &stat);
......
......@@ -8,6 +8,7 @@
#include "ADC/fundamental.h"
#include "ADC/io.h"
#include "ADC/sourceEuler.h"
#include "ADC/fillers.h"
#include "ADC/theo.h"
#include "ADC/axilib.h"