ReFRACtor
atmosphere_oco.cc
Go to the documentation of this file.
1 #include "atmosphere_oco.h"
2 #include "old_constant.h"
3 #include "linear_algebra.h"
4 #include "pressure_fixed_level.h"
6 #include "ground.h"
7 #include "planck.h"
8 #include "aerosol_optical.h"
9 #include "ostream_pad.h"
10 #include <boost/foreach.hpp>
11 #include <cmath>
12 using namespace FullPhysics;
13 using namespace blitz;
14 
15 #ifdef HAVE_LUA
16 #include "register_lua.h"
18 .def(luabind::constructor<const boost::shared_ptr<Absorber>&,
24  const std::vector<boost::shared_ptr<Altitude> >&,
26 .def(luabind::constructor<const boost::shared_ptr<Absorber>&,
31  const std::vector<boost::shared_ptr<Altitude> >&,
33 .def(luabind::constructor<const boost::shared_ptr<Absorber>&,
38  const std::vector<boost::shared_ptr<Altitude> >&,
40 .def(luabind::constructor<const boost::shared_ptr<Absorber>&,
44  const std::vector<boost::shared_ptr<Altitude> >&,
46 .def("pressure", &AtmosphereOco::pressure_ptr)
47 .def("temperature", &AtmosphereOco::temperature_ptr)
48 .def("ground", &AtmosphereOco::ground)
50 #endif
51 
52 //-----------------------------------------------------------------------
54 //-----------------------------------------------------------------------
55 
56 const int taug_index = 0;
57 const int taur_index = 1;
58 const int taua_0_index = 2;
59 
60 //-----------------------------------------------------------------------
73 //-----------------------------------------------------------------------
74 
76  const boost::shared_ptr<Pressure>& pressurev,
77  const boost::shared_ptr<Temperature>& temperaturev,
78  const boost::shared_ptr<Aerosol>& aerosolv,
80  const boost::shared_ptr<Ground>& groundv,
81  const boost::shared_ptr<SurfaceTemperature>& surface_tempv,
82  const std::vector<boost::shared_ptr<Altitude> >& altv,
84  : absorber(absorberv), pressure(pressurev), temperature(temperaturev),
85  aerosol(aerosolv), rh(rhv), ground_ptr(groundv), surface_temp(surface_tempv),
86  constant(C), alt(altv),
87  sv_size(0),
88  wn_tau_cache(-1),
89  spec_index_tau_cache(-1),
90  nlay(-1)
91 {
92  initialize();
93 }
94 
95 //-----------------------------------------------------------------------
98 //-----------------------------------------------------------------------
99 
101  const boost::shared_ptr<Pressure>& pressurev,
102  const boost::shared_ptr<Temperature>& temperaturev,
103  const boost::shared_ptr<Aerosol>& aerosolv,
105  const boost::shared_ptr<Ground>& groundv,
106  const std::vector<boost::shared_ptr<Altitude> >& altv,
108  : absorber(absorberv), pressure(pressurev), temperature(temperaturev),
109  aerosol(aerosolv), rh(rhv), ground_ptr(groundv),
110  constant(C), alt(altv),
111  sv_size(0),
112  wn_tau_cache(-1),
113  spec_index_tau_cache(-1),
114  nlay(-1)
115 {
116  initialize();
117 }
118 
119 //-----------------------------------------------------------------------
123 
125  const boost::shared_ptr<Pressure>& pressurev,
126  const boost::shared_ptr<Temperature>& temperaturev,
127  const boost::shared_ptr<Aerosol>& aerosolv,
129  const std::vector<boost::shared_ptr<Altitude> >& altv,
131  : absorber(absorberv), pressure(pressurev), temperature(temperaturev),
132  aerosol(aerosolv), rh(rhv),
133  constant(C), alt(altv),
134  sv_size(0),
135  wn_tau_cache(-1),
136  spec_index_tau_cache(-1),
137  nlay(-1)
138 {
139  initialize();
140 }
141 
142 //-----------------------------------------------------------------------
146 
148  const boost::shared_ptr<Pressure>& pressurev,
149  const boost::shared_ptr<Temperature>& temperaturev,
151  const boost::shared_ptr<Ground>& groundv,
152  const boost::shared_ptr<SurfaceTemperature>& surface_tempv,
153  const std::vector<boost::shared_ptr<Altitude> >& altv,
155  : absorber(absorberv), pressure(pressurev), temperature(temperaturev),
156  rh(rhv), ground_ptr(groundv), surface_temp(surface_tempv),
157  constant(C), alt(altv),
158  sv_size(0),
159  wn_tau_cache(-1),
160  spec_index_tau_cache(-1),
161  nlay(-1)
162 {
163  initialize();
164 }
165 
166 //-----------------------------------------------------------------------
170 
172  const boost::shared_ptr<Pressure>& pressurev,
173  const boost::shared_ptr<Temperature>& temperaturev,
175  const boost::shared_ptr<Ground>& groundv,
176  const std::vector<boost::shared_ptr<Altitude> >& altv,
178  : absorber(absorberv), pressure(pressurev), temperature(temperaturev),
179  rh(rhv), ground_ptr(groundv),
180  constant(C), alt(altv),
181  sv_size(0),
182  wn_tau_cache(-1),
183  spec_index_tau_cache(-1),
184  nlay(-1)
185 {
186  initialize();
187 }
188 
189 //-----------------------------------------------------------------------
192 //-----------------------------------------------------------------------
193 
195  const boost::shared_ptr<Pressure>& pressurev,
196  const boost::shared_ptr<Temperature>& temperaturev,
198  const std::vector<boost::shared_ptr<Altitude> >& altv,
200  : absorber(absorberv), pressure(pressurev), temperature(temperaturev),
201  constant(C), rh(rhv), alt(altv), sv_size(0), wn_tau_cache(-1),
202  spec_index_tau_cache(-1),
203  nlay(-1)
204 {
205  initialize();
206 }
207 
208 void AtmosphereOco::initialize()
209 {
210  if(!absorber)
211  throw Exception("Absorber is not allowed to be null in AtmosphereOco");
212  if(!pressure)
213  throw Exception("Pressure is not allowed to be null in AtmosphereOco");
214  if(!temperature)
215  throw Exception("Temperature is not allowed to be null in AtmosphereOco");
216  BOOST_FOREACH(const boost::shared_ptr<Altitude>& a, alt)
217  if(!a)
218  throw Exception("Altitude is not allowed to be null in AtmosphereOco");
219 
220  rayleigh.reset(new Rayleigh(pressure, alt, *constant));
221  if(aerosol)
222  aerosol->add_observer(*this);
223  pressure->add_observer(*this);
224 
226 }
227 
228 //-----------------------------------------------------------------------
231 //-----------------------------------------------------------------------
232 
234  // Remove observers from old aerosol instance
235  Sv.remove_observer(*aerosol);
236 
237  // Switch to new instance
238  aerosol = new_aerosol;
239 
240  // Register observers
241  aerosol->add_observer(*this);
242 
243  // Run notify update so gradient is set up correctly
244  aerosol->notify_update(Sv);
245 
246  // Invalidate caches
247  wn_tau_cache = -1;
248  spec_index_tau_cache = -1;
249 }
250 
251 //-----------------------------------------------------------------------
255 //-----------------------------------------------------------------------
256 
258 AtmosphereOco::scattering_moment_common(double wn, int nummom,
259  int numscat) const
260 {
262  firstIndex i1; secondIndex i2; thirdIndex i3; fourthIndex i4;
263  Array<double, 2> coefsr(RayleighGreekMoment::array());
264  Range ra(Range::all());
265 
266  // If we don't have any Aerosol (i.e., a Rayleigh atmosphere only),
267  // then calculating the scattering matrix is considerably
268  // simpler.
269  //
270  // This special case is simple enough that it is worth while
271  // handling separately.
273  Range r1, r2;
274  int s2;
275  if(nummom == -1 || nummom > coefsr.rows() - 1)
276  r1 = Range(0, coefsr.rows() - 1);
277  else
278  r1 = Range(0, nummom);
279  if(numscat == -1) {
280  r2 = ra;
281  s2 = coefsr.cols();
282  } else {
283  r2 = Range(0, numscat - 1);
284  s2 = numscat;
285  }
286  int s1 = (nummom == -1 ? coefsr.rows() : nummom + 1);
287 
288  // number of variables in rayleigh only case should
289  // be at least 2 to match how tau and omega jacobians
290  // are set up, see resizing of intermediate_v variable
291  ArrayAd<double, 3> res(s1, number_layer(), s2, 2);
292  if(s1 > coefsr.rows())
293  res = 0;
294  for(int i = 0; i < number_layer(); ++i)
295  res(r1, i, r2) = coefsr(r1, r2);
296  return res;
297  } else {
298  // Handle case where we do have aerosol.
299  Range r1(0, coefsr.rows() - 1);
300  Range ra = Range::all();
302  pf(aerosol->pf_mom(wn, frac_aer, nummom, numscat));
303  Range r2(0, coefsr.rows() - 1);
304  pf.value()(r2,ra,ra) += frac_ray.value()(i2) * coefsr(i1,i3);
305  pf.jacobian()(r2,ra,ra,ra) += frac_ray.jacobian()(i2,i4) * coefsr(i1,i3);
306  pf(0, ra, 0) = 1;
307  return pf;
308  } // End handling of atmosphere with aerosol.
309 }
310 
312 {
316 }
317 
318 std::string AtmosphereOco::timer_info() const
319 {
320  std::ostringstream os;
321  os << RtAtmosphere::timer_info() << "\n"
322  << " " << Absorber::timer << "\n"
323  << " " << Aerosol::timer << "\n";
324  return os.str();
325 }
326 
327 //-----------------------------------------------------------------------
331 //-----------------------------------------------------------------------
332 
334 {
335  wn_tau_cache = -1;
336  notify_update_do(*this);
337 }
338 
339 //-----------------------------------------------------------------------
344 //-----------------------------------------------------------------------
345 
346 bool AtmosphereOco::fill_cache(double wn, int spec_index) const
347 {
348  if(fabs(wn - wn_tau_cache) < 1e-6 &&
349  spec_index == spec_index_tau_cache)
350  return true;
351 
352  // If spectrometer changes then erase totaltaug cache
353  if(spec_index != spec_index_tau_cache) {
354  if (totaltaug_cache)
355  totaltaug_cache->clear();
356  spec_index_tau_cache = spec_index;
357  }
358 
359  wn_tau_cache = wn;
361  calc_intermediate_variable(wn, spec_index);
362  calc_rt_parameters(wn, intermediate_v);
363 
364  return false;
365 }
366 
367 //-----------------------------------------------------------------------
370 //-----------------------------------------------------------------------
371 
372 void AtmosphereOco::calc_intermediate_variable(double wn, int spec_index)
373 const
374 {
375  firstIndex i1; secondIndex i2; thirdIndex i3;
376  Range ra(Range::all());
377  range_check(spec_index, 0, number_spectrometer());
378 
379 //-----------------------------------------------------------------------
380 // We set up the intermediate variables to be taug, taur, and taua_i
381 // for each aerosol. To keep things straight, we create the
382 // variables taug, taur, and taua_i which just point to the right
383 // parts of the Intermediate variables.
384 //-----------------------------------------------------------------------
385 
386  intermediate_v.resize(number_layer(),
387  2 + (aerosol ? aerosol->number_particle() : 0),
388  sv_size);
389  ArrayAd<double, 1> taug(intermediate_v(ra, taug_index));
390  ArrayAd<double, 1> taur(intermediate_v(ra, taur_index));
391  ArrayAd<double, 2> taua_i;
392  if(aerosol) {
393  Range taua_r(taua_0_index, taua_0_index +
394  (aerosol ? aerosol->number_particle() - 1 : 0));
395  taua_i.reference(intermediate_v(ra, taua_r));
396  }
397 
398 //-----------------------------------------------------------------------
399 // Now, fill in taur and taug. We also fill in totaltaug which is the
400 // sum over all the layers for each gas absorber. This is needed for
401 // calculating column_optical_depth_main_gas() and
402 // column_optical_depth_water_vapor().
403 //-----------------------------------------------------------------------
404 
405  if(taur.is_constant())
406  taur.value() = rayleigh->optical_depth_each_layer(wn, spec_index).value();
407  else
408  taur = rayleigh->optical_depth_each_layer(wn, spec_index);
409  ArrayAd<double, 2> taug_i =
410  absorber->optical_depth_each_layer(wn, spec_index);
411 
412  totaltaug.resize(taug_i.cols(), taug_i.number_variable());
413  totaltaug.value() = sum(taug_i.value()(i2, i1), i2);
414  if(!taug_i.is_constant())
415  totaltaug.jacobian() = sum(taug_i.jacobian()(i3, i1, i2), i3);
416  else
417  totaltaug.jacobian() = 0;
418 
419  // If cache exists, then store the computed value
420  if(totaltaug_cache)
421  totaltaug_cache->insert(wn, totaltaug);
422 
423  taug.value() = sum(taug_i.value()(i1, i2), i2);
424  if(!taug.is_constant() && !taug_i.is_constant())
425  taug.jacobian() = sum(taug_i.jacobian()(i1, i3, i2), i3);
426  else
427  taug.jacobian() = 0;
428 
429 //-----------------------------------------------------------------------
431 //-----------------------------------------------------------------------
432 
433  if(aerosol) {
434  if(taua_i.is_constant())
435  taua_i.value() = aerosol->optical_depth_each_layer(wn).value();
436  else
437  taua_i = aerosol->optical_depth_each_layer(wn);
438  }
439 }
440 
441 //-----------------------------------------------------------------------
453 //-----------------------------------------------------------------------
454 
455 void AtmosphereOco::calc_rt_parameters
456 (double wn, const ArrayAd<double, 2>& iv) const
457 {
458  firstIndex i1; secondIndex i2; thirdIndex i3;
459  Range ra(Range::all());
460  tau.resize(number_layer(), iv.cols());
461  omega.resize(tau.shape(), tau.number_variable());
462  frac_ray.resize(tau.shape(), tau.number_variable());
463 
464  ArrayAd<double, 1> taug(iv(ra, taug_index));
465  ArrayAd<double, 1> taur(iv(ra, taur_index));
466  tau.value() = taur.value() + taug.value();
467  tau.jacobian() = 1; // We just add all the taus together
468  // to get total tau.
469 
470  // We need taur with derivatives with respect to the intermediate
471  // variables in a few different places, so store here
472  Array<double, 2> scratch(taur.rows(), iv.cols());
473  scratch = 0;
474  scratch(ra, taur_index) = 1;
475  ArrayAd<double, 1> taur_wrt_iv(taur.value(), scratch.copy());
476  scratch(ra, taur_index) = 0;
477 
478 //-----------------------------------------------------------------------
481 //-----------------------------------------------------------------------
482 
483  if(aerosol) {
484  Range taua_r(taua_0_index, taua_0_index +
485  (aerosol ? aerosol->number_particle() - 1 : 0));
486  ArrayAd<double, 2> taua_i(iv(ra, taua_r));
487  tau.value() += sum(taua_i.value(), i2);
488  ArrayAd<double, 2> aersc(taua_i.shape(), iv.cols());
489  for(int i = 0; i < taua_i.cols(); ++i) {
490  scratch(ra, taua_0_index + i) = 1;
491  ArrayAd<double, 1> t(taua_i.value()(Range::all(), i), scratch);
492  aersc(ra, i) = aerosol->ssa_each_layer(wn, i, t);
493  scratch(ra, taua_0_index + i) = 0;
494  }
495  frac_aer.resize(aersc.shape(), iv.cols());
496  ArrayAd<double, 1> ssasum(taur_wrt_iv.copy());
497 
498  // Because this is a bottle neck, we have explicit expressions for
499  // the Jacobians here. This is just the simple chain rule
500 
501  ssasum.value() += sum(aersc.value(), i2);
502  ssasum.jacobian() += sum(aersc.jacobian()(i1, i3, i2), i3);
503 
504  frac_aer.value() = aersc.value() / ssasum.value()(i1);
505  frac_aer.jacobian() = aersc.jacobian() / ssasum.value()(i1) -
506  aersc.value()(i1,i2) / (ssasum.value()(i1) * ssasum.value()(i1)) *
507  ssasum.jacobian()(i1, i3);
508 
509  frac_ray.value() = taur_wrt_iv.value() / ssasum.value();
510  frac_ray.jacobian() = taur_wrt_iv.jacobian() / ssasum.value()(i1) -
511  taur_wrt_iv.value()(i1) / (ssasum.value()(i1) * ssasum.value()(i1)) *
512  ssasum.jacobian();
513 
514  omega.value() = ssasum.value() / tau.value();
515  omega.jacobian() = ssasum.jacobian() / tau.value()(i1) -
516  ssasum.value()(i1) / (tau.value()(i1) * tau.value()(i1)) *
517  tau.jacobian();
518  } else {
519  // Note this is ok that frac_ray and frac_aer don't get updated on
520  // this branch of the logic, if you look at scattering_moment you'll see
521  // these value won't get used.
522  omega.value() = taur_wrt_iv.value() / tau.value();
523  omega.jacobian() = taur_wrt_iv.jacobian() / tau.value()(i1) -
524  taur_wrt_iv.value()(i1) / (tau.value()(i1) * tau.value()(i1)) *
525  tau.jacobian();
526  }
527 }
528 //
529 // See bass class for description
531 {
532  range_check(spec_index, 0, number_spectrometer());
533  ArrayAdWithUnit<double, 1> p = pressure->pressure_grid();
534  Array<AutoDerivative<double>, 1> res(p.rows());
535  Unit u = alt[spec_index]->altitude(p(0)).units;
536  for(int i = 0; i < res.rows(); ++i)
537  res(i) = alt[spec_index]->altitude(p(i)).convert(u).value;
539 }
540 
541 //-----------------------------------------------------------------------
543 //-----------------------------------------------------------------------
544 
546 {
547  ArrayAdWithUnit<double, 1> temp_grid = temperature->temperature_grid(*pressure);
548 
549  ArrayAd<double, 1> black_body(temp_grid.rows(), temp_grid.number_variable());
550 
551  for(int lev_idx = 0; lev_idx < temp_grid.rows(); lev_idx++) {
552  double temp_K = temp_grid(lev_idx).convert(Unit("K")).value.value();
553  black_body(lev_idx) = planck(wn, temp_K, temp_grid(lev_idx).value.gradient());
554  }
555 
556  return black_body;
557 }
558 
559 //-----------------------------------------------------------------------
561 //-----------------------------------------------------------------------
562 
564 {
565  if (!surface_temp) {
566  Exception error;
567  error << "Cannot compute surface_blackbody, atmosphere was constructed without a surface tempererature object.";
568  throw error;
569  }
570 
571  double surf_temp_K = surface_temp->surface_temperature(spec_index).convert(Unit("K")).value.value();
572  Array<double, 1> surf_temp_grad = surface_temp->surface_temperature(spec_index).value.gradient();
573  return planck(wn, surf_temp_K, surf_temp_grad);
574 }
575 
576 //-----------------------------------------------------------------------
592 //-----------------------------------------------------------------------
593 
595 {
596  boost::shared_ptr<Pressure> pressure_clone = pressure->clone();
597  boost::shared_ptr<Temperature> temperature_clone =
598  temperature->clone(pressure_clone);
599  boost::shared_ptr<Ground> ground_clone;
600  if(ground_ptr)
601  ground_clone = ground_ptr->clone();
602  std::vector<boost::shared_ptr<Altitude> > alt_clone;
603  BOOST_FOREACH(const boost::shared_ptr<Altitude>& a, alt)
604  alt_clone.push_back(a->clone(pressure_clone, temperature_clone));
605  boost::shared_ptr<Absorber> absorber_clone =
606  absorber->clone(pressure_clone, temperature_clone, alt_clone);
608  rh->clone(absorber_clone, temperature_clone, pressure_clone);
609  boost::shared_ptr<Aerosol> aerosol_clone;
610  if(aerosol)
611  aerosol_clone = aerosol->clone(pressure_clone, rh_clone);
612 
614  (new AtmosphereOco(absorber_clone, pressure_clone, temperature_clone,
615  aerosol_clone, rh_clone, ground_clone, alt_clone,
616  constant));
617  return res;
618 }
619 
620 void AtmosphereOco::print(std::ostream& Os) const
621 {
622  Os << "AtmosphereOco:\n";
623  OstreamPad opad(Os, " ");
624  Os << " Constant:\n";
625  opad << *constant << "\n";
626  opad.strict_sync();
627  Os << " Absorber:\n";
628  opad << *absorber << "\n";
629  opad.strict_sync();
630  Os << " Pressure:\n";
631  opad << *pressure << "\n";
632  opad.strict_sync();
633  Os << " Temperature:\n";
634  opad << *temperature << "\n";
635  opad.strict_sync();
636  Os << " Aerosol:\n";
637  if(aerosol)
638  opad << *aerosol << "\n";
639  else
640  opad << "Rayleigh only, no aerosols\n";
641  opad.strict_sync();
642  Os << " Ground:\n";
643  if(ground_ptr)
644  opad << *ground_ptr << "\n";
645  else
646  opad << "No ground\n";
647  opad.strict_sync();
648  for(int i = 0; i < (int) alt.size(); ++i) {
649  Os << " Altitude[" << i << "]:\n";
650  opad << *(alt[i]) << "\n";
651  opad.strict_sync();
652  }
653 }
654 
655 //-----------------------------------------------------------------------
660 //-----------------------------------------------------------------------
661 
663 {
664  PressureFixedLevel& p = dynamic_cast<PressureFixedLevel&>(*pressure);
666 }
667 
668 //-----------------------------------------------------------------------
673 //-----------------------------------------------------------------------
674 
676 {
677  statev.add_observer(*this);
678 
679  // Need to reattach the cloned atmosphere components to the SV one by one as done in the Lua config and in the same order
680  statev.add_observer(*this->absorber_ptr());
681  for (int spec_idx = 0; spec_idx < this->absorber_ptr()->number_species(); spec_idx++) {
682  std::string gas_name = this->absorber_ptr()->gas_name(spec_idx);
683  statev.add_observer(*this->absorber_ptr()->absorber_vmr(gas_name));
684  }
685 
686  statev.add_observer(*this->pressure_ptr());
687  statev.add_observer(*this->temperature_ptr());
688 
689  if(this->aerosol_ptr()) {
690  statev.add_observer(*this->aerosol_ptr());
691  for (int aer_idx = 0; aer_idx < this->aerosol_ptr()->number_particle(); aer_idx++) {
692  boost::shared_ptr<AerosolOptical> aer_optical(boost::dynamic_pointer_cast<AerosolOptical>(this->aerosol_ptr()));
693  if (aer_optical) {
694  statev.add_observer(*aer_optical->aerosol_extinction(aer_idx));
695  statev.add_observer(*aer_optical->aerosol_property(aer_idx));
696  }
697  }
698  }
699 
700  if(this->ground()) {
701  statev.add_observer(*this->ground());
702  }
703 }
704 
705 
ArrayAdWithUnit< T, D > convert(const Unit &R) const
Convert to the given units.
#define range_check(V, Min, Max)
Range check.
Definition: fp_exception.h:140
int cols() const
Definition: array_ad.h:369
bool is_constant() const
Definition: array_ad.h:371
virtual std::string timer_info() const
Return timer information.
This class is responsible for setting up the atmosphere and ground information needed to run the Radi...
Definition: rt_atmosphere.h:51
This is a filtering stream that adds a pad to the front of every line written out.
Definition: ostream_pad.h:32
bool rayleigh_only_atmosphere() const
Indicate we have rayleigh only atmosphere, i.e., we don&#39;t have any aerosol content.
void set_aerosol(boost::shared_ptr< Aerosol > &new_aerosol, StateVector &Sv)
Changes the aerosol class used.
static AccumulatedTimer timer
Timer for Aerosol.
Definition: aerosol.h:29
void set_surface_pressure(const AutoDerivative< double > &Surface_pressure)
Set the surface pressure. This is in Pascals.
const boost::shared_ptr< Pressure > & pressure_ptr() const
void reset_elapsed()
Reset elapsed time to 0.
boost::shared_ptr< AtmosphereOco > clone() const
This clones a Atmosphere object.
static AccumulatedTimer timer
Timer for RtAtmosphere.
Definition: rt_atmosphere.h:55
This is the base of the exception hierarchy for Full Physics code.
Definition: fp_exception.h:16
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
Definition: register_lua.h:136
const blitz::Array< T, D+1 > jacobian() const
Definition: array_ad.h:307
virtual void add_observer(Observer< StateVector > &Obs)
Add an observer.
Definition: state_vector.h:24
virtual int number_layer() const
Number of layers we currently have.
const int taua_0_index
virtual void reset_timer()
Reset timer.
const boost::shared_ptr< Temperature > & temperature_ptr() const
void notify_update_do(const RtAtmosphere &Self)
Function to call to notify Observers of a state change.
Definition: observer.h:121
Apply value function to a blitz array.
const Unit A("A", 1.0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0)
virtual const boost::shared_ptr< Ground > ground() const
Object that represents the ground surface.
static const blitz::Array< double, 2 > & array(double depolar_fact=0.02790)
Return the Ralyeigh Greek Moment Array.
This class calculates the Rayleigh portion of the optical depth.
Definition: rayleigh.h:13
const blitz::Array< T, D > & value() const
Definition: array_ad.h:306
This class maintains the aerosol portion of the state.
Definition: aerosol.h:24
void resize(const blitz::TinyVector< int, D > &Shape, int nvar)
Definition: array_ad.h:177
FunctionTimer function_timer(bool Auto_log=false) const
Function timer.
virtual int number_spectrometer() const
Number of spectrometers we have.
virtual void remove_observer(Observer< StateVector > &Obs)
Remove an observer.
Definition: state_vector.h:26
The AutoDerivative<T> works well, and it works with blitz if you create a blitz::Array<AutoDerivative...
Definition: array_ad.h:40
virtual AutoDerivative< double > surface_blackbody(double wn, int spec_index) const
The surface thermal blackbody.
static AccumulatedTimer timer
Timer for optical_depth_each_layer.
Definition: absorber.h:31
This handles informing a set of interested objects when the state vector has updated.
Definition: state_vector.h:16
int number_variable() const
Definition: array_ad.h:376
double planck(double wn, double temperature)
Computes the black body function value using the planck function for a given wavenumber (cm^-1) and t...
Definition: planck.cc:16
virtual void print(std::ostream &Os) const
void reference(const ArrayAd< T, D > &V)
Definition: array_ad.h:372
Libraries such as boost::units allow unit handling where we know the units at compile time...
Definition: unit.h:25
const int taur_index
const int taug_index
Index numbers used in Intermediate variables.
const boost::shared_ptr< Aerosol > & aerosol_ptr() const
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
virtual boost::shared_ptr< ArrayAdCache< double, double, 1 > > & column_optical_depth_cache()
#define REGISTER_LUA_END()
Definition: register_lua.h:134
This class maintains the pressure portion of the state.
const blitz::TinyVector< int, D > & shape() const
Definition: array_ad.h:383
Caches ArrayAd objects using a std::map.
This class maintains the atmosphere portion of the state, and uses this to set up the atmosphere and ...
Helper class for AccumulatedTimer.
void set_surface_pressure_for_testing(double x)
For unit test purposes, it is useful to be able to directly change the surface pressure.
void attach_children_to_sv(StateVector &statev)
For unit test purposes, it is useful to be able to clone or create a new atmosphere class then attach...
virtual void notify_update(const StateVector &Sv)
Called when the Observed object is updated.
virtual ArrayAd< double, 1 > atmosphere_blackbody(double wn, int spec_index) const
The atmospheric thermal blackbody values per level.
double value(const FullPhysics::AutoDerivative< double > &Ad)
const boost::shared_ptr< Absorber > & absorber_ptr() const
virtual std::string timer_info() const
Return timer information.
virtual ArrayAdWithUnit< double, 1 > altitude(int spec_index) const
Altitude grid for current pressure grid.
virtual void reset_timer()
Reset timer.
AtmosphereOco(const boost::shared_ptr< Absorber > &absorberv, const boost::shared_ptr< Pressure > &pressurev, const boost::shared_ptr< Temperature > &temperaturev, const boost::shared_ptr< Aerosol > &aerosolv, const boost::shared_ptr< RelativeHumidity > &rhv, const boost::shared_ptr< Ground > &groundv, const boost::shared_ptr< SurfaceTemperature > &surface_tempv, const std::vector< boost::shared_ptr< Altitude > > &altv, const boost::shared_ptr< Constant > &C)
Create an an Atmosphere with all available components:
int rows() const
Definition: array_ad.h:368

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:08