-
Notifications
You must be signed in to change notification settings - Fork 12
/
dynamicMeshDict
103 lines (77 loc) · 2.98 KB
/
dynamicMeshDict
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
FoamFile
{
version 2;
format ascii;
class dictionary;
object dynamicMeshDict;
}
dynamicFvMesh adaptiveFvMesh;
refiner polyRefiner;
errorEstimator coded;
name gradientRange;
code #{
Info<< "---->! custom error estimator !<----" << endl;
error_ = 0.0;
/*
End result must be (error_ is a volScalarField):
- error_ == 1 if the cell needs to be refined
- error_ == 0 if the cell is to be left alone
- error_ == -1 if the vertices of the cell are to be unrefined
*/
const auto& T = mesh_.lookupObject<volScalarField>("T");
error_ == mag(fvc::grad(T)) / dimensionedScalar("one",dimTemperature/dimLength,1.0);
scalar tV = returnReduce(sum(mesh_.V()).value(), sumOp<scalar>());
forAll(error_, ei) {
error_[ei] *= mesh_.V()[ei]/tV;
}
/*
Here is the deal:
- T Gradient is not recomputed if already available - !!
- T will form a diffusive interface, 50% and up of the maxGrad are refined
40%-50% are left alone, and less than 40% are unrefined
- Not well tested, so play with the values.
*/
scalar maxGradT = gMax(error_);
scalar minGradT = gMin(error_);
//error_.write();
//FatalErrorInFunction << "Oops" << abort(FatalError);
lowerRefine_ = minGradT + 0.3*(maxGradT-minGradT);
upperRefine_ = GREAT;
lowerUnrefine_ = minGradT + 0.06*(maxGradT-minGradT);
upperUnrefine_ = GREAT;
// This converts error_ to the right values (-1, 0, 1) based on the
// settings lowerRefine_ ... etc
if (scale) normalize(error_);
// error_.correctBoundaryConditions() is called after this code in case you
// need to manipulate boundary values
Info<< "---->! end error estimator !<----" << endl;
#};
balance yes;
allowableBalance 0.1;
refineInterval 70;
unrefineInterval 350;
maxRefinement 4;
nBufferLayers 5;
nRefinementBufferLayers 3;
nUnrefinementBufferLayers 7;
lowerRefineLevel 310;
upperRefineLevel 1110;
unrefineLevel 300;
upperUnrefineLevel 1410;
dumpLevel no;
refineProbes no;
correctFluxes
(
( phi_0_0 none ) ( phi_0 none ) ( phi none ) (phi_corr none )
// Not sure if this necessary
// ( J_H2 none ) ( J_N2 none )
);
// ************************************************************************* //