Conversation
…n quantity codes (currently is mostly a copy of the momentum equation codes so not valid).
… This involved adding some dummy ones as blank tex is not allowed. The parser also doesn't seem to recognize commented out lines.
… viscous force into a curl.
|
Hi @Ayesha714 , Hope your trip back is going well. I've just pushed a first draft (completely untested) implementation of the derivatives of the viscous force and an example implementation of the curl components Any chance you could try them out when you get back to work? I'm expecting that they will crash and I will have to debug them a bit more so please just let me know what fails. You can also see the proposed updated documentation of the quantity codes here: Thank you! |
Hi Cian, I have some questions: Firstly, I am unsure about the correct formulation of the curl of the pressure term. The current implementation does not appear to be mathematically correct The most important question is how I can use this new module now. Previously, I was simply adding the little routines directly in the Custom diagnostics, but with this new module, I am not sure what the correct procedure is for enabling and using it in the code. Thanks, Ayesha
|
One more clarification: I have not uncommented the lines related to the curl terms yet because these routines are not currently implemented in |
|
Hi @Ayesha714 , The diagnostics we've added should be available using the quantity codes you implemented on this branch. So if you compile your branch of the code and run it you should be able to add, for example, a global average of 1327, which should be the r component of the curl of the viscous force term, to the main input file. Obviously, as you pointed out, those codes may yet change as we update the branch with the missing diagnostics. Hope you got back home safely eventually! |
Needed to add the quantity codes to the header file.
The logic was incorrect for when to evaluate the viscous forces as they now need to be evaluated when just the curl is requested. Also fixing the logic for outputting of other curl quantities that previously required both the value and the square to be included. The curl of the momentum terms was never called. Adding an input file that doesn't currently run a test but it is what I've been using to debug these things.
…ve gaps for the codes with 0 entries in the unlikely case we ever generalize to a non-radial density profile.
…ivative needs each iteration - Fix off-by-nvffields bug in Initialize_Grad_Viscous_Force where derivative slots aliased the source field slots in d_vforce_buffer. - Refresh need_second_derivatives/need_vforce_derivatives via compute_quantity each output iteration instead of once at startup via sometimes_compute, sharing trigger-code logic between both paths through Second_Derivative_Logic/Vforce_Derivative_Logic (parameterized on a shared Quantity_Check_If procedure interface in Spherical_IO). - Deconstruct d_vforce_buffer%p3a at end of each output pass; zero d_vforce_buffer%p3b before loading fields; initialize vf_*/vfp_*/vfm_* indices to -1.
…Curl_Momentum_Diagnostics
- curl_v_grad_v_abs and curl_buoyancy_force_abs were missing their ref%density(r)/radius(r) prefactor - curl_coriolis_force_phi's duplicate-quantity check tested curl_coriolis_force_phi twice instead of ..._phi_squared - pfactor was read before being assigned in Compute_Coriolis_Force (now computed locally in both Coriolis and Pressure force routines instead of threaded in uninitialized from Compute_Linear_Forces) - j_cross_b_abs's r-component used the raw (curl B) x B expression instead of the mean-corrected lforce_r buffer used elsewhere - v_grad_v_abs/j_cross_b_abs were missing from the mean-correction and second-derivative gating logic, so their inputs were never actually computed when only the _abs quantity was requested - noted a stale comment in momentum_equation_codes.F
… using sympy. The sympy is provided in src/Diagnostics/Verifications/curl_momentum_verification.ipynb. - curl_coriolis_force_r/abs: last term used buffer(PSI,dvpdt) instead of buffer(PSI,dvpdp) - curl_v_grad_v_r/theta/phi/abs: replaced and abs now uses local scalar temporaries instead of one large nested expression - curl_v_grad_v_phi: fixed Add_Quantity check that tested curl_v_grad_v_theta instead of curl_v_grad_v_phi, so phi output was never added unless theta was also requested - curl_j_cross_b_r/theta/phi/abs: same treatment, rederived from curl(Lc*(curl B) x B); abs now uses local scalar temporaries
…tions Derive (using sympy) and implement curl_* for all decomposed (p/m) momentum forces: vp_grad_vp, vm_grad_vm, vp_grad_vm, vm_grad_vp, jp_cross_bp, jm_cross_bm, jp_cross_bm, jm_cross_bp, and the buoyancy/Coriolis/pressure pforce/mforce pairs (see updated curl_momentum_verification.ipynb). Identically-zero components (mean-field theta curls) are left as gaps in curl_momentum_equation_codes.F rather than implemented. Also fixes several LaTeX documentation bugs in curl_momentum_equation_codes.F and momentum_equation_codes.F (missing :tex: comments on abs/squared codes, a p'/mean swap on a couple of labels, a stale file comment). Skip commented-out lines in build_menu_pdf.py's line classifier so the generated docs don't show placeholder rows for inactive codes. Regenerate momentum and curl_momentum doc rsts.
… notebook to be uncleared.
…put from Rayleigh after a single iteration. This unearthed some polar oscillations in the output from Compute_Second_Derivatives call to Legendre_Transform that was improved a little by dealiasing the s2a input but it hasn't completely fixed the output (compared to transforms that happen in the solution code path). Leaving the dealiasing in for now but need to double check it. The test makes assumptions about Boussinesq in a few places that could be generalized. Additionally it doesn't test any mean or perturbation fields but could also be extended to that. The current velocity field (taken from the assess python module) has 0 toroidal component so doesn't exercise anything that requires that but the magnetic initial condition is the Christensen IC which does.
…data extraction. This commit fixes that bug and regenerates the data without the dealiasing of the pre-Legendre_Transform data but this doesn't fix the failing test because it will need to be regenerated again with that possible fix in place.
… introduced and messed up magnetic output.
This reverts commit 431f76a.
This reverts commit 24708f7.
…ng on github." This reverts commit 937c728.
…ersion. Not really tests since they're not in a github workflow. One major mistake we were making in the plotting scripts was summing all the forces together when they should be subtracted from the intertial terms. This fixes a lot but there also appears to be a latitudinal dependence in the errors that may match that seen in the sympy_diagnostics_comparison test. This is seen in both the momentum forces and their curls (though it gets worse in the curls).
No polar error seen though tolerances are globally higher than other cases (but still < 1.e-9).
I have added curls of advection, buoyancy, magnetic, coriolis, and pressure forces and tested against my own cases.