diff --git a/MANIFEST.in b/MANIFEST.in index e223737..98e559f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ include README.md -include LCIENSE +include LICENSE include environment.yml -recursive-include lightweaver/Data/ * \ No newline at end of file +recursive-include lightweaver/Data/ * diff --git a/Source/FormalScalar.cpp b/Source/FormalScalar.cpp index 855e30a..1d4ccde 100644 --- a/Source/FormalScalar.cpp +++ b/Source/FormalScalar.cpp @@ -598,6 +598,7 @@ void piecewise_bezier3_1d(FormalData* fd, int la, int mu, bool toObs, f64 wav) { if (atmos->zLowerBc.type == THERMALISED) { + // NOTE(cmo): Trying to fulfill diffusion condition. f64 Bnu[2]; int Nspace = atmos->Nspace; planck_nu(2, &atmos->temperature(Nspace - 2), wav, Bnu); diff --git a/Source/FormalScalar2d.cpp b/Source/FormalScalar2d.cpp index 124acd2..5c78269 100644 --- a/Source/FormalScalar2d.cpp +++ b/Source/FormalScalar2d.cpp @@ -564,7 +564,21 @@ void piecewise_linear_2d(FormalData* fd, int la, int mu, bool toObs, f64 wav) { case THERMALISED: { + // NOTE(cmo): This becomes a problem for j == jEnd with + // non-periodic boundary conditions; RH appears to just ignore + // this column when using fixed boundaries, which makes sense, + // since we can't truly accumulate the Lambda operator anyway. + // Nevertheless, this gradient is likely to be similar from the + // preceeding point to this one, so let's recompute that and use + // it. Admittedly this is a bit of a HACK, but is likely to + // introduce very little error. auto dwIntersection = intersections(mu, (int)toObs, k, j).dwIntersection; + if ((!periodic) && (j == jEnd) && (mux != 0.0)) + { + // NOTE(cmo): This assumes the atmosphere is wider than one + // column... but it has to be really. + dwIntersection = intersections(mu, (int)toObs, k, j-dj).dwIntersection; + } f64 chiDw = interp_param(gridData, dwIntersection, chi); f64 dtauDw = 0.5 * abs(dwIntersection.distance) * (chi(k, j) + chiDw); f64 temperatureDw = interp_param(gridData, dwIntersection, temperature); @@ -859,7 +873,21 @@ void piecewise_besser_2d(FormalData* fd, int la, int mu, bool toObs, f64 wav) { case THERMALISED: { + // NOTE(cmo): This becomes a problem for j == jEnd with + // non-periodic boundary conditions; RH appears to just ignore + // this column when using fixed boundaries, which makes sense, + // since we can't truly accumulate the Lambda operator anyway. + // Nevertheless, this gradient is likely to be similar from the + // preceeding point to this one, so let's recompute that and use + // it. Admittedly this is a bit of a HACK, but is likely to + // introduce very little error. auto dwIntersection = intersections(mu, (int)toObs, k, j).dwIntersection; + if ((!periodic) && (j == jEnd) && (mux != 0.0)) + { + // NOTE(cmo): This assumes the atmosphere is wider than one + // column... but it has to be really. + dwIntersection = intersections(mu, (int)toObs, k, j-dj).dwIntersection; + } f64 chiDw = interp_param(gridData, dwIntersection, chi); f64 dtauDw = 0.5 * abs(dwIntersection.distance) * (chi(k, j) + chiDw); f64 temperatureDw = interp_param(gridData, dwIntersection, temperature); @@ -1219,6 +1247,10 @@ void build_intersection_list(Atmosphere* atmos) IntersectionResult uw(InterpolationAxis::None, k, j, 0.0); auto dw = dw_intersection_2d(gridData, k, j); dw.distance = abs(dw.distance); + + if ((!periodic) && (j == jEnd) && (mux != 0.0)) + dw = IntersectionResult(InterpolationAxis::None, k, j, 0.0); + intersections(mu, toObsI, k, j) = InterpolationStencil{uw, dw, -1, -1}; } k += dk; @@ -1263,7 +1295,7 @@ void build_intersection_list(Atmosphere* atmos) IntersectionResult dw; if (k != kEnd) { - if ((!periodic) && (j == jEnd)) + if ((!periodic) && (j == jEnd) && (mux != 0.0)) { dw = IntersectionResult(InterpolationAxis::None, k, j, 0.0); }