From 020f02161b6fdfabb93e4110d9d22a9fe7b0eb81 Mon Sep 17 00:00:00 2001 From: Sebastian Proell Date: Thu, 27 Feb 2025 20:58:40 +0100 Subject: [PATCH] Remove artery gnuplot output Unused and untested --- src/art_net/4C_art_net_art_write_gnuplot.cpp | 343 ------------------ src/art_net/4C_art_net_art_write_gnuplot.hpp | 123 ------- .../4C_art_net_explicitintegration.cpp | 3 - .../4C_art_net_explicitintegration.hpp | 5 - .../4C_legacy_enum_definitions_conditions.hpp | 1 - 5 files changed, 475 deletions(-) delete mode 100644 src/art_net/4C_art_net_art_write_gnuplot.cpp delete mode 100644 src/art_net/4C_art_net_art_write_gnuplot.hpp diff --git a/src/art_net/4C_art_net_art_write_gnuplot.cpp b/src/art_net/4C_art_net_art_write_gnuplot.cpp deleted file mode 100644 index 88ba96ed7b2..00000000000 --- a/src/art_net/4C_art_net_art_write_gnuplot.cpp +++ /dev/null @@ -1,343 +0,0 @@ -// This file is part of 4C multiphysics licensed under the -// GNU Lesser General Public License v3.0 or later. -// -// See the LICENSE.md file in the top-level for license information. -// -// SPDX-License-Identifier: LGPL-3.0-or-later - -#include "4C_art_net_art_write_gnuplot.hpp" - -#include "4C_comm_mpi_utils.hpp" -#include "4C_fem_condition.hpp" -#include "4C_fem_general_extract_values.hpp" - -#include - -#include -#include - -FOUR_C_NAMESPACE_OPEN - -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -/*----------------------------------------------------------------------* - | Constructor (public) ismail 08/09| - | | - | | - | ------> (direction of the flow) | - | 1 2 3 4 | - | +-----------------o-----------------o-----------------+ | - | ^ ^ ^ ^ ^ | - | ___|____ | | | ___|____ | - | [DPOINT 1] | | | [DPOINT 2] | - | ___|___ ___|___ ___|___ | - | [DLINE 1] [DLINE 1] [DLINE 1] | - | | - | ................................................................... | - | | - | The gnuplot format exporter will export the results (DOFs) of each | - | artery in a different file. | - | Each artery is defined as a set of elements that belong to a similar | - | design line (DLINE) | - | | - | Therefore, ArtWriteGnuplotWrapper will check how many arteries are | - | there to export and generate the associated condition which will | - | export it. | - | | - | For now we will consider that each artery must have a ascending | - | node numbering in the direction of the flow. This could be improved | - | later! ;) | - | | - *----------------------------------------------------------------------*/ -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// - -Arteries::Utils::ArtWriteGnuplotWrapper::ArtWriteGnuplotWrapper( - std::shared_ptr actdis, Teuchos::ParameterList& params) - : discret_(actdis) -{ - // ------------------------------------------------------------------- - // Get all gnuplot export conditions - // ------------------------------------------------------------------- - std::vector myConditions; - discret_->get_condition("ArtWriteGnuplotCond", myConditions); - int numofcond = myConditions.size(); - - // ------------------------------------------------------------------- - // if gnuplot export conditions exist then create the classes - // which will export the files - // ------------------------------------------------------------------- - if (numofcond > 0 && Core::Communication::my_mpi_rank(discret_->get_comm()) == 0) - { - // Start by creating a map of classes that will export the wanted arteries - for (unsigned int i = 0; i < myConditions.size(); i++) - { - // --------------------------------------------------------------- - // Read in the artery number and the nodes associated with the - // condition - // --------------------------------------------------------------- - const int Artery_Number = myConditions[i]->parameters().get("ArteryNumber"); - const std::vector* nodes = myConditions[i]->get_nodes(); - - // --------------------------------------------------------------- - // Sort all nodes so such that inlet node is the first and outlet - // node is the last - // --------------------------------------------------------------- - - // step (1) find both inlet and outlet nodes - Core::Nodes::Node* ndi = nullptr; // ith node - Core::Nodes::Node* ndl = nullptr; // last node - - for (unsigned int n = 0; n < nodes->size(); n++) - { - Core::Nodes::Node* nd = actdis->g_node((*nodes)[n]); - if (nd->get_condition("ArtInOutCond")) - { - std::string TerminalType = - (nd->get_condition("ArtInOutCond")->parameters().get("terminaltype")); - if (TerminalType == "inlet") - ndi = nd; - else - ndl = nd; - } - } - - if (ndl == nullptr) FOUR_C_THROW("artery %d has no outlet node!", Artery_Number); - if (ndi == nullptr) FOUR_C_THROW("artery %d has no inlet node!", Artery_Number); - - - // loop over all nodes - std::vector* sorted_nodes = new std::vector; - Core::Elements::Element** Elements = ndi->elements(); - - Core::Elements::Element* Elem_i; - if (ndi->num_element() != 1) - FOUR_C_THROW("artery %d must have one element connected to the inlet node!", Artery_Number); - - Elem_i = Elements[0]; - - sorted_nodes->push_back(ndi->id()); - - for (unsigned int n = 0; n < nodes->size() - 2; n++) - { - // find the next node! - if (Elem_i->nodes()[0]->id() != ndi->id()) - ndi = Elem_i->nodes()[0]; - else - ndi = Elem_i->nodes()[1]; - if (ndi->num_element() != 2) - FOUR_C_THROW( - "artery %d must have two elements connected to any internal node!", Artery_Number); - - // find the next element - Elements = ndi->elements(); - - if (Elements[0][0].id() != Elem_i->id()) - Elem_i = Elements[0]; - else - Elem_i = Elements[1]; - sorted_nodes->push_back(ndi->id()); - } - - sorted_nodes->push_back(ndl->id()); - - // --------------------------------------------------------------- - // Allocate the gnuplot export condition - // --------------------------------------------------------------- - std::shared_ptr artgnu_c = std::make_shared(Artery_Number); - - - // --------------------------------------------------------------- - // Sort the export ondition in a map and check whether the - // condition exists more than once, which shouldn't be allowed - // --------------------------------------------------------------- - bool inserted = agmap_.insert(std::make_pair(Artery_Number, artgnu_c)).second; - bool inserted2 = agnode_map_.insert(std::make_pair(Artery_Number, sorted_nodes)).second; - - if (!inserted || !inserted2) - FOUR_C_THROW( - "Each artery must have a unique artery number, please correct your input file\n"); - - std::cout << "----------------------------------------------------------" << std::endl; - std::cout << "Artery[" << Artery_Number << "] has the following sorted nodes" << std::endl; - for (unsigned int n = 0; n < sorted_nodes->size(); n++) - { - std::cout << (*sorted_nodes)[n] << "\t"; - } - std::cout << std::endl; - std::cout << "----------------------------------------------------------" << std::endl; - } - } - // throw; -} - - -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -/*----------------------------------------------------------------------* - | Write (public) ismail 08/09| - *----------------------------------------------------------------------*/ -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// - -void Arteries::Utils::ArtWriteGnuplotWrapper::write(Teuchos::ParameterList& params) -{ - //---------------------------------------------------------------------- - // Exit if the function accessed by a non-master processor - //---------------------------------------------------------------------- - if (Core::Communication::my_mpi_rank(discret_->get_comm()) == 0) - { - // ------------------------------------------------------------------- - // loop over all conditions and export the arteries values - // ------------------------------------------------------------------- - std::map>::iterator mapiter; - - // defining a constant that will have the artery number - int art_num; - for (mapiter = agmap_.begin(); mapiter != agmap_.end(); mapiter++) - { - art_num = mapiter->first; - mapiter->second->ArtWriteGnuplot::write(*discret_, params, agnode_map_[art_num]); - } - } -} - - -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -/*----------------------------------------------------------------------* - | Constructor (public) ismail 08/09| - *----------------------------------------------------------------------*/ -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -Arteries::Utils::ArtWriteGnuplot::ArtWriteGnuplot(int ArteryNum) : artery_num_(ArteryNum) -{ - // ------------------------------------------------------------------- - // Create the file with the following name - // artery[ArteryNum]_.art - // ------------------------------------------------------------------- - std::stringstream out; - std::string str, Numb_str; - char* cstr; - out << ArteryNum; - Numb_str = out.str(); - str.clear(); - str = "xxx"; - str += Numb_str; - str += "_"; - str += ".art"; - cstr = new char[str.size() + 1]; - strcpy(cstr, str.c_str()); - fout_ = std::make_shared(cstr); - delete[] cstr; - - // Avoid warning on unused variable - (void)artery_num_; -} - -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -/*----------------------------------------------------------------------* - | Constructor (public) ismail 08/09| - *----------------------------------------------------------------------*/ -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -Arteries::Utils::ArtWriteGnuplot::ArtWriteGnuplot() {} - - -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -/*----------------------------------------------------------------------* - | Constructor (public) ismail 08/09| - *----------------------------------------------------------------------*/ -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -//<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>// -void Arteries::Utils::ArtWriteGnuplot::write(Core::FE::Discretization& discret, - Teuchos::ParameterList& params, const std::vector* nodes) -{ - // defining the Length - double L = 0.0; - double dL, time; - int ElemNum; - - for (unsigned int i = 0; i < nodes->size() - 1; i++) - { - // get the elements connected to the node - if (!discret.have_global_node((*nodes)[i])) - { - int proc = Core::Communication::my_mpi_rank(discret.get_comm()); - FOUR_C_THROW("Global Node (%d) doesn't exist on processor (%d)\n", (*nodes)[i], proc); - exit(1); - } - - // Core::Nodes::Node * nd = discret->lColNode((*nodes)[i]); - Core::Nodes::Node* nd = discret.g_node((*nodes)[i]); - Core::Elements::Element** ele = nd->elements(); - - // get element location vector, dirichlet flags and ownerships - std::vector lm; - std::vector lmstride; - std::vector lmowner; - const int* ele_nodes = ele[0][0].node_ids(); - - if (ele_nodes[0] == (*nodes)[i]) - ElemNum = 0; - else - ElemNum = 1; - - ele[ElemNum][0].location_vector(discret, lm, lmowner, lmstride); - - // get node coordinates and number of elements per node - Core::LinAlg::Matrix<3, 2> xyze; - for (int inode = 0; inode < 2; inode++) - { - const auto& x = discret.g_node((*nodes)[i + inode])->x(); - xyze(0, inode) = x[0]; - xyze(1, inode) = x[1]; - xyze(2, inode) = x[2]; - } - // calculate Length of the element - dL = sqrt(pow(xyze(0, 0) - xyze(0, 1), 2) + pow(xyze(1, 0) - xyze(1, 1), 2) + - pow(xyze(2, 0) - xyze(2, 1), 2)); - - // get the degrees of freedom - std::shared_ptr> qanp = discret.get_state("qanp"); - std::vector myqanp = Core::FE::extract_values(*qanp, lm); - - // get the current simulation time - time = params.get("total time"); - - // export the degrees of freedom - (*fout_) << time << "\t" << L << "\t"; - for (unsigned int j = 0; j < lm.size() / 2; j++) - { - (*fout_) << myqanp[j] << "\t"; - } - (*fout_) << nd->id() << std::endl; - // Update L - L += dL; - // export the dof of the final node - if (i == nodes->size() - 2) - { - (*fout_) << time << "\t" << L << "\t"; - for (unsigned int j = lm.size() / 2; j < lm.size(); j++) - { - (*fout_) << myqanp[j] << "\t"; - } - (*fout_) << nd->id() << std::endl; - } - } - (*fout_) << std::endl; -} - -FOUR_C_NAMESPACE_CLOSE diff --git a/src/art_net/4C_art_net_art_write_gnuplot.hpp b/src/art_net/4C_art_net_art_write_gnuplot.hpp deleted file mode 100644 index 072dd0e0c47..00000000000 --- a/src/art_net/4C_art_net_art_write_gnuplot.hpp +++ /dev/null @@ -1,123 +0,0 @@ -// This file is part of 4C multiphysics licensed under the -// GNU Lesser General Public License v3.0 or later. -// -// See the LICENSE.md file in the top-level for license information. -// -// SPDX-License-Identifier: LGPL-3.0-or-later - -#ifndef FOUR_C_ART_NET_ART_WRITE_GNUPLOT_HPP -#define FOUR_C_ART_NET_ART_WRITE_GNUPLOT_HPP - -#include "4C_config.hpp" - -#include "4C_fem_discretization.hpp" -#include "4C_io.hpp" -#include "4C_linalg_utils_sparse_algebra_math.hpp" - -#include -#include - -FOUR_C_NAMESPACE_OPEN - -namespace Arteries -{ - namespace Utils - { - //-------------------------------------------------------------------- - // Wrapper class (to be called from outside) for outputting - //-------------------------------------------------------------------- - - /*! - \brief 1d-artery gnuplot output condition wrapper - this class is meant to do some organisation stuff - */ - class ArtWriteGnuplotWrapper - { - friend class ArtNetExplicitTimeInt; - - - public: - /*! - \brief Standard Constructor - */ - ArtWriteGnuplotWrapper( - std::shared_ptr actdis, Teuchos::ParameterList& params); - - /*! - \brief Destructor - */ - virtual ~ArtWriteGnuplotWrapper() = default; - - /*! - \brief Standard write - */ - void write(Teuchos::ParameterList& params); - - - private: - /*! - \brief all single artery write conditions - */ - std::map> agmap_; - std::map*> agnode_map_; - - - //! 1d artery discretization - std::shared_ptr discret_; - - }; // class ArtWriteGnuplotWrapper - - - - //-------------------------------------------------------------------- - // Actual artery gnuplot output condition - //-------------------------------------------------------------------- - /*! - \brief 1d-artery gnuplot output condition - - */ - - class ArtWriteGnuplot - { - friend class ArtWriteGnuplotWrapper; - - public: - /*! - \brief Standard Constructor - */ - ArtWriteGnuplot(int ArteryNum); - - /*! - \brief Empty Constructor - */ - ArtWriteGnuplot(); - - /*! - \brief Destructor - */ - virtual ~ArtWriteGnuplot() = default; - - protected: - /*! - \Solve the write the results of an artery - */ - void write(Core::FE::Discretization& discret, Teuchos::ParameterList& params, - const std::vector* nodes); - - - private: - //! An epetra wrapper for Dense matrix solver - std::shared_ptr fout_; - - //! the Artery number - int artery_num_; - - - }; // class ArtWriteGnuplot - } // namespace Utils -} // namespace Arteries - - -FOUR_C_NAMESPACE_CLOSE - -#endif diff --git a/src/art_net/4C_art_net_explicitintegration.cpp b/src/art_net/4C_art_net_explicitintegration.cpp index cdf04b923b7..b9094cf364d 100644 --- a/src/art_net/4C_art_net_explicitintegration.cpp +++ b/src/art_net/4C_art_net_explicitintegration.cpp @@ -158,9 +158,6 @@ void Arteries::ArtNetExplicitTimeInt::init(const Teuchos::ParameterList& globalt artjun_ = std::make_shared(discret_, output_, junparams, dta_); - // create the gnuplot export conditions - artgnu_ = std::make_shared(discret_, junparams); - // --------------------------------------------------------------------------------------- // Initialize all the arteries' cross-sectional areas to the initial crossectional area Ao // and the volumetric flow rate to 0 diff --git a/src/art_net/4C_art_net_explicitintegration.hpp b/src/art_net/4C_art_net_explicitintegration.hpp index 70e7840ec34..aef32471bf6 100644 --- a/src/art_net/4C_art_net_explicitintegration.hpp +++ b/src/art_net/4C_art_net_explicitintegration.hpp @@ -11,7 +11,6 @@ #include "4C_config.hpp" #include "4C_art_net_art_junction.hpp" -#include "4C_art_net_art_write_gnuplot.hpp" #include "4C_art_net_timint.hpp" #include "4C_fem_discretization.hpp" #include "4C_io.hpp" @@ -264,10 +263,6 @@ namespace Arteries junc_nodal_vals_; //@} - //! @name A condition to export 1D arteries as a gnuplot format - std::shared_ptr artgnu_; - //@} - //@} }; // class ArtNetExplicitTimeInt diff --git a/src/core/legacy_enum_definitions/4C_legacy_enum_definitions_conditions.hpp b/src/core/legacy_enum_definitions/4C_legacy_enum_definitions_conditions.hpp index 0149ea796ee..eebcf59df41 100644 --- a/src/core/legacy_enum_definitions/4C_legacy_enum_definitions_conditions.hpp +++ b/src/core/legacy_enum_definitions/4C_legacy_enum_definitions_conditions.hpp @@ -143,7 +143,6 @@ namespace Core::Conditions SurfaceModeKrylovProjection, VolumeModeKrylovProjection, ArtJunctionCond, - ArtWriteGnuplotCond, ArtPrescribedCond, ArtPorofluidCouplingCondNodebased, ArtScatraCouplingCondNodebased,