TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Cut_cell_tools.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, 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 <Cut_cell_tools.h>
17#include <IJK_Field.h>
18#include <Cut_field.h>
19#include <Cut_cell_FT_Disc.h>
20#include <IJK_Lata_writer.h>
21
22void dumplata_scalar_cut_cell(int cut_cell_activated,
23 const char *filename, const char *fieldname,
24 const std::shared_ptr<IJK_Field_double>& f, int step)
25{
26 if (cut_cell_activated)
27 {
28 Cut_field_double& cut_field_f = static_cast<Cut_field_double&>(*f);
31 }
32
33 dumplata_scalar(filename, fieldname, *f, step);
34
35 if (cut_cell_activated)
36 {
37 Cut_field_double& cut_field_f = static_cast<Cut_field_double&>(*f);
38
39 cut_field_f.get_cut_cell_disc().fill_buffer_with_variable(cut_field_f.diph_l_);
40 dumplata_scalar(filename, Nom(fieldname) + "_CUT_L", cut_field_f.get_cut_cell_disc().get_write_buffer(), step);
41
42 cut_field_f.get_cut_cell_disc().fill_buffer_with_variable(cut_field_f.diph_v_);
43 dumplata_scalar(filename, Nom(fieldname) + "_CUT_V", cut_field_f.get_cut_cell_disc().get_write_buffer(), step);
44 }
45}
46
47
48void lire_dans_lata_cut_cell(int cut_cell_activated,
49 const char *filename_with_path, int tstep, const char *geometryname, const char *fieldname,
50 std::shared_ptr<IJK_Field_double>& f)
51{
52 lire_dans_lata(filename_with_path, tstep, geometryname, fieldname, *f);
53
54 if (cut_cell_activated)
55 {
56 Cut_field_double& cut_field_f = static_cast<Cut_field_double&>(*f);
57
58 lire_dans_lata(filename_with_path, tstep, geometryname, Nom(fieldname) + "_CUT_L", cut_field_f.get_cut_cell_disc().get_write_buffer());
59 cut_field_f.get_cut_cell_disc().fill_variable_with_buffer(cut_field_f.diph_l_);
60
61 lire_dans_lata(filename_with_path, tstep, geometryname, Nom(fieldname) + "_CUT_V", cut_field_f.get_cut_cell_disc().get_write_buffer());
62 cut_field_f.get_cut_cell_disc().fill_variable_with_buffer(cut_field_f.diph_v_);
63
65 }
66}
67
68
69void allocate_velocity(Cut_field_vector3_double& v, const Domaine_IJK& s, int ghost, double DU)
70{
71 v.get_ptr(0) = std::make_shared<Cut_field_double>();
72 v.get_ptr(1) = std::make_shared<Cut_field_double>();
73 v.get_ptr(2) = std::make_shared<Cut_field_double>();
74
75 v[0].allocate(s, Domaine_IJK::FACES_I, ghost);
76 v[1].allocate(s, Domaine_IJK::FACES_J, ghost);
77 v[2].allocate(s, Domaine_IJK::FACES_K, ghost);
78 v[0].get_shear_BC_helpler().set_dU_(DU);
79 v[1].get_shear_BC_helpler().set_dU_(0.);
80 v[2].get_shear_BC_helpler().set_dU_(0.);
81}
82
83void allocate_velocity_persistant(Cut_cell_FT_Disc& cut_cell_disc, Cut_field_vector3_double& v, const Domaine_IJK& s, int ghost, double DU)
84{
85 allocate_velocity(v, s, ghost, DU);
86
87 v[0].associer_persistant(cut_cell_disc);
88 v[1].associer_persistant(cut_cell_disc);
89 v[2].associer_persistant(cut_cell_disc);
90}
91
92void allocate_velocity_ephemere(Cut_cell_FT_Disc& cut_cell_disc, Cut_field_vector3_double& v, const Domaine_IJK& s, int ghost, double DU)
93{
94 allocate_velocity(v, s, ghost, DU);
95
96 v[0].associer_ephemere(cut_cell_disc);
97 v[1].associer_ephemere(cut_cell_disc);
98 v[2].associer_ephemere(cut_cell_disc);
99}
100
101void allocate_velocity_paresseux(Cut_cell_FT_Disc& cut_cell_disc, Cut_field_vector3_double& v, const Domaine_IJK& s, int ghost, double DU)
102{
103 allocate_velocity(v, s, ghost, DU);
104
105 v[0].associer_paresseux(cut_cell_disc);
106 v[1].associer_paresseux(cut_cell_disc);
107 v[2].associer_paresseux(cut_cell_disc);
108}
void fill_buffer_with_variable(const TRUSTTabFT< T > &array, int component=0) const
void fill_variable_with_buffer(TRUSTTabFT< T > &array, int component=0) const
IJK_Field_double & get_write_buffer() const
const Cut_cell_FT_Disc & get_cut_cell_disc() const
Definition Cut_field.h:78
void remplir_tableau_pure_cellules_diphasiques(bool next_time)
TRUSTTabFT_cut_cell< _TYPE_ > diph_l_
Definition Cut_field.h:49
void echange_pure_vers_diph_cellules_initialement_pures()
Definition Cut_field.cpp:54
void echange_diph_vers_pure_cellules_finalement_pures()
TRUSTTabFT_cut_cell< _TYPE_ > diph_v_
Definition Cut_field.h:50
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
Definition Domaine_IJK.h:47
std::shared_ptr< IJK_Field_template< T, TRUSTArray< T > > > & get_ptr(int i)
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31