1 /* ----------------------------------------------------------------------
2     This is the
3 
4     ██╗     ██╗ ██████╗  ██████╗  ██████╗ ██╗  ██╗████████╗███████╗
5     ██║     ██║██╔════╝ ██╔════╝ ██╔════╝ ██║  ██║╚══██╔══╝██╔════╝
6     ██║     ██║██║  ███╗██║  ███╗██║  ███╗███████║   ██║   ███████╗
7     ██║     ██║██║   ██║██║   ██║██║   ██║██╔══██║   ██║   ╚════██║
8     ███████╗██║╚██████╔╝╚██████╔╝╚██████╔╝██║  ██║   ██║   ███████║
9     ╚══════╝╚═╝ ╚═════╝  ╚═════╝  ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚══════╝®
10 
11     DEM simulation engine, released by
12     DCS Computing Gmbh, Linz, Austria
13     http://www.dcs-computing.com, office@dcs-computing.com
14 
15     LIGGGHTS® is part of CFDEM®project:
16     http://www.liggghts.com | http://www.cfdem.com
17 
18     Core developer and main author:
19     Christoph Kloss, christoph.kloss@dcs-computing.com
20 
21     LIGGGHTS® is open-source, distributed under the terms of the GNU Public
22     License, version 2 or later. It is distributed in the hope that it will
23     be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
24     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have
25     received a copy of the GNU General Public License along with LIGGGHTS®.
26     If not, see http://www.gnu.org/licenses . See also top-level README
27     and LICENSE files.
28 
29     LIGGGHTS® and CFDEM® are registered trade marks of DCS Computing GmbH,
30     the producer of the LIGGGHTS® software and the CFDEM®coupling software
31     See http://www.cfdem.com/terms-trademark-policy for details.
32 
33 -------------------------------------------------------------------------
34     Contributing author and copyright for this file:
35     (if not contributing author is listed, this file has been contributed
36     by the core developer)
37 
38     Copyright 2012-     DCS Computing GmbH, Linz
39     Copyright 2009-2012 JKU Linz
40 ------------------------------------------------------------------------- */
41 
42 #include <string.h>
43 #include <stdlib.h>
44 #include "atom.h"
45 #include "error.h"
46 #include "memory.h"
47 #include "modify.h"
48 #include <cmath>
49 #include "fix_property_atom.h"
50 #include "fix_property_global.h"
51 #include "fix_cfd_coupling.h"
52 #include "cfd_regionmodel_none.h"
53 
54 #define DELTA 10000
55 
56 using namespace LAMMPS_NS;
57 
58 /* ---------------------------------------------------------------------- */
59 
CfdRegionmodelNone(LAMMPS * lmp,int jarg,int narg,char ** arg,FixCfdCoupling * fc)60 CfdRegionmodelNone::CfdRegionmodelNone(LAMMPS *lmp, int jarg,int narg, char **arg,FixCfdCoupling *fc)  :
61   CfdRegionmodel(lmp, jarg, narg, arg,fc)
62 {
63     iarg = jarg;
64     //do something else here
65 
66     inRegion = NULL;
67     outRegion = NULL;
68     inregion = NULL;
69     outregion = NULL;
70     nout = 0;
71     nlocal_last = 0;
72 }
73 
74 /* ---------------------------------------------------------------------- */
75 
~CfdRegionmodelNone()76 CfdRegionmodelNone::~CfdRegionmodelNone()
77 {
78     if(inRegion) modify->delete_fix("inRegion");
79     if(outRegion) modify->delete_fix("outRegion");
80 }
81 
82 /* ---------------------------------------------------------------------- */
83 
init()84 void CfdRegionmodelNone::init()
85 {
86     const char* fixarg[9];
87     if(!inRegion)
88     {
89         fixarg[0]="inRegion";
90         fixarg[1]="all";
91         fixarg[2]="property/atom";
92         fixarg[3]="inRegion";
93         fixarg[4]="scalar";
94         fixarg[5]="yes";
95         fixarg[6]="no";
96         fixarg[7]="no";
97         fixarg[8]="1.";
98         modify->add_fix(9,const_cast<char**>(fixarg));
99     }
100 
101     inRegion = static_cast<FixPropertyAtom*>(modify->find_fix_property("inRegion","property/atom","scalar",1,0,"cfd_regionmodel none"));
102 
103     if(!outRegion)
104     {
105         fixarg[0]="outRegion";
106         fixarg[1]="all";
107         fixarg[2]="property/global";
108         fixarg[3]="outRegion";
109         fixarg[4]="vector";
110         fixarg[5]="0.";
111         fixarg[6]="0.";
112         modify->add_fix(7,const_cast<char**>(fixarg));
113     }
114 
115     outRegion = static_cast<FixPropertyGlobal*>(modify->find_fix_property("outRegion","property/global","vector",2,0,"cfd_regionmodel none"));
116 
117     special_settings();
118 }
119 
120 /* ---------------------------------------------------------------------- */
121 
special_settings()122 void CfdRegionmodelNone::special_settings()
123 {
124   //values to be transfered to OF
125   add_push_property("inRegion","scalar");
126   add_push_property("outRegion","globalvector");
127 
128   //values to come from OF
129   //add_pull_property("inRegion","scalar");
130 }
131 
132 /* ---------------------------------------------------------------------- */
133 
rm_update()134 void CfdRegionmodelNone::rm_update()
135 {/*
136    nout = nlocal_last;
137    int nlocal = atom->nlocal;
138 
139    outRegion->grow(nout,0);
140 
141    inregion = inRegion->vector_atom;
142    outregion = outRegion->values;
143 
144    for(int i = 0; i < nout; i++)
145       outregion[i] = 1.;
146 
147    for(int i = 0; i < nlocal; i++)
148       inregion[i] = 1.;
149 
150    nlocal_last = nlocal;*/
151 }
152