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

Add darcy's law and MMS for poroelastodynamics #629

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
92e6f9b
Added darcyFluxRateDynamic Kernel
rezgarshakeri Jun 13, 2023
f3b6ebc
Add mms for poroelastodynamics
rezgarshakeri Jun 14, 2023
1ac8c2b
Add poroelastodynamics MMS Makefiles to configure and update Makefile.
baagaard-usgs Jun 15, 2023
46d8c59
Added TestCases.cc for poroelastodynamics
rezgarshakeri Jun 15, 2023
339245f
make quadrature space equal for pressure and displacement
rezgarshakeri Jun 16, 2023
b6a7425
Added bulk_density in data->auxDB.addValue
rezgarshakeri Jun 16, 2023
48b3519
Fixed typo in TestCases.cc
rezgarshakeri Jun 16, 2023
0eedca0
Read ".mesh" file NOT ".msh"
rezgarshakeri Jun 16, 2023
d717997
Fixed boundary conditions and added auxDB.addValue
rezgarshakeri Jun 16, 2023
3b21db3
Set the order of auDB as in terzaghi.cfg
rezgarshakeri Jun 16, 2023
85785e4
Add break; after DYNMICS in Poroelaticity.cc
rezgarshakeri Jun 16, 2023
aa51462
add setMMSBodyForceKernels
rezgarshakeri Jun 16, 2023
b2a702f
Error: Quadrature order of 2 for subfield 'fluid_density' does not ma…
rezgarshakeri Jun 16, 2023
73d215c
Fixed the error of the quadrature space mismatch
rezgarshakeri Jun 16, 2023
dc19a1f
Added f0u_explicit for poro
rezgarshakeri Jun 16, 2023
694b4c8
Added Jf0uu_stshift in Poroelasticty.hh and .cc
rezgarshakeri Jun 16, 2023
426b991
removed Jacobian tests in TestCases.ss
rezgarshakeri Jun 16, 2023
12108da
add printf to see which function get called
rezgarshakeri Jun 17, 2023
7ca9489
Switched g1p to darcyfluxratedynamic
rwalkerlewis Jun 17, 2023
5db4509
Moving displacement dynamic poro to LHS
rwalkerlewis Jun 17, 2023
791e768
Moving dyn poro terms to LHS
rwalkerlewis Jun 17, 2023
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
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ AC_CONFIG_FILES([Makefile
tests/mmstests/linearelasticity/faults-2d/Makefile
tests/mmstests/incompressibleelasticity/Makefile
tests/mmstests/incompressibleelasticity/nofaults-2d/Makefile
tests/mmstests/poroelastodynamics/Makefile
tests/mmstests/poroelastodynamics/nofaults-2d/Makefile
tests/fullscale/Makefile
tests/fullscale/cornercases/Makefile
tests/fullscale/cornercases/nofaults-2d/Makefile
Expand Down
187 changes: 145 additions & 42 deletions libsrc/pylith/fekernels/IsotropicLinearPoroelasticity.hh
Original file line number Diff line number Diff line change
Expand Up @@ -501,14 +501,13 @@ public:

// ================================ Kernels ====================================
// --------------------------------------------------------------------------------------------
/** Helper function for calculating Cauchy stress for WITHOUT a reference stress and strain.
/** Helper function for calculating darcy flux
*
* ISA Poroelasticity::fluxrateFn
*
* @param[in] rheologyContext IsotropicLinearElasticity context.
* @param[in] strain Strain tensor.
* @param[in] tensorOps Tensor operations.
* @param[out] stress Stress tensor.
* @param[out] fluxRate darcy flux vector
*/
static inline
void darcyFluxRate(const pylith::fekernels::Poroelasticity::PoroelasticContext& poroelasticContext,
Expand Down Expand Up @@ -541,6 +540,8 @@ public:
} // for
} // for

printf("darcyFluxRate\n");

fluxRate->xx = fluxRateVector[0];
fluxRate->yy = fluxRateVector[1];
fluxRate->zz = fluxRateVector[2];
Expand All @@ -549,6 +550,58 @@ public:
fluxRate->xz = 0.0;
} // darcyFluxRate

// ================================ Kernels ====================================
// --------------------------------------------------------------------------------------------
/** Helper function for calculating darcy flux for poroelastodynamics
*
* ISA Poroelasticity::fluxrateFn
*
* @param[in] rheologyContext IsotropicLinearElasticity context.
* @param[in] tensorOps Tensor operations.
* @param[out] fluxRateDynamic darcy flux vector
*/
static inline
void darcyFluxRateDynamic(const pylith::fekernels::Poroelasticity::PoroelasticContext& poroelasticContext,
void* rheologyContext,
const pylith::fekernels::TensorOps& tensorOps,
pylith::fekernels::Tensor* fluxRateDynamic) {
Context* context = (Context*)(rheologyContext);
assert(context);
assert(fluxRateDynamic);

const PylithInt dim = poroelasticContext.dim;
// Solution Variables
const PylithScalar *pressure_x = poroelasticContext.pressure_x;
const PylithScalar *velocity_t = poroelasticContext.velocity_t;

// Poroelastic Auxiliaries
const PylithScalar fluidDensity = poroelasticContext.fluidDensity;
const PylithScalar fluidViscosity = poroelasticContext.fluidViscosity;
const PylithScalar *bodyForce = poroelasticContext.bodyForce;
const PylithScalar *gravityField = poroelasticContext.gravityField;

// Rheological Auxiliaries

PylithScalar tensorPermeability[9] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
PylithScalar fluxRateVectorDynamic[3] = {0.0, 0.0, 0.0};
tensorOps.toTensor(context->permeability, tensorPermeability);

for (PylithInt i = 0; i < dim; ++i) {
for (PylithInt j = 0; j < dim; j++) {
fluxRateVectorDynamic[i] += (tensorPermeability[i * dim + j] / fluidViscosity) * (pressure_x[j] + fluidDensity * velocity_t[j] - bodyForce[j] - fluidDensity * gravityField[j]);
} // for
} // for

printf("darcyFluxRateDynamic\n");

fluxRateDynamic->xx = fluxRateVectorDynamic[0];
fluxRateDynamic->yy = fluxRateVectorDynamic[1];
fluxRateDynamic->zz = fluxRateVectorDynamic[2];
fluxRateDynamic->xy = 0.0;
fluxRateDynamic->yz = 0.0;
fluxRateDynamic->xz = 0.0;
} // darcyFluxRateDynamic

}; // IsotropicLinearPoroelasticity

// ---------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1797,11 +1850,16 @@ public:

// Solution Variables
const PylithScalar trace_strain_t = poroelasticContext.trace_strain_t;
const PylithScalar pressure_t = poroelasticContext.pressure_t;

// Rheology Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
const PylithScalar biotModulus = rheologyContext.biotModulus;

g0[0] -= biotCoefficient * trace_strain_t;
// Rheological Auxiliaries

g0[0] += pressure_t / biotModulus;
g0[0] += biotCoefficient * trace_strain_t;
} // g0p_implicit

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -1844,15 +1902,20 @@ public:

// Solution Variables
const PylithScalar trace_strain_t = poroelasticContext.trace_strain_t;
const PylithScalar pressure_t = poroelasticContext.pressure_t;

// Rheology Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
const PylithScalar biotModulus = rheologyContext.biotModulus;

// Poroelastic Auxiliaries
const PylithScalar source = poroelasticContext.sourceDensity;

// Rheologic Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
// Rheological Auxiliaries
g0[0] -= source;
g0[0] += pressure_t / biotModulus;
g0[0] += biotCoefficient * trace_strain_t;

g0[0] += source;
g0[0] -= biotCoefficient * trace_strain_t;
} // g0p_source

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -1895,15 +1958,19 @@ public:

// Solution Variables
const PylithScalar trace_strain_t = poroelasticContext.trace_strain_t;
const PylithScalar pressure_t = poroelasticContext.pressure_t;

// Rheology Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
const PylithScalar biotModulus = rheologyContext.biotModulus;

// Poroelastic Auxiliaries
const PylithScalar source = poroelasticContext.sourceDensity;

// Rheologic Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
g0[0] -= source;
g0[0] += pressure_t / biotModulus;
g0[0] += biotCoefficient * trace_strain_t;

g0[0] += source;
g0[0] -= biotCoefficient * trace_strain_t;
} // g0p_source_body

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -1946,15 +2013,19 @@ public:

// Solution Variables
const PylithScalar trace_strain_t = poroelasticContext.trace_strain_t;
const PylithScalar pressure_t = poroelasticContext.pressure_t;

// Rheology Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
const PylithScalar biotModulus = rheologyContext.biotModulus;

// Poroelastic Auxiliaries
const PylithScalar source = poroelasticContext.sourceDensity;

// Rheologic Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
g0[0] -= source;
g0[0] += pressure_t / biotModulus;
g0[0] += biotCoefficient * trace_strain_t;

g0[0] += source;
g0[0] -= biotCoefficient * trace_strain_t;
} // g0p_source_grav

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -1997,15 +2068,19 @@ public:

// Solution Variables
const PylithScalar trace_strain_t = poroelasticContext.trace_strain_t;
const PylithScalar pressure_t = poroelasticContext.pressure_t;

// Rheology Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
const PylithScalar biotModulus = rheologyContext.biotModulus;

// Poroelastic Auxiliaries
const PylithScalar source = poroelasticContext.sourceDensity;

// Rheologic Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
g0[0] -= source;
g0[0] += pressure_t / biotModulus;
g0[0] += biotCoefficient * trace_strain_t;

g0[0] += source;
g0[0] -= biotCoefficient * trace_strain_t;
} // g0p_source_grav_body

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -2049,10 +2124,11 @@ public:
&rheologyContext, _dim, numS, numA, sOff, sOff_x, s, s_t, s_x, aOff, aOff_x, a, a_t, a_x,
t, x, numConstants, constants, pylith::fekernels::Tensor::ops2D);

printf("g1p\n");
// Use f1p / fluxrate / darcy function
pylith::fekernels::Poroelasticity::f1p(
poroelasticContext, &rheologyContext,
pylith::fekernels::IsotropicLinearPoroelasticity::darcyFluxRate,
pylith::fekernels::IsotropicLinearPoroelasticity::darcyFluxRateDynamic,
pylith::fekernels::Tensor::ops2D,
g1);

Expand Down Expand Up @@ -3837,11 +3913,16 @@ public:

// Solution Variables
const PylithScalar trace_strain_t = poroelasticContext.trace_strain_t;
const PylithScalar pressure_t = poroelasticContext.pressure_t;

// Rheology Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
const PylithScalar biotModulus = rheologyContext.biotModulus;

// Rheological Auxiliaries
g0[0] += pressure_t / biotModulus;
g0[0] += biotCoefficient * trace_strain_t;

g0[0] -= biotCoefficient * trace_strain_t;
} // g0p_implicit

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -3884,13 +3965,18 @@ public:

// Solution Variables
const PylithScalar trace_strain_t = poroelasticContext.trace_strain_t;
const PylithScalar pressure_t = poroelasticContext.pressure_t;

// Rheology Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
const PylithScalar biotModulus = rheologyContext.biotModulus;

// Poroelastic Auxiliaries
const PylithScalar source = poroelasticContext.sourceDensity;
// Rheologic Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;

g0[0] += source;
g0[0] -= biotCoefficient * trace_strain_t;
g0[0] -= source;
g0[0] += pressure_t / biotModulus;
g0[0] += biotCoefficient * trace_strain_t;
} // g0p_source

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -3933,13 +4019,19 @@ public:

