| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,15 +60,6 @@ void DataBlock::InitFromGrid(Grid &grid, Input &input) { | |||
| 60 | 60 | xend[dir] = gridHost.xr[dir](gend[dir]-1); | |
| 61 | 61 | } | |
| 62 | 62 | ||
| 63 | - if(idfx::psize>1) { | ||
| 64 | - idfx::cout << "DataBlock::InitFromGrid: local size is " << std::endl; | ||
| 65 | - | ||
| 66 | - for(int dir = 0 ; dir < DIMENSIONS ; dir++) { | ||
| 67 | - idfx::cout << "\t Direction X" << (dir+1) << ": " << xbeg[dir] << "...." << np_int[dir] | ||
| 68 | - << "...." << xend[dir] << std::endl; | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | 63 | // Allocate the required fields | |
| 73 | 64 | for(int dir = 0 ; dir < 3 ; dir++) { | |
| 74 | 65 | x[dir] = IdefixArray1D<real>("DataBlock_x",np_tot[dir]); | |
@@ -146,3 +137,17 @@ void DataBlock::ResetStage() { | |||
| 146 | 137 | void DataBlock::SetBoundaries() { | |
| 147 | 138 | hydro.boundary.SetBoundaries(t); | |
| 148 | 139 | } | |
| 140 | + | ||
| 141 | + void DataBlock::ShowConfig() { | ||
| 142 | + if(idfx::psize>1) { | ||
| 143 | + idfx::cout << "DataBlock: this process grid size is " << std::endl; | ||
| 144 | + | ||
| 145 | + for(int dir = 0 ; dir < DIMENSIONS ; dir++) { | ||
| 146 | + idfx::cout << "\t Direction X" << (dir+1) << ": " << xbeg[dir] << "...." << np_int[dir] | ||
| 147 | + << "...." << xend[dir] << std::endl; | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + hydro.ShowConfig(); | ||
| 151 | + if(haveFargo) fargo.ShowConfig(); | ||
| 152 | + if(haveGravity) gravity.ShowConfig(); | ||
| 153 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -76,7 +76,7 @@ class DataBlock { | |||
| 76 | 76 | ||
| 77 | 77 | void EvolveStage(); ///< Evolve this DataBlock by dt | |
| 78 | 78 | void SetBoundaries(); ///< Enforce boundary conditions to this datablock | |
| 79 | - | ||
| 79 | + void ShowConfig(); ///< Show the datablock's configuration | ||
| 80 | 80 | ||
| 81 | 81 | void ResetStage(); ///< Reset the variables needed at each major integration Stage | |
| 82 | 82 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,9 +23,11 @@ class DataBlockHost { | |||
| 23 | 23 | IdefixArray3D<real>::HostMirror A[3]; // cell right interface area | |
| 24 | 24 | ||
| 25 | 25 | IdefixArray4D<real>::HostMirror Vc; // Main cell-centered primitive variables index | |
| 26 | + #if MHD == YES | ||
| 26 | 27 | IdefixArray4D<real>::HostMirror Vs; // Main face-centered primitive variables index | |
| 27 | 28 | IdefixArray4D<real>::HostMirror Ve; // Main edge-centered primitive variables index | |
| 28 | 29 | IdefixArray4D<real>::HostMirror J; // Current (only when haveCurrent is enabled) | |
| 30 | + #endif | ||
| 29 | 31 | IdefixArray4D<real>::HostMirror Uc; // Main cell-centered conservative variables | |
| 30 | 32 | IdefixArray3D<real>::HostMirror InvDt; | |
| 31 | 33 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -242,10 +242,19 @@ void Fargo::Init(Input &input, DataBlock *data) { | |||
| 242 | 242 | } | |
| 243 | 243 | #endif | |
| 244 | 244 | ||
| 245 | + | ||
| 246 | + idfx::popRegion(); | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + void Fargo::ShowConfig() { | ||
| 250 | + idfx::pushRegion("Fargo::ShowConfig"); | ||
| 245 | 251 | if(type==userdef) { | |
| 246 | - idfx::cout << "Fargo: Enabled with user-defined velocity function" << std::endl; | ||
| 252 | + idfx::cout << "Fargo: ENABLED with user-defined velocity function." << std::endl; | ||
| 253 | + if(!fargoVelocityFunc) { | ||
| 254 | + IDEFIX_ERROR("No Fargo velocity function has been enabled."); | ||
| 255 | + } | ||
| 247 | 256 | } else if(type==shearingbox) { | |
| 248 | - idfx::cout << "Fargo: Enabled with shearing-box velocity function" << std::endl; | ||
| 257 | + idfx::cout << "Fargo: ENABLED with shearing-box velocity function." << std::endl; | ||
| 249 | 258 | } else { | |
| 250 | 259 | IDEFIX_ERROR("Something went wrong during Fargo initialisation"); | |
| 251 | 260 | } | |
@@ -267,7 +276,6 @@ void Fargo::EnrollVelocity(FargoVelocityFunc myFunc) { | |||
| 267 | 276 | "to be set to userdef in .ini file"); | |
| 268 | 277 | } | |
| 269 | 278 | this->fargoVelocityFunc = myFunc; | |
| 270 | - idfx::cout << "Fargo: User-defined velocity function has been enrolled." << std::endl; | ||
| 271 | 279 | } | |
| 272 | 280 | ||
| 273 | 281 | // This function fetches Fargo velocity when required | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,7 @@ class Fargo { | |||
| 26 | 26 | void EnrollVelocity(FargoVelocityFunc); | |
| 27 | 27 | void StoreToScratch(); | |
| 28 | 28 | void CheckMaxDisplacement(); | |
| 29 | + void ShowConfig(); | ||
| 29 | 30 | ||
| 30 | 31 | private: | |
| 31 | 32 | friend class Hydro; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,12 +77,6 @@ void popRegion() { | |||
| 77 | 77 | ||
| 78 | 78 | // Init the iostream with defined rank | |
| 79 | 79 | void IdefixOutStream::init(int rank) { | |
| 80 | - std::stringstream sslogFileName; | ||
| 81 | - sslogFileName << "idefix." << rank << ".log"; | ||
| 82 | - | ||
| 83 | - std::string logFileName(sslogFileName.str()); | ||
| 84 | - this->my_fstream.open(logFileName.c_str()); | ||
| 85 | - | ||
| 86 | 80 | if(rank==0) | |
| 87 | 81 | this->toscreen=true; | |
| 88 | 82 | else | |
@@ -91,10 +85,14 @@ void IdefixOutStream::init(int rank) { | |||
| 91 | 85 | ||
| 92 | 86 | ||
| 93 | 87 | // disable the log file | |
| 94 | - void IdefixOutStream::disableLogFile() { | ||
| 95 | - my_fstream << "Log files have been disabled (e.g. using -nowrite)." << std::endl; | ||
| 96 | - my_fstream.close(); | ||
| 97 | - this->logFileEnabled = false; | ||
| 88 | + void IdefixOutStream::enableLogFile() { | ||
| 89 | + std::stringstream sslogFileName; | ||
| 90 | + sslogFileName << "idefix." << idfx::prank << ".log"; | ||
| 91 | + | ||
| 92 | + std::string logFileName(sslogFileName.str()); | ||
| 93 | + this->my_fstream.open(logFileName.c_str()); | ||
| 94 | + | ||
| 95 | + this->logFileEnabled = true; | ||
| 98 | 96 | } | |
| 99 | 97 | ||
| 100 | 98 | } // namespace idfx | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,7 +46,7 @@ IdefixArray1D<T> ConvertVectorToIdefixArray(std::vector<T> &inputVector) { | |||
| 46 | 46 | class idfx::IdefixOutStream { | |
| 47 | 47 | public: | |
| 48 | 48 | void init(int); | |
| 49 | - void disableLogFile(); | ||
| 49 | + void enableLogFile(); | ||
| 50 | 50 | // for regular output of variables and stuff | |
| 51 | 51 | template<typename T> IdefixOutStream& operator<<(const T& something) { | |
| 52 | 52 | if(toscreen) std::cout << something; | |
@@ -63,7 +63,7 @@ class idfx::IdefixOutStream { | |||
| 63 | 63 | private: | |
| 64 | 64 | std::ofstream my_fstream; | |
| 65 | 65 | bool toscreen; | |
| 66 | - bool logFileEnabled{true}; //< whether streams are also written to a log file | ||
| 66 | + bool logFileEnabled{false}; //< whether streams are also written to a log file | ||
| 67 | 67 | }; | |
| 68 | 68 | ||
| 69 | 69 | class idfx::IdefixErrStream { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,15 +22,11 @@ void Gravity::Init(Input &input, DataBlock *datain) { | |||
| 22 | 22 | std::string potentialString = input.Get<std::string>("Gravity","potential",i); | |
| 23 | 23 | if(potentialString.compare("userdef") == 0) { | |
| 24 | 24 | this->haveUserDefPotential = true; | |
| 25 | - idfx::cout << "Gravity: Enabling user-defined gravitational potential" << std::endl; | ||
| 26 | 25 | } else if (potentialString.compare("central") == 0) { | |
| 27 | 26 | this->haveCentralMassPotential = true; | |
| 28 | 27 | this->centralMass = input.GetOrSet<real>("Gravity","Mcentral",0, 1.0); | |
| 29 | - idfx::cout << "Gravity: Enabling central mass gravitational potential with M=" | ||
| 30 | - << this->centralMass << std::endl; | ||
| 31 | 28 | } else if (potentialString.compare("selfgravity") == 0) { | |
| 32 | 29 | this->haveSelfGravityPotential = true; | |
| 33 | - idfx::cout << "Gravity: Enabling self Gravity" << std::endl; | ||
| 34 | 30 | } else { | |
| 35 | 31 | IDEFIX_ERROR("Unknown type of gravitational potential in idefix.ini. "); | |
| 36 | 32 | } | |
@@ -42,7 +38,6 @@ void Gravity::Init(Input &input, DataBlock *datain) { | |||
| 42 | 38 | std::string potentialString = input.Get<std::string>("Gravity","bodyForce",0); | |
| 43 | 39 | if(potentialString.compare("userdef") == 0) { | |
| 44 | 40 | this->haveBodyForce = true; | |
| 45 | - idfx::cout << "Gravity:: Enabling user-defined body force" << std::endl; | ||
| 46 | 41 | } else { | |
| 47 | 42 | IDEFIX_ERROR("Unknown type of body force in idefix.ini. " | |
| 48 | 43 | "Only userdef is implemented"); | |
@@ -62,6 +57,31 @@ void Gravity::Init(Input &input, DataBlock *datain) { | |||
| 62 | 57 | } | |
| 63 | 58 | } | |
| 64 | 59 | ||
| 60 | + void Gravity::ShowConfig() { | ||
| 61 | + if(data->haveGravity) { | ||
| 62 | + idfx::cout << "Gravity: ENABLED." << std::endl; | ||
| 63 | + if(haveUserDefPotential) { | ||
| 64 | + idfx::cout << "Gravity: User-defined gravitational potential ENABLED." << std::endl; | ||
| 65 | + if(!gravPotentialFunc) { | ||
| 66 | + IDEFIX_ERROR("No user-defined gravitational potential has been enrolled."); | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + if(haveCentralMassPotential) { | ||
| 70 | + idfx::cout << "Gravity: central mass gravitational potential ENABLED with M=" | ||
| 71 | + << this->centralMass << std::endl; | ||
| 72 | + } | ||
| 73 | + if(haveSelfGravityPotential) { | ||
| 74 | + idfx::cout << "Gravity: self-gravity ENABLED." << std::endl; | ||
| 75 | + } | ||
| 76 | + if(haveBodyForce) { | ||
| 77 | + idfx::cout << "Gravity: user-defined body force ENABLED." << std::endl; | ||
| 78 | + if(!bodyForceFunc) { | ||
| 79 | + IDEFIX_ERROR("No user-defined body force has been enrolled."); | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + } | ||
| 84 | + } | ||
| 65 | 85 | // This function compute the gravitational field, using both body force and potential | |
| 66 | 86 | void Gravity::ComputeGravity() { | |
| 67 | 87 | idfx::pushRegion("Gravity::ComputeGravity"); | |
@@ -107,7 +127,6 @@ void Gravity::EnrollPotential(GravPotentialFunc myFunc) { | |||
| 107 | 127 | "with the potential entry in [Gravity]."); | |
| 108 | 128 | } | |
| 109 | 129 | this->gravPotentialFunc = myFunc; | |
| 110 | - idfx::cout << "Gravity: User-defined gravitational potential has been enrolled" << std::endl; | ||
| 111 | 130 | } | |
| 112 | 131 | ||
| 113 | 132 | void Gravity::EnrollBodyForce(BodyForceFunc myFunc) { | |
@@ -117,7 +136,6 @@ void Gravity::EnrollBodyForce(BodyForceFunc myFunc) { | |||
| 117 | 136 | "with the bodyForce entry in [Gravity]."); | |
| 118 | 137 | } | |
| 119 | 138 | this->bodyForceFunc = myFunc; | |
| 120 | - idfx::cout << "Gravity: User-defined body force function has been enrolled" << std::endl; | ||
| 121 | 139 | } | |
| 122 | 140 | ||
| 123 | 141 | // Fill the gravitational potential with zeros | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,6 +35,7 @@ class Gravity { | |||
| 35 | 35 | ||
| 36 | 36 | void AddCentralMassPotential(); ///< Àdd the potential due to a centrall mass | |
| 37 | 37 | ||
| 38 | + void ShowConfig(); ///< Show the gravity configuration | ||
| 38 | 39 | bool havePotential{false}; ///< Whether a gravitational potential is present | |
| 39 | 40 | ///< in which case, (at least) one of the following is true | |
| 40 | 41 | bool haveUserDefPotential{false}; ///< Whether a potential is defined by user | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,8 +18,6 @@ Grid::Grid() { | |||
| 18 | 18 | Grid::Grid(Input &input) { | |
| 19 | 19 | idfx::pushRegion("Grid::Grid(Input)"); | |
| 20 | 20 | ||
| 21 | - idfx::cout << "Grid: allocating Grid." << std::endl; | ||
| 22 | - | ||
| 23 | 21 | // Get grid size from input file, block [Grid] | |
| 24 | 22 | int npoints[3]; | |
| 25 | 23 | for(int dir = 0 ; dir < 3 ; dir++) { | |
@@ -257,3 +255,64 @@ Grid& Grid::operator=(const Grid& grid) { | |||
| 257 | 255 | return *this; | |
| 258 | 256 | } | |
| 259 | 257 | */ | |
| 258 | + | ||
| 259 | + void Grid::ShowConfig() { | ||
| 260 | + for(int dir = 0 ; dir < DIMENSIONS ; dir++) { | ||
| 261 | + idfx::cout << "Grid: "; | ||
| 262 | + std::string lboundString, rboundString; | ||
| 263 | + switch(lbound[dir]) { | ||
| 264 | + case outflow: | ||
| 265 | + lboundString="outflow"; | ||
| 266 | + break; | ||
| 267 | + case reflective: | ||
| 268 | + lboundString="reflective"; | ||
| 269 | + break; | ||
| 270 | + case periodic: | ||
| 271 | + lboundString="periodic"; | ||
| 272 | + break; | ||
| 273 | + case internal: | ||
| 274 | + lboundString="internal"; | ||
| 275 | + break; | ||
| 276 | + case shearingbox: | ||
| 277 | + lboundString="shearingbox"; | ||
| 278 | + break; | ||
| 279 | + case axis: | ||
| 280 | + lboundString="axis"; | ||
| 281 | + break; | ||
| 282 | + case userdef: | ||
| 283 | + lboundString="userdef"; | ||
| 284 | + break; | ||
| 285 | + default: | ||
| 286 | + lboundString="unknown"; | ||
| 287 | + } | ||
| 288 | + switch(rbound[dir]) { | ||
| 289 | + case outflow: | ||
| 290 | + rboundString="outflow"; | ||
| 291 | + break; | ||
| 292 | + case reflective: | ||
| 293 | + rboundString="reflective"; | ||
| 294 | + break; | ||
| 295 | + case periodic: | ||
| 296 | + rboundString="periodic"; | ||
| 297 | + break; | ||
| 298 | + case internal: | ||
| 299 | + rboundString="internal"; | ||
| 300 | + break; | ||
| 301 | + case shearingbox: | ||
| 302 | + rboundString="shearingbox"; | ||
| 303 | + break; | ||
| 304 | + case axis: | ||
| 305 | + rboundString="axis"; | ||
| 306 | + break; | ||
| 307 | + case userdef: | ||
| 308 | + rboundString="userdef"; | ||
| 309 | + break; | ||
| 310 | + default: | ||
| 311 | + rboundString="unknown"; | ||
| 312 | + } | ||
| 313 | + | ||
| 314 | + idfx::cout << "Direction X" << (dir+1) << ": " << lboundString << "\t" << xbeg[dir] | ||
| 315 | + << "...." << np_int[dir] << "...." << xend[dir] << "\t" << rboundString | ||
| 316 | + << std::endl; | ||
| 317 | + } | ||
| 318 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments