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

Use externally provided constant values to set nodal values #15

Merged
merged 1 commit into from
Mar 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
44 changes: 44 additions & 0 deletions FEM/rf_pcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ CRFProcess::CRFProcess(void) :
eqs_x = NULL;
_hasConstrainedBC=false;
_hasConstrainedST = false;
_pcs_constant_model = 0;
_pcs_constant_value = .0;
_pcs_constant_curve = 0;
}


Expand Down Expand Up @@ -2145,6 +2148,27 @@ std::ios::pos_type CRFProcess::Read(std::ifstream* pcs_file)
*pcs_file >> UpdateIniState;
continue;
}
if (line_string.find("$CONSTANT") == 0)
{
*pcs_file >> _pcs_constant_model;
switch (_pcs_constant_model)
{
case 0:
break;
case 1:
*pcs_file >> _pcs_constant_value;
break;
case 2:
*pcs_file >> _pcs_constant_curve;
break;
default:
std::cout << "-> invalid CONSTANT model " << _pcs_constant_model << std::endl;
break;
}
if (_pcs_constant_model > 0)
std::cout << "-> CONSTAT is activated." << std::endl;
continue;
}
//....................................................................
}
//----------------------------------------------------------------------
Expand Down Expand Up @@ -4638,6 +4662,26 @@ double CRFProcess::Execute()
pcs_error = DBL_MAX;
g_nnodes = m_msh->GetNodesNumber(false);

// if const, set node values directly
if (_pcs_constant_model > 0)
{
double const_val = _pcs_constant_value;
if (_pcs_constant_model == 2)
{
int valid;
const_val = GetCurveValue(_pcs_constant_curve, 0, aktuelle_zeit, &valid);
}
std::cout << "-> set given constant value. no need to solve a linear system.\n";
for (int ii = 0; ii < pcs_number_of_primary_nvals; ii++) {
nidx1 = GetNodeValueIndex(pcs_primary_function_name[ii]) + 1;
for (j = 0; j < g_nnodes; j++) {
k = m_msh->Eqs2Global_NodeIndex[j];
SetNodeValue(k, nidx1, const_val);
}
}
return .0;
}

#if !defined(USE_PETSC) // || defined(other parallel libs)//03.3012. WW
double implicit_lim = 1.0 - DBL_EPSILON;
#ifdef NEW_EQS
Expand Down
4 changes: 4 additions & 0 deletions FEM/rf_pcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,10 @@ class CRFProcess : public ProcessInfo
double const & time_fac = 1, double const & fac = 1);

double evaluteSwitchBC(CBoundaryCondition const & bc, CBoundaryConditionNode const & bc_node, double time_fac, double fac);

int _pcs_constant_model;
double _pcs_constant_value;
int _pcs_constant_curve;
};

//========================================================================
Expand Down