// Solution Variables
const PylithScalar trace_strain_t = poroelasticContext.trace_strain_t;
const PylithScalar pressure_t = poroelasticContext.pressure_t;

// Rheology Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
const PylithScalar biotModulus = rheologyContext.biotModulus;

// Poroelastic Auxiliaries
const PylithScalar source = poroelasticContext.sourceDensity;
// Rheologic Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;

g0[0] += source;
g0[0] -= biotCoefficient * trace_strain_t;
g0[0] -= source;
g0[0] += pressure_t / biotModulus;
g0[0] += biotCoefficient * trace_strain_t;

} // g0p_source_body

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -3982,13 +4074,18 @@ public:

// Solution Variables
const PylithScalar trace_strain_t = poroelasticContext.trace_strain_t;
const PylithScalar pressure_t = poroelasticContext.pressure_t;

// Rheology Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
const PylithScalar biotModulus = rheologyContext.biotModulus;

// Poroelastic Auxiliaries
const PylithScalar source = poroelasticContext.sourceDensity;
// Rheologic Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;

g0[0] += source;
g0[0] -= biotCoefficient * trace_strain_t;
g0[0] -= source;
g0[0] += pressure_t / biotModulus;
g0[0] += biotCoefficient * trace_strain_t;
} // g0p_source_grav

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -4031,13 +4128,19 @@ public:

// Solution Variables
const PylithScalar trace_strain_t = poroelasticContext.trace_strain_t;
const PylithScalar pressure_t = poroelasticContext.pressure_t;

// Rheology Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;
const PylithScalar biotModulus = rheologyContext.biotModulus;

// Poroelastic Auxiliaries
const PylithScalar source = poroelasticContext.sourceDensity;
// Rheologic Auxiliaries
const PylithScalar biotCoefficient = rheologyContext.biotCoefficient;

g0[0] += source;
g0[0] -= biotCoefficient * trace_strain_t;
g0[0] -= source;
g0[0] += pressure_t / biotModulus;
g0[0] += biotCoefficient * trace_strain_t;

} // g0p_source_grav_body

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -4084,7 +4187,7 @@ public:
// Use f1p / fluxrate / darcy function
pylith::fekernels::Poroelasticity::f1p(
poroelasticContext, &rheologyContext,
pylith::fekernels::IsotropicLinearPoroelasticity::darcyFluxRate,
pylith::fekernels::IsotropicLinearPoroelasticity::darcyFluxRateDynamic,
pylith::fekernels::Tensor::ops3D,
g1);

Expand Down Expand Up @@ -4134,7 +4237,7 @@ public:
// Use f1p / fluxrate / darcy function
pylith::fekernels::Poroelasticity::f1p(
poroelasticContext, &rheologyContext,
pylith::fekernels::IsotropicLinearPoroelasticity::darcyFluxRate,
pylith::fekernels::IsotropicLinearPoroelasticity::darcyFluxRateDynamic,
pylith::fekernels::Tensor::ops3D,
g1);

Expand Down Expand Up @@ -4186,7 +4289,7 @@ public:
// Use f1p / fluxrate / darcy function
pylith::fekernels::Poroelasticity::f1p(
poroelasticContext, &rheologyContext,
pylith::fekernels::IsotropicLinearPoroelasticity::darcyFluxRate,
pylith::fekernels::IsotropicLinearPoroelasticity::darcyFluxRateDynamic,
pylith::fekernels::Tensor::ops3D,
g1);

Expand Down Expand Up @@ -4237,7 +4340,7 @@ public:
// Use f1p / fluxrate / darcy function
pylith::fekernels::Poroelasticity::f1p(
poroelasticContext, &rheologyContext,
pylith::fekernels::IsotropicLinearPoroelasticity::darcyFluxRate,
pylith::fekernels::IsotropicLinearPoroelasticity::darcyFluxRateDynamic,
pylith::fekernels::Tensor::ops3D,
g1);

Expand Down
Loading
Loading