Esempio n. 1
0
/* This is called after PreliminaryCalcs() and just before first MPM time step and it
		is only called if the material is actually in use by one or more particles
	If material cannot be used in current analysis type throw an exception
	Subclass that overrides must pass on to super class
 */
void MaterialBase::ValidateForUse(int np) const
{	int i;
	
	for(i=0;i<=1;i++)
	{	if(i==1 && criterion[i]==NO_PROPAGATION) break;		// skip if no alternate criterion
		if(tractionMat[i]>0)
		{	if(tractionMat[i]>nmat)
			{	throw CommonException("Material with undefined traction law material for propagation",
									  "MaterialBase::ValidateForUse");
			}
			if(!theMaterials[tractionMat[i]-1]->isTractionLaw())
			{	throw CommonException("Material with propagation material that is not a traction law",
									  "MaterialBase::ValidateForUse");
			}
		}
	}
	
	// check for unsupported alternate propagation criterion
	if(criterion[1]==STEADYSTATEGROWTH)
	{	throw CommonException("The alternate propagation criterion cannot be steady state crack growth.",
							  "MaterialBase::ValidateForUse");
	}
	
	if(ConductionTask::active || ConductionTask::adiabatic)
	{	if(heatCapacity<=0. && !Rigid())
		{	throw CommonException("Thermal conduction and/or mechanical energy cannot be done using materials that have zero heat capacity.",
								  "MaterialBase::ValidateForUse");
		}
	}
}
Esempio n. 2
0
// print transport properties to output window - default is isotropic properties
// aniostropic materials must override it
void MaterialBase::PrintTransportProperties(void) const
{
	if(Rigid()) return;
	
	// Diffusion constants
	if(DiffusionTask::active)
	{	PrintProperty("D",diffusionCon,"mm^2/sec");
		PrintProperty("csat",concSaturation,"");
		cout << endl;
		PrintProperty("b",betaI,"1/wt fr");
		cout << endl;
	}
	// Conductivity constants
	if(ConductionTask::active)
	{	PrintProperty("k",rho*kCond*UnitsController::Scaling(1.e-6),UnitsController::Label(CONDUCTIVITY_UNITS));
		PrintProperty("Cv",heatCapacity*UnitsController::Scaling(1.e-6),UnitsController::Label(HEATCAPACITY_UNITS));
		PrintProperty("Cp",(heatCapacity+GetCpMinusCv(NULL))*UnitsController::Scaling(1.e-6),UnitsController::Label(HEATCAPACITY_UNITS));
		cout << endl;
	}
	else if(ConductionTask::adiabatic)
	{	PrintProperty("Cv",heatCapacity*UnitsController::Scaling(1.e-6),UnitsController::Label(HEATCAPACITY_UNITS));
        // Cp only used in conduction so not printed here when conduction is off
		cout << endl;
	}
}
Esempio n. 3
0
Shape::Shape () {
    SetUndefined();
    Rigid(hfil, hfil, vfil, vfil);
    aspect = 0;
    hunits = 1;
    vunits = 1;
}
Esempio n. 4
0
// print any properties common to all MPM material types
void MaterialBase::PrintCommonProperties(void) const
{
	if(Rigid() || isTractionLaw()) return;
	
	// print density
	PrintProperty("rho",rho*UnitsController::Scaling(1000.),"");
	cout << endl;
	
	// print growth criterion and relevant material properties for crack growth
	cout << "Crack Growth Criterion: ";
	PrintCriterion(criterion[0],matPropagateDirection[0]);
	
	// traction mat
	if(criterion[0]!=NO_PROPAGATION && tractionMat[0]>0)
		cout << "   New crack surface has traction material " << tractionMat[0] << endl;
	
	if(criterion[0]!=NO_PROPAGATION && criterion[1]!=NO_PROPAGATION)
	{	cout << "Alternate Crack Growth Criterion: ";
		PrintCriterion(criterion[1],matPropagateDirection[1]);
		
		// traction mat
		if(tractionMat[1]>0)
			cout << "   New crack surface has traction material " << tractionMat[1] << endl;
	}
	   
    // artificial visconsity
    if(artificialViscosity)
	{	PrintProperty("Artificial viscosity on",FALSE);
		PrintProperty("AV-A1",avA1,"");
		PrintProperty("AV-A2",avA2,"");
        cout << endl;
        if(ConductionTask::AVHeating)
            PrintProperty("    AV heating on",FALSE);
        else
            PrintProperty("    AV heating off",FALSE);
	}
	
	// optional color
	if(red>=0.)
	{	char mline[200];
		sprintf(mline,"color= %g, %g, %g, %g",red,green,blue,alpha);
		cout << mline << endl;
	}
}
Esempio n. 5
0
// when set, return total number of materials if this is a new one, or 1 if not in multimaterial mode
// not thread safe due to push_back()
int MaterialBase::SetField(int fieldNum,bool multiMaterials,int matid,int &activeNum)
{	if(!multiMaterials)
	{	if(field<0)
		{	field=0;
			activeField=activeNum;
			fieldNum=1;
			activeNum++;
			activeMatIDs.push_back(matid);
            int altBuffer,matBuffer = SizeOfMechanicalProperties(altBuffer);
            if(matBuffer > maxPropertyBufferSize) maxPropertyBufferSize = matBuffer;
            if(altBuffer > maxAltBufferSize) maxAltBufferSize = altBuffer;
		}
	}
	else
	{	if(field<0)
		{	// if sharing a field, look up shared material.
			if(shareMatField>0)
			{	if(shareMatField>nmat)
				{	throw CommonException("Material class trying to share velocity field with an undefined material type",
										  "MaterialBase::SetField");
				}
			
				// must match for rigid feature
				MaterialBase *matRef = theMaterials[shareMatField-1];
				if(matRef->Rigid() != Rigid())
				{	throw CommonException("Material class trying to share velocity field with an incompatible material type",
										  "MaterialBase::SetField");
				}
			
				// base material cannot share too
				if(matRef->GetShareMatField()>=0)
				{	throw CommonException("Material class trying to share velocity field with a material that share's its field",
										  "MaterialBase::SetField");
				}

				// set field to other material (and set other material if needed
				field = matRef->GetField();
				if(field<0)
				{	fieldNum = matRef->SetField(fieldNum,multiMaterials,shareMatField-1,activeNum);
					field = fieldNum-1;
				}
			}
			else
			{	field=fieldNum;
				fieldNum++;
				
				// fieldMatIDs[i] for i=0 to # materials is material index for that material velocity field
				// when materials share fields, it points to the based shared material
				fieldMatIDs.push_back(matid);
			}
			
			// for first particle using this material, add to active material IDs and check required
			// material buffer sizes
			if(activeNum>=0)
			{	activeField=activeNum;
				activeNum++;
				activeMatIDs.push_back(matid);
                int altBuffer,matBuffer = SizeOfMechanicalProperties(altBuffer);
                if(matBuffer > maxPropertyBufferSize) maxPropertyBufferSize = matBuffer;
                if(altBuffer > maxAltBufferSize) maxAltBufferSize = altBuffer;
			}
		}
	}
	return fieldNum;
}
Esempio n. 6
0
void Shape::Rect (int w, int h) {
    width = w; height = h;
    Rigid();
}
Esempio n. 7
0
void Shape::Square (int side) {
    width = side; height = side;
    Rigid();
    aspect = 1;
}