[cig-commits] commit:
Mercurial
hg at geodynamics.org
Mon Nov 24 11:59:23 PST 2008
changeset: 130:af4a5d7869ea
user: LukeHodkinson
date: Tue Aug 05 06:17:01 2008 +0000
files: Mesh/src/SurfaceAdaptor.c Mesh/src/SurfaceAdaptor.h
description:
* Fixed a bug with the sinusoidal surface in
3D.
* Adding some code to handle frictional boundary
layers elegantly in combindation with deformed
meshes.
diff -r 4de4ce2a5947 -r af4a5d7869ea Mesh/src/SurfaceAdaptor.c
--- a/Mesh/src/SurfaceAdaptor.c Mon Aug 04 16:28:35 2008 +0000
+++ b/Mesh/src/SurfaceAdaptor.c Tue Aug 05 06:17:01 2008 +0000
@@ -141,11 +141,16 @@ void _SurfaceAdaptor_Construct( void* ad
/* Rip out the components structure as a dictionary. */
dict = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( cf->componentDict, self->name ) );
+ /* Check if we want to keep a certain depth at the bottom reserved for
+ contact elements. */
+ self->contactDepth = Stg_ComponentFactory_GetInt( cf, self->name, "contactDepth", 0 );
+
/* What kind of surface do we want? */
surfaceType = Stg_ComponentFactory_GetString( cf, self->name, "surfaceType", "" );
if( !strcmp( surfaceType, "wedge" ) ) {
self->surfaceType = SurfaceAdaptor_SurfaceType_Wedge;
- self->info.wedge.offs = Stg_ComponentFactory_GetDouble( cf, self->name, "offset", 0.0 );
+ self->info.wedge.offs = Stg_ComponentFactory_GetDouble( cf, self->name, "beginOffset", 0.0 );
+ self->info.wedge.endOffs = Stg_ComponentFactory_GetDouble( cf, self->name, "endOffset", 1.0 );
self->info.wedge.grad = Stg_ComponentFactory_GetDouble( cf, self->name, "gradient", 0.5 );
}
else if( !strcmp( surfaceType, "sine" ) || !strcmp( surfaceType, "cosine" ) ) {
@@ -204,6 +209,7 @@ void SurfaceAdaptor_Generate( void* adap
SurfaceAdaptor_DeformFunc* deformFunc;
Grid *grid;
unsigned* inds;
+ double deform;
unsigned n_i;
/* Build base mesh, which is assumed to be cartesian. */
@@ -242,11 +248,16 @@ void SurfaceAdaptor_Generate( void* adap
gNode = Sync_DomainToGlobal( sync, n_i );
Grid_Lift( grid, gNode, inds );
+ /* If we're under the contact depth don't modify. */
+ if( self->contactDepth && inds[1] < (self->contactDepth + 1) )
+ continue;
+
/* Calculate a height percentage. */
- height = (double)inds[1] / (double)(grid->sizes[1] - 1);
+ height = (double)(inds[1] - self->contactDepth) / (double)(grid->sizes[1] - 1);
/* Deform this node. */
- mesh->verts[n_i][1] += height * deformFunc( self, mesh, grid->sizes, n_i, inds );
+ deform = deformFunc( self, mesh, grid->sizes, n_i, inds );
+ mesh->verts[n_i][1] += height * deform;
}
/* Free resources. */
@@ -261,10 +272,14 @@ double SurfaceAdaptor_Wedge( SurfaceAdap
double SurfaceAdaptor_Wedge( SurfaceAdaptor* self, Mesh* mesh,
unsigned* globalSize, unsigned vertex, unsigned* vertexInds )
{
- if( mesh->verts[vertex][0] >= self->info.wedge.offs )
- return (mesh->verts[vertex][0] - self->info.wedge.offs) * self->info.wedge.grad;
- else
- return 0.0;
+ if( mesh->verts[vertex][0] >= self->info.wedge.offs ) {
+ if( mesh->verts[vertex][0] >= self->info.wedge.endOffs )
+ return (self->info.wedge.endOffs - self->info.wedge.offs) * self->info.wedge.grad;
+ else
+ return (mesh->verts[vertex][0] - self->info.wedge.offs) * self->info.wedge.grad;
+ }
+ else
+ return 0.0;
}
double SurfaceAdaptor_Sine( SurfaceAdaptor* self, Mesh* mesh,
@@ -287,14 +302,14 @@ double SurfaceAdaptor_Cosine( SurfaceAda
double SurfaceAdaptor_Cosine( SurfaceAdaptor* self, Mesh* mesh,
unsigned* globalSize, unsigned vertex, unsigned* vertexInds )
{
- double dx, dy;
+ double dx, dz;
double rad;
dx = mesh->verts[vertex][0] - self->info.trig.origin[0];
rad = dx * dx;
if( mesh->topo->nDims == 3 ) {
- dy = mesh->verts[vertex][1] - self->info.trig.origin[1];
- rad += dy * dy;
+ dz = mesh->verts[vertex][2] - self->info.trig.origin[2];
+ rad += dz * dz;
}
rad = sqrt( rad );
diff -r 4de4ce2a5947 -r af4a5d7869ea Mesh/src/SurfaceAdaptor.h
--- a/Mesh/src/SurfaceAdaptor.h Mon Aug 04 16:28:35 2008 +0000
+++ b/Mesh/src/SurfaceAdaptor.h Tue Aug 05 06:17:01 2008 +0000
@@ -55,8 +55,9 @@
} SurfaceAdaptor_SurfaceType;
typedef struct {
- double offs;
- double grad;
+ double offs;
+ double endOffs;
+ double grad;
} SurfaceAdaptor_WedgeInfo;
typedef struct {
@@ -78,7 +79,9 @@
\
/* SurfaceAdaptor info */ \
SurfaceAdaptor_SurfaceType surfaceType; \
- SurfaceAdaptor_SurfaceInfo info;
+ SurfaceAdaptor_SurfaceInfo info; \
+ int contactDepth;
+
struct SurfaceAdaptor { __SurfaceAdaptor };
More information about the CIG-COMMITS
mailing list