Flow123d  3.9.0-9663d1cde
transport.cc
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file transport.cc
15  * @ingroup transport
16  * @brief Transport
17  */
18 
19 #include <memory>
20 
21 #include "system/system.hh"
22 #include "system/sys_profiler.hh"
23 #include "system/index_types.hh"
24 
25 #include "mesh/mesh.h"
26 #include "mesh/partitioning.hh"
27 #include "mesh/accessors.hh"
28 #include "mesh/range_wrapper.hh"
29 #include "mesh/neighbours.h"
30 #include "transport/transport.h"
32 
33 #include "la/distribution.hh"
34 
35 #include "la/sparse_graph.hh"
36 #include <iostream>
37 #include <iomanip>
38 #include <string>
39 
40 #include "io/output_time.hh"
41 #include "tools/time_governor.hh"
42 #include "tools/mixed.hh"
43 #include "coupling/balance.hh"
44 #include "input/accessors.hh"
45 #include "input/input_type.hh"
46 
48 #include "fields/field_values.hh"
49 #include "fields/field_fe.hh"
51 #include "fields/generic_field.hh"
52 
53 #include "reaction/isotherm.hh" // SorptionType enum
54 
55 #include "fem/fe_p.hh"
56 #include "fem/fe_values.hh"
58 
59 
60 FLOW123D_FORCE_LINK_IN_CHILD(convectionTransport)
61 
62 
63 namespace IT = Input::Type;
64 
65 /********************************************************************************
66  * Static methods and data members
67  */
68 const string _equation_name = "Solute_Advection_FV";
69 
71  Input::register_class< ConvectionTransport, Mesh &, const Input::Record >(_equation_name) +
73 
75 {
76  return IT::Record(_equation_name, "Finite volume method, explicit in time, for advection only solute transport.")
78  .declare_key("input_fields", IT::Array(
79  EqFields().make_field_descriptor_type(_equation_name)),
81  "")
82  .declare_key("output",
83  EqFields().output_fields.make_output_type(_equation_name, ""),
84  IT::Default("{ \"fields\": [ \"conc\" ] }"),
85  "Specification of output fields and output times.")
86  .close();
87 }
88 
89 
91 {
92  *this += bc_conc.name("bc_conc")
93  .description("Boundary condition for concentration of substances.")
94  .input_default("0.0")
95  .units( UnitSI().kg().m(-3) );
96 
97  *this += init_conc.name("init_conc")
98  .description("Initial values for concentration of substances.")
99  .input_default("0.0")
100  .units( UnitSI().kg().m(-3) );
101 
102  output_fields += *this;
103  output_fields += conc_mobile.name("conc")
104  .units( UnitSI().kg().m(-3) )
106  .description("Concentration solution.");
107  output_fields += region_id.name("region_id")
110  .description("Region ids.");
111  output_fields += subdomain.name("subdomain")
114  .description("Subdomain ids of the domain decomposition.");
115 }
116 
117 
118 /********************************************************************************
119  * ConvectionTransport
120  */
122 : ConcentrationTransportBase(init_mesh, in_rec),
123  input_rec(in_rec)
124 {
125  START_TIMER("ConvectionTransport");
126  eq_data_ = make_shared<EqData>();
127  eq_fields_ = make_shared<EqFields>();
128  eq_fields_->add_coords_field();
129  this->eq_fieldset_ = eq_fields_.get();
130 
131  eq_data_->transport_matrix_time = -1.0; // or -infty
132  eq_data_->transport_bc_time = -1.0;
133  eq_data_->is_convection_matrix_scaled = false;
134  is_src_term_scaled = false;
135  is_bc_term_scaled = false;
136 
137  //initialization of DOF handler
138  MixedPtr<FE_P_disc> fe(0);
139  eq_data_->dh_ = make_shared<DOFHandlerMultiDim>(init_mesh);
140  shared_ptr<DiscreteSpace> ds = make_shared<EqualOrderDiscreteSpace>( &init_mesh, fe);
141  eq_data_->dh_->distribute_dofs(ds);
142  vcumulative_corr = nullptr;
143 
144 }
145 
147 {
149 
151 
152  eq_fields_->set_components(eq_data_->substances_.names());
153  eq_fields_->set_input_list( input_rec.val<Input::Array>("input_fields"), *time_ );
154  eq_fields_->set_mesh(*mesh_);
155 
158 
159  // register output vectors
160  eq_fields_->output_fields.set_components(eq_data_->substances_.names());
161  eq_fields_->output_fields.set_mesh(*mesh_);
162  eq_fields_->output_fields.output_type(OutputTime::ELEM_DATA);
163  eq_fields_->conc_mobile.setup_components();
166  for (unsigned int sbi=0; sbi<n_substances(); sbi++)
167  {
168  // create shared pointer to a FieldFE and push this Field to output_field on all regions
169  eq_fields_->conc_mobile_fe[sbi] = create_field_fe< 3, FieldValue<3>::Scalar >(eq_data_->dh_);
170  eq_fields_->conc_mobile[sbi].set(eq_fields_->conc_mobile_fe[sbi], 0);
171  }
172  //output_stream_->add_admissible_field_names(input_rec.val<Input::Array>("output_fields"));
173  //output_stream_->mark_output_times(*time_);
174 
175  eq_fields_->output_fields.initialize(output_stream_, mesh_, input_rec.val<Input::Record>("output"), time() );
176  //cout << "Transport." << endl;
177  //cout << time().marks();
178 
179  balance_->allocate(mesh_->get_el_ds()->lsize(), 1);
180  eq_data_->balance_ = this->balance();
181  eq_data_->set_time_governor(this->time_);
182  eq_data_->max_edg_sides = max(this->mesh_->max_edge_sides(1), max(this->mesh_->max_edge_sides(2), this->mesh_->max_edge_sides(3)));
183 
189 }
190 
191 
193 {
194  return eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec();
195 }
196 
197 
198 
200 {
201  unsigned int sbi;
202 
203  if (vcumulative_corr) {
204  //Destroy mpi vectors at first
205  chkerr(MatDestroy(&eq_data_->tm));
206  chkerr(VecDestroy(&eq_data_->mass_diag));
207  chkerr(VecDestroy(&vpmass_diag));
208 
209  for (sbi = 0; sbi < n_substances(); sbi++) {
210  // mpi vectors
211  chkerr(VecDestroy(&vpconc[sbi]));
212  chkerr(VecDestroy(&eq_data_->bcvcorr[sbi]));
213  chkerr(VecDestroy(&vcumulative_corr[sbi]));
214  }
215 
216  // arrays of mpi vectors
217  delete vpconc;
218  delete eq_data_->bcvcorr;
219  delete vcumulative_corr;
220 
221  // assembly objects
222  delete mass_assembly_;
223  delete init_cond_assembly_;
225  delete matrix_mpi_assembly_;
226  }
227 }
228 
229 
230 
231 
232 
233 //=============================================================================
234 // ALLOCATE OF TRANSPORT VARIABLES (ELEMENT & NODES)
235 //=============================================================================
237 
238  eq_fields_->conc_mobile_fe.resize(this->n_substances());
239 }
240 
241 //=============================================================================
242 // ALLOCATION OF TRANSPORT VECTORS (MPI)
243 //=============================================================================
245 
246  int sbi, n_subst, lsize;
247  n_subst = n_substances();
248  lsize = mesh_->get_el_ds()->lsize();
249 
250  MPI_Barrier(PETSC_COMM_WORLD);
251 
252  vpconc = new Vec[n_subst];
253  eq_data_->bcvcorr = new Vec[n_subst];
254  vcumulative_corr = new Vec[n_subst];
255  eq_data_->tm_diag.reserve(eq_data_->n_substances());
256  eq_data_->corr_vec.reserve(eq_data_->n_substances());
257 
258 
259  for (sbi = 0; sbi < n_subst; sbi++) {
260  VecCreateMPI(PETSC_COMM_WORLD, lsize, mesh_->n_elements(), &eq_data_->bcvcorr[sbi]);
261  VecZeroEntries(eq_data_->bcvcorr[sbi]);
262 
263  VecCreateMPI(PETSC_COMM_WORLD, lsize, mesh_->n_elements(), &vpconc[sbi]);
264  VecZeroEntries(vpconc[sbi]);
265 
266  // SOURCES
267  VecCreateMPI(PETSC_COMM_WORLD, lsize, mesh_->n_elements(), &vcumulative_corr[sbi]);
268 
269  eq_data_->corr_vec.emplace_back(lsize, PETSC_COMM_WORLD);
270 
271  eq_data_->tm_diag.emplace_back(lsize, PETSC_COMM_WORLD);
272 
273  VecZeroEntries(vcumulative_corr[sbi]);
274  }
275 
276 
277  MatCreateAIJ(PETSC_COMM_WORLD, lsize, lsize, mesh_->n_elements(),
278  mesh_->n_elements(), 16, PETSC_NULL, 4, PETSC_NULL, &eq_data_->tm);
279 
280  VecCreateMPI(PETSC_COMM_WORLD, lsize, mesh_->n_elements(), &eq_data_->mass_diag);
281  VecCreateMPI(PETSC_COMM_WORLD, lsize, mesh_->n_elements(), &vpmass_diag);
282 
283  eq_data_->alloc_transport_structs_mpi(lsize);
284 }
285 
286 
288 {
289  ASSERT_EQ(time_->tlevel(), 0);
290 
291  eq_fields_->mark_input_times(*time_);
292  eq_fields_->set_time(time_->step(), LimitSide::right);
293  std::stringstream ss; // print warning message with table of uninitialized fields
294  if ( FieldCommon::print_message_table(ss, "convection transport") ) {
295  WarningOut() << ss.str();
296  }
297 
298  //set_initial_condition();
300  //create_mass_matrix();
302 
303  START_TIMER("Convection balance zero time step");
304 
305  START_TIMER("convection_matrix_assembly");
306  //create_transport_matrix_mpi();
308  END_TIMER("convection_matrix_assembly");
309  START_TIMER("sources_reinit_set_bc");
310  //conc_sources_bdr_conditions();
312  END_TIMER("sources_reinit_set_bc");
313 
314  // write initial condition
315  output_data();
316 }
317 
318 
320 {
321  ASSERT_PTR(eq_data_->dh_).error( "Null DOF handler object.\n" );
322  // read changed status before setting time
323  bool changed_flux = eq_fields_->flow_flux.changed();
324  eq_fields_->set_time(time_->step(), LimitSide::right); // set to the last computed time
325 
326  START_TIMER("data reinit");
327 
328  bool cfl_changed = false;
329 
330  // if FLOW or DATA changed ---------------------> recompute transport matrix
331  if (changed_flux)
332  {
333  START_TIMER("convection_matrix_assembly");
334  //create_transport_matrix_mpi();
336  END_TIMER("convection_matrix_assembly");
337  eq_data_->is_convection_matrix_scaled=false;
338  cfl_changed = true;
339  DebugOut() << "CFL changed - flow.\n";
340  }
341 
342  if (eq_data_->is_mass_diag_changed)
343  {
344  //create_mass_matrix();
346  cfl_changed = true;
347  DebugOut() << "CFL changed - mass matrix.\n";
348  }
349 
350  // if DATA changed ---------------------> recompute concentration sources (rhs and matrix diagonal)
351  if( eq_fields_->sources_density.changed() || eq_fields_->sources_conc.changed() || eq_fields_->sources_sigma.changed()
352  || eq_fields_->cross_section.changed() || eq_fields_->flow_flux.changed() || eq_fields_->porosity.changed()
353  || eq_fields_->water_content.changed() || eq_fields_->bc_conc.changed() )
354  {
355  START_TIMER("sources_reinit_set_bc");
356  //conc_sources_bdr_conditions();
358  END_TIMER("sources_reinit_set_bc");
359  if( eq_data_->sources_changed_ ) {
360  is_src_term_scaled = false;
361  cfl_changed = true;
362  }
363  if (eq_fields_->flow_flux.changed() || eq_fields_->porosity.changed()
364  || eq_fields_->water_content.changed() || eq_fields_->bc_conc.changed() ) is_bc_term_scaled = false;
365  DebugOut() << "CFL changed - source.\n";
366  }
367 
368  // now resolve the CFL condition
369  if(cfl_changed)
370  {
371  // find maximum of sum of contribution from flow and sources: MAX(vcfl_flow_ + vcfl_source_)
372  Vec cfl;
373  VecCreateMPI(PETSC_COMM_WORLD, mesh_->get_el_ds()->lsize(), PETSC_DETERMINE, &cfl);
374  VecWAXPY(cfl, 1.0, eq_data_->cfl_flow_.petsc_vec(), eq_data_->cfl_source_.petsc_vec());
375  VecMaxPointwiseDivide(cfl, eq_data_->mass_diag, &cfl_max_step);
376  // get a reciprocal value as a time constraint
378  DebugOut().fmt("CFL constraint (transport): {}\n", cfl_max_step);
379  }
380 
381  END_TIMER("data reinit");
382 
383  // return time constraint
384  time_constraint = cfl_max_step;
385  return cfl_changed;
386 }
387 
389 
390  START_TIMER("convection-one step");
391 
392  // proceed to next time - which we are about to compute
393  // explicit scheme looks one step back and uses data from previous time
394  // (data time set previously in assess_time_constraint())
395  time_->next_time();
396 
397  double dt_new = time_->dt(), // current time step we are about to compute
398  dt_scaled = dt_new / time_->last_dt(); // scaling ratio to previous time step
399 
400  START_TIMER("time step rescaling");
401 
402  // if FLOW or DATA or BC or DT changed ---------------------> rescale boundary condition
404  {
405  DebugOut() << "BC - rescale dt.\n";
406  //choose between fresh scaling with new dt or rescaling to a new dt
407  double dt = (!is_bc_term_scaled) ? dt_new : dt_scaled;
408  for (unsigned int sbi=0; sbi<n_substances(); sbi++)
409  VecScale(eq_data_->bcvcorr[sbi], dt);
410  is_bc_term_scaled = true;
411  }
412 
413 
414  // if DATA or TIME STEP changed -----------------------> rescale source term
416  DebugOut() << "SRC - rescale dt.\n";
417  //choose between fresh scaling with new dt or rescaling to a new dt
418  double dt = (!is_src_term_scaled) ? dt_new : dt_scaled;
419  for (unsigned int sbi=0; sbi<n_substances(); sbi++)
420  {
421  VecScale(eq_data_->corr_vec[sbi].petsc_vec(), dt);
422  VecScale(eq_data_->tm_diag[sbi].petsc_vec(), dt);
423  }
424  is_src_term_scaled = true;
425  }
426 
427  // if DATA or TIME STEP changed -----------------------> rescale transport matrix
428  if ( !eq_data_->is_convection_matrix_scaled || time_->is_changed_dt()) {
429  DebugOut() << "TM - rescale dt.\n";
430  //choose between fresh scaling with new dt or rescaling to a new dt
431  double dt = (!eq_data_->is_convection_matrix_scaled) ? dt_new : dt_scaled;
432 
433  MatScale(eq_data_->tm, dt);
434  eq_data_->is_convection_matrix_scaled = true;
435  }
436 
437  END_TIMER("time step rescaling");
438 
439 
440  eq_fields_->set_time(time_->step(), LimitSide::right); // set to the last computed time
441  if (eq_fields_->cross_section.changed() || eq_fields_->water_content.changed() || eq_fields_->porosity.changed())
442  {
443  VecCopy(eq_data_->mass_diag, vpmass_diag);
444  //create_mass_matrix();
446  } else eq_data_->is_mass_diag_changed = false;
447 
448 
449  // Compute new concentrations for every substance.
450 
451  for (unsigned int sbi = 0; sbi < n_substances(); sbi++) {
452  // one step in MOBILE phase
453  START_TIMER("mat mult");
454  Vec vconc = eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec();
455 
456  // tm_diag is a diagonal part of transport matrix, which depends on substance data (sources_sigma)
457  // Wwe need keep transport matrix independent of substance, therefore we keep this diagonal part
458  // separately in a vector tm_diag.
459  // Computation: first, we compute this diagonal addition D*pconc and save it temporaly into RHS
460 
461  // RHS = D*pconc, where D is diagonal matrix represented by a vector
462  VecPointwiseMult(vcumulative_corr[sbi], eq_data_->tm_diag[sbi].petsc_vec(), vconc); //w = x.*y
463 
464  // Then we add boundary terms ans other source terms into RHS.
465  // RHS = 1.0 * bcvcorr + 1.0 * corr_vec + 1.0 * rhs
466  VecAXPBYPCZ(vcumulative_corr[sbi], 1.0, 1.0, 1.0, eq_data_->bcvcorr[sbi], eq_data_->corr_vec[sbi].petsc_vec()); //z = ax + by + cz
467 
468  // Then we set the new previous concentration.
469  VecCopy(vconc, vpconc[sbi]); // pconc = conc
470  // And finally proceed with transport matrix multiplication.
471  if (eq_data_->is_mass_diag_changed) {
472  VecPointwiseMult(vconc, vconc, vpmass_diag); // vconc*=vpmass_diag
473  MatMultAdd(eq_data_->tm, vpconc[sbi], vconc, vconc); // vconc+=tm*vpconc
474  VecAXPY(vconc, 1, vcumulative_corr[sbi]); // vconc+=vcumulative_corr
475  VecPointwiseDivide(vconc, vconc, eq_data_->mass_diag); // vconc/=mass_diag
476  } else {
477  MatMultAdd(eq_data_->tm, vpconc[sbi], vcumulative_corr[sbi], vconc); // vconc =tm*vpconc+vcumulative_corr
478  VecPointwiseDivide(vconc, vconc, eq_data_->mass_diag); // vconc/=mass_diag
479  VecAXPY(vconc, 1, vpconc[sbi]); // vconc+=vpconc
480  }
481 
482  END_TIMER("mat mult");
483  }
484 
485  for (unsigned int sbi=0; sbi<n_substances(); ++sbi)
486  balance_->calculate_cumulative(sbi, vpconc[sbi]);
487 
488  END_TIMER("convection-one step");
489 }
490 
491 
492 void ConvectionTransport::set_target_time(double target_time)
493 {
494 
495  //sets target_mark_type (it is fixed) to be met in next_time()
496  time_->marks().add(TimeMark(target_time, target_mark_type));
497 
498  // This is done every time TOS calls update_solution.
499  // If CFL condition is changed, time fixation will change later from TOS.
500 
501  // Set the same constraint as was set last time.
502 
503  // TODO: fix this hack, remove this method completely, leaving just the first line at the calling point
504  // in TransportOperatorSplitting::update_solution()
505  // doing this directly leads to choose of large time step violationg CFL condition
506  if (cfl_max_step > time_->dt()*1e-10)
507  time_->set_upper_constraint(cfl_max_step, "CFL condition used from previous step.");
508 
509  // fixing convection time governor till next target_mark_type (got from TOS or other)
510  // may have marks for data changes
512 }
513 
514 
516  return eq_fields_->conc_mobile_fe;
517 }
518 
519 
521 
522  eq_fields_->output_fields.set_time(time().step(), LimitSide::right);
523  eq_fields_->output_fields.output(time().step());
524 
525  START_TIMER("TOS-balance");
526  for (unsigned int sbi=0; sbi<n_substances(); ++sbi)
527  balance_->calculate_instant(sbi, eq_fields_->conc_mobile_fe[sbi]->vec().petsc_vec());
528  balance_->output();
529  END_TIMER("TOS-balance");
530 }
531 
532 void ConvectionTransport::set_balance_object(std::shared_ptr<Balance> balance)
533 {
534  balance_ = balance;
535  eq_data_->subst_idx = balance_->add_quantities(eq_data_->substances_.names());
536  eq_data_->balance_ = this->balance();
537 }
FieldCommon::units
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
Definition: field_common.hh:152
LimitSide::right
@ right
MeshBase::max_edge_sides
unsigned int max_edge_sides(unsigned int dim) const
Definition: mesh.h:145
_equation_name
const string _equation_name
Definition: transport.cc:68
EquationBase::mesh_
Mesh * mesh_
Definition: equation.hh:219
ConvectionTransport::set_balance_object
void set_balance_object(std::shared_ptr< Balance > balance) override
Definition: transport.cc:532
ConvectionTransport::is_bc_term_scaled
bool is_bc_term_scaled
Definition: transport.h:300
ConvectionTransport::EqFields::region_id
Field< 3, FieldValue< 3 >::Scalar > region_id
Definition: transport.h:108
TimeGovernor::dt
double dt() const
Definition: time_governor.hh:565
UnitSI::dimensionless
static UnitSI & dimensionless()
Returns dimensionless unit.
Definition: unit_si.cc:55
sparse_graph.hh
Distributed sparse graphs, partitioning.
Distribution::lsize
unsigned int lsize(int proc) const
get local size
Definition: distribution.hh:115
time_governor.hh
Basic time management class.
TimeGovernor::end_time
double end_time() const
End time.
Definition: time_governor.hh:591
ConvectionTransport::get_input_type
static const Input::Type::Record & get_input_type()
Definition: transport.cc:74
field_algo_base.hh
neighbours.h
GenericAssembly::set_min_edge_sides
void set_min_edge_sides(unsigned int val)
Definition: generic_assembly.hh:194
ConvectionTransport::matrix_mpi_assembly_
GenericAssembly< MatrixMpiAssemblyConvection > * matrix_mpi_assembly_
Definition: transport.h:325
MeshBase::get_el_ds
Distribution * get_el_ds() const
Definition: mesh.h:119
TimeGovernor::equation_fixed_mark_type
TimeMark::Type equation_fixed_mark_type() const
Definition: time_governor.hh:481
EquationBase::time_
TimeGovernor * time_
Definition: equation.hh:220
distribution.hh
Support classes for parallel programing.
ConvectionTransport::EqFields::output_fields
EquationOutput output_fields
Fields indended for output, i.e. all input fields plus those representing solution.
Definition: transport.h:115
ConvectionTransport::EqFields::conc_mobile
MultiField< 3, FieldValue< 3 >::Scalar > conc_mobile
Calculated concentrations in the mobile zone.
Definition: transport.h:111
Input::Record::val
const Ret val(const string &key) const
Definition: accessors_impl.hh:31
TimeGovernor::set_upper_constraint
int set_upper_constraint(double upper, std::string message)
Sets upper constraint for the next time step estimating.
Definition: time_governor.cc:555
EquationBase::time
TimeGovernor & time()
Definition: equation.hh:148
fe_values.hh
Class FEValues calculates finite element data on the actual cells such as shape function values,...
chkerr
void chkerr(unsigned int ierr)
Replacement of new/delete operator in the spirit of xmalloc.
Definition: system.hh:142
FLOW123D_FORCE_LINK_IN_CHILD
#define FLOW123D_FORCE_LINK_IN_CHILD(x)
Definition: global_defs.h:104
ConvectionTransport::~ConvectionTransport
virtual ~ConvectionTransport()
Definition: transport.cc:199
std::vector< std::shared_ptr< FieldFE< 3, FieldValue< 3 >::Scalar > > >
ConvectionTransport::eq_data_
std::shared_ptr< EqData > eq_data_
Definition: transport.h:292
system.hh
OutputTime::ELEM_DATA
@ ELEM_DATA
Definition: output_time.hh:111
FieldCommon::flags
FieldCommon & flags(FieldFlag::Flags::Mask mask)
Definition: field_common.hh:191
ConvectionTransport::n_substances
unsigned int n_substances() override
Returns number of transported substances.
Definition: transport.h:271
ConvectionTransport::EqFields::bc_conc
BCMultiField< 3, FieldValue< 3 >::Scalar > bc_conc
Definition: transport.h:103
ConvectionTransport::vcumulative_corr
Vec * vcumulative_corr
Definition: transport.h:313
field_fe.hh
ConvectionTransport::output_stream_
std::shared_ptr< OutputTime > output_stream_
Definition: transport.h:318
index_types.hh
ConvectionTransport::init_cond_assembly_
GenericAssembly< InitCondAssemblyConvection > * init_cond_assembly_
Definition: transport.h:323
ConvectionTransport::EqFields::init_conc
MultiField< 3, FieldValue< 3 >::Scalar > init_conc
Initial concentrations.
Definition: transport.h:106
GenericAssembly::assemble
void assemble(std::shared_ptr< DOFHandlerMultiDim > dh) override
General assemble methods.
Definition: generic_assembly.hh:204
FieldFlag::equation_external_output
static constexpr Mask equation_external_output
Match an output field, that can be also copy of other field.
Definition: field_flag.hh:58
fe_p.hh
Definitions of basic Lagrangean finite elements with polynomial shape functions.
Input::Type::Record::size
unsigned int size() const
Returns number of keys in the Record.
Definition: type_record.hh:602
Input::Type::Default
Class Input::Type::Default specifies default value of keys of a Input::Type::Record.
Definition: type_record.hh:61
Input::Type::Record::derive_from
virtual Record & derive_from(Abstract &parent)
Method to derive new Record from an AbstractRecord parent.
Definition: type_record.cc:196
EquationBase::balance
std::shared_ptr< Balance > balance() const
Definition: equation.hh:186
TimeMark
Class used for marking specified times at which some events occur.
Definition: time_marks.hh:45
ConvectionTransport::alloc_transport_structs_mpi
void alloc_transport_structs_mpi()
Definition: transport.cc:244
accessors.hh
assembly_convection.hh
EquationBase::balance_
std::shared_ptr< Balance > balance_
object for calculation and writing the mass balance to file.
Definition: equation.hh:231
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
FieldFlag::equation_result
static constexpr Mask equation_result
Match result fields. These are never given by input or copy of input.
Definition: field_flag.hh:55
sys_profiler.hh
ConvectionTransport::input_rec
const Input::Record input_rec
Record with input specification.
Definition: transport.h:316
ConvectionTransport::evaluate_time_constraint
bool evaluate_time_constraint(double &time_constraint) override
Definition: transport.cc:319
ConvectionTransport::registrar
static const int registrar
Registrar of class to factory.
Definition: transport.h:286
TimeGovernor::tlevel
int tlevel() const
Definition: time_governor.hh:607
ConvectionTransport::zero_time_step
void zero_time_step() override
Definition: transport.cc:287
quadrature_lib.hh
Definitions of particular quadrature rules on simplices.
ConvectionTransport::EqFields
Definition: transport.h:88
accessors.hh
ConvectionTransport::vpmass_diag
Vec vpmass_diag
Definition: transport.h:309
TimeGovernor::step
const TimeStep & step(int index=-1) const
Definition: time_governor.cc:756
ConvectionTransport::output_data
virtual void output_data() override
Write computed fields.
Definition: transport.cc:520
output_time.hh
ConvectionTransport::conc_sources_bdr_assembly_
GenericAssembly< ConcSourcesBdrAssemblyConvection > * conc_sources_bdr_assembly_
Definition: transport.h:324
field_values.hh
GenericField::subdomain
static auto subdomain(Mesh &mesh) -> IndexField
Definition: generic_field.impl.hh:58
Input::Type::Default::obligatory
static Default obligatory()
The factory function to make an empty default value which is obligatory.
Definition: type_record.hh:110
FieldCommon::print_message_table
static bool print_message_table(ostream &stream, std::string equation_name)
Definition: field_common.cc:96
ConvectionTransport::EqFields::EqFields
EqFields()
Definition: transport.cc:90
UnitSI
Class for representation SI units of Fields.
Definition: unit_si.hh:40
ASSERT_EQ
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Definition: asserts.hh:333
Input::Type::Record::declare_key
Record & declare_key(const string &key, std::shared_ptr< TypeBase > type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
Declares a new key of the Record.
Definition: type_record.cc:503
isotherm.hh
ConvectionTransport::eq_fields_
std::shared_ptr< EqFields > eq_fields_
Definition: transport.h:291
mesh.h
TimeMarks::add
TimeMark add(const TimeMark &mark)
Definition: time_marks.cc:81
Input::Type::Record::close
Record & close() const
Close the Record for further declarations of keys.
Definition: type_record.cc:304
generic_field.hh
Input::Type
Definition: balance.hh:41
partitioning.hh
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
GenericField::region_id
static auto region_id(Mesh &mesh) -> IndexField
Definition: generic_field.impl.hh:39
ConvectionTransport::get_component_vec
Vec get_component_vec(unsigned int sbi) override
Return PETSc vector with solution for sbi-th substance.
Definition: transport.cc:192
FieldCommon::input_default
FieldCommon & input_default(const string &input_default)
Definition: field_common.hh:139
ConvectionTransport::get_p0_interpolation
FieldFEScalarVec & get_p0_interpolation() override
Getter for P0 interpolation by FieldFE.
Definition: transport.cc:515
input_type.hh
ConcentrationTransportBase
Definition: transport_operator_splitting.hh:61
ConvectionTransport::is_src_term_scaled
bool is_src_term_scaled
Definition: transport.h:300
Mesh
Definition: mesh.h:361
ConvectionTransport::EqFields::subdomain
Field< 3, FieldValue< 3 >::Scalar > subdomain
Definition: transport.h:109
Input::Type::Array
Class for declaration of inputs sequences.
Definition: type_base.hh:339
TimeGovernor::marks
static TimeMarks & marks()
Definition: time_governor.hh:338
Input::Array
Accessor to input data conforming to declared Array.
Definition: accessors.hh:566
ConvectionTransport::target_mark_type
TimeMark::Type target_mark_type
TimeMark type for time marks denoting end of every time interval where transport matrix remains const...
Definition: transport.h:304
WarningOut
#define WarningOut()
Macro defining 'warning' record of log.
Definition: logger.hh:278
fe_value_handler.hh
MixedPtr< FE_P_disc >
ConvectionTransport::update_solution
void update_solution() override
Definition: transport.cc:388
transport.h
ConcentrationTransportBase::get_input_type
static Input::Type::Abstract & get_input_type()
Common specification of the input record for secondary equations.
Definition: transport_operator_splitting.cc:62
EquationBase::eq_fieldset_
FieldSet * eq_fieldset_
Definition: equation.hh:228
TimeGovernor::is_changed_dt
bool is_changed_dt() const
Definition: time_governor.hh:529
ConvectionTransport::ConvectionTransport
ConvectionTransport(Mesh &init_mesh, const Input::Record in_rec)
Definition: transport.cc:121
balance.hh
ConvectionTransport::mass_assembly_
GenericAssembly< MassAssemblyConvection > * mass_assembly_
general assembly objects, hold assembly objects of appropriate dimension
Definition: transport.h:322
ConvectionTransport::set_target_time
void set_target_time(double target_time) override
Definition: transport.cc:492
MeshBase::n_elements
unsigned int n_elements() const
Definition: mesh.h:111
ConvectionTransport::alloc_transport_vectors
void alloc_transport_vectors()
Definition: transport.cc:236
FieldCommon::description
FieldCommon & description(const string &description)
Definition: field_common.hh:127
TransportEqFields
Definition: transport_operator_splitting.hh:137
DebugOut
#define DebugOut()
Macro defining 'debug' record of log.
Definition: logger.hh:284
ASSERT_PTR
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.
Definition: asserts.hh:341
TimeGovernor::next_time
void next_time()
Proceed to the next time according to current estimated time step.
Definition: time_governor.cc:670
ConvectionTransport::vpconc
Vec * vpconc
Definition: transport.h:312
ConvectionTransport::cfl_max_step
double cfl_max_step
Time step constraint coming from CFL condition.
Definition: transport.h:305
ConvectionTransport::initialize
void initialize() override
Definition: transport.cc:146
TimeGovernor::fix_dt_until_mark
double fix_dt_until_mark()
Fixing time step until fixed time mark.
Definition: time_governor.cc:597
mixed.hh
START_TIMER
#define START_TIMER(tag)
Starts a timer with specified tag.
Definition: sys_profiler.hh:115
GenericAssembly< MassAssemblyConvection >
MPI_Barrier
#define MPI_Barrier(comm)
Definition: mpi.h:531
END_TIMER
#define END_TIMER(tag)
Ends a timer with specified tag.
Definition: sys_profiler.hh:149
TimeGovernor::last_dt
double last_dt() const
Definition: time_governor.hh:548
FieldCommon::name
FieldCommon & name(const string &name)
Definition: field_common.hh:120
range_wrapper.hh
Implementation of range helper class.