-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Diagnostics of Diagnostics #452
Changes from 9 commits
75277e2
d6d1b62
1cf50a2
fd8ad70
59af186
597ba6a
c6c1fa6
0be6b0d
2d4798e
7695709
53234f2
3996356
e2817f9
0de497f
efb8c90
2132208
63f4342
053a9bc
ec1a2e5
14396ad
171fb16
0d90f99
9ce0ecf
725f1a9
c85cec0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,10 +27,10 @@ | |
tmax = dt | ||
dumpfreq = 1 | ||
else: | ||
nlayers = 10 | ||
columns = 150 | ||
tmax = 3600. | ||
dumpfreq = int(tmax / (2*dt)) | ||
nlayers = 5 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know exactly what point you started this branch from, but I think that there should be almost no changes to this file |
||
columns = 30 | ||
tmax = 10*dt | ||
dumpfreq = 1 | ||
|
||
# ---------------------------------------------------------------------------- # | ||
# Set up model objects | ||
|
@@ -44,22 +44,22 @@ | |
# Equation | ||
Tsurf = 300. | ||
parameters = CompressibleParameters() | ||
eqns = CompressibleEulerEquations(domain, parameters) | ||
eqns = CompressibleEulerEquations(domain, parameters, u_transport_option='vector_advection_form') | ||
Witt-D marked this conversation as resolved.
Show resolved
Hide resolved
|
||
print(f'Number of DOFs = {eqns.X.function_space().dim()}') | ||
Witt-D marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# I/O | ||
points_x = np.linspace(0., L, 100) | ||
points_z = [H/2.] | ||
points = np.array([p for p in itertools.product(points_x, points_z)]) | ||
dirname = 'skamarock_klemp_nonlinear' | ||
dirname = 'testing' | ||
Witt-D marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Dumping point data using legacy PointDataOutput is not supported in parallel | ||
if COMM_WORLD.size == 1: | ||
output = OutputParameters( | ||
dirname=dirname, | ||
dumpfreq=dumpfreq, | ||
pddumpfreq=dumpfreq, | ||
dumplist=['u'], | ||
point_data=[('theta_perturbation', points)], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please keep the point data outputting in here for now! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So i had no intention of pushing the change to this example and will move to testing through the examples suggested above. For the reference when including point data the examples wouldn't run so will most likely revert a lot of the changes to skamarock and move to testing in Williams 2 and dcmip etc |
||
dump_nc=True, | ||
dump_vtus=False | ||
) | ||
else: | ||
logger.warning( | ||
|
@@ -69,13 +69,11 @@ | |
output = OutputParameters( | ||
dirname=dirname, | ||
dumpfreq=dumpfreq, | ||
pddumpfreq=dumpfreq, | ||
dumplist=['u'], | ||
) | ||
dump_nc=True, | ||
dump_vtus=False | ||
Witt-D marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) | ||
|
||
diagnostic_fields = [CourantNumber(), Gradient("u"), Perturbation('theta'), | ||
Gradient("theta_perturbation"), Perturbation('rho'), | ||
RichardsonNumber("theta", parameters.g/Tsurf), Gradient("theta")] | ||
diagnostic_fields = [CourantNumber(), Pressure(eqns), SteadyStateError('Pressure_Vt')] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are any of the changes to this file meant to be added to this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes im not sure why the examples have been added as i was unaware that these had even been pushed from my local area? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it makes sense to add something like I think it would make more sense to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed the changes to the skamarock test and implemented it in Williamson2 |
||
io = IO(domain, output, diagnostic_fields=diagnostic_fields) | ||
|
||
# Transport schemes | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1033,12 +1033,33 @@ def setup(self, domain, state_fields): | |
field1 = state_fields(self.field_name1) | ||
field2 = state_fields(self.field_name2, space=field1.function_space(), | ||
pick_up=True, dump=False) | ||
# By default set this new field to the current value | ||
# This may be overwritten if picking up from a checkpoint | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we still want these deleted comments in here... I suggest adding something like (you can use your own words!):
|
||
|
||
self.init_field_set = False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like we can get rid of |
||
|
||
#HACK Defo not the best way to do this perhaps we want a flag for checkpoint or prognostic | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed offline, I think we can avoid a hack like this by adding things to the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed the fix to this by placing a check in the checkpointing routine to avoid it resetting as discuessed |
||
if not self.name in ['rho', 'u', 'theta']: | ||
self.init_field_set = True | ||
|
||
# Attach state fields to self so that we can pick it up in compute | ||
self.state_fields = state_fields | ||
field2.assign(field1) | ||
|
||
else: | ||
self.init_field_set = True | ||
|
||
super().setup(domain, state_fields) | ||
|
||
def compute(self): | ||
if not self.init_field_set: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add comment here along the lines of:
|
||
# Set initial field | ||
full_field = self.state_fields(self.field_name1) | ||
init_field = self.state_fields(self.field_name2) | ||
init_field.assign(full_field) | ||
|
||
self.init_field_set = True | ||
|
||
super().compute() | ||
|
||
@property | ||
def name(self): | ||
"""Gives the name of this diagnostic field.""" | ||
|
@@ -1200,7 +1221,10 @@ def setup(self, domain, state_fields): | |
state_fields (:class:`StateFields`): the model's field container. | ||
""" | ||
x = SpatialCoordinate(domain.mesh) | ||
self.expr = self.rho_averaged * (1 + self.r_t) * self.parameters.g * dot(x, domain.k) | ||
self._setup_thermodynamics(domain, state_fields) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for fixing this! |
||
z = Function(self.rho_averaged.function_space()) | ||
z.interpolate(dot(x, domain.k)) | ||
self.expr = self.rho_averaged * (1 + self.r_t) * self.parameters.g * z | ||
super().setup(domain, state_fields, space=domain.spaces("DG")) | ||
|
||
|
||
|
@@ -1243,6 +1267,7 @@ def setup(self, domain, state_fields): | |
state_fields (:class:`StateFields`): the model's field container. | ||
""" | ||
u = state_fields('u') | ||
self._setup_thermodynamics(domain, state_fields) | ||
self.expr = 0.5 * self.rho_averaged * (1 + self.r_t) * dot(u, u) | ||
super().setup(domain, state_fields, space=domain.spaces("DG")) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to add all of these changes?