Peano
Loading...
Searching...
No Matches
CreateGrid.cpp
Go to the documentation of this file.
1#include "CreateGrid.h"
2#include "Constants.h"
3#include "peano4/utils/Loop.h"
4
5
6tarch::logging::Log examples::finitevolumes::actions::CreateGrid::_log( "examples::finitevolumes::actions::CreateGrid");
7
8
9examples::finitevolumes::actions::CreateGrid::CreateGrid(int treeNumber) {
10// @todo Please implement
11}
12
13
14examples::finitevolumes::actions::CreateGrid::~CreateGrid() {
15// @todo Please implement
16}
17
18
19std::vector< peano4::grid::GridControlEvent > examples::finitevolumes::actions::CreateGrid::getGridControlEvents() {
20 std::vector< peano4::grid::GridControlEvent > result;
21
22 result.push_back(peano4::grid::GridControlEvent(
23 peano4::grid::GridControlEvent::RefinementControl::Refine,
24 tarch::la::Vector<DIMENSIONS,double>(0.0),
25 tarch::la::Vector<DIMENSIONS,double>(1.0),
26 tarch::la::Vector<DIMENSIONS,double>(0.3)
27// tarch::la::Vector<DIMENSIONS,double>(0.1)
28 ));
29
30 return result;
31}
32
33
34void examples::finitevolumes::actions::CreateGrid::beginTraversal(
35 ) {
36
37// Feel free to comment in and to add arguments if you want to trace them.
38// Ensure the logTraceOut is activated, too, if you switch on traceIn.
39// logTraceIn( "beginTraversal()" );
40// @todo Please implement
41// logTraceOut( "beginTraversal()" );
42}
43
44
45void examples::finitevolumes::actions::CreateGrid::endTraversal(
46 ) {
47
48// Feel free to comment in and to add arguments if you want to trace them.
49// Ensure the logTraceOut is activated, too, if you switch on traceIn.
50// logTraceIn( "endTraversal()" );
51// @todo Please implement
52// logTraceOut( "endTraversal()" );
53}
54
55
56void examples::finitevolumes::actions::CreateGrid::createPersistentFace(
57 const peano4::datamanagement::FaceMarker& marker,
58 examples::finitevolumes::facedata::Q& fineGridFaceQ,
59 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> coarseGridFacesQ,
60 examples::finitevolumes::celldata::Q& coarseGridCellQ) {
61 #if DIMENSIONS==2
62 int NumberOfEntries = PatchSize * 2;
63 #else
64 int NumberOfEntries = PatchSize * PatchSize * 2;
65 #endif
66 for (int i=0; i<NumberOfEntries; i++) {
67 for (int unknowns=0; unknowns<NumberOfUnknownsPerCell; unknowns++) {
68 fineGridFaceQ.value[i*NumberOfUnknownsPerCell+unknowns] = 0.0;
69 }
70 }
71}
72
73
74void examples::finitevolumes::actions::CreateGrid::destroyPersistentFace(
75 const peano4::datamanagement::FaceMarker& marker,
76 examples::finitevolumes::facedata::Q& fineGridFaceQ,
77 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> coarseGridFacesQ,
78 examples::finitevolumes::celldata::Q& coarseGridCellQ) {
79
80// Feel free to comment in and to add arguments if you want to trace them.
81// Ensure the logTraceOut is activated, too, if you switch on traceIn.
82// logTraceIn( "destroyPersistentFace()" );
83// @todo Please implement
84// logTraceOut( "destroyPersistentFace()" );
85}
86
87
88void examples::finitevolumes::actions::CreateGrid::createHangingFace(
89 const peano4::datamanagement::FaceMarker& marker,
90 examples::finitevolumes::facedata::Q& fineGridFaceQ,
91 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> coarseGridFacesQ,
92 examples::finitevolumes::celldata::Q& coarseGridCellQ) {
93
94// Feel free to comment in and to add arguments if you want to trace them.
95// Ensure the logTraceOut is activated, too, if you switch on traceIn.
96// logTraceIn( "createHangingFace()" );
97// @todo Please implement
98// logTraceOut( "createHangingFace()" );
99}
100
101
102void examples::finitevolumes::actions::CreateGrid::destroyHangingFace(
103 const peano4::datamanagement::FaceMarker& marker,
104 examples::finitevolumes::facedata::Q& fineGridFaceQ,
105 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> coarseGridFacesQ,
106 examples::finitevolumes::celldata::Q& coarseGridCellQ) {
107
108// Feel free to comment in and to add arguments if you want to trace them.
109// Ensure the logTraceOut is activated, too, if you switch on traceIn.
110// logTraceIn( "destroyHangingFace()" );
111// @todo Please implement
112// logTraceOut( "destroyHangingFace()" );
113}
114
115
116void examples::finitevolumes::actions::CreateGrid::touchFaceFirstTime(
117 const peano4::datamanagement::FaceMarker& marker,
118 examples::finitevolumes::facedata::Q& fineGridFaceQ,
119 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> coarseGridFacesQ,
120 examples::finitevolumes::celldata::Q& coarseGridCellQ) {
121
122// Feel free to comment in and to add arguments if you want to trace them.
123// Ensure the logTraceOut is activated, too, if you switch on traceIn.
124// logTraceIn( "touchFaceFirstTime()" );
125// @todo Please implement
126// logTraceOut( "touchFaceFirstTime()" );
127}
128
129
130void examples::finitevolumes::actions::CreateGrid::touchFaceLastTime(
131 const peano4::datamanagement::FaceMarker& marker,
132 examples::finitevolumes::facedata::Q& fineGridFaceQ,
133 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> coarseGridFacesQ,
134 examples::finitevolumes::celldata::Q& coarseGridCellQ) {
135
136// Feel free to comment in and to add arguments if you want to trace them.
137// Ensure the logTraceOut is activated, too, if you switch on traceIn.
138// logTraceIn( "touchFaceLastTime()" );
139// @todo Please implement
140// logTraceOut( "touchFaceLastTime()" );
141}
142
143
144void examples::finitevolumes::actions::CreateGrid::createCell(
145 const peano4::datamanagement::CellMarker& marker,
146 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> fineGridFacesQ,
147 examples::finitevolumes::celldata::Q& fineGridCellQ,
148 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> coarseGridFacesQ,
149 examples::finitevolumes::celldata::Q& coarseGridCellQ
150) {
151 const double cellWidth = marker.h()(0);
152 const double subcellWidth = cellWidth / PatchSize;
153 dfor(k,PatchSize) {
154 const tarch::la::Vector<DIMENSIONS,double> subcellCentre =
155 marker.x() - 0.5*cellWidth + k.convertScalar<double>() * subcellWidth + 0.5 * subcellWidth;
156 int dofIndex = peano4::utils::dLinearised(k,PatchSize) * NumberOfUnknownsPerCell;
157
158 fineGridCellQ.value[dofIndex+0] = 1.0; // rho
159 fineGridCellQ.value[dofIndex+1] = 0; // velocities
160 fineGridCellQ.value[dofIndex+2] = 0;
161 fineGridCellQ.value[dofIndex+3] = 0;
162
163 if (
164 tarch::la::norm2( subcellCentre-tarch::la::Vector<DIMENSIONS,double>(0.5) ) < 0.03
165 ) {
166 fineGridCellQ.value[dofIndex+4] = 1.0; // inner energy
167 }
168 else {
169 fineGridCellQ.value[dofIndex+4] = 0.0;
170 }
171 }
172}
173
174
175void examples::finitevolumes::actions::CreateGrid::destroyCell(
176 const peano4::datamanagement::CellMarker& marker,
177 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> fineGridFacesQ,
178 examples::finitevolumes::celldata::Q& fineGridCellQ,
179 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> coarseGridFacesQ,
180 examples::finitevolumes::celldata::Q& coarseGridCellQ) {
181
182// Feel free to comment in and to add arguments if you want to trace them.
183// Ensure the logTraceOut is activated, too, if you switch on traceIn.
184// logTraceIn( "destroyCell()" );
185// @todo Please implement
186// logTraceOut( "destroyCell()" );
187}
188
189
190void examples::finitevolumes::actions::CreateGrid::touchCellFirstTime(
191 const peano4::datamanagement::CellMarker& marker,
192 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> fineGridFacesQ,
193 examples::finitevolumes::celldata::Q& fineGridCellQ,
194 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> coarseGridFacesQ,
195 examples::finitevolumes::celldata::Q& coarseGridCellQ) {
196
197// Feel free to comment in and to add arguments if you want to trace them.
198// Ensure the logTraceOut is activated, too, if you switch on traceIn.
199// logTraceIn( "touchCellFirstTime()" );
200// @todo Please implement
201// logTraceOut( "touchCellFirstTime()" );
202}
203
204
205void examples::finitevolumes::actions::CreateGrid::touchCellLastTime(
206 const peano4::datamanagement::CellMarker& marker,
207 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> fineGridFacesQ,
208 examples::finitevolumes::celldata::Q& fineGridCellQ,
209 peano4::datamanagement::FaceEnumerator<examples::finitevolumes::facedata::Q> coarseGridFacesQ,
210 examples::finitevolumes::celldata::Q& coarseGridCellQ) {
211
212// Feel free to comment in and to add arguments if you want to trace them.
213// Ensure the logTraceOut is activated, too, if you switch on traceIn.
214// logTraceIn( "touchCellLastTime()" );
215// @todo Please implement
216// logTraceOut( "touchCellLastTime()" );
217}
218
219
dict unknowns
Definition euler.py:11