TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_ALE_Beam.cpp
1/****************************************************************************
2* Copyright (c) 2021, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#include <Champ_front_ALE_Beam.h>
17#include <Frontiere_dis_base.h>
18#include <Domaine_Cl_dis_base.h>
19#include <Front_VF.h>
20#include <Domaine_ALE.h>
21#include <Domaine.h>
22#include <Domaine_VEF.h>
23#include <Cond_lim.h>
24#include <TRUSTVects.h>
25#include <fstream>
26#include <math.h>
27#define pi 3.14159265
28
29using namespace std;
30
31
32Implemente_instanciable( Champ_front_ALE_Beam, "Champ_front_ALE_Beam", Ch_front_var_instationnaire_dep ) ;
33// XD Champ_front_ALE_Beam front_field_base Champ_front_ALE_Beam NO_BRACE Class to define a Beam on a FSI boundary.
34// XD attr val listchaine val REQ NL2 Example: 3 0 0 0
35
37{
38 return Champ_front_ALE::printOn(os);
39}
40
42{
43 return Champ_front_ALE::readOn(is);
44}
45
47{
48 Cerr<<"Champ_front_ALE_Beam::remplir_vit_som_bord_ALE "<<finl;
49 const Frontiere& front=la_frontiere_dis->frontiere();
50 Cerr<<" front nom := "<<front.le_nom()<<finl;
51 int nb_faces=front.nb_faces();
52 const Domaine& domaine=front.domaine();
53 const Faces& faces=front.faces();
54
55 Domaine_ALE& dom_ale=ref_cast_non_const(Domaine_ALE, domaine);
56
57 int nbBordsBeam= dom_ale.getBeamNbBeam(); //give the number of Beam in the domain
58 int index=-1; //position of Beam associated with the boundary front
59 for(int i=0; i<nbBordsBeam; i++)
60 {
61 if(front.le_nom()==dom_ale.getBeamName(i))
62 index=i; //we find the position of Beam associated with the boundary front.le_nom()
63 }
64 if(index==-1)//no match found between the Beam name and the mobile boundaries
65 {
66 Cerr << "The CL name and the Beam name must be the same!";
68 }
69
70 double dt = dom_ale.get_dt();
71 const int nbModes=dom_ale.getBeamNbModes(index);
72 const int nb_planes = dom_ale.getBeamNbPlanes(index);
73 const int modes_per_plane = nbModes / nb_planes;
74 int nbsf=faces.nb_som_faces();
75 int i,j,k;
76 int nb_som_tot=domaine.nb_som_tot();
77 vit_som_bord_ALE.resize(nb_som_tot,nb_comp());
79 const DoubleTab& beamVelocity=dom_ale.getBeamVelocity(index,tps, dt);
80 for( i=0; i<nb_faces; i++)
81 {
82 for( k=0; k<nbsf; k++)
83 {
84 double x = domaine.coord(faces.sommet(i, k), 0);
85 double y = (dimension > 1) ? domaine.coord(faces.sommet(i, k), 1) : 0.;
86 double z = (dimension > 2) ? domaine.coord(faces.sommet(i, k), 2) : 0.;
87
88 DoubleVect value(3);
89 value=0.;
90 DoubleTab phi(3,nb_planes);
91 phi = 0.;
92 for (int plane = 0; plane < nb_planes; ++plane)
93 {
94 for (int mode = 0; mode < modes_per_plane; ++mode)
95 {
96 const DoubleTab& u = dom_ale.getBeamDisplacement(index, mode);
97 const DoubleTab& R = dom_ale.getBeamRotation(index, mode);
98 phi = dom_ale.interpolationOnThe3DSurface(index, x, y, z, u, R);
99 for(int comp=0; comp<nb_comp(); comp++)
100 {
101 value[comp] +=beamVelocity(mode, plane)*phi(comp,plane);
102 }
103
104 }
105 }
106 for( j=0; j<nb_comp(); j++)
107 {
108 vit_som_bord_ALE(faces.sommet(i,k),j)=value[j];
109
110 }
111 }
112 }
113 vit_som_bord_ALE.echange_espace_virtuel();
114}
115
classe Ch_front_var_instationnaire_dep Cette classe abstraite represente un champ sur une frontiere,
void remplir_vit_som_bord_ALE(double) override
DoubleTab vit_som_bord_ALE
const int & getBeamNbModes(const int &) const
DoubleTab interpolationOnThe3DSurface(const int &, const double &x, const double &y, const double &z, const DoubleTab &u, const DoubleTab &R) const
const int & getBeamNbBeam() const
const int & getBeamNbPlanes(const int &) const
const DoubleTab & getBeamRotation(const int &, const int &) const
const double & get_dt() const
const DoubleTab & getBeamDisplacement(const int &, const int &) const
const Nom & getBeamName(const int &) const
DoubleTab & getBeamVelocity(const int &, const double &tps, const double &dt)
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
int_t sommet(int_t, int) const
Renvoie le numero du j-ieme sommet de la i-ieme face.
Definition Faces.h:130
int nb_som_faces() const
Renvoie le nombre de sommet par face.
Definition Faces.h:149
virtual int nb_comp() const
Definition Field_base.h:56
const Domaine_t & domaine() const
Renvoie le domaine associe a la frontiere.
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Frontiere.h:49
int_t nb_faces() const
Renvoie le nombre de faces de la frontiere.
Definition Frontiere.h:59
const Faces_t & faces() const
Definition Frontiere.h:54
static int dimension
Definition Objet_U.h:99
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52