45 #include "Teuchos_Assert.hpp"
47 #include "Panzer_EquationSet_DefaultImpl.hpp"
62 const bool write_graphviz_file,
63 const std::string& graphviz_file_prefix,
66 std::vector<Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator blkItr;
67 for (blkItr=physicsBlocks.begin();blkItr!=physicsBlocks.end();++blkItr) {
76 std::string closure_model_name =
"";
77 if (ic_block_closure_models.
isSublist(blockId))
78 closure_model_name = blockId;
79 else if (ic_block_closure_models.
isSublist(
"Default"))
80 closure_model_name =
"Default";
83 <<
"\". You must provide an initial condition for each element block or set a default!"
84 << ic_block_closure_models);
95 fm->postRegistrationSetup(setupData);
96 phx_ic_field_managers[blockId] = fm;
98 if (write_graphviz_file)
99 fm->writeGraphvizFile(graphviz_file_prefix+
"_IC_"+blockId);
111 const bool write_graphviz_file,
112 const std::string& graphviz_file_prefix,
115 std::vector<Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator blkItr;
116 for (blkItr=physicsBlocks.begin();blkItr!=physicsBlocks.end();++blkItr) {
125 std::string closure_model_name =
"";
126 if (ic_block_closure_models.
isSublist(blockId))
127 closure_model_name = blockId;
128 else if (ic_block_closure_models.
isSublist(
"Default"))
129 closure_model_name =
"Default";
132 <<
"\". You must provide an initial condition for each element block or set a default!"
133 << ic_block_closure_models);
147 fm->postRegistrationSetup(setupData);
148 phx_ic_field_managers[blockId] = fm;
150 if (write_graphviz_file)
151 fm->writeGraphvizFile(graphviz_file_prefix+
"_IC_"+blockId);
160 const double time_stamp)
175 localCounter->initialize();
177 ped.
gedc->addDataObject(
"Residual Scatter Container",ghostedloc);
178 ped.
gedc->addDataObject(
"Dirichlet Counter",localCounter);
182 itr!=phx_ic_field_managers.end();++itr) {
183 std::string blockId = itr->first;
190 std::vector<panzer::Workset>& w = *wkstContainer.
getWorksets(wd);
191 for (std::size_t i = 0; i < w.size(); ++i) {
195 workset.
time = time_stamp;
202 summedGhostedCounter->initialize();
207 globalCounter->initialize();
224 if(loc2!=Teuchos::null) {
225 bool zeroVectorRows =
false;
240 template <
typename EvalT>
241 class EquationSet_IC :
public EquationSet_DefaultImpl<EvalT> {
248 const int& default_integration_order,
249 const CellData& cell_data,
251 const bool build_transient_support);
256 const FieldLibrary& ,
262 template <
typename EvalT>
263 EquationSet_IC<EvalT>::
265 const int& default_integration_order,
266 const CellData& cell_data,
268 const bool build_transient_support) :
269 EquationSet_DefaultImpl<EvalT>(params, default_integration_order, cell_data, global_data, build_transient_support )
275 valid_parameters_sublist.
set(
"Basis Type",
"HGrad",
"Type of Basis to use");
276 valid_parameters_sublist.
set(
"Basis Order",1,
"Order of the basis");
278 for(
auto itr=params->
begin();itr!=params->
end();++itr) {
280 const std::string
field = params->
name(itr);
284 if(!entry.
isList())
continue;
289 std::string basis_type = basisPL.
get<std::string>(
"Basis Type");
290 int basis_order = basisPL.
get<
int>(
"Basis Order");
292 this->addDOF(field,basis_type,basis_order,default_integration_order);
295 this->addClosureModel(
"");
304 class IC_EquationSetFactory : public EquationSetFactory {
309 const int& default_integration_order,
310 const CellData& cell_data,
312 const bool build_transient_support)
const
324 std::string msg =
"Error - the \"Equation Set\" called \"" + params->
get<std::string>(
"Type") +
325 "\" is not a valid equation set identifier. Please supply the correct factory.\n";
338 const std::map<std::string,std::vector<ICFieldDescriptor> > & block_ids_to_fields,
348 std::vector<Teuchos::RCP<PhysicsBlock> > physics_blocks;
351 std::map<std::string, Teuchos::RCP< PHX::FieldManager<Traits> > > phx_ic_field_managers;
359 "initial_condition_control_test",
360 phx_ic_field_managers);
372 const std::map<std::string,std::vector<ICFieldDescriptor> > & block_ids_to_fields,
379 std::map<std::string,std::string> block_ids_to_physics_ids;
383 for(
auto itr=block_ids_to_cell_topo.begin();itr!=block_ids_to_cell_topo.end();++itr) {
384 std::string eblock = itr->first;
388 auto fds_itr = block_ids_to_fields.find(eblock);
391 const std::vector<ICFieldDescriptor> & fd_vec = fds_itr->second;
393 std::string physics_id =
"ic_"+eblock;
394 block_ids_to_physics_ids[eblock] = physics_id;
398 physics_block.
set(
"Type",
"IC");
400 for(std::size_t i=0;i<fd_vec.size();i++) {
413 block_ids_to_cell_topo,
414 ipb,1,workset_size,eqset_factory,gd,
false,physics_blocks);
void buildICPhysicsBlocks(const std::map< std::string, Teuchos::RCP< const shards::CellTopology > > &block_ids_to_cell_topo, const std::map< std::string, std::vector< ICFieldDescriptor > > &block_ids_to_fields, int workset_size, std::vector< Teuchos::RCP< PhysicsBlock > > &physics_blocks)
Teuchos::RCP< GlobalEvaluationDataContainer > gedc
const std::string & name() const
Teuchos::RCP< const std::vector< Intrepid2::Orientation > > orientations_
ConstIterator end() const
void addDataObject(const std::string &key, const Teuchos::RCP< GlobalEvaluationData > &ged)
std::unordered_map< std::string, Teuchos::RCP< GlobalEvaluationData > >::iterator iterator
T & get(const std::string &name, T def_value)
const_iterator begin() const
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
void setupControlInitialCondition(const std::map< std::string, Teuchos::RCP< const shards::CellTopology > > &block_ids_to_cell_topo, const std::map< std::string, std::vector< ICFieldDescriptor > > &block_ids_to_fields, WorksetContainer &wkstContainer, const LinearObjFactory< Traits > &lof, const ClosureModelFactory_TemplateManager< Traits > &cm_factory, const Teuchos::ParameterList &ic_closure_models, const Teuchos::ParameterList &user_data, int workset_size, double t0, const Teuchos::RCP< Thyra::VectorBase< double > > &vec)
#define PANZER_BUILD_EQSET_OBJECTS(key, fType)
void buildAndRegisterClosureModelEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &factory, const Teuchos::ParameterList &models, const Teuchos::ParameterList &user_data) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual void adjustForDirichletConditions(const LinearObjContainer &localBCRows, const LinearObjContainer &globalBCRows, LinearObjContainer &ghostedObjs, bool zeroVectorRows=false, bool adjustX=false) const =0
void buildAndRegisterInitialConditionEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &factory, const std::string &model_name, const Teuchos::ParameterList &models, const panzer::LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
Teuchos::RCP< const std::vector< Intrepid2::Orientation > > getOrientations() const
T & getValue(T *ptr) const
Class that provides access to worksets on each element block and side set.
virtual Teuchos::RCP< LinearObjContainer > buildPrimitiveGhostedLinearObjContainer() const =0
std::string first_sensitivities_name
virtual void initializeContainer(int, LinearObjContainer &loc) const =0
const_iterator end() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
bool isSublist(const std::string &name) const
std::string elementBlockID() const
void buildPhysicsBlocks(const std::map< std::string, std::string > &block_ids_to_physics_ids, const std::map< std::string, Teuchos::RCP< const shards::CellTopology > > &block_ids_to_cell_topo, const Teuchos::RCP< Teuchos::ParameterList > &physics_blocks_plist, const int default_integration_order, const std::size_t workset_size, const Teuchos::RCP< const panzer::EquationSetFactory > &eqset_factory, const Teuchos::RCP< panzer::GlobalData > &global_data, const bool build_transient_support, std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const std::vector< std::string > &tangent_param_names=std::vector< std::string >())
Nonmember function for building the physics blocks from a Teuchos::ParameterList for a given list of ...
Teuchos::RCP< panzer::GlobalData > createGlobalData(bool build_default_os=true, int print_process=0)
Nonmember constructor.
Teuchos::RCP< std::vector< Workset > > getWorksets(const WorksetDescriptor &wd)
Access to volume worksets.
virtual Teuchos::RCP< LinearObjContainer > buildLinearObjContainer() const =0
void validateParametersAndSetDefaults(ParameterList const &validParamList, int const depth=1000)
ConstIterator begin() const
#define PANZER_DECLARE_EQSET_TEMPLATE_BUILDER(fClass, fType)
const ParameterEntry & entry(ConstIterator i) const
void setupInitialConditionFieldManagers(WorksetContainer &wkstContainer, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &cm_factory, const Teuchos::ParameterList &ic_block_closure_models, const panzer::LinearObjFactory< panzer::Traits > &lo_factory, const Teuchos::ParameterList &user_data, const bool write_graphviz_file, const std::string &graphviz_file_prefix, std::map< std::string, Teuchos::RCP< PHX::FieldManager< panzer::Traits > > > &phx_ic_field_managers)
Builds PHX::FieldManager objects for inital conditions and registers evaluators.
PHX::MDField< ScalarT, panzer::Cell, panzer::BASIS > field
A field to which we'll contribute, or in which we'll store, the result of computing this integral...
virtual Teuchos::RCP< LinearObjContainer > buildPrimitiveLinearObjContainer() const =0
virtual void globalToGhostContainer(const LinearObjContainer &container, LinearObjContainer &ghostContainer, int) const =0
virtual void initializeGhostedContainer(int, LinearObjContainer &loc) const =0
WorksetDescriptor blockDescriptor(const std::string &eBlock)
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
virtual Teuchos::RCP< LinearObjContainer > buildGhostedLinearObjContainer() const =0
#define TEUCHOS_ASSERT(assertion_test)
void evaluateInitialCondition(WorksetContainer &wkstContainer, const std::map< std::string, Teuchos::RCP< PHX::FieldManager< panzer::Traits > > > &phx_ic_field_managers, Teuchos::RCP< panzer::LinearObjContainer > loc, const panzer::LinearObjFactory< panzer::Traits > &lo_factory, const double time_stamp)
virtual void ghostToGlobalContainer(const LinearObjContainer &ghostContainer, LinearObjContainer &container, int) const =0
Teuchos::RCP< const std::vector< panzer::Workset > > worksets_