Skip to content
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

Point source #617

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e4a1b7e
Initial commit. Adding in source class.
rwalkerlewis Jun 12, 2023
77e8865
Recovery after botched build
rwalkerlewis Jun 13, 2023
cc59907
Fixed STF nomenclature and added files to makefile
rwalkerlewis Jun 13, 2023
d0f3110
Issue with identifing point for source in parallel
rwalkerlewis Jun 13, 2023
de198b1
Added Square Wavelet for testing
rwalkerlewis Jun 14, 2023
fb09c7e
Added listing for squarewavelet classes
rwalkerlewis Jun 14, 2023
525732d
Added lumped LHS mass matrix for MT source
rwalkerlewis Jun 14, 2023
51e0f9f
removed local source label functions
rwalkerlewis Jun 15, 2023
a103461
Removed other label function from source
rwalkerlewis Jun 15, 2023
97ee037
Moved coordinate to label assignment to function in Source.cc
rwalkerlewis Jun 15, 2023
b6b8a49
First work on user selectable subfields for moment tensor sources
rwalkerlewis Jun 15, 2023
2fb65d3
Fixed variable issue
rwalkerlewis Jun 15, 2023
e3b511b
Parallel works now
rwalkerlewis Jun 15, 2023
a64f2b7
Removed comments
rwalkerlewis Jun 15, 2023
b85b642
Field is now selectable for MT
rwalkerlewis Jun 15, 2023
62a2478
Changed square pulse to user selected subfield
rwalkerlewis Jun 15, 2023
a4a9628
Updated to new location function
rwalkerlewis Jun 15, 2023
5a15308
Array source input works for parallel
rwalkerlewis Jun 15, 2023
8b16d3a
Passes libtest for source
rwalkerlewis Oct 25, 2023
16c617c
Intermediate update for unit tests
rwalkerlewis Nov 23, 2023
cf0c3cf
Minor changes
rwalkerlewis Nov 23, 2023
2219d70
Cleanup of testing loose ends, still not passing source check. See th…
rwalkerlewis Jan 2, 2024
a4dd07c
added point force header to makefile
rwalkerlewis Jan 5, 2024
b988774
Point Force libtest fails on factory assertion
rwalkerlewis Jan 16, 2024
e1da491
Libtests pass, moving to implement timehistorydb
rwalkerlewis Jan 17, 2024
7cc9e7e
Added change to allow moment tensor force STFs to use time history db
rwalkerlewis Feb 5, 2024
3181b61
Added fekernel for timehistorywavelet
rwalkerlewis Feb 5, 2024
753e119
need to find out how to pass _dbtimehistory
rwalkerlewis Feb 5, 2024
b1d1400
Kicked dbtimehistory down a level
cpstutorials Feb 7, 2024
32bd033
first pass for libsrc finished
rwalkerlewis Feb 19, 2024
a683309
first pass at modulesrc
rwalkerlewis Feb 19, 2024
6269be0
Need to fix modulesrc
cpstutorials Feb 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ AC_CONFIG_FILES([Makefile
libsrc/pylith/feassemble/Makefile
libsrc/pylith/fekernels/Makefile
libsrc/pylith/faults/Makefile
libsrc/pylith/sources/Makefile
libsrc/pylith/friction/Makefile
libsrc/pylith/materials/Makefile
libsrc/pylith/meshio/Makefile
Expand All @@ -205,6 +206,7 @@ AC_CONFIG_FILES([Makefile
modulesrc/include/Makefile
modulesrc/bc/Makefile
modulesrc/faults/Makefile
modulesrc/sources/Makefile
modulesrc/feassemble/Makefile
modulesrc/friction/Makefile
modulesrc/materials/Makefile
Expand All @@ -227,6 +229,8 @@ AC_CONFIG_FILES([Makefile
tests/libtests/meshio/Makefile
tests/libtests/problems/Makefile
tests/libtests/problems/data/Makefile
tests/libtests/sources/Makefile
tests/libtests/sources/data/Makefile
tests/libtests/meshio/data/Makefile
tests/libtests/topology/Makefile
tests/libtests/topology/data/Makefile
Expand Down
22 changes: 22 additions & 0 deletions libsrc/pylith/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ SUBDIRS = \
topology \
feassemble \
problems \
sources \
meshio \
materials \
bc \
Expand Down Expand Up @@ -74,6 +75,11 @@ libpylith_la_SOURCES = \
fekernels/Tensor.cc \
fekernels/IsotropicLinearGenMaxwell.cc \
fekernels/IsotropicPowerLaw.cc \
fekernels/SquareWavelet.cc \
fekernels/GaussianWavelet.cc \
fekernels/PointForce.cc \
fekernels/SquarePulseSource.cc \
fekernels/WellboreSource.cc \
materials/Material.cc \
materials/Elasticity.cc \
materials/RheologyElasticity.cc \
Expand Down Expand Up @@ -132,6 +138,22 @@ libpylith_la_SOURCES = \
problems/ProgressMonitor.cc \
problems/ProgressMonitorTime.cc \
problems/ProgressMonitorStep.cc \
sources/AuxiliaryFactoryMomentTensorForce.cc \
sources/AuxiliaryFactoryPointForce.cc \
sources/AuxiliaryFactorySourceTime.cc \
sources/AuxiliaryFactorySquarePulseSource.cc \
sources/AuxiliaryFactoryWellboreSource.cc \
sources/DerivedFactoryMomentTensorForce.cc \
sources/GaussianWavelet.cc \
sources/MomentTensorForce.cc \
sources/PointForce.cc \
sources/SquareWavelet.cc \
sources/RickerWavelet.cc \
sources/TimeHistoryWavelet.cc \
sources/Source.cc \
sources/SourceTimeFunctionMomentTensorForce.cc \
sources/SquarePulseSource.cc \
sources/WellboreSource.cc \
topology/Mesh.cc \
topology/MeshOps.cc \
topology/FieldBase.cc \
Expand Down
4 changes: 3 additions & 1 deletion libsrc/pylith/feassemble/DSLabelAccess.icc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ pylith::feassemble::DSLabelAccess::DSLabelAccess(const PetscDM dm,
} else {
err = ISDestroy(&_cellsIS);PYLITH_CHECK_ERROR(err);
} // if/else
} // if
// } else {
// err = ISCreateGeneral(PETSC_COMM_SELF,0,NULL,PETSC_OWN_POINTER,&_cellsIS);
}

PYLITH_METHOD_END;
}
Expand Down
134 changes: 134 additions & 0 deletions libsrc/pylith/fekernels/GaussianWavelet.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/* -*- C++ -*-
*
* ----------------------------------------------------------------------
*
* Brad T. Aagaard, U.S. Geological Survey
* Charles A. Williams, GNS Science
* Matthew G. Knepley, University of Chicago
*
* This code was developed as part of the Computational Infrastructure
* for Geodynamics (http:*geodynamics.org).
*
* Copyright (c) 2010-2015 University of California, Davis
*
* See COPYING for license information.
*
* ----------------------------------------------------------------------
*/

#include <portinfo>

#include "pylith/fekernels/GaussianWavelet.hh"

#include <cassert> // USES assert()
#include <iostream> // debugging.

// =====================================================================================================================
// Kernels for the Gaussian Source Time Function in 2D.
// =====================================================================================================================

// ----------------------------------------------------------------------
// g1 entry function for velocity equation
void
pylith::fekernels::GaussianWaveletPlaneStrain::g1v(const PylithInt dim,
const PylithInt numS,
const PylithInt numA,
const PylithInt sOff[],
const PylithInt sOff_x[],
const PylithScalar s[],
const PylithScalar s_t[],
const PylithScalar s_x[],
const PylithInt aOff[],
const PylithInt aOff_x[],
const PylithScalar a[],
const PylithScalar a_t[],
const PylithScalar a_x[],
const PylithReal t,
const PylithScalar x[],
const PylithInt numConstants,
const PylithScalar constants[],
PylithScalar g1[]) {
assert(sOff);
assert(s);
assert(g1);

PylithInt _dim = 2;

// Incoming re-packed solution field.

// Incoming re-packed auxiliary field.
const PylithInt i_momentTensor = 0;
const PylithInt i_timeDelay = 1;
const PylithInt i_gaussianwaveletCenterFrequency = numA - 1;

const PylithScalar* momentTensor = &a[aOff[i_momentTensor]];
const PylithScalar timeDelay = a[aOff[i_timeDelay]];
const PylithScalar f0 = a[aOff[i_gaussianwaveletCenterFrequency]];

// GaussianWavelet source time function (time domain)

PylithScalar rt = t - timeDelay;
PylithScalar gaussianwavelet = PetscExpReal( (PETSC_PI*PETSC_PI * f0*f0) * rt*rt) / (2.0 * (PETSC_PI*PETSC_PI * f0*f0) );
// PetscPrintf(PETSC_COMM_WORLD, "timeDelay %d\n", (double)timeDelay);
// PetscPrintf(PETSC_COMM_WORLD, "t %d\n", (double)t);
// PetscPrintf(PETSC_COMM_WORLD, "gaussianWavelet %d\n", (double)gaussianwavelet);
for (PylithInt i = 0; i < dim*dim; ++i) {
g1[i] -= momentTensor[i] * gaussianwavelet;
} // for
} // g1v


// =====================================================================================================================
// Kernels for the Gaussian Source Time Function in 3D.
// =====================================================================================================================

// ----------------------------------------------------------------------
// g1 entry function for velocity equation
void
pylith::fekernels::GaussianWavelet3D::g1v(const PylithInt dim,
const PylithInt numS,
const PylithInt numA,
const PylithInt sOff[],
const PylithInt sOff_x[],
const PylithScalar s[],
const PylithScalar s_t[],
const PylithScalar s_x[],
const PylithInt aOff[],
const PylithInt aOff_x[],
const PylithScalar a[],
const PylithScalar a_t[],
const PylithScalar a_x[],
const PylithReal t,
const PylithScalar x[],
const PylithInt numConstants,
const PylithScalar constants[],
PylithScalar g1[]) {
assert(sOff);
assert(s);
assert(g1);

PylithInt _dim = 3;

// Incoming re-packed solution field.

// Incoming re-packed auxiliary field.
const PylithInt i_momentTensor = 0;
const PylithInt i_timeDelay = 1;
const PylithInt i_gaussianwaveletCenterFrequency = numA - 1;

const PylithScalar* momentTensor = &a[aOff[i_momentTensor]];
const PylithScalar timeDelay = a[aOff[i_timeDelay]];
const PylithScalar f0 = a[aOff[i_gaussianwaveletCenterFrequency]];

// GaussianWavelet source time function (time domain)

PylithScalar rt = t - timeDelay;
PylithScalar gaussianwavelet = PetscExpReal( (PETSC_PI*PETSC_PI * f0*f0) * rt*rt) / (2.0 * (PETSC_PI*PETSC_PI * f0*f0) );

for (PylithInt i = 0; i < dim*dim; ++i) {
g1[i] -= momentTensor[i] * gaussianwavelet;
} // for
} // g1v


// End of file
143 changes: 143 additions & 0 deletions libsrc/pylith/fekernels/GaussianWavelet.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/* -*- C++ -*-
*
* ----------------------------------------------------------------------
*
* Brad T. Aagaard, U.S. Geological Survey
* Charles A. Williams, GNS Science
* Matthew G. Knepley, University of Chicago
*
* This code was developed as part of the Computational Infrastructure
* for Geodynamics (http:*geodynamics.org).
*
* Copyright (c) 2010-2015 University of California, Davis
*
* See COPYING for license information.
*
* ----------------------------------------------------------------------
*/

/** @file libsrc/fekernels/GaussianWavelet.hh
*
*/

#if !defined(pylith_fekernels_gaussianwavelet_hh)
#define pylith_fekernels_gaussianwavelet_hh

// Include directives ---------------------------------------------------
#include "fekernelsfwd.hh" // forward declarations

#include "pylith/utils/types.hh"

// =====================================================================================================================
// Kernels for the Ricker Source Time Function in 2D.
// =====================================================================================================================

class pylith::fekernels::GaussianWaveletPlaneStrain {
// PUBLIC MEMBERS ///////////////////////////////////////////////////////
public:

/** Kernel interface.
*
* @param[in] dim Spatial dimension.
* @param[in] numS Number of registered subfields in solution field.
* @param[in] numA Number of registered subfields in auxiliary field.
* @param[in] sOff Offset of registered subfields in solution field [numS].
* @param[in] sOff_x Offset of registered subfields in gradient of the solution field [numS].
* @param[in] s Solution field with all subfields.
* @param[in] s_t Time derivative of solution field.
* @param[in] s_x Gradient of solution field.
* @param[in] aOff Offset of registered subfields in auxiliary field [numA]
* @param[in] aOff_x Offset of registered subfields in gradient of auxiliary field [numA]
* @param[in] a Auxiliary field with all subfields.
* @param[in] a_t Time derivative of auxiliary field.
* @param[in] a_x Gradient of auxiliary field.
* @param[in] t Time for residual evaluation.
* @param[in] x Coordinates of point evaluation.
* @param[in] numConstants Number of registered constants.
* @param[in] constants Array of registered constants.
* @param[out] f0 [dim].
*/

/** g1 function for velocity equation
*
*/
static
void g1v(const PylithInt dim,
const PylithInt numS,
const PylithInt numA,
const PylithInt sOff[],
const PylithInt sOff_x[],
const PylithScalar s[],
const PylithScalar s_t[],
const PylithScalar s_x[],
const PylithInt aOff[],
const PylithInt aOff_x[],
const PylithScalar a[],
const PylithScalar a_t[],
const PylithScalar a_x[],
const PylithReal t,
const PylithScalar x[],
const PylithInt numConstants,
const PylithScalar constants[],
PylithScalar g1[]);

}; // GaussianWaveletPlaneStrain

// =====================================================================================================================
// Kernels for the Ricker Source Time Function in 3D.
// =====================================================================================================================

class pylith::fekernels::GaussianWavelet3D {
// PUBLIC MEMBERS ///////////////////////////////////////////////////////
public:

/** Kernel interface.
*
* @param[in] dim Spatial dimension.
* @param[in] numS Number of registered subfields in solution field.
* @param[in] numA Number of registered subfields in auxiliary field.
* @param[in] sOff Offset of registered subfields in solution field [numS].
* @param[in] sOff_x Offset of registered subfields in gradient of the solution field [numS].
* @param[in] s Solution field with all subfields.
* @param[in] s_t Time derivative of solution field.
* @param[in] s_x Gradient of solution field.
* @param[in] aOff Offset of registered subfields in auxiliary field [numA]
* @param[in] aOff_x Offset of registered subfields in gradient of auxiliary field [numA]
* @param[in] a Auxiliary field with all subfields.
* @param[in] a_t Time derivative of auxiliary field.
* @param[in] a_x Gradient of auxiliary field.
* @param[in] t Time for residual evaluation.
* @param[in] x Coordinates of point evaluation.
* @param[in] numConstants Number of registered constants.
* @param[in] constants Array of registered constants.
* @param[out] f0 [dim].
*/

/** g1 function for velocity equation
*
*/
static
void g1v(const PylithInt dim,
const PylithInt numS,
const PylithInt numA,
const PylithInt sOff[],
const PylithInt sOff_x[],
const PylithScalar s[],
const PylithScalar s_t[],
const PylithScalar s_x[],
const PylithInt aOff[],
const PylithInt aOff_x[],
const PylithScalar a[],
const PylithScalar a_t[],
const PylithScalar a_x[],
const PylithReal t,
const PylithScalar x[],
const PylithInt numConstants,
const PylithScalar constants[],
PylithScalar g1[]);

}; // GaussianWaveletPlaneStrain

#endif /* pylith_fekernels_gaussianwavelet_hh */

/* End of file */
8 changes: 7 additions & 1 deletion libsrc/pylith/fekernels/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ subpkginclude_HEADERS = \
TimeDependentFn.hh \
NeumannTimeDependent.hh \
AbsorbingDampers.hh \
FaultCohesiveKin.hh
FaultCohesiveKin.hh \
WellboreSource.hh \
SquarePulseSource.hh \
SquareWavelet.hh \
RickerWavelet.hh \
GaussianWavelet.hh \
PointForce.hh

dist_noinst_HEADERS =

Expand Down
Loading