source: issm/trunk/src/c/modules/ModelProcessorx/Enthalpy/CreateConstraintsEnthalpy.cpp@ 8498

Last change on this file since 8498 was 8498, checked in by seroussi, 14 years ago

impose enthalpy and not tempeture for the spc in EnthalpySolution

File size: 1.5 KB
Line 
1/*
2 * CreateConstraintsEnthalpy.c:
3 */
4
5#include "../../../Container/Container.h"
6#include "../../../io/io.h"
7#include "../../../toolkits/toolkits.h"
8#include "../../../EnumDefinitions/EnumDefinitions.h"
9#include "../../../objects/objects.h"
10#include "../../../shared/shared.h"
11#include "../ModelProcessorx.h"
12
13void CreateConstraintsEnthalpy(Constraints** pconstraints, IoModel* iomodel,FILE* iomodel_handle){
14
15 /*Intermediary*/
16 int i;
17 int count;
18
19 /*Output*/
20 Constraints* constraints = NULL;
21 Spc* spc = NULL;
22
23 /*Recover pointer: */
24 constraints=*pconstraints;
25
26 /*Create constraints if they do not exist yet*/
27 if(!constraints) constraints = new Constraints(ConstraintsEnum);
28
29 /*return if 2d mesh*/
30 if (iomodel->dim==2) goto cleanup_and_return;
31
32 /*Fetch data: */
33 IoModelFetchData(&iomodel->spctemperature,NULL,NULL,iomodel_handle,"spctemperature");
34
35 /*Initialize counter*/
36 count=0;
37
38 /*Create spcs from x,y,z, as well as the spc values on those spcs: */
39 for (i=0;i<iomodel->numberofvertices;i++){
40 /*keep only this partition's nodes:*/
41 if((iomodel->my_vertices[i])){
42
43 if ((int)iomodel->spctemperature[2*i]){
44
45 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->heatcapacity*(iomodel->spctemperature[2*i+1]-iomodel->referencetemperature),EnthalpyAnalysisEnum));
46 count++;
47
48 }
49
50 } //if((my_nodes[i]==1))
51 }
52
53 /*Free data: */
54 xfree((void**)&iomodel->spctemperature);
55
56 cleanup_and_return:
57
58 /*Assign output pointer: */
59 *pconstraints=constraints;
60}
Note: See TracBrowser for help on using the repository browser.