densitycurrent.c (ce18bed930e8f3bfebcf709a18844aba97fe4630) densitycurrent.c (67490bc6de48fa3615ca135c74fbc2a7c9584dee)
1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6// This file is part of CEED: http://github.com/ceed
7
8/// @file

--- 26 unchanged lines hidden (view full) ---

35 PetscReal center[3], dc_axis[3] = {0, 0, 0};
36 PetscReal domain_min[3], domain_max[3], domain_size[3];
37 ierr = DMGetBoundingBox(dm, domain_min, domain_max); CHKERRQ(ierr);
38 for (int i=0; i<3; i++) domain_size[i] = domain_max[i] - domain_min[i];
39
40 // ------------------------------------------------------
41 // Command line Options
42 // ------------------------------------------------------
1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6// This file is part of CEED: http://github.com/ceed
7
8/// @file

--- 26 unchanged lines hidden (view full) ---

35 PetscReal center[3], dc_axis[3] = {0, 0, 0};
36 PetscReal domain_min[3], domain_max[3], domain_size[3];
37 ierr = DMGetBoundingBox(dm, domain_min, domain_max); CHKERRQ(ierr);
38 for (int i=0; i<3; i++) domain_size[i] = domain_max[i] - domain_min[i];
39
40 // ------------------------------------------------------
41 // Command line Options
42 // ------------------------------------------------------
43 ierr = PetscOptionsBegin(comm, NULL, "Options for DENSITY_CURRENT problem",
44 NULL); CHKERRQ(ierr);
43 PetscOptionsBegin(comm, NULL, "Options for DENSITY_CURRENT problem", NULL);
45 ierr = PetscOptionsScalar("-rc", "Characteristic radius of thermal bubble",
46 NULL, rc, &rc, NULL); CHKERRQ(ierr);
47 for (int i=0; i<3; i++) center[i] = .5*domain_size[i];
48 PetscInt n = problem->dim;
49 ierr = PetscOptionsRealArray("-center", "Location of bubble center",
50 NULL, center, &n, NULL); CHKERRQ(ierr);
51 n = problem->dim;
52 ierr = PetscOptionsRealArray("-dc_axis",
53 "Axis of density current cylindrical anomaly, or {0,0,0} for spherically symmetric",
54 NULL, dc_axis, &n, NULL); CHKERRQ(ierr);
55 {
56 PetscReal norm = PetscSqrtReal(PetscSqr(dc_axis[0]) + PetscSqr(dc_axis[1]) +
57 PetscSqr(dc_axis[2]));
58 if (norm > 0) {
59 for (int i=0; i<3; i++) dc_axis[i] /= norm;
60 }
61 }
62
44 ierr = PetscOptionsScalar("-rc", "Characteristic radius of thermal bubble",
45 NULL, rc, &rc, NULL); CHKERRQ(ierr);
46 for (int i=0; i<3; i++) center[i] = .5*domain_size[i];
47 PetscInt n = problem->dim;
48 ierr = PetscOptionsRealArray("-center", "Location of bubble center",
49 NULL, center, &n, NULL); CHKERRQ(ierr);
50 n = problem->dim;
51 ierr = PetscOptionsRealArray("-dc_axis",
52 "Axis of density current cylindrical anomaly, or {0,0,0} for spherically symmetric",
53 NULL, dc_axis, &n, NULL); CHKERRQ(ierr);
54 {
55 PetscReal norm = PetscSqrtReal(PetscSqr(dc_axis[0]) + PetscSqr(dc_axis[1]) +
56 PetscSqr(dc_axis[2]));
57 if (norm > 0) {
58 for (int i=0; i<3; i++) dc_axis[i] /= norm;
59 }
60 }
61
63 ierr = PetscOptionsEnd(); CHKERRQ(ierr);
62 PetscOptionsEnd();
64
65 PetscScalar meter = user->units->meter;
66 rc = fabs(rc) * meter;
67 for (int i=0; i<3; i++) center[i] *= meter;
68
69 setup_context->rc = rc;
70 setup_context->center[0] = center[0];
71 setup_context->center[1] = center[1];

--- 32 unchanged lines hidden ---
63
64 PetscScalar meter = user->units->meter;
65 rc = fabs(rc) * meter;
66 for (int i=0; i<3; i++) center[i] *= meter;
67
68 setup_context->rc = rc;
69 setup_context->center[0] = center[0];
70 setup_context->center[1] = center[1];

--- 32 unchanged lines hidden ---